39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define ADC12_CMD_SD_MASK 0x80
74#define ADC12_CMD_SD_DIFF 0x00
75#define ADC12_CMD_SD_SINGLE_END 0x80
77#define ADC12_CMD_PD_MASK 0x0C
78#define ADC12_CMD_PD_PDADCONV 0x00
79#define ADC12_CMD_PD_IROFF_ADON 0x04
80#define ADC12_CMD_PD_IRON_ADOFF 0x08
81#define ADC12_CMD_PD_IRON_ADON 0x0C
99#define ADC12_SINGLE_END_CH0 0
100#define ADC12_SINGLE_END_CH1 1
101#define ADC12_SINGLE_END_CH2 2
102#define ADC12_SINGLE_END_CH3 3
103#define ADC12_SINGLE_END_CH4 4
104#define ADC12_SINGLE_END_CH5 5
105#define ADC12_SINGLE_END_CH6 6
106#define ADC12_SINGLE_END_CH7 7
112#define ADC12_DIFF_CH0_P_CH1_N 0
113#define ADC12_DIFF_CH1_P_CH0_N 1
114#define ADC12_DIFF_CH2_P_CH3_N 2
115#define ADC12_DIFF_CH3_P_CH2_N 3
116#define ADC12_DIFF_CH4_P_CH5_N 4
117#define ADC12_DIFF_CH5_P_CH4_N 5
118#define ADC12_DIFF_CH6_P_CH7_N 6
119#define ADC12_DIFF_CH7_P_CH6_N 7
125#define ADC12_INTERNAL_VREF 2500
131#define ADC12_RES 4096.0
138#define ADC12_DEV_ADDR_DEFAULT 0x48
139#define ADC12_DEV_ADDR_01 0x49
140#define ADC12_DEV_ADDR_10 0x4A
141#define ADC12_DEV_ADDR_11 0x4B
159#define ADC12_MAP_MIKROBUS( cfg, mikrobus ) \
160 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
161 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
adc12_return_value_t
ADC 12 Click return value data.
Definition adc12.h:204
@ ADC12_ERROR
Definition adc12.h:206
@ ADC12_OK
Definition adc12.h:205
err_t adc12_send_cmd(adc12_t *ctx, uint8_t cmd_byte)
ADC 12 send command function.
err_t adc12_read_data(adc12_t *ctx, uint16_t *data_out)
ADC 12 read data function.
uint8_t adc12_get_sd_mode(adc12_t *ctx)
ADC 12 get the Single-Ended/Differential Inputs function.
err_t adc12_read_raw_data(adc12_t *ctx, uint8_t ch, uint16_t *data_out)
ADC 12 read raw ADC data function.
err_t adc12_init(adc12_t *ctx, adc12_cfg_t *cfg)
ADC 12 initialization function.
void adc12_set_pd_mode(adc12_t *ctx, uint8_t pd_mode)
ADC 12 set the Power-Down mode function.
err_t adc12_read_voltage(adc12_t *ctx, uint8_t ch, uint16_t vref, float *data_out)
ADC 12 read voltage function.
void adc12_set_sd_mode(adc12_t *ctx, uint8_t sd_mode)
ADC 12 set the Single-Ended/Differential Inputs function.
void adc12_cfg_setup(adc12_cfg_t *cfg)
ADC 12 configuration object setup function.
uint8_t adc12_get_pd_mode(adc12_t *ctx)
ADC 12 get the Power-Down mode function.
ADC 12 Click configuration object.
Definition adc12.h:190
uint32_t i2c_speed
Definition adc12.h:194
pin_name_t scl
Definition adc12.h:191
pin_name_t sda
Definition adc12.h:192
uint8_t i2c_address
Definition adc12.h:195
ADC 12 Click context object.
Definition adc12.h:171
uint8_t adc12_pd_mode
Definition adc12.h:181
uint8_t adc12_sd_mode
Definition adc12.h:180
i2c_master_t i2c
Definition adc12.h:174
uint8_t slave_address
Definition adc12.h:178