adc15 2.0.0.0
adc15.h File Reference

This file contains API for ADC 15 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  adc15_t
 ADC 15 Click context object. More...
 
struct  adc15_cfg_t
 ADC 15 Click configuration object. More...
 

Macros

#define ADC15_CMD_NULL   0x0000
 ADC 15 control commands.
 
#define ADC15_CMD_RESET   0x0011
 
#define ADC15_CMD_STANDBY   0x0022
 
#define ADC15_CMD_WAKEUP   0x0033
 
#define ADC15_CMD_LOCK   0x0555
 
#define ADC15_CMD_UNLOCK   0x0655
 
#define ADC15_CMD_RREG   0xA000
 
#define ADC15_CMD_WREG   0x6000
 
#define ADC15_REG_ID   0x00
 ADC 15 description register.
 
#define ADC15_REG_STATUS   0x01
 
#define ADC15_REG_MODE   0x02
 
#define ADC15_REG_CLOCK   0x03
 
#define ADC15_REG_GAIN   0x04
 
#define ADC15_REG_CFG   0x06
 
#define ADC15_REG_THRSHLD_MSB   0x07
 
#define ADC15_REG_THRSHLD_LSB   0x08
 
#define ADC15_REG_CH0_CFG   0x09
 
#define ADC15_REG_CH0_OCAL_MSB   0x0A
 
#define ADC15_REG_CH0_OCAL_LSB   0x0B
 
#define ADC15_REG_CH0_GCAL_MSB   0x0C
 
#define ADC15_REG_CH0_GCAL_LSB   0x0D
 
#define ADC15_REG_CH1_CFG   0x0E
 
#define ADC15_REG_CH1_OCAL_MSB   0x0F
 
#define ADC15_REG_CH1_OCAL_LSB   0x10
 
#define ADC15_REG_CH1_GCAL_MSB   0x11
 
#define ADC15_REG_CH1_GCAL_LSB   0x12
 
#define ADC15_REG_REGMAP_CRC   0x3E
 
#define ADC15_FREQ_MODE_HIGH_RESOLUTION   8192000
 ADC 15 frequency mode settings.
 
#define ADC15_FREQ_MODE_LOW_POWER   4096000
 
#define ADC15_FREQ_MODE_VERY_LOW_POWER   2048000
 
#define ADC15_LDC_CFG_POWER_ON   2
 ADC 15 LDC power settings.
 
#define ADC15_LDC_CFG_POWER_DOWN   3
 
#define ADC15_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ADC15_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ADC15_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  adc15_return_value_t { ADC15_OK = 0 , ADC15_ERROR = -1 }
 ADC 15 Click return value data. More...
 
enum  adc15_channel_t { ADC15_CHANNEL1 = 0 , ADC15_CHANNEL2 = 4 }
 ADC 15 Click channel selection. More...
 
enum  adc15_gain_t {
  ADC15_GAIN1 = 0 , ADC15_GAIN2 , ADC15_GAIN4 , ADC15_GAIN8 ,
  ADC15_GAIN16 , ADC15_GAIN32 , ADC15_GAIN64 , ADC15_GAIN128
}
 ADC 15 Click ADC gain configuration. More...
 
enum  adc15_word_t { ADC15_16bit = 0 , ADC15_24bit , ADC15_32bit }
 ADC 15 Click communication word data length. More...
 

Functions

void adc15_cfg_setup (adc15_cfg_t *cfg)
 ADC 15 configuration object setup function.
 
err_t adc15_init (adc15_t *ctx, adc15_cfg_t *cfg)
 ADC 15 initialization function.
 
err_t adc15_default_cfg (adc15_t *ctx)
 ADC 15 default configuration function.
 
err_t adc15_adc_write (adc15_t *ctx, uint8_t *data_in, uint8_t len)
 Data writing function.
 
err_t adc15_reg_write (adc15_t *ctx, uint8_t reg, uint16_t data_in)
 Register writing function.
 
err_t adc15_multiple_reg_write (adc15_t *ctx, uint8_t reg, uint16_t *data_in, uint8_t data_size)
 Multiple register writing function.
 
err_t adc15_adc_read (adc15_t *ctx, uint8_t *data_out, uint8_t len)
 Data reading function.
 
err_t adc15_reg_read (adc15_t *ctx, uint8_t reg, uint16_t *data_out)
 Register reading function.
 
err_t adc15_multiple_reg_read (adc15_t *ctx, uint8_t reg, uint16_t *data_out, uint8_t data_size)
 Multiple registern reading function.
 
err_t adc15_adc_transfer (adc15_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t len)
 Data transfer function.
 
err_t adc15_ltc_write (adc15_t *ctx, uint8_t oct, uint16_t dac, uint8_t cfg)
 LTC writing function.
 
err_t adc15_set_frequency (adc15_t *ctx, uint32_t frequency)
 Set sampling frequency.
 
err_t adc15_read_adc_value (adc15_t *ctx, uint16_t *status, int32_t *ch1_out, int32_t *ch2_out)
 Get raw adc value.
 
err_t adc15_read_voltage (adc15_t *ctx, uint16_t *status, float *ch1_out, float *ch2_out)
 Get voltage value.
 
uint8_t adc15_data_ready (adc15_t *ctx)
 Get data ready state.
 
err_t adc15_set_gain (adc15_t *ctx, adc15_channel_t channel, adc15_gain_t gain)
 Set gain for channel.
 
err_t adc15_set_word_len (adc15_t *ctx, adc15_word_t word_len)
 Set word len.
 

Detailed Description

This file contains API for ADC 15 Click Driver.

Enumeration Type Documentation

◆ adc15_channel_t

ADC 15 Click channel selection.

Predefined enum values for driver channel selection.

Enumerator
ADC15_CHANNEL1 
ADC15_CHANNEL2 

◆ adc15_gain_t

ADC 15 Click ADC gain configuration.

Predefined enum values for driver ADC gain configuration.

Enumerator
ADC15_GAIN1 

+/-1.2V

ADC15_GAIN2 

+/-600mV

ADC15_GAIN4 

+/-300mV

ADC15_GAIN8 

+/-150mV

ADC15_GAIN16 

+/-75mV

ADC15_GAIN32 

+/-37.5mV

ADC15_GAIN64 

+/-18.75mV

ADC15_GAIN128 

+/-9.375mV

◆ adc15_return_value_t

ADC 15 Click return value data.

Predefined enum values for driver return values.

Enumerator
ADC15_OK 
ADC15_ERROR 

◆ adc15_word_t

ADC 15 Click communication word data length.

Predefined enum values for driver communication word data length.

Enumerator
ADC15_16bit 
ADC15_24bit 
ADC15_32bit