42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define ADC3_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
75#define ADC3_RETVAL uint8_t
78#define ADC3_INIT_ERROR 0xFF
85#define ADC3_I2C_SLAVE_ADDR 0x68
92#define ADC3_CFG_REG 0x00
98#define ADC3_PGA_GAIN_X1 0x00
99#define ADC3_PGA_GAIN_X2 0x01
100#define ADC3_PGA_GAIN_X4 0x02
101#define ADC3_PGA_GAIN_X8 0x03
107#define ADC3_SAMPLE_RATE_12 0x00
108#define ADC3_SAMPLE_RATE_14 0x04
109#define ADC3_SAMPLE_RATE_16 0x08
115#define ADC3_CONV_ONE_SHOT 0x00
116#define ADC3_CONV_CONTINOUS 0x10
122#define ADC3_SELECT_CHANNEL_1 0x00
123#define ADC3_SELECT_CHANNEL_2 0x20
124#define ADC3_SELECT_CHANNEL_3 0x40
125#define ADC3_SELECT_CHANNEL_4 0x60
131#define ADC3_DATA_START_VALUE 0
132#define ADC3_DATA_RESOL_RATE_12 0x0F
133#define ADC3_DATA_RESULT_RATE_12 0x07FF
134#define ADC3_DATA_RESOL_RATE_14 0x3F
135#define ADC3_DATA_RESULT_RATE_14 0x1FFF
136#define ADC3_DATA_RESOL_RATE_16 0xFF
137#define ADC3_DATA_RESULT_RATE_16 0x7FFF
144#define ADC3_RDY_SET 0x80
145#define ADC3_RDY_CLEAR 0x00
151#define ADC3_GENERAL_CALL_RESET 0x06
152#define ADC3_GENERAL_CALL_LATCH 0x04
153#define ADC3_GENERAL_CALL_CONVERSION 0x08
#define ADC3_RETVAL
Definition adc3.h:75
ADC3_RETVAL adc3_init(adc3_t *ctx, adc3_cfg_t *cfg)
Initialization function.
int16_t adc3_read_measurement(adc3_t *ctx, uint8_t channel, uint8_t resolution, uint8_t gain)
ADC3 read measurement function.
void adc3_reset(adc3_t *ctx)
General call reset function.
void adc3_generic_read(adc3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void adc3_default_cfg(adc3_t *ctx)
Click Default Configuration function.
void adc3_latch(adc3_t *ctx)
General call latch function.
void adc3_generic_write(adc3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void adc3_conversion(adc3_t *ctx)
General call conversion function.
void adc3_cfg_setup(adc3_cfg_t *cfg)
Config Object Initialization function.
float adc3_read_voltage(adc3_t *ctx, uint8_t channel, uint8_t resolution, uint8_t gain)
Read voltage function.
Click configuration structure definition.
Definition adc3.h:183
uint32_t i2c_speed
Definition adc3.h:191
pin_name_t scl
Definition adc3.h:186
pin_name_t sda
Definition adc3.h:187
uint8_t i2c_address
Definition adc3.h:192
Click ctx object definition.
Definition adc3.h:168
i2c_master_t i2c
Definition adc3.h:171
uint8_t slave_address
Definition adc3.h:175