adc10 2.0.0.0
adc10.h File Reference

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

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  adc10_t
 ADC 10 Click context object. More...
 
struct  adc10_cfg_t
 ADC 10 Click configuration object.
More...
 
struct  adc10_settings_t
 

Macros

#define ADC10_REG_CONFIG_0   0x00
 ADC 10 description register.
 
#define ADC10_REG_CONFIG_1   0x01
 
#define ADC10_REG_CONFIG_2   0x02
 
#define ADC10_REG_CONFIG_3   0x03
 
#define ADC10_REG_CONFIG_4   0x04
 
#define ADC10_SYNC_WORD   0x55
 ADC 10 commands description setting.
 
#define ADC10_CMD_RESET   0x06
 
#define ADC10_CMD_START   0x08
 
#define ADC10_CMD_POWERDOWN   0x03
 
#define ADC10_CMD_RDATA   0x10
 
#define ADC10_CMD_RREG   0x20
 
#define ADC10_CMD_WREG   0x40
 
#define ADC10_REG0_MUX_P0_N1   0x00
 ADC 10 Configuration Register 0 description setting.
 
#define ADC10_REG0_MUX_P0_N2   0x01
 
#define ADC10_REG0_MUX_P0_N3   0x02
 
#define ADC10_REG0_MUX_P1_N0   0x03
 
#define ADC10_REG0_MUX_P1_N2   0x04
 
#define ADC10_REG0_MUX_P1_N3   0x05
 
#define ADC10_REG0_MUX_P2_N3   0x06
 
#define ADC10_REG0_MUX_P3_N2   0x07
 
#define ADC10_REG0_MUX_P0_NS   0x08
 
#define ADC10_REG0_MUX_P1_NS   0x09
 
#define ADC10_REG0_MUX_P2_NS   0x0A
 
#define ADC10_REG0_MUX_P3_NS   0x0B
 
#define ADC10_REG0_MUX_VREF   0x0C
 
#define ADC10_REG0_MUX_AVOLD_4   0x0D
 
#define ADC10_REG0_MUX_AVOLAVER   0x0E
 
#define ADC10_REG0_MUX_RESERVE   0x0F
 
#define ADC10_REG0_GAIN_1   0x00
 ADC 10 Configuration Register 0 description setting.
 
#define ADC10_REG0_GAIN_2   0x01
 
#define ADC10_REG0_GAIN_4   0x02
 
#define ADC10_REG0_GAIN_8   0x03
 
#define ADC10_REG0_GAIN_16   0x04
 
#define ADC10_REG0_GAIN_32   0x05
 
#define ADC10_REG0_GAIN_64   0x06
 
#define ADC10_REG0_GAIN_128   0x07
 
#define ADC10_REG0_PGA_ENABLED   0x00
 ADC 10 Configuration Register 0 description setting.
 
#define ADC10_REG0_PGA_DISABLED   0x01
 
#define ADC10_REG1_DR_NORMAL_20   0x00
 ADC 10 Configuration Register 1 description setting.
 
#define ADC10_REG1_DR_NORMAL_45   0x01
 
#define ADC10_REG1_DR_NORMAL_90   0x02
 
#define ADC10_REG1_DR_NORMAL_175   0x03
 
#define ADC10_REG1_DR_NORMAL_330   0x04
 
#define ADC10_REG1_DR_NORMAL_600   0x05
 
#define ADC10_REG1_DR_NORMAL_1000   0x06
 
#define ADC10_REG1_DR_TURBO_40   0x00
 
#define ADC10_REG1_DR_TURBO_90   0x01
 
#define ADC10_REG1_DR_TURBO_180   0x02
 
#define ADC10_REG1_DR_TURBO_350   0x03
 
#define ADC10_REG1_DR_TURBO_660   0x04
 
#define ADC10_REG1_DR_TURBO_1200   0x05
 
#define ADC10_REG1_DR_TURBO_2000   0x06
 
#define ADC10_REG1_MODE_NORMAL   0x00
 ADC 10 Configuration Register 1 description setting.
 
#define ADC10_REG1_MODE_TURBO   0x01
 
#define ADC10_REG1_CM_SINGAL_SHOT   0x00
 ADC 10 Configuration Register 1 description setting.
 
#define ADC10_REG1_CM_CONTINUOUS   0x01
 
#define ADC10_REG1_VREF_INTERNAL_2048   0x00
 ADC 10 Configuration Register 1 description setting.
 
#define ADC10_REG1_VREF_EXTERNAL_REF   0x01
 
#define ADC10_REG1_VREF_ANALOG_1   0x02
 
#define ADC10_REG1_VREF_ANALOG_2   0x03
 
#define ADC10_REG1_TS_DISABLED   0x00
 ADC 10 Configuration Register 1 description setting.
 
#define ADC10_REG1_TS_ENABLED   0x01
 
#define ADC10_REG2_DRDY_NOT_READY   0x00
 ADC 10 Configuration Register 2 description setting.
 
#define ADC10_REG2_DRDY_READY   0x01
 
#define ADC10_REG2_DCNT_DISABLED   0x00
 ADC 10 Configuration Register 2 description setting.
 
#define ADC10_REG2_DCNT_ENABLED   0x01
 
#define ADC10_REG2_CRC_DISABLED   0x00
 ADC 10 Configuration Register 2 description setting.
 
#define ADC10_REG2_CRC_INVERTED_ENABLED   0x01
 
#define ADC10_REG2_CRC_CRC16_ENABLED   0x02
 
#define ADC10_REG2_CRC_RESERVED   0x03
 
#define ADC10_REG2_BCS_CURRENT_SOURCE_OFF   0x00
 ADC 10 Configuration Register 2 description setting.
 
#define ADC10_REG2_BCS_CURRENT_SOURCE_ON   0x01
 
#define ADC10_REG2_IDAC_CURRENT_OFF   0x00
 ADC 10 Configuration Register 2 description setting.
 
#define ADC10_REG2_IDAC_CURRENT_10_uA   0x01
 
#define ADC10_REG2_IDAC_CURRENT_50_uA   0x02
 
#define ADC10_REG2_IDAC_CURRENT_100_uA   0x03
 
#define ADC10_REG2_IDAC_CURRENT_250_uA   0x04
 
#define ADC10_REG2_IDAC_CURRENT_500_uA   0x05
 
#define ADC10_REG2_IDAC_CURRENT_1000_uA   0x06
 
#define ADC10_REG2_IDAC_CURRENT_1500_uA   0x07
 
#define ADC10_REG3_L1MUX_DISABLED   0x00
 ADC 10 Configuration Register 3 description setting.
 
#define ADC10_REG3_L1MUX_TO_AIN0   0x01
 
#define ADC10_REG3_L1MUX_TO_AIN1   0x02
 
#define ADC10_REG3_L1MUX_TO_AIN2   0x03
 
#define ADC10_REG3_L1MUX_TO_AIN3   0x04
 
#define ADC10_REG3_L1MUX_TO_REFP   0x05
 
#define ADC10_REG3_L1MUX_TO_REFN   0x06
 
#define ADC10_REG3_L1MUX_RESERVED   0x07
 
#define ADC10_REG3_L2MUX_DISABLED   0x00
 ADC 10 Configuration Register 3 description setting.
 
#define ADC10_REG3_L2MUX_TO_AIN0   0x01
 
#define ADC10_REG3_L2MUX_TO_AIN1   0x02
 
#define ADC10_REG3_L2MUX_TO_AIN2   0x03
 
#define ADC10_REG3_L2MUX_TO_AIN3   0x04
 
#define ADC10_REG3_L2MUX_TO_REFP   0x05
 
#define ADC10_REG3_L2MUX_TO_REFN   0x06
 
#define ADC10_REG3_DATA_MODE_MANUAL   0x00
 ADC 10 Configuration Register 3 description setting.
 
#define ADC10_REG3_DATA_MODE_AUTO   0x01
 
#define ADC10_REG4_GPIO2_DIR_INPUT   0x00
 ADC 10 Configuration Register 4 description setting.
 
#define ADC10_REG4_GPIO2_DIR_OUTPUT   0x01
 
#define ADC10_REG4_GPIO1_DIR_INPUT   0x00
 
#define ADC10_REG4_GPIO1_DIR_OUTPUT   0x01
 
#define ADC10_REG4_GPIO0_DIR_INPUT   0x00
 
#define ADC10_REG4_GPIO0_DIR_OUTPUT   0x01
 
#define ADC10_REG4_GPIO2_SEL_DAT   0x00
 ADC 10 Configuration Register 4 description setting.
 
#define ADC10_REG4_GPIO2_SEL_DRDY   0x01
 
#define ADC10_REG4_GPIO_LOW   0x00
 ADC 10 Configuration Register 4 description setting.
 
#define ADC10_REG4_GPIO_HIGH   0x01
 
#define ADC10_ANALOG_INPUT_CH_0   0x00
 ADC 10 Configuration analog input setting.
 
#define ADC10_ANALOG_INPUT_CH_1   0x01
 
#define ADC10_ANALOG_INPUT_CH_2   0x02
 
#define ADC10_ANALOG_INPUT_CH_3   0x03
 
#define ADC10_NEW_DATA_IS_READY   0x00
 ADC 10 Configuration data ready setting.
 
#define ADC10_NEW_DATA_NOT_READY   0x01
 
#define ADC10_GAIN_1   1
 ADC 10 Gain value.
 
#define ADC10_GAIN_2   2
 
#define ADC10_GAIN_4   4
 
#define ADC10_GAIN_8   8
 
#define ADC10_GAIN_16   16
 
#define ADC10_GAIN_32   32
 
#define ADC10_GAIN_64   64
 
#define ADC10_GAIN_128   128
 
#define ADC10_REG_BITS   0x0E
 ADC 10 Configuration Vref and resolution setting.
 
#define ADC10_ADC_RESOLUTION   0x007FFFFF
 
#define ADC10_VREF_INTERNAL   2048.0
 
#define ADC10_VREF_EXTERNAL_3300_mA   3300.0
 
#define ADC10_VREF_EXTERNAL_5000_mA   5000.0
 
#define DRV_BUFFER_SIZE   200
 ADC 10 driver buffer size.
 
#define ADC10_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Functions

void adc10_cfg_setup (adc10_cfg_t *cfg)
 ADC 10 configuration object setup function.
 
err_t adc10_init (adc10_t *ctx, adc10_cfg_t *cfg)
 ADC 10 initialization function.
 
void adc10_default_cfg (adc10_t *ctx)
 ADC 10 default configuration function.
 
err_t adc10_generic_write (adc10_t *ctx, char *data_buf, uint16_t len)
 ADC 10 data writing function.
 
err_t adc10_generic_read (adc10_t *ctx, char *data_buf, uint16_t max_len)
 ADC 10 data reading function.
 
void adc10_hw_reset (adc10_t *ctx)
 ADC 10 Hardware reset function.
 
uint8_t adc10_check_drdy (adc10_t *ctx)
 ADC 10 Check DRDY function.
 
void adc10_send_command (adc10_t *ctx, uint8_t cmd)
 ADC 10 Send command function.
 
void adc10_reset (adc10_t *ctx)
 ADC 10 Software reset function.
 
void adc10_start_sync (adc10_t *ctx)
 ADC 10 Start the synchronization function.
 
void adc10_shutdown (adc10_t *ctx)
 ADC 10 Shutdown function.
 
void adc10_write_reg (adc10_t *ctx, uint8_t reg, uint8_t tx_data)
 ADC 10 Write register function.
 
uint8_t adc10_read_reg (adc10_t *ctx, uint8_t reg)
 ADC 10 Read register function.
 
int32_t adc10_get_ch_output (adc10_t *ctx, uint8_t sel_ch)
 ADC 10 Get the channel output function.
 
float adc10_calc_voltage (adc10_t *ctx, int32_t adc_data, float vref, uint8_t gain)
 ADC 10 Calculate the voltage function.
 
void adc10_set_config (adc10_t *ctx, adc10_settings_t cfg_data)
 ADC 10 Set configuration function.
 
void adc10_get_config (adc10_t *ctx, adc10_settings_t *cfg_data)
 ADC 10 Get configuration function.
 

Detailed Description

This file contains API for ADC 10 Click Driver.