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_spi_master.h"
73#define ISOADC5_REG_PROD_ID 0x00
74#define ISOADC5_REG_ADC_1 0x01
75#define ISOADC5_REG_ADC_2 0x02
76#define ISOADC5_REG_ADC_3 0x03
77#define ISOADC5_REG_ADC_4 0x04
78#define ISOADC5_REG_FADC_1 0x05
79#define ISOADC5_REG_FADC_2 0x06
80#define ISOADC5_REG_FADC_3 0x07
81#define ISOADC5_REG_FADC_4 0x08
82#define ISOADC5_REG_COUNTHI_1 0x09
83#define ISOADC5_REG_COUNTHI_2 0x0A
84#define ISOADC5_REG_COUNTHI_3 0x0B
85#define ISOADC5_REG_COUNTHI_4 0x0C
86#define ISOADC5_REG_COUNTLO_1 0x0D
87#define ISOADC5_REG_COUNTLO_2 0x0E
88#define ISOADC5_REG_COUNTLO_3 0x0F
89#define ISOADC5_REG_COUNTLO_4 0x10
90#define ISOADC5_REG_COUT_STATUS 0x11
91#define ISOADC5_REG_INTERRUPT_STATUS 0x12
92#define ISOADC5_REG_INTERRUPT_ENABLE 0x13
93#define ISOADC5_REG_CONTROL 0x14
111#define ISOADC5_DEVICE_ID 0x00
112#define ISOADC5_NORMAL_OPERATION 0x00
113#define ISOADC5_WAKE_UP_FROM_POR 0x80
114#define ISOADC5_DEVICE_REV 0x01
120#define ISOADC5_ADC_NOT_UPDATED 0x8000
121#define ISOADC5_ADC_12BIT_MASK 0x0FFF
127#define ISOADC5_CO_MODE_STATUS 0x80
128#define ISOADC5_CO_IN_SEL_FILTERED_ADC 0x40
134#define ISOADC5_STATUS_CO_4 0x08
135#define ISOADC5_STATUS_CO_3 0x04
136#define ISOADC5_STATUS_CO_2 0x02
137#define ISOADC5_STATUS_CO_1 0x01
143#define ISOADC5_INT_STATUS_EOC 0x1000
144#define ISOADC5_INT_STATUS_ADCF 0x0800
145#define ISOADC5_INT_STATUS_FLD 0x0400
146#define ISOADC5_INT_STATUS_SPIFRM 0x0200
147#define ISOADC5_INT_STATUS_SPICRC 0x0100
148#define ISOADC5_INT_STATUS_CO_POS_4 0x0080
149#define ISOADC5_INT_STATUS_CO_POS_3 0x0040
150#define ISOADC5_INT_STATUS_CO_POS_2 0x0020
151#define ISOADC5_INT_STATUS_CO_POS_1 0x0010
152#define ISOADC5_INT_STATUS_CO_NEG_4 0x0008
153#define ISOADC5_INT_STATUS_CO_NEG_3 0x0004
154#define ISOADC5_INT_STATUS_CO_NEG_2 0x0002
155#define ISOADC5_INT_STATUS_CO_NEG_1 0x0001
161#define ISOADC5_EN_CRC 0x8000
162#define ISOADC5_EN_COMMON_COMP 0x4000
163#define ISOADC5_CLEAR_FLT_4 0x0080
164#define ISOADC5_CLEAR_FLT_3 0x0040
165#define ISOADC5_CLEAR_FLT_2 0x0020
166#define ISOADC5_CLEAR_FLT_1 0x0010
167#define ISOADC5_DISABLE_PWR 0x0008
168#define ISOADC5_CLEAR_POR 0x0004
169#define ISOADC5_SOFT_RESET 0x0002
170#define ISOADC5_HARD_RESET 0x0001
176#define ISOADC5_ADC_CHANNEL_1 0x01
177#define ISOADC5_ADC_CHANNEL_2 0x02
178#define ISOADC5_ADC_CHANNEL_3 0x03
179#define ISOADC5_ADC_CHANNEL_4 0x04
185#define ISOADC5_ADC_UNFILTERED 0x00
186#define ISOADC5_ADC_FILTERED 0x01
192#define ISOADC5_MAX_VOLTAGE 48.0
198#define ISOADC5_SPI_READ 0x00
199#define ISOADC5_SPI_WRITE 0x02
200#define ISOADC5_SPI_BURST 0x01
218#define ISOADC5_MAP_MIKROBUS( cfg, mikrobus ) \
219 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
220 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
221 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
222 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
223 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t isoadc5_write_register(isoadc5_t *ctx, uint8_t reg, uint16_t data_in)
ISO ADC 5 write register function.
void isoadc5_cfg_setup(isoadc5_cfg_t *cfg)
ISO ADC 5 configuration object setup function.
err_t isoadc5_init(isoadc5_t *ctx, isoadc5_cfg_t *cfg)
ISO ADC 5 initialization function.
err_t isoadc5_read_voltage(isoadc5_t *ctx, uint8_t filt, uint8_t ch, float *volt)
ISO ADC 5 read voltage function.
err_t isoadc5_read_register_burst(isoadc5_t *ctx, uint8_t filt, isoadc5_burst_payload_t *payload)
ISO ADC 5 read register function.
err_t isoadc5_read_register(isoadc5_t *ctx, uint8_t reg, uint16_t *data_out)
ISO ADC 5 read register function.
uint8_t isoadc5_get_int_pin(isoadc5_t *ctx)
ISO ADC 5 get int pin function.
isoadc5_return_value_t
ISO ADC 5 Click return value data.
Definition isoadc5.h:284
@ ISOADC5_OK
Definition isoadc5.h:285
@ ISOADC5_ERROR
Definition isoadc5.h:286
ISO ADC 5 Click burst payload structure object.
Definition isoadc5.h:270
uint16_t int_status
Definition isoadc5.h:275
uint16_t adc_1
Definition isoadc5.h:271
uint16_t adc_4
Definition isoadc5.h:274
uint16_t adc_2
Definition isoadc5.h:272
uint16_t adc_3
Definition isoadc5.h:273
ISO ADC 5 Click configuration object.
Definition isoadc5.h:248
spi_master_chip_select_polarity_t cs_polarity
Definition isoadc5.h:261
pin_name_t sck
Definition isoadc5.h:252
spi_master_mode_t spi_mode
Definition isoadc5.h:260
pin_name_t mosi
Definition isoadc5.h:251
uint32_t spi_speed
Definition isoadc5.h:259
pin_name_t int_pin
Definition isoadc5.h:256
pin_name_t miso
Definition isoadc5.h:250
pin_name_t cs
Definition isoadc5.h:253
ISO ADC 5 Click context object.
Definition isoadc5.h:233
spi_master_t spi
Definition isoadc5.h:237
digital_in_t int_pin
Definition isoadc5.h:234
pin_name_t chip_select
Definition isoadc5.h:239