no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ad74416h.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef _AD74416H_H
34#define _AD74416H_H
35
36#include "stdint.h"
37#include "stdbool.h"
38#include "no_os_spi.h"
39#include "no_os_gpio.h"
40
41#define AD74416H_N_CHANNELS 4
42
43#define AD74416H_CH_A 0
44#define AD74416H_CH_B 1
45#define AD74416H_CH_C 2
46#define AD74416H_CH_D 3
47
49#define AD74416H_RSENSE 12
51#define AD74416H_ADC_MAX_VALUE 16777215
52
54#define AD74416H_NOP 0x00
55#define AD74416H_CH_FUNC_SETUP(x) (0x01 + (x * 12))
56#define AD74416H_ADC_CONFIG(x) (0x02 + (x * 12))
57#define AD74416H_DIN_CONFIG0(x) (0x03 + (x * 12))
58#define AD74416H_DIN_CONFIG1(x) (0x04 + (x * 12))
59#define AD74416H_OUTPUT_CONFIG(x) (0x05 + (x * 12))
60#define AD74416H_RTD_CONFIG(x) (0x06 + (x * 12))
61#define AD74416H_FET_LKG_COMP(x) (0x07 + (x * 12))
62#define AD74416H_DO_EXT_CONFIG(x) (0x08 + (x * 12))
63#define AD74416H_I_BURNOUT_CONFIG(x) (0x09 + (x * 12))
64#define AD74416H_DAC_CODE(x) (0x0A + (x * 12))
65#define AD74416H_DAC_ACTIVE(x) (0x0C + (x * 12))
66#define AD74416H_GPIO_CONFIG(x) (0x32 + x)
67#define AD74416H_PWR_OPTIM_CONFIG 0x38
68#define AD74416H_ADC_CONV_CTRL 0x39
69#define AD74416H_DIAG_ASSIGN 0x3A
70#define AD74416H_WTD_CONFIG 0x3B
71#define AD74416H_DIN_COMP_OUT 0x3E
72#define AD74416H_ALERT_STATUS 0x3F
73#define AD74416H_LIVE_STATUS 0x40
74#define AD74416H_ADC_RESULT_UPR(x) (0x41 + (x * 2))
75#define AD74416H_ADC_RESULT(x) (0x42 + (x * 2))
76#define AD74416H_ADC_DIAG_RESULT(x) (0x49 + x)
77#define AD74416H_LAST_ADC_RESULT_UPR 0x4D
78#define AD74416H_LAST_ADC_RESULT 0x4E
79#define AD74416H_DIN_COUNTER(x) (0x50 + (x * 2))
80#define AD74416H_SUPPLY_ALERT_STATUS 0x57
81#define AD74416H_CHANNEL_ALERT_STATUS(x) (0x58 + x)
82#define AD74416H_ALERT_MASK 0x5C
83#define AD74416H_SUPPLY_ALERT_MASK 0x5D
84#define AD74416H_CHANNEL_ALERT_MASK(x) (0x5E + x)
85#define AD74416H_READ_SELECT 0x6E
86#define AD74416H_BURST_READ_SEL 0x6F
87#define AD74416H_THERM_RST 0x73
88#define AD74416H_CMD_KEY 0x74
89#define AD74416H_BORADCAST_CMD_KEY 0x75
90#define AD74416H_SCRATCH(x) (0x76 + x)
91#define AD74416H_GENERIC_ID 0x7A
92#define AD74416H_SILICON_REV 0x7B
93#define AD74416H_SILICON_ID0 0x7D
94#define AD74416H_SILICON_ID1 0x7E
95#define AD74416H_HART_ALERT_STATUS(x) (0x80 + (x * 16))
96#define AD74416H_HART_RX(x) (0x81 + (x * 16))
97#define AD74416H_HART_TX(x) (0x82 + (x * 16))
98#define AD74416H_HART_FCR(x) (0x83 + (x * 16))
99#define AD74416H_HART_MCR(x) (0x84 + (x * 16))
100#define AD74416H_HART_RFC(x) (0x85 + (x * 16))
101#define AD74416H_HART_TFC(x) (0x86 + (x * 16))
102#define AD74416H_HART_ALERT_MASK(x) (0x87 + (x * 16))
103#define AD74416H_HART_CONFIG(x) (0x88 + (x * 16))
104#define AD74416H_HART_TX_PREM(x) (0x89 + (x * 16))
105#define AD74416H_HART_EVDET(x) (0x8A + (x * 16))
106#define AD74416H_HART_TX_GAIN(x) (0x8B + (x * 16))
107#define AD74416H_HART_GPIO_IF_CONFIG 0xC0
108#define AD74416H_HART_GPIO_MON_CONFIG(x) (0xC1 + x)
109
111#define AD74416H_CMD_KEY_RESET_1 0x15FA
112#define AD74416H_CMD_KEY_RESET_2 0xAF51
113
114#define AD74416H_SPI_RD_RET_INFO_MSK NO_OS_BIT(8)
115#define AD74416H_ERR_CLR_MSK NO_OS_GENMASK(15, 0)
116#define AD74416H_SPI_CRC_ERR_MSK NO_OS_BIT(13)
117
118/* AD74416H_CH_FUNC_SETUP */
119#define AD74416H_CH_FUNC_SETUP_MSK NO_OS_GENMASK(3, 0)
120
121/* AD74416H_ADC_CONFIG */
122#define AD74416H_ADC_CONV_RATE_MSK NO_OS_GENMASK(11, 8)
123#define AD74416H_ADC_CONV_RANGE_MSK NO_OS_GENMASK(6, 4)
124#define AD74416H_CONV_MUX_MSK NO_OS_GENMASK(2, 0)
125
126/* AD74416H_DIN_CONFIG0 */
127#define AD74416H_COUNT_EN_MSK NO_OS_BIT(15)
128#define AD74416H_DIN_INV_COMP_OUT_MSK NO_OS_BIT(14)
129#define AD74416H_COMPARATOR_EN_MSK NO_OS_BIT(13)
130#define AD74416H_DIN_SINK_RANGE_MSK NO_OS_BIT(12)
131#define AD74416H_DIN_SINK_MSK NO_OS_GENMASK(11, 7)
132#define AD74416H_DEBOUNCE_MODE_MSK NO_OS_BIT(6)
133#define AD74416H_DEBOUNCE_TIME_MSK NO_OS_GENMASK(4, 0)
134
135/* AD74416H_DIN_CONFIG1 Register */
136#define AD74416H_DIN_INPUT_SELECT_MSK NO_OS_BIT(10)
137#define AD74416H_DIN_SC_DET_EN_MSK NO_OS_BIT(9)
138#define AD74416H_DIN_OC_DET_EN_MSK NO_OS_BIT(8)
139#define AD74416H_DIN_THRESH_MODE_MSK NO_OS_BIT(7)
140#define AD74416H_COMP_THRESH_MSK NO_OS_GENMASK(6, 0)
141
143#define AD74416H_AVDD_SELECT_MSK NO_OS_GENMASK(15, 14)
144#define AD74416H_ALARM_DEG_PERIOD_MSK NO_OS_BIT(12)
145#define AD74VOUT_4W_EN_MSK NO_OS_BIT(11)
146#define AD74416H_WAIT_LDAC_CMD_MSK NO_OS_BIT(10)
147#define AD74416H_VIOUT_DRV_EN_DLY NO_OS_BIT(9)
148#define AD74416H_HART_COMPL_SETTLED NO_OS_BIT(8)
149#define AD74416H_VOUT_RANGE_MSK NO_OS_BIT(7)
150#define AD74416H_SLEW_EN_MSK NO_OS_GENMASK(6, 5)
151#define AD74416H_SLEW_LIN_STEP_MSK NO_OS_GENMASK(4, 3)
152#define AD74416H_SLEW_LIN_RATE_MSK NO_OS_GENMASK(2, 1)
153#define AD74416H_I_LIMIT_MSK NO_OS_BIT(0)
154
156#define AD74416H_RTD_ADC_REF_MSK NO_OS_BIT(3)
157#define AD74416H_RTD_MODE_SEL_MSK NO_OS_BIT(2)
158#define AD74416H_RTD_EXC_SWAP_MSK NO_OS_BIT(1)
159#define AD74416H_RTD_CURRENT_MSK NO_OS_BIT(0)
160
162#define AD74416H_FET_SRC_LKG_COMP_EN_MSK NO_OS_BIT(0)
163
165#define AD74416H_DO_T2_MSK NO_OS_GENMASK(12, 8)
166#define AD74416H_DO_DATA_MSK NO_OS_BIT(7)
167#define AD74416H_DO_T1_MSK NO_OS_GENMASK(6, 2)
168#define AD74416H_DO_SRC_SEL_MSK NO_OS_BIT(1)
169#define AD74416H_DO_MODE_MSK NO_OS_BIT(0)
170
172#define AD74416H_BRN_SEN_VSENSEN_CURR_MSK NO_OS_GENMASK(6, 5)
173#define AD74416H_BRN_SEN_VSENSEN_POL_MSK NO_OS_BIT(4)
174#define AD74416H_BRN_VIOUT_CURR_MSK NO_OS_GENAMSK(2, 1)
175#define AD74416H_BRN_VIOUT_POL_MSK NO_OS_BIT(0)
176
178#define AD74416H_DAC_CODE_MSK NO_OS_GENMASK(15, 0)
179
181#define AD74416H_DAC_ACTIVE_MSK NO_OS_GENMASK(15, 0)
182
184#define AD74416H_ADC_RDY_CTRL_MSK NO_OS_BIT(13)
185#define AD74416H_CONV_RATE_DIAG_MSK NO_OS_GENMASK(12, 10)
186#define AD74416H_CONV_SEQ_MSK NO_OS_GENMASK(9, 8)
187#define AD74416H_DIAG_EN_MSK(x) (NO_OS_BIT(x) << 4)
188#define AD74416H_CH_EN_MSK(x) NO_OS_BIT(x)
189
191#define AD74416H_DIAG_ASSIGN_MSK(x) (NO_OS_GENMASK(3, 0) << ((x) * 4))
192
194#define AD74416H_DIN_DO_MSK NO_OS_BIT(7, 6)
195#define AD74416H_GPI_DATA_MSK NO_OS_BIT(5)
196#define AD74416H_GPO_DATA_MSK NO_OS_BIT(4)
197#define AD74416H_GP_WK_PD_EN_MSK NO_OS_BIT(3)
198#define AD74416H_GPIO_SELECT_MSK NO_OS_GENMASK(2, 0)
199
201#define AD74416H_REF_EN_MSK NO_OS_BIT(13)
202#define AD74416H_SENSE_AGND_OPT_MSK NO_OS_BIT(12)
203#define AD74416H_SENSE_HF_OPT_D_MSK NO_OS_BIT(11)
204#define AD74416H_SENSE_HF_OPT_C_MSK NO_OS_BIT(10)
205#define AD74416H_SENSE_HF_OPT_B_MSK NO_OS_BIT(9)
206#define AD74416H_SENSE_HF_OPT_A_MSK NO_OS_BIT(8)
207#define AD74416H_SENSE_LF_OPT_D_MSK NO_OS_BIT(7)
208#define AD74416H_SENSE_LF_OPT_C_MSK NO_OS_BIT(6)
209#define AD74416H_SENSE_LF_OPT_B_MSK NO_OS_BIT(5)
210#define AD74416H_SENSE_LF_OPT_A_MSK NO_OS_BIT(4)
211#define AD74416H_VSENSEN_OPT_D_MSK NO_OS_BIT(3)
212#define AD74416H_VSENSEN_OPT_C_MSK NO_OS_BIT(2)
213#define AD74416H_VSENSEN_OPT_B_MSK NO_OS_BIT(1)
214#define AD74416H_VSENSEN_OPT_A_MSK NO_OS_BIT(0)
215
217#define AD74416H_WDT_EN_MSK NO_OS_BIT(4)
218#define AD74416H_WDT_TIMEOUT_MSK NO_OS_GENMASK(3, 0)
219
221#define AD74416H_DIN_COMP_OUT_D_MSK NO_OS_BIT(3)
222#define AD74416H_DIN_COMP_OUT_C_MSK NO_OS_BIT(2)
223#define AD74416H_DIN_COMP_OUT_B_MSK NO_OS_BIT(1)
224#define AD74416H_DIN_COMP_OUT_A_MSK NO_OS_BIT(0)
225
227#define AD74416H_HART_ALERT_D_MSK NO_OS_BIT(15)
228#define AD74416H_HART_ALERT_C_MSK NO_OS_BIT(14)
229#define AD74416H_HART_ALERT_B_MSK NO_OS_BIT(13)
230#define AD74416H_HART_ALERT_A_MSK NO_OS_BIT(12)
231#define AD74416H_CHANNEL_ALERT_D_MSK NO_OS_BIT(11)
232#define AD74416H_CHANNEL_ALERT_C_MSK NO_OS_BIT(10)
233#define AD74416H_CHANNEL_ALERT_B_MSK NO_OS_BIT(9)
234#define AD74416H_CHANNEL_ALERT_A_MSK NO_OS_BIT(8)
235#define AD74416H_ADC_ERR_MSK NO_OS_BIT(5)
236#define AD74416H_TEMP_ALERT_MSK NO_OS_BIT(4)
237#define AD74416H_SPI_ERR_MSK NO_OS_BIT(3)
238#define AD74416H_SUPPLY_ERR_MSK NO_OS_BIT(2)
239#define AD74416H_RESET_OCCURRED_MSK NO_OS_BIT(0)
240
242#define AD74416H_ANALOG_IO_STATUS_D_MSK NO_OS_BIT(15)
243#define AD74416H_ANALOG_IO_STATUS_C_MSK NO_OS_BIT(14)
244#define AD74416H_ANALOG_IO_STATUS_B_MSK NO_OS_BIT(13)
245#define AD74416H_ANALOG_IO_STATUS_A_MSK NO_OS_BIT(12)
246#define AD74416H_DO_STATUS_D_MSK NO_OS_BIT(11)
247#define AD74416H_DO_STATUS_C_MSK NO_OS_BIT(10)
248#define AD74416H_DO_STATUS_B_MSK NO_OS_BIT(9)
249#define AD74416H_DO_STATUS_A_MSK NO_OS_BIT(8)
250#define AD74416H_DIN_STATUS_D_MSK NO_OS_BIT(7)
251#define AD74416H_DIN_STATUS_C_MSK NO_OS_BIT(6)
252#define AD74416H_DIN_STATUS_B_MSK NO_OS_BIT(5)
253#define AD74416H_DIN_STATUS_A_MSK NO_OS_BIT(4)
254#define AD74416H_TEMP_ALERT_STATUS_MSK NO_OS_BIT(3)
255#define AD74416H_ADC_DATA_RDY_MSK NO_OS_BIT(2)
256#define AD74416H_ADC_BUSY_MSK NO_OS_BIT(1)
257#define AD74416H_SUPPLY_STATUS_MSK NO_OS_BIT(0)
258
259/* AD74416H_ADC_RESULT_UPRn Register */
260#define AD74416H_CONV_RES_MUX_MSK NO_OS_GENMASK(15, 13)
261#define AD74416H_CONV_RES_RANGE_MSK NO_OS_GENMASK(12, 10)
262#define AD74416H_CONV_SEQ_COUNT_MSK NO_OS_GENAMSK(9. 8)
263#define AD74416H_CONV_RES_UPR_MSK NO_OS_GENMASK(7, 0)
264
265/* AD74416H_ADC_RESULTn Register */
266#define AD74416H_CONV_RESULT_MSK NO_OS_GENMASK(15, 0)
267
268/* AD74416H_ADC_DIAG_RESULTn */
269#define AD74416H_DIAG_RESULT_MSK NO_OS_GENMASK(15, 0)
270
271/* AD74416H_LAST_ADC_RESULT_UPRn Register */
272#define AD74416H_LAST_CONV_CH_MSK NO_OS_GENAMSK(10 8)
273#define AD74416H_LAST_CONV_RES_UPR_MSK NO_OS_GENMASK(7, 0)
274
275/* AD74416H_ADC_RESULTn Register */
276#define AD74416H_LAST_CONV_RES_MSK NO_OS_GENMASK(15, 0)
277
278/* AD74416H_DIN_COUNTER_UPRn Register */
279#define AD74416H_DIN_CNT_UPR_MSK NO_OS_GENMASK(15, 0)
280
281/* AD74416H_DIN_COUNTERn Register */
282#define AD74416H_DIN_CNT_MSK NO_OS_GENMASK(15, 0)
283
284/* AD74416H SUPPLY_ALERT_STATUS Register */
285#define AD74416H_AVDD_HI_ERR_MSK NO_OS_BIT(6)
286#define AD74416H_AVDD_LO_ERR_MSK NO_OS_BIT(5)
287#define AD74416H_DO_VDD_ERR_MSK NO_OS_BIT(4)
288#define AD74416H_AVCC_ERR_MSK NO_OS_BIT(3)
289#define AD74416H_DVCC_ERR_MSK NO_OS_BIT(2)
290#define AD74416H_AVSS_ERR_MSK NO_OS_BIT(1)
291#define AD74416H_CAL_MEM_ERR_MSK NO_OS_BIT(0)
292
293/* AD74416H CHANNEL_ALERT_STATUS Register */
294#define AD74416H_VIOUT_SHUTDOWN_MSK NO_OS_BIT(6)
295#define AD74416H_ANALOG_IO_OC_MSK NO_OS_BIT(5)
296#define AD74416H_ANALOG_IO_SC_MSK NO_OS_BIT(4)
297#define AD74416H_DO_TIMEOUT_MSK NO_OS_BIT(3)
298#define AD74416H_DO_SC_MSK NO_OS_BIT(2)
299#define AD74416H_DIN_OC_MSK NO_OS_BIT(1)
300#define AD74416H_DIN_SC_MSK NO_OS_BIT(0)
301
302/* AD74416H READ_SELECT Register */
303#define AD74416H_READBACK_ADDR_MSK NO_OS_GENMASK(8, 0)
304
305/* AD74416H BURST_READ_SEL Register */
306#define AD74416H_BURST_READ_SEL_MSK NO_OS_GENMASK(15, 0)
307
308/* AD74416H THERM_RST Register */
309#define AD74416H_THERM_RST_EN_MSK NO_OS_BIT(0)
310
311/* AD74416H CMD_KEY Register */
312#define AD74416H_CMD_KEY_MSK NO_OS_GENMASK(15, 0)
313
314/* AD74416H BROADCAST_CMD_KEY Register */
315#define AD74416H_BROADCAST_CMD_KEY_MSK NO_OS_GENMASK(15, 0)
316
317/* AD74416H SCRATCHn Register */
318#define AD74416H_SCRATCH_BITS_MSK NO_OS_GENMASK(15, 0)
319
320/* AD74416H GENERIC_ID Register */
321#define AD74416H_GENERIC_ID_MSK NO_OS_GENMASK(2, 0)
322
323/* AD74416H SILICON_REV Register */
324#define AD74416H_SILICON_REV_ID_MSK NO_OS_GENMASK(7, 0)
325
326/* AD74416H SILICON_ID0 Register */
327#define AD74416H_UID0_MSK NO_OS_GENMASK(6, 0)
328
329/* AD74416H SILICON_ID1 Register */
330#define AD74416H_UID2_MSK NO_OS_GENMASK(11, 6)
331#define AD74416H_UID1_MSK NO_OS_GENMASK(5, 0)
332
333/* AD74416H HART_ALERT_STATUSn Register */
334#define AD74416H_FRM_MON_STATE_MSK NO_OS_GENMASK(15, 13)
335#define AD74416H_EOM_MSK NO_OS_BIT(12)
336#define AD74416H_RX_BCNT_MSK NO_OS_BIT(11)
337#define AD74416H_RX_CMD_MSK NO_OS_BIT(10)
338#define AD74416H_SOM_MSK NO_OS_BIT(9)
339#define AD74416H_CD_MSK NO_OS_BIT(8)
340#define AD74416H_CD_EDGE_DET_MSK NO_OS_BIT(7)
341#define AD74416H_TX_COMPLETE_MSK NO_OS_BIT(6)
342#define AD74416H_TX_FIFO_ALERT_MSK NO_OS_BIT(5)
343#define AD74416H_RX_FIFO_ALERT_MSK NO_OS_BIT(4)
344#define AD74416H_RX_OVERFLOW_ERR_MSK NO_OS_BIT(3)
345#define AD74416H_FRAME_ERR_MSK NO_OS_BIT(2)
346#define AD74416H_PARITY_ERR_MSK NO_OS_BIT(1)
347#define AD74416H_GAP_ERR_MSK NO_OS_BIT(0)
348
349/* AD74416H HART_RXn Register */
350#define AD74416H_RFGI_MSK NO_OS_BIT(11)
351#define AD74416H_RFFE_MSK NO_OS_BIT(10)
352#define AD74416H_RFPE_MSK NO_OS_BIT(9)
353#define AD74416H_RFBI_MSK NO_OS_BIT(8)
354#define AD74416H_RBR_MSK NO_OS_GENMASK(7, 0)
355
356/* AD74416H HART_TXn Register */
357#define AD74416H_TDR_MSK NO_OS_GENMASK(7, 0)
358
359/* AD74416H HART_FCRn Register */
360#define AD74416H_TFTRIG_MSK NO_OS_GENMASK(12, 8)
361#define AD74416H_RFTRIG_MSK NO_OS_GENMASK(7, 3)
362#define AD74416H_TFCLR_MSK NO_OS_BIT(2)
363#define AD74416H_RFCLR_MSK NO_OS_BIT(1)
364#define AD74416H_FIFOEN_MSK NO_OS_BIT(0)
365
366/* AD74416H HART_MCRn Register */
367#define AD74416H_RTS_MSK NO_OS_BIT(0)
368
369/* AD74416H HART_RFCn Register */
370#define AD74416H_RFC_MSK NO_OS_GENMASK(5, 0)
371
372/* AD74416H HART_TFCn Register */
373#define AD74416H_TFC_MSK NO_OS_GENMASK(5, 0)
374
375/* AD74416H HART_CONFIGn Register */
376#define AD74416H_CD_EXTD_QUAL_MSK NO_OS_BIT(13)
377#define AD74416H_FRM_MON_RX_PREMX2_MSK NO_OS_BIT(12)
378#define AD74416H_FRM_MON_RST_GAP_MSK NO_OS_BIT(11)
379#define AD74416H_FRM_MON_RST_CD_MSK NO_OS_BIT(10)
380#define AD74416H_RX_ALL_CHARS_MSK NO_OS_BIT(9)
381#define AD74416H_FRM_MON_EN_MSK NO_OS_BIT(8)
382#define AD74416H_EVENT_DET_SEL_MSK NO_OS_GENMASK(7, 6)
383#define AD74416H_TX_1B_AFTER_RST_MSK NO_OS_BIT(5)
384#define AD74416H_AUTO_CLR_RST_MSK NO_OS_BIT(4)
385#define AD74416H_CD_EDGE_SEL_MSK NO_OS_GENAMSK(3, 2)
386#define AD74416H_MODEM_DUPLEX_MSK NO_OS_BIT(1)
387#define AD74416H_MODEM_PWRUP_MSK NO_OS_BIT(0)
388
389/* AD74416H HART_TX_PREMn Register */
390#define AD74416H_TX_PREM_CNT_MSK NO_OS_GENMASK(4, 0)
391
392/* AD74416H HART_EVDETn Register */
393#define AD74416H_EVENT_DET_TIME_MSK NO_OS_GENMASK(15, 0)
394
395/* AD74416H HART_TX_GAINn Register */
396#define AD74416H_TX_GAIN_MSK NO_OS_GENMASK(3, 0)
397
398/* AD74416H HART_GPIO_IF_CONFIG Register */
399#define AD74416H_HART_GPIO_IF_CH_MSK NO_OS_GENMASK(3, 2)
400#define AD74416H_HART_GPIO_IF_SEL_MSK NO_OS_GENMASK(1, 0)
401
402/* AD74416H HART_GPIO_MON_CONFIG Register */
403#define AD74416H_HART_GPIO_MON_CH_MSK NO_OS_GENMASK(4, 3)
404#define AD74416H_HART_GPIO_MON_SEL_MSK NO_OS_GENMASK(2, 0)
405
406#define AD74416H_TEMP_OFFSET -2392
407#define AD74416H_TEMP_SCALE 8950
408#define AD74416H_TEMP_SCALE_DIV 1000
409
410#define AD74416H_FRAME_SIZE 5
411#define AD74416H_THRESHOLD_DAC_RANGE 98
412#define AD74416H_THRESHOLD_RANGE 30000
413#define AD74416H_DAC_RANGE 12000
414#define AD74416H_DAC_CURRENT_RANGE 25000
415#define AD74416H_DAC_RESOLUTION 16
416#define AD74414H_DAC_RESOLUTION 14
417#define AD74116H_CONV_TIME_US 1000000
418
426
444
455
469
484
496
507
515
525
545
555
565
573
581
586 uint8_t SUPPLY_STATUS: 1;
587 uint8_t ADC_BUSY: 1;
588 uint8_t ADC_DATA_RDY: 1;
590 uint8_t DIN_STATUS_A: 1;
591 uint8_t DIN_STATUS_B: 1;
592 uint8_t DIN_STATUS_C: 1;
593 uint8_t DIN_STATUD_D: 1;
594 uint8_t DO_STATUS_A: 1;
595 uint8_t DO_STATUS_B: 1;
596 uint8_t DO_STATUS_C: 3;
597 uint8_t DO_STATUS_D: 1;
602};
603
611
618
622
629
641
643int ad74416h_dac_voltage_to_code(struct ad74416h_desc *, int32_t,
644 uint16_t *, uint32_t);
645
647int ad74416h_dac_current_to_code(struct ad74416h_desc *, uint32_t, uint16_t *);
648
650int ad74416h_reg_write(struct ad74416h_desc *, uint32_t, uint16_t);
651
653int ad74416h_reg_read_raw(struct ad74416h_desc *, uint32_t, uint8_t *);
654
656int ad74416h_reg_read(struct ad74416h_desc *, uint32_t, uint16_t *);
657
659int ad74416h_reg_update(struct ad74416h_desc *, uint32_t, uint16_t,
660 uint16_t);
661
663int ad74416h_nb_active_channels(struct ad74416h_desc *, uint8_t *);
664
669int ad74416h_set_info(struct ad74416h_desc *desc, uint16_t mode);
670
673 uint32_t, enum ad74416h_op_mode);
674
676int ad74416h_set_channel_vout_range(struct ad74416h_desc *desc, uint32_t ch,
677 enum ad74416h_vout_range vout_range);
678
680int ad74416h_set_channel_i_limit(struct ad74416h_desc *, uint32_t,
681 enum ad74416h_i_limit);
682
684int ad74416h_get_raw_adc_result(struct ad74416h_desc *, uint32_t,
685 uint32_t *);
686
689 bool);
690
692int ad74416h_set_diag_channel_enable(struct ad74416h_desc *, uint32_t, bool);
693
695int ad74416h_get_adc_range(struct ad74416h_desc *, uint32_t, uint16_t *);
696
698int ad74416h_set_adc_range(struct ad74416h_desc *, uint32_t,
699 enum ad74416h_adc_range);
700
702int ad74416h_get_adc_rate(struct ad74416h_desc *, uint32_t,
703 enum ad74416h_adc_rate *);
704
706int ad74416h_set_adc_rate(struct ad74416h_desc *, uint32_t,
707 enum ad74416h_adc_rate);
708
710int ad74416h_get_adc_conv_mux(struct ad74416h_desc *, uint32_t,
711 enum ad74416h_adc_conv_mux *);
712
714int ad74416h_set_adc_conv_mux(struct ad74416h_desc *, uint32_t,
716
719
721int ad74416h_get_adc_single(struct ad74416h_desc *, uint32_t, uint16_t *);
722
724int ad74416h_get_temp(struct ad74416h_desc *, uint32_t, uint16_t *);
725
727int ad74416h_set_channel_dac_code(struct ad74416h_desc *, uint32_t, uint16_t);
728
730int ad74416h_set_diag(struct ad74416h_desc *, uint32_t,
731 enum ad74416h_diag_mode);
732
734int ad74416h_get_diag(struct ad74416h_desc *, uint32_t, uint16_t *);
735
740int ad74416h_set_debounce_mode(struct ad74416h_desc *, uint32_t,
742
747int ad74416h_set_debounce_time(struct ad74416h_desc *, uint32_t, uint32_t);
748
750int ad74416h_gpio_get(struct ad74416h_desc *, uint32_t, uint8_t *);
751
753int ad74416h_set_gpio_config(struct ad74416h_desc *, uint32_t,
755
760int ad74416h_set_threshold(struct ad74416h_desc *, uint32_t, uint32_t);
761
763int ad74416h_do_set(struct ad74416h_desc *, uint32_t, uint8_t);
764
766int ad74416h_gpio_set(struct ad74416h_desc *, uint32_t, uint8_t);
767
770 union ad74416h_live_status *);
771
773int ad74416h_dac_slew_enable(struct ad74416h_desc *, uint32_t,
775 enum ad74416h_lin_rate);
776
778int ad74416h_dac_slew_disable(struct ad74416h_desc *, uint32_t);
779
781int ad74416h_set_therm_rst(struct ad74416h_desc *, bool);
782
784int ad74416h_reset(struct ad74416h_desc *);
785
787int ad74416h_init(struct ad74416h_desc **, struct ad74416h_init_param *);
788
790int ad74416h_remove(struct ad74416h_desc *desc);
791
792#endif // _AD74416H_H
int ad74416h_set_channel_i_limit(struct ad74416h_desc *, uint32_t, enum ad74416h_i_limit)
Set the current limit for a specific DAC channel in vout mode.
Definition ad74416h.c:640
ad74416h_diag_mode
Possible values to be loaded in the DIAG_RESULT register.
Definition ad74416h.h:529
@ AD74416H_DIAG_TEMP
Definition ad74416h.h:531
@ AD74416H_DIAG_DO_VDD
Definition ad74416h.h:539
@ AD74416H_DIAG_AVSS
Definition ad74416h.h:537
@ AD74416H_VSENSEP_C
Definition ad74416h.h:540
@ AD74416H_DO_C
Definition ad74416h.h:542
@ AD74416H_DIAG_AVDD_HI
Definition ad74416h.h:535
@ AD74416H_AVDD_C
Definition ad74416h.h:543
@ AD74416H_VSENSEN_C
Definition ad74416h.h:541
@ AD74416H_DIAG_DVCC
Definition ad74416h.h:532
@ AD74416H_DIAG_LVIN
Definition ad74416h.h:538
@ AD74416H_DIAG_AGND
Definition ad74416h.h:530
@ AD74416H_DIAG_LDO1V8
Definition ad74416h.h:534
@ AD74416H_DIAG_AVCC
Definition ad74416h.h:533
@ AD74416H_DIAG_AVDD_LO
Definition ad74416h.h:536
ad74416h_i_limit
DAC Current limits in Vout mode.
Definition ad74416h.h:577
@ AD74416H_I_LIMIT1
Definition ad74416h.h:579
@ AD74416H_I_LIMIT0
Definition ad74416h.h:578
int ad74416h_reg_read_raw(struct ad74416h_desc *, uint32_t, uint8_t *)
Read a raw communication frame.
Definition ad74416h.c:157
int ad74416h_do_set(struct ad74416h_desc *, uint32_t, uint8_t)
Set the DO value of a channel.
Definition ad74416h.c:822
int ad74416h_gpio_set(struct ad74416h_desc *, uint32_t, uint8_t)
Set the logic value of a GPO pin.
Definition ad74416h.c:835
int ad74416h_gpio_get(struct ad74416h_desc *, uint32_t, uint8_t *)
Get the GPO value for a specific channel.
Definition ad74416h.c:757
ad74416h_adc_conv_mux
ADC input configuration values.
Definition ad74416h.h:500
@ AD74416H_MUX_HF_TO_LF
Definition ad74416h.h:502
@ AD74416H_MUX_LF_TO_AGND
Definition ad74416h.h:501
@ AD74416H_MUX_VSENSEN_TO_AGND
Definition ad74416h.h:503
@ AD74416H_MUX_LF_TO_VSENSEN
Definition ad74416h.h:504
@ AD74416H_MUX_AGND_TO_AGND
Definition ad74416h.h:505
ad74416h_gpio_select
GPO operation modes.
Definition ad74416h.h:448
@ AD74416H_GPIO_CONFIG_COMP
Definition ad74416h.h:452
@ AD74416H_GPIO_CONFIG_HIGH_Z
Definition ad74416h.h:449
@ AD74416H_GPIO_CONFIG_DO
Definition ad74416h.h:453
@ AD74416H_GPIO_CONFIG_IN
Definition ad74416h.h:451
@ AD74416H_GPIO_CONFIG_DATA
Definition ad74416h.h:450
int ad74416h_set_therm_rst(struct ad74416h_desc *, bool)
Enable or disable the higher thermal reset.
Definition ad74416h.c:907
int ad74416h_get_adc_single(struct ad74416h_desc *, uint32_t, uint16_t *)
Get a single ADC raw value for a specific channel, then power down the ADC.
Definition ad74416h.c:495
int ad74416h_set_diag_channel_enable(struct ad74416h_desc *, uint32_t, bool)
Enable conversions on a diagnostic register.
Definition ad74416h.c:330
ad74416h_adc_range
Conversion range configuration values.
Definition ad74416h.h:459
@ AD74416H_RNG_NEG104_104MV
Definition ad74416h.h:466
@ AD74416H_RNG_0_0P3125V
Definition ad74416h.h:464
@ AD74416H_RNG_NEG0P3125_0V
Definition ad74416h.h:463
@ AD74416H_RNG_0_0P625V
Definition ad74416h.h:465
@ AD74416H_RNG_0_12_V
Definition ad74416h.h:460
@ AD74416H_RNG_NEG2P5_2P5V
Definition ad74416h.h:467
@ AD74416H_RNG_NEG0P3125_0P3125V
Definition ad74416h.h:462
@ AD74416H_RNG_NEG12_12_V
Definition ad74416h.h:461
int ad74416h_set_adc_rate(struct ad74416h_desc *, uint32_t, enum ad74416h_adc_rate)
Set the ADC Conversion Rate for a specific channel.
Definition ad74416h.c:413
ad74416h_adc_rate
Conversion configuration values.
Definition ad74416h.h:473
@ AD74416H_4K8SPS
Definition ad74416h.h:481
@ AD74416H_1K2SPS_HART_REJECTION
Definition ad74416h.h:480
@ AD74416H_200SPS_HART_REJECTION
Definition ad74416h.h:477
@ AD74416H_10SPS_50_60HZ_HART_REJECTION
Definition ad74416h.h:474
@ AD74416H_200SPS_SIGN_HART_REJECTION
Definition ad74416h.h:478
@ AD74416H_1K2SPS
Definition ad74416h.h:479
@ AD74416H_9K6SPS
Definition ad74416h.h:482
@ AD74416H_20SPS_50_60HZ_HART_REJECTION
Definition ad74416h.h:476
@ AD74416H_20SPS_50_60HZ_REJECTION
Definition ad74416h.h:475
int ad74416h_set_adc_channel_enable(struct ad74416h_desc *, uint32_t, bool)
Enable/disable a specific ADC channel.
Definition ad74416h.c:308
int ad74416h_set_gpio_config(struct ad74416h_desc *, uint32_t, enum ad74416h_gpio_select)
Set the GPIO operation mode.
Definition ad74416h.c:778
int ad74416h_get_diag(struct ad74416h_desc *, uint32_t, uint16_t *)
Get the diagnostic value for a specific channel.
Definition ad74416h.c:698
int ad74416h_set_channel_dac_code(struct ad74416h_desc *, uint32_t, uint16_t)
Set and load a code for the DAC on a specific channel.
Definition ad74416h.c:661
int ad74416h_remove(struct ad74416h_desc *desc)
Free the device descriptor.
Definition ad74416h.c:1032
ad74416h_op_mode
Operation modes of the device.
Definition ad74416h.h:430
@ AD74416H_CURRENT_OUT_HART
Definition ad74416h.h:440
@ AD74416H_CURRENT_IN_EXT_HART
Definition ad74416h.h:441
@ AD74416H_CURRENT_IN_LOOP_HART
Definition ad74416h.h:442
@ AD74416H_DIGITAL_INPUT_LOOP
Definition ad74416h.h:439
@ AD74416H_DIGITAL_INPUT
Definition ad74416h.h:438
@ AD74416H_RESISTANCE
Definition ad74416h.h:437
@ AD74416H_CURRENT_IN_EXT
Definition ad74416h.h:435
@ AD74416H_VOLTAGE_IN
Definition ad74416h.h:434
@ AD74416H_HIGH_Z
Definition ad74416h.h:431
@ AD74416H_CURRENT_OUT
Definition ad74416h.h:433
@ AD74416H_VOLTAGE_OUT
Definition ad74416h.h:432
@ AD74416H_CURRENT_IN_LOOP
Definition ad74416h.h:436
#define AD74416H_FRAME_SIZE
Definition ad74416h.h:410
ad74416h_diag_rate
Diagnostics conversion configuration values.
Definition ad74416h.h:488
@ AD74416H_DIAG_4K8SPS
Definition ad74416h.h:492
@ AD74416H_DIAG_9K6SPS
Definition ad74416h.h:493
@ AD74416H_DIAG_1K2SPS_HART_REJECTION
Definition ad74416h.h:491
@ AD74416H_DIAG_20SPS_50_60HZ_REJECTION
Definition ad74416h.h:489
@ AD74416H_DIAG_20SPS_50_60HZ_HART_REJECTION
Definition ad74416h.h:490
@ AD74416H_DIAG_19K2SPS
Definition ad74416h.h:494
int ad74416h_set_threshold(struct ad74416h_desc *, uint32_t, uint32_t)
Set the threshold, for which a signal would be considered high, when the ADC is running in digital in...
Definition ad74416h.c:793
int ad74416h_get_raw_adc_result(struct ad74416h_desc *, uint32_t, uint32_t *)
Read the raw ADC raw conversion value.
Definition ad74416h.c:275
int ad74416h_get_live(struct ad74416h_desc *, union ad74416h_live_status *)
Read the live status bits.
Definition ad74416h.c:853
int ad74416h_reset(struct ad74416h_desc *)
Perform software or hardware reset and wait for device reset time.
Definition ad74416h.c:917
int ad74416h_set_channel_vout_range(struct ad74416h_desc *desc, uint32_t ch, enum ad74416h_vout_range vout_range)
Set the voltage range for a specific channel.
Definition ad74416h.c:618
ad74416h_lin_rate
Possible update rates for a DAC when slew control is enabled.
Definition ad74416h.h:559
@ AD74416H_LIN_RATE_230KHZ4
Definition ad74416h.h:563
@ AD74416H_LIN_RATE_153KHZ6
Definition ad74416h.h:562
@ AD74416H_LIN_RATE_76KHZ8
Definition ad74416h.h:561
@ AD74416H_LIN_RATE_4KHZ8
Definition ad74416h.h:560
ad74416h_vout_range
Possible voltage output ranges for the DAC.
Definition ad74416h.h:569
@ AD74416H_VOUT_RANGE_NEG12_12V
Definition ad74416h.h:571
@ AD74416H_VOUT_RANGE_0_12V
Definition ad74416h.h:570
int ad74416h_set_debounce_time(struct ad74416h_desc *, uint32_t, uint32_t)
Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode.
Definition ad74416h.c:735
int ad74416h_set_adc_conv_seq(struct ad74416h_desc *, enum ad74416h_conv_seq)
Start or stop ADC conversions.
Definition ad74416h.c:470
ad74416h_slew_lin_step
The voltage step size of Full Scale DAC Voltage.
Definition ad74416h.h:549
@ AD74416H_STEP_1_5_PERCENT
Definition ad74416h.h:551
@ AD74416H_STEP_0_8_PERCENT
Definition ad74416h.h:550
@ AD74416H_STEP_22_2_PERCENT
Definition ad74416h.h:553
@ AD74416H_STEP_6_1_PERCENT
Definition ad74416h.h:552
int ad74416h_get_adc_conv_mux(struct ad74416h_desc *, uint32_t, enum ad74416h_adc_conv_mux *)
Get the ADC Input Node for conversion.
Definition ad74416h.c:426
int ad74416h_reg_write(struct ad74416h_desc *, uint32_t, uint16_t)
Write a register's value.
Definition ad74416h.c:188
#define AD74416H_N_CHANNELS
Definition ad74416h.h:41
int ad74416h_init(struct ad74416h_desc **, struct ad74416h_init_param *)
Initialize the device structure.
Definition ad74416h.c:978
int ad74416h_dac_voltage_to_code(struct ad74416h_desc *, int32_t, uint16_t *, uint32_t)
Converts a millivolt value in the corresponding DAC 16 bit code.
Definition ad74416h.c:67
int ad74416h_dac_slew_enable(struct ad74416h_desc *, uint32_t, enum ad74416h_slew_lin_step, enum ad74416h_lin_rate)
Configure and enable slew rate control for a DAC on a specific channel.
Definition ad74416h.c:867
int ad74416h_dac_current_to_code(struct ad74416h_desc *, uint32_t, uint16_t *)
Convers a microamp value in the corresponding DAC 16 bit code.
Definition ad74416h.c:112
int ad74416h_set_adc_range(struct ad74416h_desc *, uint32_t, enum ad74416h_adc_range)
Set the ADC measurement range for a specific channel.
Definition ad74416h.c:365
int ad74416h_dac_slew_disable(struct ad74416h_desc *, uint32_t)
Disable the slew rate control.
Definition ad74416h.c:893
int ad74416h_set_channel_function(struct ad74416h_desc *, uint32_t, enum ad74416h_op_mode)
Set the operation mode for a specific channel.
Definition ad74416h.c:563
ad74416h_debounce_mode
Debounce modes for the IOx inputs when using the digital input op mode.
Definition ad74416h.h:511
@ AD74416H_DEBOUNCE_MODE_0
Definition ad74416h.h:512
@ AD74416H_DEBOUNCE_MODE_1
Definition ad74416h.h:513
int ad74416h_reg_update(struct ad74416h_desc *, uint32_t, uint16_t, uint16_t)
Update a register's field.
Definition ad74416h.c:229
ad74416h_conv_seq
ADC conversion sequence commands.
Definition ad74416h.h:519
@ AD74416H_STOP_PWR_UP
Definition ad74416h.h:520
@ AD74416H_START_CONT
Definition ad74416h.h:522
@ AD74416H_START_SINGLE
Definition ad74416h.h:521
@ AD74416H_STOP_PWR_DOWN
Definition ad74416h.h:523
int ad74416h_get_temp(struct ad74416h_desc *, uint32_t, uint16_t *)
Read the die's temperature from the diagnostic register.
Definition ad74416h.c:542
ad74416h_dev_id
Supported device ids.
Definition ad74416h.h:422
@ ID_AD74414H
Definition ad74416h.h:424
@ ID_AD74416H
Definition ad74416h.h:423
int ad74416h_set_adc_conv_mux(struct ad74416h_desc *, uint32_t, enum ad74416h_adc_conv_mux)
Set the ADC Input Node for conversion.
Definition ad74416h.c:447
int ad74416h_get_adc_range(struct ad74416h_desc *, uint32_t, uint16_t *)
Get the ADC measurement range for a specific channel.
Definition ad74416h.c:344
int ad74416h_set_diag(struct ad74416h_desc *, uint32_t, enum ad74416h_diag_mode)
Set which diagnostic value to be loaded in the DIAG_RESULT register.
Definition ad74416h.c:674
int ad74416h_set_info(struct ad74416h_desc *desc, uint16_t mode)
int ad74416h_set_debounce_mode(struct ad74416h_desc *, uint32_t, enum ad74416h_debounce_mode)
Set the debounce mode for the IOx inputs when the ADC is running in digital input mode.
Definition ad74416h.c:720
int ad74416h_nb_active_channels(struct ad74416h_desc *, uint8_t *)
Get the number of active channels.
Definition ad74416h.c:252
int ad74416h_get_adc_rate(struct ad74416h_desc *, uint32_t, enum ad74416h_adc_rate *)
Get the ADC Conversion Rate for a specific channel.
Definition ad74416h.c:391
int ad74416h_reg_read(struct ad74416h_desc *, uint32_t, uint16_t *)
Read a register's value.
Definition ad74416h.c:203
Header file of GPIO Interface.
Header file of SPI Interface.
Bitfield struct which maps on the LIVE_STATUS register.
Definition ad74416h.h:585
uint8_t ADC_BUSY
Definition ad74416h.h:587
uint8_t TEMP_ALERT_STATUS
Definition ad74416h.h:589
uint8_t DIN_STATUS_B
Definition ad74416h.h:591
uint8_t DO_STATUS_D
Definition ad74416h.h:597
uint8_t DO_STATUS_B
Definition ad74416h.h:595
uint8_t SUPPLY_STATUS
Definition ad74416h.h:586
uint8_t DIN_STATUS_A
Definition ad74416h.h:590
uint8_t DIN_STATUD_D
Definition ad74416h.h:593
uint8_t ANALOG_IO_STATUS_D
Definition ad74416h.h:601
uint8_t DO_STATUS_C
Definition ad74416h.h:596
uint8_t DO_STATUS_A
Definition ad74416h.h:594
uint8_t ANALOG_IO_STATUS_A
Definition ad74416h.h:598
uint8_t ADC_DATA_RDY
Definition ad74416h.h:588
uint8_t ANALOG_IO_STATUS_B
Definition ad74416h.h:599
uint8_t ANALOG_IO_STATUS_C
Definition ad74416h.h:600
uint8_t DIN_STATUS_C
Definition ad74416h.h:592
Device channel state.
Definition ad74416h.h:623
bool enabled
Definition ad74416h.h:624
enum ad74416h_i_limit i_limit
Definition ad74416h.h:627
enum ad74416h_vout_range vout_range
Definition ad74416h.h:626
enum ad74416h_op_mode function
Definition ad74416h.h:625
AD74416h device descriptor.
Definition ad74416h.h:633
struct no_os_gpio_desc * reset_gpio
Definition ad74416h.h:639
struct no_os_spi_desc * spi_desc
Definition ad74416h.h:636
uint8_t dev_addr
Definition ad74416h.h:635
enum ad74416h_dev_id id
Definition ad74416h.h:634
uint8_t comm_buff[AD74416H_FRAME_SIZE]
Definition ad74416h.h:637
struct ad74416h_channel_config channel_configs[AD74416H_N_CHANNELS]
Definition ad74416h.h:638
Definition ad74416h.h:612
struct no_os_spi_init_param spi_ip
Definition ad74416h.h:615
uint8_t dev_addr
Definition ad74416h.h:614
enum ad74416h_dev_id id
Definition ad74416h.h:613
struct no_os_gpio_init_param * reset_gpio_param
Definition ad74416h.h:616
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128
Used to store the live status bit fields.
Definition ad74416h.h:607
struct _ad74416h_live_status status_bits
Definition ad74416h.h:608
uint16_t value
Definition ad74416h.h:609