isoadc6 2.1.0.0
isoadc6.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef ISOADC6_H
29#define ISOADC6_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
52#include "spi_specifics.h"
53
74#define ISOADC6_REG_COMM_STATUS 0x00
75#define ISOADC6_REG_CONTROL 0x01
76#define ISOADC6_REG_DATA 0x02
77#define ISOADC6_REG_IO_CONTROL_1 0x03
78#define ISOADC6_REG_IO_CONTROL_2 0x04
79#define ISOADC6_REG_ID 0x05
80#define ISOADC6_REG_ERR_STATUS 0x06
81#define ISOADC6_REG_ERR_EN 0x07
82#define ISOADC6_REG_MCLK_CNT 0x08
83#define ISOADC6_REG_CHANNEL_0 0x09
84#define ISOADC6_REG_CHANNEL_1 0x0A
85#define ISOADC6_REG_CHANNEL_2 0x0B
86#define ISOADC6_REG_CHANNEL_3 0x0C
87#define ISOADC6_REG_CHANNEL_4 0x0D
88#define ISOADC6_REG_CHANNEL_5 0x0E
89#define ISOADC6_REG_CHANNEL_6 0x0F
90#define ISOADC6_REG_CHANNEL_7 0x10
91#define ISOADC6_REG_CHANNEL_8 0x11
92#define ISOADC6_REG_CHANNEL_9 0x12
93#define ISOADC6_REG_CHANNEL_10 0x13
94#define ISOADC6_REG_CHANNEL_11 0x14
95#define ISOADC6_REG_CHANNEL_12 0x15
96#define ISOADC6_REG_CHANNEL_13 0x16
97#define ISOADC6_REG_CHANNEL_14 0x17
98#define ISOADC6_REG_CHANNEL_15 0x18
99#define ISOADC6_REG_CONFIG_0 0x19
100#define ISOADC6_REG_CONFIG_1 0x1A
101#define ISOADC6_REG_CONFIG_2 0x1B
102#define ISOADC6_REG_CONFIG_3 0x1C
103#define ISOADC6_REG_CONFIG_4 0x1D
104#define ISOADC6_REG_CONFIG_5 0x1E
105#define ISOADC6_REG_CONFIG_6 0x1F
106#define ISOADC6_REG_CONFIG_7 0x20
107#define ISOADC6_REG_FILTER_0 0x21
108#define ISOADC6_REG_FILTER_1 0x22
109#define ISOADC6_REG_FILTER_2 0x23
110#define ISOADC6_REG_FILTER_3 0x24
111#define ISOADC6_REG_FILTER_4 0x25
112#define ISOADC6_REG_FILTER_5 0x26
113#define ISOADC6_REG_FILTER_6 0x27
114#define ISOADC6_REG_FILTER_7 0x28
115#define ISOADC6_REG_OFFSET_0 0x29
116#define ISOADC6_REG_OFFSET_1 0x2A
117#define ISOADC6_REG_OFFSET_2 0x2B
118#define ISOADC6_REG_OFFSET_3 0x2C
119#define ISOADC6_REG_OFFSET_4 0x2D
120#define ISOADC6_REG_OFFSET_5 0x2E
121#define ISOADC6_REG_OFFSET_6 0x2F
122#define ISOADC6_REG_OFFSET_7 0x30
123#define ISOADC6_REG_GAIN_0 0x31
124#define ISOADC6_REG_GAIN_1 0x32
125#define ISOADC6_REG_GAIN_2 0x33
126#define ISOADC6_REG_GAIN_3 0x34
127#define ISOADC6_REG_GAIN_4 0x35
128#define ISOADC6_REG_GAIN_5 0x36
129#define ISOADC6_REG_GAIN_6 0x37
130#define ISOADC6_REG_GAIN_7 0x38
131
132 // isoadc6_reg
133
143#define ISOADC6_CMD_SPI_WRITE 0x00
144#define ISOADC6_CMD_SPI_READ 0x40
145#define ISOADC6_CMD_SPI_WRITE_DIS 0x80
146
147 // isoadc6_cmd
148
163#define ISOADC6_SEL_CH_0 0
164#define ISOADC6_SEL_CH_1 1
165#define ISOADC6_SEL_CH_2 2
166#define ISOADC6_SEL_CH_3 3
167#define ISOADC6_SEL_CH_4 4
168#define ISOADC6_SEL_CH_5 5
169#define ISOADC6_SEL_CH_6 6
170#define ISOADC6_SEL_CH_7 7
171#define ISOADC6_SEL_CH_8 8
172#define ISOADC6_SEL_CH_9 9
173#define ISOADC6_SEL_CH_10 10
174#define ISOADC6_SEL_CH_11 11
175#define ISOADC6_SEL_CH_12 12
176#define ISOADC6_SEL_CH_13 13
177#define ISOADC6_SEL_CH_14 14
178#define ISOADC6_SEL_CH_15 15
179
184#define ISOADC6_NEW_DATA_BIT_MASK 0x80
185#define ISOADC6_NEW_DATA_IS_READY 0x00
186#define ISOADC6_NEW_DATA_NOT_READY 0x01
187
192#define ISOADC6_SIL_REV_BIT_MASK 0x0F
193#define ISOADC6_DEV_ID_REV_BIT_MASK 0xF0
194#define ISOADC6_DEVICE_ID 0x01
195#define ISOADC6_SILICON_REVISION 0x04
196
201#define ISOADC6_LEN_REG_ERROR 0
202#define ISOADC6_LEN_REG_BYTE 1
203#define ISOADC6_LEN_REG_WORD 2
204#define ISOADC6_LEN_REG_DWORD 3
205
210#define ISOADC6_CTRL_RDY_LOW_PWR_MODE_RDY_EN 0x00000000ul
211#define ISOADC6_CTRL_RDY_DELAY_100NS 0x00001000ul
212#define ISOADC6_CTRL_CONT_CONV_MODE 0x00000800ul
213#define ISOADC6_CTRL_DATA_STATUS_EN 0x00000400ul
214#define ISOADC6_CTRL_DOUT_PIN_EN 0x00000200ul
215#define ISOADC6_CTRL_INT_REF_VVTG_EN 0x00000100ul
216#define ISOADC6_CTRL_MID_POWER_MODE 0x00000040ul
217#define ISOADC6_CTRL_FULL_POWER_MODE 0x00000080ul
218#define ISOADC6_CTRL_SINGLE_CONV_MODE 0x00000004ul
219#define ISOADC6_CTRL_STANDBY_MODE 0x00000008ul
220#define ISOADC6_CTRL_SINGLE_PWR_DOWN_MODE 0x0000000Cul
221#define ISOADC6_CTRL_IDLE_MODE 0x00000010ul
222#define ISOADC6_CTRL_MODE_MASK 0x0000003Cul
223#define ISOADC6_CTRL_INT_ZERO_SCALE_OFFSET_CALIB 0x00000014ul
224#define ISOADC6_CTRL_INT_FULL_SCALE_GAIN_CALIB 0x00000018ul
225#define ISOADC6_CTRL_SYS_ZERO_SCALE_OFFSET_CALIB 0x0000001Cul
226#define ISOADC6_CTRL_SYS_FULL_SCALE_GAIN_CALIB 0x00000020ul
227
232#define ISOADC6_IO_CON1_DOUT_PINS_DIS 0x00000000ul
233#define ISOADC6_IO_CON1_SET_DOUT_PIN_P4 0x00800000ul
234#define ISOADC6_IO_CON1_SET_DOUT_PIN_P3 0x00400000ul
235#define ISOADC6_IO_CON1_SET_DOUT_PIN_P2 0x00200000ul
236#define ISOADC6_IO_CON1_SET_DOUT_PIN_P1 0x00100000ul
237#define ISOADC6_IO_CON1_DOUT_PIN_P4_EN 0x00080000ul
238#define ISOADC6_IO_CON1_DOUT_PIN_P3_EN 0x00040000ul
239#define ISOADC6_IO_CON1_DOUT_PIN_P2_EN 0x00020000ul
240#define ISOADC6_IO_CON1_DOUT_PIN_P1_EN 0x00010000ul
241#define ISOADC6_IO_CON1_BRIGDE_PWR_DOWN_EN 0x00008000ul
242#define ISOADC6_IO_CON1_IOUT1_MIKRO_A_50 0x00000800ul
243#define ISOADC6_IO_CON1_IOUT1_MIKRO_A_100 0x00001000ul
244#define ISOADC6_IO_CON1_IOUT1_MIKRO_A_250 0x00001800ul
245#define ISOADC6_IO_CON1_IOUT1_MIKRO_A_500 0x00002000ul
246#define ISOADC6_IO_CON1_IOUT1_MIKRO_A_750 0x00002800ul
247#define ISOADC6_IO_CON1_IOUT1_MIKRO_A_1000 0x00003000ul
248#define ISOADC6_IO_CON1_IOUT0_MIKRO_A_50 0x00000100ul
249#define ISOADC6_IO_CON1_IOUT0_MIKRO_A_100 0x00000200ul
250#define ISOADC6_IO_CON1_IOUT0_MIKRO_A_250 0x00000300ul
251#define ISOADC6_IO_CON1_IOUT0_MIKRO_A_500 0x00000400ul
252#define ISOADC6_IO_CON1_IOUT0_MIKRO_A_750 0x00000500ul
253#define ISOADC6_IO_CON1_IOUT0_MIKRO_A_1000 0x00000600ul
254#define ISOADC6_IO_CON1_IOUT1_AIN0_PIN_ON 0x00000000ul
255#define ISOADC6_IO_CON1_IOUT1_AIN1_PIN_ON 0x00000010ul
256#define ISOADC6_IO_CON1_IOUT1_AIN2_PIN_ON 0x00000020ul
257#define ISOADC6_IO_CON1_IOUT1_AIN3_PIN_ON 0x00000030ul
258#define ISOADC6_IO_CON1_IOUT1_AIN4_PIN_ON 0x00000040ul
259#define ISOADC6_IO_CON1_IOUT1_AIN5_PIN_ON 0x00000050ul
260#define ISOADC6_IO_CON1_IOUT1_AIN6_PIN_ON 0x00000060ul
261#define ISOADC6_IO_CON1_IOUT1_AIN7_PIN_ON 0x00000070ul
262#define ISOADC6_IO_CON1_IOUT1_AIN8_PIN_ON 0x00000080ul
263#define ISOADC6_IO_CON1_IOUT1_AIN9_PIN_ON 0x00000090ul
264#define ISOADC6_IO_CON1_IOUT1_AIN10_PIN_ON 0x000000A0ul
265#define ISOADC6_IO_CON1_IOUT1_AIN11_PIN_ON 0x000000B0ul
266#define ISOADC6_IO_CON1_IOUT1_AIN12_PIN_ON 0x000000C0ul
267#define ISOADC6_IO_CON1_IOUT1_AIN13_PIN_ON 0x000000D0ul
268#define ISOADC6_IO_CON1_IOUT1_AIN14_PIN_ON 0x000000E0ul
269#define ISOADC6_IO_CON1_IOUT1_AIN15_PIN_ON 0x000000F0ul
270#define ISOADC6_IO_CON1_IOUT0_AIN0_PIN_ON 0x00000000ul
271#define ISOADC6_IO_CON1_IOUT0_AIN1_PIN_ON 0x00000001ul
272#define ISOADC6_IO_CON1_IOUT0_AIN2_PIN_ON 0x00000002ul
273#define ISOADC6_IO_CON1_IOUT0_AIN3_PIN_ON 0x00000003ul
274#define ISOADC6_IO_CON1_IOUT0_AIN4_PIN_ON 0x00000004ul
275#define ISOADC6_IO_CON1_IOUT0_AIN5_PIN_ON 0x00000005ul
276#define ISOADC6_IO_CON1_IOUT0_AIN6_PIN_ON 0x00000006ul
277#define ISOADC6_IO_CON1_IOUT0_AIN7_PIN_ON 0x00000007ul
278#define ISOADC6_IO_CON1_IOUT0_AIN8_PIN_ON 0x00000008ul
279#define ISOADC6_IO_CON1_IOUT0_AIN9_PIN_ON 0x00000009ul
280#define ISOADC6_IO_CON1_IOUT0_AIN10_PIN_ON 0x0000000Aul
281#define ISOADC6_IO_CON1_IOUT0_AIN11_PIN_ON 0x0000000Bul
282#define ISOADC6_IO_CON1_IOUT0_AIN12_PIN_ON 0x0000000Cul
283#define ISOADC6_IO_CON1_IOUT0_AIN13_PIN_ON 0x0000000Dul
284#define ISOADC6_IO_CON1_IOUT0_AIN14_PIN_ON 0x0000000Eul
285#define ISOADC6_IO_CON1_IOUT0_AIN15_PIN_ON 0x0000000Ful
286
291#define ISOADC6_IO_CON2_VBIAS_DISABLE 0x0000u
292#define ISOADC6_IO_CON2_VBIAS_AIN0_CH_EN_ON 0x0001u
293#define ISOADC6_IO_CON2_VBIAS_AIN1_CH_EN_ON 0x0002u
294#define ISOADC6_IO_CON2_VBIAS_AIN2_CH_EN_ON 0x0004u
295#define ISOADC6_IO_CON2_VBIAS_AIN3_CH_EN_ON 0x0008u
296#define ISOADC6_IO_CON2_VBIAS_AIN4_CH_EN_ON 0x0010u
297#define ISOADC6_IO_CON2_VBIAS_AIN5_CH_EN_ON 0x0020u
298#define ISOADC6_IO_CON2_VBIAS_AIN6_CH_EN_ON 0x0040u
299#define ISOADC6_IO_CON2_VBIAS_AIN7_CH_EN_ON 0x0080u
300#define ISOADC6_IO_CON2_VBIAS_AIN8_CH_EN_ON 0x0100u
301#define ISOADC6_IO_CON2_VBIAS_AIN9_CH_EN_ON 0x0200u
302#define ISOADC6_IO_CON2_VBIAS_AIN10_CH_EN_ON 0x0400u
303#define ISOADC6_IO_CON2_VBIAS_AIN11_CH_EN_ON 0x0800u
304#define ISOADC6_IO_CON2_VBIAS_AIN12_CH_EN_ON 0x1000u
305#define ISOADC6_IO_CON2_VBIAS_AIN13_CH_EN_ON 0x2000u
306#define ISOADC6_IO_CON2_VBIAS_AIN14_CH_EN_ON 0x4000u
307#define ISOADC6_IO_CON2_VBIAS_AIN15_CH_EN_ON 0x8000u
308
313#define ISOADC6_CHANNEL_DISABLE 0x0000u
314#define ISOADC6_CHANNEL_ENABLE 0x8000u
315#define ISOADC6_CHANNEL_POS_AN_IN_AIN0 0x0000u
316#define ISOADC6_CHANNEL_POS_AN_IN_AIN1 0x0020u
317#define ISOADC6_CHANNEL_POS_AN_IN_AIN2 0x0040u
318#define ISOADC6_CHANNEL_POS_AN_IN_AIN3 0x0060u
319#define ISOADC6_CHANNEL_POS_AN_IN_AIN4 0x0080u
320#define ISOADC6_CHANNEL_POS_AN_IN_AIN5 0x00A0u
321#define ISOADC6_CHANNEL_POS_AN_IN_AIN6 0x00C0u
322#define ISOADC6_CHANNEL_POS_AN_IN_AIN7 0x00E0u
323#define ISOADC6_CHANNEL_POS_AN_IN_AIN8 0x0100u
324#define ISOADC6_CHANNEL_POS_AN_IN_AIN9 0x0120u
325#define ISOADC6_CHANNEL_POS_AN_IN_AIN10 0x0140u
326#define ISOADC6_CHANNEL_POS_AN_IN_AIN11 0x0160u
327#define ISOADC6_CHANNEL_POS_AN_IN_AIN12 0x0180u
328#define ISOADC6_CHANNEL_POS_AN_IN_AIN13 0x01A0u
329#define ISOADC6_CHANNEL_POS_AN_IN_AIN14 0x01C0u
330#define ISOADC6_CHANNEL_POS_AN_IN_AIN15 0x01E0u
331#define ISOADC6_CHANNEL_POS_TEMP_SENSOR 0x0200u
332#define ISOADC6_CHANNEL_POS_AVSS 0x0220u
333#define ISOADC6_CHANNEL_POS_INT_REF 0x0240u
334#define ISOADC6_CHANNEL_POS_DGND 0x0260u
335#define ISOADC6_CHANNEL_NEG_AN_IN_AIN0 0x0000u
336#define ISOADC6_CHANNEL_NEG_AN_IN_AIN1 0x0001u
337#define ISOADC6_CHANNEL_NEG_AN_IN_AIN2 0x0002u
338#define ISOADC6_CHANNEL_NEG_AN_IN_AIN3 0x0003u
339#define ISOADC6_CHANNEL_NEG_AN_IN_AIN4 0x0004u
340#define ISOADC6_CHANNEL_NEG_AN_IN_AIN5 0x0005u
341#define ISOADC6_CHANNEL_NEG_AN_IN_AIN6 0x0006u
342#define ISOADC6_CHANNEL_NEG_AN_IN_AIN7 0x0007u
343#define ISOADC6_CHANNEL_NEG_AN_IN_AIN8 0x0008u
344#define ISOADC6_CHANNEL_NEG_AN_IN_AIN9 0x0009u
345#define ISOADC6_CHANNEL_NEG_AN_IN_AIN10 0x000Au
346#define ISOADC6_CHANNEL_NEG_AN_IN_AIN11 0x000Bu
347#define ISOADC6_CHANNEL_NEG_AN_IN_AIN12 0x000Cu
348#define ISOADC6_CHANNEL_NEG_AN_IN_AIN13 0x000Du
349#define ISOADC6_CHANNEL_NEG_AN_IN_AIN14 0x000Eu
350#define ISOADC6_CHANNEL_NEG_AN_IN_AIN15 0x000Fu
351#define ISOADC6_CHANNEL_NEG_TEMP_SENSOR 0x0010u
352#define ISOADC6_CHANNEL_NEG_AVSS 0x0011u
353#define ISOADC6_CHANNEL_NEG_INT_REF 0x0012u
354#define ISOADC6_CHANNEL_NEG_DGND 0x0013u
355
360#define ISOADC6_ALL_ERROR_FLAG_DIS 0x00000000ul
361#define ISOADC6MASTER_CLK_CNT_EN 0x00400000ul
362#define ISOADC6LDO_CAP_TEST_CHECK_EN 0x00200000ul
363#define ISOADC6ANALOG_LDO_CALIB_CHECK_EN 0x00080000ul
364#define ISOADC6DIGITAL_LDO_CALIB_CHECK_EN 0x00100000ul
365#define ISOADC6LDO_CHECK_DIS 0x00180000ul
366#define ISOADC6_CALIB_FAIL_CHECK_EN 0x00040000ul
367#define ISOADC6_CONV_FAIL_CHECK_EN 0x00020000ul
368#define ISOADC6_SAT_CHECK_EN 0x00010000ul
369#define ISOADC6_OVERVTG_MON_ON_AINP_CH_EN 0x00008000ul
370#define ISOADC6_UNDERVTG_MON_ON_AINP_CH_EN 0x00004000ul
371#define ISOADC6_OVERVTG_MON_ON_AINM_CH_EN 0x00002000ul
372#define ISOADC6_UNDERVTG_MON_ON_AINM_CH_EN 0x00001000ul
373#define ISOADC6_EXT_REF_DET_ERROR 0x00000800ul
374#define ISOADC6_DIG_LDO_TEST_MECH_CHECK 0x00000400ul
375#define ISOADC6_DIG_LDO_VTG_MONITORING 0x00000200ul
376#define ISOADC6_AN_LDO_TEST_MECH_CHECK 0x00000100ul
377#define ISOADC6_AN_LDO_VTG_MON 0x00000080ul
378#define ISOADC6_SPI_IGNORE_ERROR 0x00000040ul
379#define ISOADC6_SPI_SCLK_CNT_ERROR_CHECK 0x00000020ul
380#define ISOADC6_SPI_READ_ERROR_CHECK 0x00000010ul
381#define ISOADC6_SPI_WRITE_ERROR_CHECK 0x00000008ul
382#define ISOADC6_SPI_CRC_CHECK 0x00000004ul
383#define ISOADC6_SPI_CRC_CALC_PERF_ON_MEMORY 0x00000002ul
384#define ISOADC6_GAIN_COEFF 0x00400000ul
385
390#define ISOADC6_CFG_UNP_OP_BUFF_BOUT_DIS 0x0000u
391#define ISOADC6_CFG_BIP_OP_EN 0x0800u
392#define ISOADC6_CFG_BOUT_CURR_500_UA 0x0200u
393#define ISOADC6_CFG_BOUT_CURR_2_MA 0x0400u
394#define ISOADC6_CFG_BOUT_CURR_4_MA 0x0600u
395#define ISOADC6_CFG_BUFF_ON_REFIN_POS_EN 0x0100u
396#define ISOADC6_CFG_BUFF_ON_REFIN_NEG_EN 0x0080u
397#define ISOADC6_CFG_BUFF_ON_AINP_EN 0x0040u
398#define ISOADC6_CFG_BUFF_ON_AINM_EN 0x0020u
399#define ISOADC6_CFG_SEL_REFIN1 0x0000u
400#define ISOADC6_CFG_SEL_REFIN2 0x0008u
401#define ISOADC6_CFG_SEL_INT_REF 0x0010u
402#define ISOADC6_CFG_SEL_AVDD_REF 0x0018u
403#define ISOADC6_CFG_SET_GAIN_1 0x0000u
404#define ISOADC6_CFG_SET_GAIN_2 0x0001u
405#define ISOADC6_CFG_SET_GAIN_4 0x0002u
406#define ISOADC6_CFG_SET_GAIN_8 0x0003u
407#define ISOADC6_CFG_SET_GAIN_16 0x0004u
408#define ISOADC6_CFG_SET_GAIN_32 0x0005u
409#define ISOADC6_CFG_SET_GAIN_64 0x0006u
410#define ISOADC6_CFG_SET_GAIN_128 0x0007u
411
416#define ISOADC6_VTG_REF_2_65_V 2.65f
417#define ISOADC6_CALIB_DEFAULT 1.00f
418
427#define ISOADC6_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
428#define ISOADC6_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
429
430 // isoadc6_set
431
446#define ISOADC6_MAP_MIKROBUS( cfg, mikrobus ) \
447 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
448 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
449 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
450 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
451
452 // isoadc6_map
453 // isoadc6
454
459typedef struct
460{
461 // Modules
462 spi_master_t spi;
464 pin_name_t chip_select;
466 float vref;
467 float calib;
468 uint8_t ch_sel;
470} isoadc6_t;
471
476typedef struct
477{
478 // Communication gpio pins
479 pin_name_t miso;
480 pin_name_t mosi;
481 pin_name_t sck;
482 pin_name_t cs;
484 // static variable
485 uint32_t spi_speed;
486 spi_master_mode_t spi_mode;
487 spi_master_chip_select_polarity_t cs_polarity;
489 float vref;
490 float calib;
491 uint8_t ch_sel;
494
499typedef enum
500{
502 ISOADC6_ERROR = -1
503
505
522
537
551
566err_t isoadc6_generic_write ( isoadc6_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
567
582err_t isoadc6_generic_read ( isoadc6_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
583
597err_t isoadc6_write_byte ( isoadc6_t* ctx, uint8_t reg, uint8_t data_in );
598
612err_t isoadc6_read_byte ( isoadc6_t *ctx, uint8_t reg, uint8_t *data_out );
613
627err_t isoadc6_write_word ( isoadc6_t* ctx, uint8_t reg, uint16_t data_in );
628
642err_t isoadc6_read_word ( isoadc6_t *ctx, uint8_t reg, uint16_t *data_out );
643
657err_t isoadc6_write_dword ( isoadc6_t* ctx, uint8_t reg, uint32_t data_in );
658
672err_t isoadc6_read_dword ( isoadc6_t *ctx, uint8_t reg, uint32_t *data_out );
673
690err_t isoadc6_get_device_id ( isoadc6_t* ctx, uint8_t *device_id, uint8_t *sil_rev );
691
708err_t isoadc6_set_channel ( isoadc6_t* ctx, uint8_t sel_ch, uint16_t ch_data );
709
725err_t isoadc6_set_ch_config ( isoadc6_t* ctx, uint16_t cfg_data );
726
742err_t isoadc6_set_adc_control ( isoadc6_t* ctx, uint16_t adc_ctrl );
743
759err_t isoadc6_set_ch_offset ( isoadc6_t* ctx, uint32_t offset );
760
776err_t isoadc6_get_ch_offset ( isoadc6_t* ctx, uint32_t *offset );
777
793err_t isoadc6_set_ch_gain ( isoadc6_t* ctx, uint32_t gain );
794
810err_t isoadc6_get_ch_gain ( isoadc6_t* ctx, uint32_t *gain );
811
827err_t isoadc6_get_adc_data ( isoadc6_t* ctx, uint32_t *adc_data );
828
845err_t isoadc6_get_voltage ( isoadc6_t* ctx, float *voltage );
846
847#ifdef __cplusplus
848}
849#endif
850#endif // ISOADC6_H
851
852 // isoadc6
853
854// ------------------------------------------------------------------------ END
err_t isoadc6_read_byte(isoadc6_t *ctx, uint8_t reg, uint8_t *data_out)
ISO ADC 6 byte reading function.
err_t isoadc6_get_ch_gain(isoadc6_t *ctx, uint32_t *gain)
ISO ADC 6 get channel gain function.
err_t isoadc6_get_voltage(isoadc6_t *ctx, float *voltage)
ISO ADC 6 get voltage level function.
err_t isoadc6_get_device_id(isoadc6_t *ctx, uint8_t *device_id, uint8_t *sil_rev)
ISO ADC 6 get device ID function.
err_t isoadc6_set_ch_offset(isoadc6_t *ctx, uint32_t offset)
ISO ADC 6 set channel offset function.
err_t isoadc6_set_ch_config(isoadc6_t *ctx, uint16_t cfg_data)
ISO ADC 6 set channel config function.
err_t isoadc6_get_adc_data(isoadc6_t *ctx, uint32_t *adc_data)
ISO ADC 6 get ADC data function.
err_t isoadc6_set_channel(isoadc6_t *ctx, uint8_t sel_ch, uint16_t ch_data)
ISO ADC 6 set channel function.
err_t isoadc6_get_ch_offset(isoadc6_t *ctx, uint32_t *offset)
ISO ADC 6 get channel offset function.
err_t isoadc6_read_dword(isoadc6_t *ctx, uint8_t reg, uint32_t *data_out)
ISO ADC 6 dword reading function.
err_t isoadc6_read_word(isoadc6_t *ctx, uint8_t reg, uint16_t *data_out)
ISO ADC 6 word reading function.
err_t isoadc6_default_cfg(isoadc6_t *ctx)
ISO ADC 6 default configuration function.
err_t isoadc6_generic_read(isoadc6_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
ISO ADC 6 data reading function.
err_t isoadc6_generic_write(isoadc6_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
ISO ADC 6 data writing function.
err_t isoadc6_write_word(isoadc6_t *ctx, uint8_t reg, uint16_t data_in)
ISO ADC 6 word writing function.
err_t isoadc6_init(isoadc6_t *ctx, isoadc6_cfg_t *cfg)
ISO ADC 6 initialization function.
void isoadc6_cfg_setup(isoadc6_cfg_t *cfg)
ISO ADC 6 configuration object setup function.
err_t isoadc6_write_byte(isoadc6_t *ctx, uint8_t reg, uint8_t data_in)
ISO ADC 6 byte writing function.
err_t isoadc6_set_adc_control(isoadc6_t *ctx, uint16_t adc_ctrl)
ISO ADC 6 set ADC control function.
err_t isoadc6_write_dword(isoadc6_t *ctx, uint8_t reg, uint32_t data_in)
ISO ADC 6 dword writing function.
err_t isoadc6_set_ch_gain(isoadc6_t *ctx, uint32_t gain)
ISO ADC 6 set channel gain function.
isoadc6_return_value_t
ISO ADC 6 Click return value data.
Definition isoadc6.h:500
@ ISOADC6_OK
Definition isoadc6.h:501
@ ISOADC6_ERROR
Definition isoadc6.h:502
This file contains SPI specific macros, functions, etc.
ISO ADC 6 Click configuration object.
Definition isoadc6.h:477
float vref
Definition isoadc6.h:489
uint8_t ch_sel
Definition isoadc6.h:491
spi_master_chip_select_polarity_t cs_polarity
Definition isoadc6.h:487
pin_name_t sck
Definition isoadc6.h:481
spi_master_mode_t spi_mode
Definition isoadc6.h:486
pin_name_t mosi
Definition isoadc6.h:480
uint32_t spi_speed
Definition isoadc6.h:485
float calib
Definition isoadc6.h:490
pin_name_t miso
Definition isoadc6.h:479
pin_name_t cs
Definition isoadc6.h:482
ISO ADC 6 Click context object.
Definition isoadc6.h:460
spi_master_t spi
Definition isoadc6.h:462
float vref
Definition isoadc6.h:466
uint8_t ch_sel
Definition isoadc6.h:468
float calib
Definition isoadc6.h:467
pin_name_t chip_select
Definition isoadc6.h:464