Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define ADC16_OPCODE_SINGLE_READ 0x10
60 #define ADC16_OPCODE_SINGLE_WRITE 0x08
61 #define ADC16_OPCODE_SET_BIT 0x18
62 #define ADC16_OPCODE_CLEAR_BIT 0x20
63 #define ADC16_OPCODE_CONTINUOUS_READ 0x30
64 #define ADC16_OPCODE_CONTINUOUS_WRITE 0x28
70 #define ADC16_REG_OPMODE_I2CMODE_STATUS 0x00
71 #define ADC16_REG_DATA_BUFFER_STATUS 0x01
72 #define ADC16_REG_ACCUMULATOR_STATUS 0x02
73 #define ADC16_REG_ALERT_TRIG_CHID 0x03
74 #define ADC16_REG_SEQUENCE_STATUS 0x04
75 #define ADC16_REG_ACC_CH0_LSB 0x08
76 #define ADC16_REG_ACC_CH0_MSB 0x09
77 #define ADC16_REG_ACC_CH1_LSB 0x0A
78 #define ADC16_REG_ACC_CH1_MSB 0x0B
79 #define ADC16_REG_ALERT_LOW_FLAGS 0x0C
80 #define ADC16_REG_ALERT_HIGH_FLAGS 0x0E
81 #define ADC16_REG_DEVICE_RESET 0x14
82 #define ADC16_REG_OFFSET_CAL 0x15
83 #define ADC16_REG_WKEY 0x17
84 #define ADC16_REG_OSC_SEL 0x18
85 #define ADC16_REG_NCLK_SEL 0x19
86 #define ADC16_REG_OPMODE_SEL 0x1C
87 #define ADC16_REG_START_SEQUENCE 0x1E
88 #define ADC16_REG_ABORT_SEQUENCE 0x1F
89 #define ADC16_REG_AUTO_SEQ_CHEN 0x20
90 #define ADC16_REG_CH_INPUT_CFG 0x24
91 #define ADC16_REG_DOUT_FORMAT_CFG 0x28
92 #define ADC16_REG_DATA_BUFFER_OPMODE 0x2C
93 #define ADC16_REG_ACC_EN 0x30
94 #define ADC16_REG_ALERT_CHEN 0x34
95 #define ADC16_REG_PRE_ALT_MAX_EVENT_COUNT 0x36
96 #define ADC16_REG_ALERT_DWC_EN 0x37
97 #define ADC16_REG_DWC_HTH_CH0_LSB 0x38
98 #define ADC16_REG_DWC_HTH_CH0_MSB 0x39
99 #define ADC16_REG_DWC_LTH_CH0_LSB 0x3A
100 #define ADC16_REG_DWC_LTH_CH0_MSB 0x3B
101 #define ADC16_REG_DWC_HTH_CH1_LSB 0x3C
102 #define ADC16_REG_DWC_HTH_CH1_MSB 0x3D
103 #define ADC16_REG_DWC_LTH_CH1_LSB 0x3E
104 #define ADC16_REG_DWC_LTH_CH1_MSB 0x3F
105 #define ADC16_REG_DWC_HYS_CH0 0x40
106 #define ADC16_REG_DWC_HYS_CH1 0x41
124 #define ADC16_WKEY_UNLOCK 0x0A
125 #define ADC16_WKEY_LOCK 0x00
131 #define ADC16_DEVICE_RESET 0x01
137 #define ADC16_START_CALIBRATION 0x01
143 #define ADC16_CH_CFG_TWO_CH_SINGLE_END 0x00
144 #define ADC16_CH_CFG_SIN_CH_SINGLE_END_RMT_GND 0x01
145 #define ADC16_CH_CFG_SIN_CH_SINGLE_END_PSEUDO_DIFF 0x02
151 #define ADC16_OPMODE_SEL_MAN_WITH_CH0 0x00
152 #define ADC16_OPMODE_SEL_MAN_WITH_AUTO_SEQ 0x04
153 #define ADC16_OPMODE_SEL_AUTO_WITH_AUTO_SEQ 0x06
154 #define ADC16_OPMODE_SEL_HIGH_PREC_WITH_AUTO_SEQ 0x07
160 #define ADC16_AUTOSEQ_EN_CH0 0x01
161 #define ADC16_AUTOSEQ_EN_CH1 0x02
162 #define ADC16_AUTOSEQ_EN_BOTH_CH 0x03
168 #define ADC16_START_SEQUENCE 0x01
169 #define ADC16_ABORT_SEQUENCE 0x01
175 #define ADC16_RESOLUTION 0x0FFF
176 #define ADC16_VREF 3.3
183 #define ADC16_DEV_ADDR_R1_0_R2_DNP 0x1F
184 #define ADC16_DEV_ADDR_R1_11K_R2_DNP 0x1E
185 #define ADC16_DEV_ADDR_R1_33K_R2_DNP 0x1D
186 #define ADC16_DEV_ADDR_R1_100K_R2_DNP 0x1C
187 #define ADC16_DEV_ADDR_R1_DNP_R2_DNP 0x18
188 #define ADC16_DEV_ADDR_R1_DNP_R2_11K 0x19
189 #define ADC16_DEV_ADDR_R1_DNP_R2_33K 0x1A
190 #define ADC16_DEV_ADDR_R1_DNP_R2_100K 0x1B
208 #define ADC16_MAP_MIKROBUS( cfg, mikrobus ) \
209 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
210 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
211 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_AN ); \
212 cfg.alr = MIKROBUS( mikrobus, MIKROBUS_INT )
uint32_t i2c_speed
Definition: adc16.h:247
err_t adc16_single_register_read(adc16_t *ctx, uint8_t reg, uint8_t *data_out)
ADC 16 single register read function.
err_t adc16_init(adc16_t *ctx, adc16_cfg_t *cfg)
ADC 16 initialization function.
err_t adc16_set_register_bits(adc16_t *ctx, uint8_t reg, uint8_t bit_mask)
ADC 16 set register bits function.
adc16_return_value_t
ADC 16 Click return value data.
Definition: adc16.h:257
pin_name_t alr
Definition: adc16.h:245
@ ADC16_OK
Definition: adc16.h:258
uint8_t adc16_get_alr_pin(adc16_t *ctx)
ADC 16 get alr pin function.
err_t adc16_continuous_register_read(adc16_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
ADC 16 continuous register read function.
err_t adc16_get_voltage(adc16_t *ctx, float *ain0_voltage, float *ain1_voltage)
ADC 16 get voltage function.
uint8_t adc16_get_rdy_pin(adc16_t *ctx)
ADC 16 get rdy pin function.
i2c_master_t i2c
Definition: adc16.h:228
err_t adc16_default_cfg(adc16_t *ctx)
ADC 16 default configuration function.
err_t adc16_continuous_register_write(adc16_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
ADC 16 continuous register write function.
ADC 16 Click configuration object.
Definition: adc16.h:240
uint8_t slave_address
Definition: adc16.h:231
ADC 16 Click context object.
Definition: adc16.h:222
uint8_t i2c_address
Definition: adc16.h:248
err_t adc16_clear_register_bits(adc16_t *ctx, uint8_t reg, uint8_t bit_mask)
ADC 16 clear register bits function.
pin_name_t scl
Definition: adc16.h:241
digital_in_t alr
Definition: adc16.h:225
pin_name_t rdy
Definition: adc16.h:244
digital_in_t rdy
Definition: adc16.h:224
void adc16_cfg_setup(adc16_cfg_t *cfg)
ADC 16 configuration object setup function.
@ ADC16_ERROR
Definition: adc16.h:259
pin_name_t sda
Definition: adc16.h:242
err_t adc16_single_register_write(adc16_t *ctx, uint8_t reg, uint8_t data_in)
ADC 16 single register write function.