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"
74#define ADC15_CMD_NULL 0x0000
75#define ADC15_CMD_RESET 0x0011
76#define ADC15_CMD_STANDBY 0x0022
77#define ADC15_CMD_WAKEUP 0x0033
78#define ADC15_CMD_LOCK 0x0555
79#define ADC15_CMD_UNLOCK 0x0655
80#define ADC15_CMD_RREG 0xA000
81#define ADC15_CMD_WREG 0x6000
87#define ADC15_REG_ID 0x00
88#define ADC15_REG_STATUS 0x01
89#define ADC15_REG_MODE 0x02
90#define ADC15_REG_CLOCK 0x03
91#define ADC15_REG_GAIN 0x04
92#define ADC15_REG_CFG 0x06
93#define ADC15_REG_THRSHLD_MSB 0x07
94#define ADC15_REG_THRSHLD_LSB 0x08
95#define ADC15_REG_CH0_CFG 0x09
96#define ADC15_REG_CH0_OCAL_MSB 0x0A
97#define ADC15_REG_CH0_OCAL_LSB 0x0B
98#define ADC15_REG_CH0_GCAL_MSB 0x0C
99#define ADC15_REG_CH0_GCAL_LSB 0x0D
100#define ADC15_REG_CH1_CFG 0x0E
101#define ADC15_REG_CH1_OCAL_MSB 0x0F
102#define ADC15_REG_CH1_OCAL_LSB 0x10
103#define ADC15_REG_CH1_GCAL_MSB 0x11
104#define ADC15_REG_CH1_GCAL_LSB 0x12
105#define ADC15_REG_REGMAP_CRC 0x3E
124#define ADC15_FREQ_MODE_HIGH_RESOLUTION 8192000
125#define ADC15_FREQ_MODE_LOW_POWER 4096000
126#define ADC15_FREQ_MODE_VERY_LOW_POWER 2048000
132#define ADC15_LDC_CFG_POWER_ON 2
133#define ADC15_LDC_CFG_POWER_DOWN 3
143#define ADC15_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
144#define ADC15_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
162#define ADC15_MAP_MIKROBUS( cfg, mikrobus ) \
163 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
164 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
165 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
166 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
167 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
168 cfg.cs2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
169 cfg.drdy = MIKROBUS( mikrobus, MIKROBUS_INT )
adc15_gain_t
ADC 15 Click ADC gain configuration.
Definition adc15.h:250
@ ADC15_GAIN4
Definition adc15.h:253
@ ADC15_GAIN128
Definition adc15.h:258
@ ADC15_GAIN8
Definition adc15.h:254
@ ADC15_GAIN16
Definition adc15.h:255
@ ADC15_GAIN32
Definition adc15.h:256
@ ADC15_GAIN2
Definition adc15.h:252
@ ADC15_GAIN1
Definition adc15.h:251
@ ADC15_GAIN64
Definition adc15.h:257
adc15_channel_t
ADC 15 Click channel selection.
Definition adc15.h:239
@ ADC15_CHANNEL1
Definition adc15.h:240
@ ADC15_CHANNEL2
Definition adc15.h:241
adc15_word_t
ADC 15 Click communication word data length.
Definition adc15.h:267
@ ADC15_32bit
Definition adc15.h:270
@ ADC15_16bit
Definition adc15.h:268
@ ADC15_24bit
Definition adc15.h:269
adc15_return_value_t
ADC 15 Click return value data.
Definition adc15.h:228
@ ADC15_OK
Definition adc15.h:229
@ ADC15_ERROR
Definition adc15.h:230
void adc15_cfg_setup(adc15_cfg_t *cfg)
ADC 15 configuration object setup function.
err_t adc15_set_frequency(adc15_t *ctx, uint32_t frequency)
Set sampling frequency.
err_t adc15_set_word_len(adc15_t *ctx, adc15_word_t word_len)
Set word len.
err_t adc15_read_voltage(adc15_t *ctx, uint16_t *status, float *ch1_out, float *ch2_out)
Get voltage value.
err_t adc15_reg_write(adc15_t *ctx, uint8_t reg, uint16_t data_in)
Register writing function.
err_t adc15_reg_read(adc15_t *ctx, uint8_t reg, uint16_t *data_out)
Register reading function.
err_t adc15_adc_transfer(adc15_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t len)
Data transfer function.
err_t adc15_multiple_reg_read(adc15_t *ctx, uint8_t reg, uint16_t *data_out, uint8_t data_size)
Multiple registern reading function.
err_t adc15_multiple_reg_write(adc15_t *ctx, uint8_t reg, uint16_t *data_in, uint8_t data_size)
Multiple register writing function.
err_t adc15_adc_write(adc15_t *ctx, uint8_t *data_in, uint8_t len)
Data writing function.
err_t adc15_adc_read(adc15_t *ctx, uint8_t *data_out, uint8_t len)
Data reading function.
err_t adc15_init(adc15_t *ctx, adc15_cfg_t *cfg)
ADC 15 initialization function.
err_t adc15_set_gain(adc15_t *ctx, adc15_channel_t channel, adc15_gain_t gain)
Set gain for channel.
uint8_t adc15_data_ready(adc15_t *ctx)
Get data ready state.
err_t adc15_ltc_write(adc15_t *ctx, uint8_t oct, uint16_t dac, uint8_t cfg)
LTC writing function.
err_t adc15_read_adc_value(adc15_t *ctx, uint16_t *status, int32_t *ch1_out, int32_t *ch2_out)
Get raw adc value.
err_t adc15_default_cfg(adc15_t *ctx)
ADC 15 default configuration function.
This file contains SPI specific macros, functions, etc.
ADC 15 Click configuration object.
Definition adc15.h:204
pin_name_t drdy
Definition adc15.h:214
pin_name_t cs2
Definition adc15.h:213
spi_master_chip_select_polarity_t cs_polarity
Definition adc15.h:219
pin_name_t sck
Definition adc15.h:208
spi_master_mode_t spi_mode
Definition adc15.h:218
pin_name_t mosi
Definition adc15.h:207
uint32_t spi_speed
Definition adc15.h:217
pin_name_t miso
Definition adc15.h:206
pin_name_t rst
Definition adc15.h:212
pin_name_t cs
Definition adc15.h:209
ADC 15 Click context object.
Definition adc15.h:179
uint8_t gain2
Definition adc15.h:193
uint8_t gain1
Definition adc15.h:192
spi_master_t spi
Definition adc15.h:188
digital_in_t drdy
Definition adc15.h:185
uint8_t word_len
Definition adc15.h:194
digital_out_t rst
Definition adc15.h:181
digital_out_t cs2
Definition adc15.h:182
pin_name_t chip_select
Definition adc15.h:190
uint32_t resolution
Definition adc15.h:195