41#ifdef PREINIT_SUPPORTED
45#ifdef MikroCCoreVersion
46 #if MikroCCoreVersion >= 1
51#include "drv_digital_out.h"
52#include "drv_digital_in.h"
53#include "drv_spi_master.h"
66#define ADC7_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
68 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
69 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
70 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
71 cfg.drl = MIKROBUS( mikrobus, MIKROBUS_AN ); \
72 cfg.pre = MIKROBUS( mikrobus, MIKROBUS_RST ); \
73 cfg.mck = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
74 cfg.bsy = MIKROBUS( mikrobus, MIKROBUS_INT )
81#define ADC7_RETVAL uint8_t
84#define ADC7_INIT_ERROR 0xFF
91#define ADC7_SINC1_FILT 0x01
92#define ADC7_SINC2_FILT 0x02
93#define ADC7_SINC3_FILT 0x03
94#define ADC7_SINC4_FILT 0x04
95#define ADC7_SSINC_FILT 0x05
96#define ADC7_FLAT_PASSBAND_FILT 0x06
97#define ADC7_AVERAGING_FILT 0x07
104#define ADC7_DOWNSAMPL_FACT_4 0x02
105#define ADC7_DOWNSAMPL_FACT_8 0x03
106#define ADC7_DOWNSAMPL_FACT_16 0x04
107#define ADC7_DOWNSAMPL_FACT_32 0x05
108#define ADC7_DOWNSAMPL_FACT_64 0x06
109#define ADC7_DOWNSAMPL_FACT_128 0x07
110#define ADC7_DOWNSAMPL_FACT_256 0x08
111#define ADC7_DOWNSAMPL_FACT_512 0x09
112#define ADC7_DOWNSAMPL_FACT_1024 0x0A
113#define ADC7_DOWNSAMPL_FACT_2048 0x0B
114#define ADC7_DOWNSAMPL_FACT_4096 0x0C
115#define ADC7_DOWNSAMPL_FACT_8192 0x0D
116#define ADC7_DOWNSAMPL_FACT_16384 0x0E
123#define ADC7_GAIN_EXPAN_EN 0x01
124#define ADC7_GAIN_COMPR_EN 0x02
125#define ADC7_GAIN_DISABLE 0x00
132#define ADC7_DATA_NOT_READY 0x01
133#define ADC7_DATA_IS_READY 0x00
134#define ADC7_DEVICE_IS_BUSY 0x01
135#define ADC7_DEVICE_NOT_BUSY 0x00
136#define ADC7_WRONG_GAIN_CONFIG 0x02
137#define ADC7_WRONG_DOWNSAMPL_FACT 0x03
138#define ADC7_WRONG_FILT_TYPE 0x04
145#define ADC7_HIGH_STATE 0x01
146#define ADC7_LOW_STATE 0x00
270 uint8_t down_samp_factor, uint8_t filter_type );
#define ADC7_RETVAL
Definition adc7.h:81
uint8_t adc7_read_bytes(adc7_t *ctx, uint8_t n_bytes, uint8_t *data_out)
Read Bytes Function.
void adc7_default_cfg(adc7_t *ctx)
Default Configuration Initialization function.
uint8_t adc7_check_data_ready(adc7_t *ctx)
Data Ready Check Function.
uint8_t adc7_read_results(adc7_t *ctx, float *voltage)
Start Conversion Function.
ADC7_RETVAL adc7_init(adc7_t *ctx, adc7_cfg_t *cfg)
Initialization function.
uint8_t adc7_set_config(adc7_t *ctx, uint8_t gain_config, uint8_t down_samp_factor, uint8_t filter_type)
Configuration set function.
void adc7_cfg_setup(adc7_cfg_t *cfg)
Config Object Initialization function.
void adc7_set_clock(adc7_t *ctx, uint8_t state)
Set Clock.
uint8_t adc7_check_busy(adc7_t *ctx)
Busy Check Function.
void adc7_preset_mode(adc7_t *ctx, uint8_t state)
Preset Mode.
void adc7_start_conv_cycle(adc7_t *ctx)
Start Conversion Function.
Click configuration structure definition.
Definition adc7.h:189
float dev_value_lsb
Definition adc7.h:212
pin_name_t pre
Definition adc7.h:200
pin_name_t drl
Definition adc7.h:199
uint16_t dev_num_sampl
Definition adc7.h:210
pin_name_t bsy
Definition adc7.h:202
spi_master_chip_select_polarity_t cs_polarity
Definition adc7.h:208
pin_name_t sck
Definition adc7.h:194
spi_master_mode_t spi_mode
Definition adc7.h:207
pin_name_t mck
Definition adc7.h:201
pin_name_t mosi
Definition adc7.h:193
uint32_t spi_speed
Definition adc7.h:206
pin_name_t miso
Definition adc7.h:192
pin_name_t cs
Definition adc7.h:195
float dev_volt_ref
Definition adc7.h:211
Click ctx object definition.
Definition adc7.h:160
digital_out_t cs
Definition adc7.h:161
digital_in_t drl
Definition adc7.h:170
spi_master_t spi
Definition adc7.h:175
digital_out_t mck
Definition adc7.h:166
float value_lsb
Definition adc7.h:180
digital_out_t pre
Definition adc7.h:165
float volt_ref
Definition adc7.h:179
digital_in_t bsy
Definition adc7.h:171
pin_name_t chip_select
Definition adc7.h:176
uint16_t num_sampl
Definition adc7.h:178