adc6  2.0.0.0
adc6.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright© 2020 MikroElektronika d.o.o.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so,
11  * subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22  * OR OTHER DEALINGS IN THE SOFTWARE.
23  */
32 // ----------------------------------------------------------------------------
33 
34 #ifndef ADC6_H
35 #define ADC6_H
36 
37 #include "mikrosdk_version.h"
38 
39 #ifdef __GNUC__
40 #if mikroSDK_GET_VERSION < 20800ul
41 #include "rcu_delays.h"
42 #else
43 #include "delays.h"
44 #endif
45 #endif
46 
47 #include "drv_digital_out.h"
48 #include "drv_digital_in.h"
49 #include "drv_spi_master.h"
50 
51 // -------------------------------------------------------------- PUBLIC MACROS
63 #define ADC6_MAP_MIKROBUS( cfg, mikrobus ) \
64  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
65  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
66  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
67  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
68  cfg.syn = MIKROBUS( mikrobus, MIKROBUS_RST )
69 
75 #define ADC6_OK 0
76 #define ADC6_ERROR -1
77 
83 #define ADC6_COMMUNICATION_AND_STATUS_REG 0x00
84 #define ADC6_CONTROL_REG 0x01
85 #define ADC6_DATA_REG 0x02
86 #define ADC6_IO_CONTROL_1_REG 0x03
87 #define ADC6_IO_CONTROL_2_REG 0x04
88 #define ADC6_ID_REG 0x05
89 #define ADC6_ERROR_STATUS_REG 0x06
90 #define ADC6_ERROR_ENABLE_REG 0x07
91 #define ADC6_MASTER_CLOCK_COUNTER_REG 0x08
92 #define ADC6_CHANNEL_0_REG 0x09
93 #define ADC6_CHANNEL_1_REG 0x0A
94 #define ADC6_CHANNEL_2_REG 0x0B
95 #define ADC6_CHANNEL_3_REG 0x0C
96 #define ADC6_CHANNEL_4_REG 0x0D
97 #define ADC6_CHANNEL_5_REG 0x0E
98 #define ADC6_CHANNEL_6_REG 0x0F
99 #define ADC6_CHANNEL_7_REG 0x10
100 #define ADC6_CHANNEL_8_REG 0x11
101 #define ADC6_CHANNEL_9_REG 0x12
102 #define ADC6_CHANNEL_10_REG 0x13
103 #define ADC6_CHANNEL_11_REG 0x14
104 #define ADC6_CHANNEL_12_REG 0x15
105 #define ADC6_CHANNEL_13_REG 0x16
106 #define ADC6_CHANNEL_14_REG 0x17
107 #define ADC6_CHANNEL_15_REG 0x18
108 #define ADC6_CONFIG_0_REG 0x19
109 #define ADC6_CONFIG_1_REG 0x1A
110 #define ADC6_CONFIG_2_REG 0x1B
111 #define ADC6_CONFIG_3_REG 0x1C
112 #define ADC6_CONFIG_4_REG 0x1D
113 #define ADC6_CONFIG_5_REG 0x1E
114 #define ADC6_CONFIG_6_REG 0x1F
115 #define ADC6_CONFIG_7_REG 0x20
116 #define ADC6_FILTER_0_REG 0x21
117 #define ADC6_FILTER_1_REG 0x22
118 #define ADC6_FILTER_2_REG 0x23
119 #define ADC6_FILTER_3_REG 0x24
120 #define ADC6_FILTER_4_REG 0x25
121 #define ADC6_FILTER_5_REG 0x26
122 #define ADC6_FILTER_6_REG 0x27
123 #define ADC6_FILTER_7_REG 0x28
124 #define ADC6_OFFSET_0_REG 0x29
125 #define ADC6_OFFSET_1_REG 0x2A
126 #define ADC6_OFFSET_2_REG 0x2B
127 #define ADC6_OFFSET_3_REG 0x2C
128 #define ADC6_OFFSET_4_REG 0x2D
129 #define ADC6_OFFSET_5_REG 0x2E
130 #define ADC6_OFFSET_6_REG 0x2F
131 #define ADC6_OFFSET_7_REG 0x30
132 #define ADC6_GAIN_0_REG 0x31
133 #define ADC6_GAIN_1_REG 0x32
134 #define ADC6_GAIN_2_REG 0x33
135 #define ADC6_GAIN_3_REG 0x34
136 #define ADC6_GAIN_4_REG 0x35
137 #define ADC6_GAIN_5_REG 0x36
138 #define ADC6_GAIN_6_REG 0x37
139 #define ADC6_GAIN_7_REG 0x38
140 
146 #define ADC6_COMMUN_WRITE_COMMAND 0x00
147 #define ADC6_COMMUN_READ_COMMAND 0x40
148 #define ADC6_COMMUN_WRITE_DISABLE 0x80
149 
155 #define ADC6_CONTROL_RDY_DELAY_10NS_LOW_POWER_MODE_RDY_PIN_ENABLE 0x0000
156 #define ADC6_CONTROL_RDY_DELAY_100NS 0x1000
157 #define ADC6_CONTROL_CONTINUOUS_CONVERSION_MODE 0x0800
158 #define ADC6_CONTROL_DATA_STATUS_ENABLE 0x0400
159 #define ADC6_CONTROL_DOUT_PIN_ENABLE 0x0200
160 #define ADC6_CONTROL_INTERNAL_REFERENCE_VOLTAGE_ENABLE 0x0100
161 #define ADC6_CONTROL_MID_POWER_MODE 0x0040
162 #define ADC6_CONTROL_FULL_POWER_MODE 0x0080
163 #define ADC6_CONTROL_SINGLE_CONVERSION_MODE 0x0004
164 #define ADC6_CONTROL_STANDBY_MODE 0x0008
165 #define ADC6_CONTROL_SINGLE_POWER_DOWN_MODE 0x000C
166 #define ADC6_CONTROL_IDLE_MODE 0x0010
167 #define ADC6_CONTROL_MODE_MASK 0x003C
168 #define ADC6_CONTROL_INTERNAL_ZERO_SCALE_OFFSET_CALIBRATION 0x0014
169 #define ADC6_CONTROL_INTERNAL_FULL_SCALE_GAIN_CALIBRATION 0x0018
170 #define ADC6_CONTROL_SYSTEM_ZERO_SCALE_OFFSET_CALIBRATION 0x001C
171 #define ADC6_CONTROL_SYSTEM_FULL_SCALE_GAIN_CALIBRATION 0x0020
172 
178 #define ADC6_IO_CON1_DIGITAL_OUTPUT_PINS_DISABLE_CURRENT_DISABLE 0x00000000
179 #define ADC6_IO_CON1_SET_DIGITAL_OUTPUT_PIN_P4 0x00800000
180 #define ADC6_IO_CON1_SET_DIGITAL_OUTPUT_PIN_P3 0x00400000
181 #define ADC6_IO_CON1_SET_DIGITAL_OUTPUT_PIN_P2 0x00200000
182 #define ADC6_IO_CON1_SET_DIGITAL_OUTPUT_PIN_P1 0x00100000
183 #define ADC6_IO_CON1_ENABLE_DIGITAL_OUTPUT_PIN_P4 0x00080000
184 #define ADC6_IO_CON1_ENABLE_DIGITAL_OUTPUT_PIN_P3 0x00040000
185 #define ADC6_IO_CON1_ENABLE_DIGITAL_OUTPUT_PIN_P2 0x00020000
186 #define ADC6_IO_CON1_ENABLE_DIGITAL_OUTPUT_PIN_P1 0x00010000
187 #define ADC6_IO_CON1_ENABLE_BRIGDE_POWER_DOWN 0x00008000
188 #define ADC6_IO_CON1_IOUT1_CURRENT_50_MIKRO_A 0x00000800
189 #define ADC6_IO_CON1_IOUT1_CURRENT_100_MIKRO_A 0x00001000
190 #define ADC6_IO_CON1_IOUT1_CURRENT_250_MIKRO_A 0x00001800
191 #define ADC6_IO_CON1_IOUT1_CURRENT_500_MIKRO_A 0x00002000
192 #define ADC6_IO_CON1_IOUT1_CURRENT_750_MIKRO_A 0x00002800
193 #define ADC6_IO_CON1_IOUT1_CURRENT_1000_MIKRO_A 0x00003000
194 #define ADC6_IO_CON1_IOUT0_CURRENT_50_MIKRO_A 0x00000100
195 #define ADC6_IO_CON1_IOUT0_CURRENT_100_MIKRO_A 0x00000200
196 #define ADC6_IO_CON1_IOUT0_CURRENT_250_MIKRO_A 0x00000300
197 #define ADC6_IO_CON1_IOUT0_CURRENT_500_MIKRO_A 0x00000400
198 #define ADC6_IO_CON1_IOUT0_CURRENT_750_MIKRO_A 0x00000500
199 #define ADC6_IO_CON1_IOUT0_CURRENT_1000_MIKRO_A 0x00000600
200 #define ADC6_IO_CON1_IOUT1_ON_AIN0_PIN 0x00000000
201 #define ADC6_IO_CON1_IOUT1_ON_AIN1_PIN 0x00000010
202 #define ADC6_IO_CON1_IOUT1_ON_AIN2_PIN 0x00000020
203 #define ADC6_IO_CON1_IOUT1_ON_AIN3_PIN 0x00000030
204 #define ADC6_IO_CON1_IOUT1_ON_AIN4_PIN 0x00000040
205 #define ADC6_IO_CON1_IOUT1_ON_AIN5_PIN 0x00000050
206 #define ADC6_IO_CON1_IOUT1_ON_AIN6_PIN 0x00000060
207 #define ADC6_IO_CON1_IOUT1_ON_AIN7_PIN 0x00000070
208 #define ADC6_IO_CON1_IOUT1_ON_AIN8_PIN 0x00000080
209 #define ADC6_IO_CON1_IOUT1_ON_AIN9_PIN 0x00000090
210 #define ADC6_IO_CON1_IOUT1_ON_AIN10_PIN 0x000000A0
211 #define ADC6_IO_CON1_IOUT1_ON_AIN11_PIN 0x000000B0
212 #define ADC6_IO_CON1_IOUT1_ON_AIN12_PIN 0x000000C0
213 #define ADC6_IO_CON1_IOUT1_ON_AIN13_PIN 0x000000D0
214 #define ADC6_IO_CON1_IOUT1_ON_AIN14_PIN 0x000000E0
215 #define ADC6_IO_CON1_IOUT1_ON_AIN15_PIN 0x000000F0
216 #define ADC6_IO_CON1_IOUT0_ON_AIN0_PIN 0x00000000
217 #define ADC6_IO_CON1_IOUT0_ON_AIN1_PIN 0x00000001
218 #define ADC6_IO_CON1_IOUT0_ON_AIN2_PIN 0x00000002
219 #define ADC6_IO_CON1_IOUT0_ON_AIN3_PIN 0x00000003
220 #define ADC6_IO_CON1_IOUT0_ON_AIN4_PIN 0x00000004
221 #define ADC6_IO_CON1_IOUT0_ON_AIN5_PIN 0x00000005
222 #define ADC6_IO_CON1_IOUT0_ON_AIN6_PIN 0x00000006
223 #define ADC6_IO_CON1_IOUT0_ON_AIN7_PIN 0x00000007
224 #define ADC6_IO_CON1_IOUT0_ON_AIN8_PIN 0x00000008
225 #define ADC6_IO_CON1_IOUT0_ON_AIN9_PIN 0x00000009
226 #define ADC6_IO_CON1_IOUT0_ON_AIN10_PIN 0x0000000A
227 #define ADC6_IO_CON1_IOUT0_ON_AIN11_PIN 0x0000000B
228 #define ADC6_IO_CON1_IOUT0_ON_AIN12_PIN 0x0000000C
229 #define ADC6_IO_CON1_IOUT0_ON_AIN13_PIN 0x0000000D
230 #define ADC6_IO_CON1_IOUT0_ON_AIN14_PIN 0x0000000E
231 #define ADC6_IO_CON1_IOUT0_ON_AIN15_PIN 0x0000000F
232 
238 #define ADC6_IO_CON2_VBIAS_DISABLE 0x0000
239 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN0_CHANNEL 0x0001
240 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN1_CHANNEL 0x0002
241 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN2_CHANNEL 0x0004
242 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN3_CHANNEL 0x0008
243 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN4_CHANNEL 0x0010
244 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN5_CHANNEL 0x0020
245 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN6_CHANNEL 0x0040
246 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN7_CHANNEL 0x0080
247 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN8_CHANNEL 0x0100
248 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN9_CHANNEL 0x0200
249 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN10_CHANNEL 0x0400
250 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN11_CHANNEL 0x0800
251 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN12_CHANNEL 0x1000
252 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN13_CHANNEL 0x2000
253 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN14_CHANNEL 0x4000
254 #define ADC6_IO_CON2_VBIAS_ENABLE_ON_AIN15_CHANNEL 0x8000
255 
261 #define ADC6_DISABLE_ALL_ERROR_FLAG 0x00000000
262 #define ADC6_ENABLE_MASTER_CLOCK_COUNTER 0x00400000
263 #define ADC6_ENABLE_LDO_CAPACITOR_TEST_CHECK 0x00200000
264 #define ADC6_ENABLE_ANALOG_LDO_CALIBRATION_CHECK 0x00080000
265 #define ADC6_ENABLE_DIGITAL_LDO_CALIBRATION_CHECK 0x00100000
266 #define ADC6_DISABLE_LDO_CHECK 0x00180000
267 #define ADC6_ENABLE_CALIBRATION_FAIL_CHECK 0x00040000
268 #define ADC6_ENABLE_CONVERSION_FAIL_CHECK 0x00020000
269 #define ADC6_ENABLE_SATURATION_CHECK 0x00010000
270 #define ADC6_ENABLE_OVERVOLTAGE_MONITOR_ON_AINP_CHANNELS 0x00008000
271 #define ADC6_ENABLE_UNDERVOLTAGE_MONITOR_ON_AINP_CHANNELS 0x00004000
272 #define ADC6_ENABLE_OVERVOLTAGE_MONITOR_ON_AINM_CHANNELS 0x00002000
273 #define ADC6_ENABLE_UNDERVOLTAGE_MONITOR_ON_AINM_CHANNELS 0x00001000
274 #define ADC6_ENABLE_EXT_REFERENCE_DETECT_ERROR 0x00000800
275 #define ADC6_ENABLE_DIG_LDO_TEST_MECHANISM_CHECK 0x00000400
276 #define ADC6_ENABLE_DIG_LDO_VOLTAGE_MONITORING 0x00000200
277 #define ADC6_ENABLE_AN_LDO_TEST_MECHANISM_CHECK 0x00000100
278 #define ADC6_ENABLE_AN_LDO_VOLTAGE_MONITORING 0x00000080
279 #define ADC6_ENABLE_SPI_IGNORE_ERROR 0x00000040
280 #define ADC6_ENABLE_SPI_SCLK_COUNTER_ERROR_CHECK 0x00000020
281 #define ADC6_ENABLE_SPI_READ_ERROR_CHECK 0x00000010
282 #define ADC6_ENABLE_SPI_WRITE_ERROR_CHECK 0x00000008
283 #define ADC6_ENABLE_SPI_CRC_CHECK 0x00000004
284 #define ADC6_ENABLE_SPI_CRC_CALCULATION_PERFORMING_ON_MEMORY 0x00000002
285 
291 #define ADC6_DISABLE_CHANNEL 0x0000
292 #define ADC6_ENABLE_CHANNEL 0x8000
293 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN0 0x0000
294 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN1 0x0020
295 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN2 0x0040
296 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN3 0x0060
297 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN4 0x0080
298 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN5 0x00A0
299 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN6 0x00C0
300 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN7 0x00E0
301 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN8 0x0100
302 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN9 0x0120
303 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN10 0x0140
304 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN11 0x0160
305 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN12 0x0180
306 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN13 0x01A0
307 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN14 0x01C0
308 #define ADC6_CHANNEL_POSITIVE_ANALOG_INPUT_AIN15 0x01E0
309 #define ADC6_POSITIVE_CHANNEL_TEMPERATURE_SENSOR 0x0200
310 #define ADC6_POSITIVE_CHANNEL_AVSS 0x0220
311 #define ADC6_POSITIVE_CHANNEL_INTERNAL_REFERENCE 0x0240
312 #define ADC6_POSITIVE_CHANNEL_DGND 0x0260
313 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN0 0x0000
314 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN1 0x0001
315 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN2 0x0002
316 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN3 0x0003
317 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN4 0x0004
318 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN5 0x0005
319 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN6 0x0006
320 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN7 0x0007
321 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN8 0x0008
322 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN9 0x0009
323 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN10 0x000A
324 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN11 0x000B
325 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN12 0x000C
326 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN13 0x000D
327 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN14 0x000E
328 #define ADC6_CHANNEL_NEGATIVE_ANALOG_INPUT_AIN15 0x000F
329 #define ADC6_NEGATIVE_CHANNEL_TEMPERATURE_SENSOR 0x0010
330 #define ADC6_NEGATIVE_CHANNEL_AVSS 0x0011
331 #define ADC6_NEGATIVE_CHANNEL_INTERNAL_REFERENCE 0x0012
332 #define ADC6_NEGATIVE_CHANNEL_DGND 0x0013
333 
339 #define ADC6_CONFIG_UNIPOLAR_OP_BUFFER_DISABLE_BURNOUT_CURRENT_OFF 0x0000
340 #define ADC6_CONFIG_ENABLE_BIPOLAR_OP 0x0800
341 #define ADC6_CONFIG_ENABLE_BURNOUT_CURRENT_ON_500_NANO_A 0x0200
342 #define ADC6_CONFIG_ENABLE_BURNOUT_CURRENT_ON_2_MIKRO_A 0x0400
343 #define ADC6_CONFIG_ENABLE_BURNOUT_CURRENT_ON_4_MIKRO_A 0x0600
344 #define ADC6_CONFIG_ENABLE_BUFFER_ON_REFIN_POSITIVE 0x0100
345 #define ADC6_CONFIG_ENABLE_BUFFER_ON_REFIN_NEGATIVE 0x0080
346 #define ADC6_CONFIG_ENABLE_BUFFER_ON_AINP 0x0040
347 #define ADC6_CONFIG_ENABLE_BUFFER_ON_AINM 0x0020
348 #define ADC6_CONFIG_SELECT_REFIN1 0x0000
349 #define ADC6_CONFIG_SELECT_REFIN2 0x0008
350 #define ADC6_CONFIG_SELECT_INTERNAL_REFERENCE 0x0010
351 #define ADC6_CONFIG_SELECT_AVDD_FOR_REFERENCE 0x0018
352 #define ADC6_CONFIG_SET_GAIN_1 0x0000
353 #define ADC6_CONFIG_SET_GAIN_2 0x0001
354 #define ADC6_CONFIG_SET_GAIN_4 0x0002
355 #define ADC6_CONFIG_SET_GAIN_8 0x0003
356 #define ADC6_CONFIG_SET_GAIN_16 0x0004
357 #define ADC6_CONFIG_SET_GAIN_32 0x0005
358 #define ADC6_CONFIG_SET_GAIN_64 0x0006
359 #define ADC6_CONFIG_SET_GAIN_128 0x0007
360  // End group macro
363 // --------------------------------------------------------------- PUBLIC TYPES
372 typedef struct
373 {
374  digital_out_t cs;
375 
376  // Output pins
377 
378  digital_out_t syn;
379 
380  // Modules
381 
382  spi_master_t spi;
383  pin_name_t chip_select;
384 
385 } adc6_t;
386 
390 typedef struct
391 {
392  // Communication gpio pins
393 
394  pin_name_t miso;
395  pin_name_t mosi;
396  pin_name_t sck;
397  pin_name_t cs;
398 
399  // Additional gpio pins
400 
401  pin_name_t syn;
402 
403  // static variable
404 
405  uint32_t spi_speed;
406  spi_master_mode_t spi_mode;
407  spi_master_chip_select_polarity_t cs_polarity;
408 
409 } adc6_cfg_t;
410  // End types group
412 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
413 
418 #ifdef __cplusplus
419 extern "C"{
420 #endif
421 
431 
440 err_t adc6_init ( adc6_t *ctx, adc6_cfg_t *cfg );
441 
449 void adc6_default_cfg ( adc6_t* ctx );
450 
459 void adc6_reset_device ( adc6_t* ctx );
460 
471 uint32_t adc6_get_adc_data ( adc6_t* ctx );
472 
483 uint32_t adc6_read_reg ( adc6_t* ctx, uint8_t register_address );
484 
494 void adc6_write_reg ( adc6_t* ctx, uint8_t register_address, uint32_t transfer_data );
495 
496 
497 #ifdef __cplusplus
498 }
499 #endif
500 #endif // _ADC6_H_
501  // End public_function group
504 
505 // ------------------------------------------------------------------------- END
adc6_get_adc_data
uint32_t adc6_get_adc_data(adc6_t *ctx)
Get data function.
adc6_cfg_t::mosi
pin_name_t mosi
Definition: adc6.h:395
adc6_cfg_t::sck
pin_name_t sck
Definition: adc6.h:396
adc6_cfg_t::spi_speed
uint32_t spi_speed
Definition: adc6.h:405
adc6_cfg_t::spi_mode
spi_master_mode_t spi_mode
Definition: adc6.h:406
adc6_init
err_t adc6_init(adc6_t *ctx, adc6_cfg_t *cfg)
Initialization function.
adc6_default_cfg
void adc6_default_cfg(adc6_t *ctx)
Click Default Configuration function.
adc6_cfg_t::syn
pin_name_t syn
Definition: adc6.h:401
adc6_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: adc6.h:407
adc6_cfg_t::cs
pin_name_t cs
Definition: adc6.h:397
adc6_t::syn
digital_out_t syn
Definition: adc6.h:378
adc6_write_reg
void adc6_write_reg(adc6_t *ctx, uint8_t register_address, uint32_t transfer_data)
Generic write function.
adc6_t::spi
spi_master_t spi
Definition: adc6.h:382
adc6_reset_device
void adc6_reset_device(adc6_t *ctx)
Reset device.
adc6_t
Click ctx object definition.
Definition: adc6.h:373
adc6_cfg_setup
void adc6_cfg_setup(adc6_cfg_t *cfg)
Config Object Initialization function.
adc6_cfg_t
Click configuration structure definition.
Definition: adc6.h:391
adc6_t::cs
digital_out_t cs
Definition: adc6.h:374
adc6_cfg_t::miso
pin_name_t miso
Definition: adc6.h:394
adc6_t::chip_select
pin_name_t chip_select
Definition: adc6.h:383
adc6_read_reg
uint32_t adc6_read_reg(adc6_t *ctx, uint8_t register_address)
Generic read function.