Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_spi_master.h"
70 #define ADC24_CTRL_SET_WRITE 0x0800u
71 #define ADC24_CTRL_SET_SEQ 0x0400u
72 #define ADC24_CTRL_SET_CH_0 0x0000u
73 #define ADC24_CTRL_SET_CH_1 0x0040u
74 #define ADC24_CTRL_SET_CH_2 0x0080u
75 #define ADC24_CTRL_SET_CH_3 0x00C0u
76 #define ADC24_CTRL_SET_CH_4 0x0100u
77 #define ADC24_CTRL_SET_CH_5 0x0140u
78 #define ADC24_CTRL_SET_CH_6 0x0180u
79 #define ADC24_CTRL_SET_CH_7 0x01C0u
80 #define ADC24_CTRL_SET_CH_8 0x0200u
81 #define ADC24_CTRL_SET_CH_9 0x0240u
82 #define ADC24_CTRL_SET_CH_10 0x0280u
83 #define ADC24_CTRL_SET_CH_11 0x02C0u
84 #define ADC24_CTRL_SET_CH_12 0x0300u
85 #define ADC24_CTRL_SET_CH_13 0x0340u
86 #define ADC24_CTRL_SET_CH_14 0x0380u
87 #define ADC24_CTRL_SET_CH_15 0x03C0u
88 #define ADC24_CTRL_SET_PM_NORMAL 0x0030u
89 #define ADC24_CTRL_SET_PM_FULL_SHDN 0x0020u
90 #define ADC24_CTRL_SET_PM_AUTO_SHDN 0x0010u
91 #define ADC24_CTRL_SET_PM_STANDBY 0x0000u
92 #define ADC24_CTRL_SET_SHADOW 0x0008u
93 #define ADC24_CTRL_SET_WEAK 0x0004u
94 #define ADC24_CTRL_SET_RANGE_5V 0x0000u
95 #define ADC24_CTRL_SET_RANGE_2_5V 0x0002u
96 #define ADC24_CTRL_SET_CODING_2C 0x0000u
97 #define ADC24_CTRL_SET_CODING_BIN 0x0001u
103 #define ADC24_SEQ_SHADOW_AN_INPUT 0
104 #define ADC24_SEQ_SHADOW_PROGRAMMING 1
105 #define ADC24_SEQ_SHADOW_ALTERED 2
106 #define ADC24_SEQ_SHADOW_ADDR_CONJ 3
112 #define ADC24_CH_SEL_IN_0 0
113 #define ADC24_CH_SEL_IN_1 1
114 #define ADC24_CH_SEL_IN_2 2
115 #define ADC24_CH_SEL_IN_3 3
116 #define ADC24_CH_SEL_IN_4 4
117 #define ADC24_CH_SEL_IN_5 5
118 #define ADC24_CH_SEL_IN_6 6
119 #define ADC24_CH_SEL_IN_7 7
120 #define ADC24_CH_SEL_IN_8 8
121 #define ADC24_CH_SEL_IN_9 9
122 #define ADC24_CH_SEL_IN_10 10
123 #define ADC24_CH_SEL_IN_11 11
124 #define ADC24_CH_SEL_IN_12 12
125 #define ADC24_CH_SEL_IN_13 13
126 #define ADC24_CH_SEL_IN_14 14
127 #define ADC24_CH_SEL_IN_15 15
133 #define ADC24_PM_STANDBY 0
134 #define ADC24_PM_AUTO_SHDN 1
135 #define ADC24_PM_FULL_SHDN 2
136 #define ADC24_PM_NORMAL 3
142 #define ADC24_WEAK_DOUT_THREE_STATE 0
143 #define ADC24_WEAK_DOUT_WEAKLY_DRIVEN 1
149 #define ADC24_RANGE_VREF_5V 0
150 #define ADC24_RANGE_VREF_2V5 1
156 #define ADC24_CODING_2C 0
157 #define ADC24_CODING_BIN 1
163 #define ADC24_ADC_RESOLUTION 0x0FFF
164 #define ADC24_VREF_2V5 2.5f
165 #define ADC24_VREF_5V 5.0f
175 #define ADC24_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
176 #define ADC24_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
194 #define ADC24_MAP_MIKROBUS( cfg, mikrobus ) \
195 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
196 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
197 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
198 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
uint8_t ch_sel
Definition: adc24.h:241
err_t adc24_get_adc_data(adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, uint16_t *adc_data)
ADC 24 get ADC data function.
err_t adc24_generic_read(adc24_t *ctx, uint16_t *data_out)
ADC 24 data reading function.
err_t adc24_init(adc24_t *ctx, adc24_cfg_t *cfg)
ADC 24 initialization function.
uint32_t spi_speed
Definition: adc24.h:229
@ ADC24_ERROR
Definition: adc24.h:257
spi_master_chip_select_polarity_t cs_polarity
Definition: adc24.h:231
This file contains SPI specific macros, functions, etc.
@ ADC24_OK
Definition: adc24.h:256
ADC 24 Click context object.
Definition: adc24.h:208
uint8_t seq_shadow
Definition: adc24.h:243
err_t adc24_generic_write(adc24_t *ctx, uint16_t control)
ADC 24 data writing function.
uint8_t range
Definition: adc24.h:245
ADC 24 Click configuration object.
Definition: adc24.h:221
pin_name_t chip_select
Definition: adc24.h:212
void adc24_cfg_setup(adc24_cfg_t *cfg)
ADC 24 configuration object setup function.
err_t adc24_get_voltage(adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, float *voltage)
ADC 24 get voltage level function.
uint8_t pm
Definition: adc24.h:242
spi_master_mode_t spi_mode
Definition: adc24.h:230
pin_name_t sck
Definition: adc24.h:225
pin_name_t mosi
Definition: adc24.h:224
uint8_t weak
Definition: adc24.h:244
pin_name_t miso
Definition: adc24.h:223
adc24_return_value_t
ADC 24 Click return value data.
Definition: adc24.h:255
spi_master_t spi
Definition: adc24.h:210
pin_name_t cs
Definition: adc24.h:226
uint8_t coding
Definition: adc24.h:246
ADC 24 Click control object.
Definition: adc24.h:240