Trident IoT SDK
Loading...
Searching...
No Matches
T32CM11_adc.h
Go to the documentation of this file.
1
13
14#ifndef T32CM11_ADC_H_
15#define T32CM11_ADC_H_
16
17#include "tr_hal_platform.h"
18
24
25#define TR_HAL_NUM_ADC 4
26
40
41#define MAX_ADC_CHANNEL_ID ADC_CHANNEL_3_ID
42#define TR_HAL_ADC_CHANNEL_NONE 0xFF
43
49#define TR_HAL_ADC_AIO4 28
50#define TR_HAL_ADC_AIO5 29
51#define TR_HAL_ADC_AIO6 30
52#define TR_HAL_ADC_AIO7 31
53
54#define ADC_VALID_PIN_CHOICE1 TR_HAL_ADC_AIO4
55#define ADC_VALID_PIN_CHOICE2 TR_HAL_ADC_AIO5
56#define ADC_VALID_PIN_CHOICE3 TR_HAL_ADC_AIO6
57#define ADC_VALID_PIN_CHOICE4 TR_HAL_ADC_AIO7
58
59#define DEFAULT_ADC_PIN TR_HAL_ADC_AIO4
60
61// these are used to enable the AIO in the analog settings register
62#define TR_ADC_ENABLE_AIO4 0x10UL
63#define TR_ADC_ENABLE_AIO5 0x20UL
64#define TR_ADC_ENABLE_AIO6 0x40UL
65#define TR_ADC_ENABLE_AIO7 0x80UL
66
67
77#define CHIP_MEMORY_MAP_ADC_BASE (0xA0D00000UL)
78
79
85typedef struct
86{
87 __IO uint32_t ch_x_config; // 0x00
88 __IO uint32_t ch_x_burst; // 0x04
89 __IO uint32_t ch_x_threshholds; // 0x08
90 __IO uint32_t ch_x_reserved; // 0x0C
92
93
98typedef union tr_sadc_ana_set1_s
99{
101 {
102 uint32_t CFG_AUX_CMSEL : 4;
103 uint32_t CFG_AUX_COMP : 2;
105 uint32_t CFG_AUX_TEST_MODE : 1;
106 uint32_t CFG_AUX_VLDO : 2;
107 uint32_t CFG_AUX_CLK_SEL : 2;
108 uint32_t RESERVED1 : 4;
109 uint32_t CFG_AUX_PW : 6;
110 uint32_t RESERVED2 : 3;
111 uint32_t CFG_EN_CLKAUX : 1;
112 uint32_t RESERVED3 : 6;
114 uint32_t reg;
116
117
121typedef struct
122{
123 // enable, reset, and start control register
124 __IO uint32_t control_enable; // 0x00
125 __IO uint32_t control_reset; // 0x04
126 __IO uint32_t control_start; // 0x08
127
128 // settings
129 __IO uint32_t clock_settings; // 0x0C
130 __IO uint32_t oversample_settings; // 0x10
131
132 // reserved
133 __IO uint32_t reserved1[3]; // 0x14, 0x18, 0x1C
134
135 // there are 10 channels: 0 to 9
136 // each channel has 3 register fields, plus one reserved
137 // rather than have 40 fields for these, these are setup as an array
138 // for simpler code
139 //
140 // here is an example of CH 0 and CH 1 if we were doing individual fields:
141 // CH 0: configurations, burst mode, and monitor threshhold
142 // __IO uint32_t ch_0_config; // 0x20
143 // __IO uint32_t ch_0_burst; // 0x24
144 // __IO uint32_t ch_0_threshholds; // 0x28
145 // __IO uint32_t ch_0_reserved; // 0x2C
146
147 // CH 1: configurations, burst mode, and monitor threshhold
148 // __IO uint32_t ch_1_config; // 0x30
149 // __IO uint32_t ch_1_burst; // 0x34
150 // __IO uint32_t ch_1_threshholds; // 0x38
151 // __IO uint32_t ch_1_reserved; // 0x3C
152
153 // each of the 10 channels has 4 registers = 40 total
154 // CH 0: configurations (0x20), burst mode (0x24), and threshholds (0x28), rsvd (0x2C)
155 // CH 1: configurations (0x30), burst mode (0x34), and threshholds (0x38), rsvd (0x3C)
156 // CH 2: configurations (0x40), burst mode (0x44), and threshholds (0x48), rsvd (0x4C)
157 // CH 3: configurations (0x50), burst mode (0x54), and threshholds (0x58), rsvd (0x5C)
158 // CH 4: configurations (0x60), burst mode (0x64), and threshholds (0x68), rsvd (0x6C)
159 // CH 5: configurations (0x70), burst mode (0x74), and threshholds (0x78), rsvd (0x7C)
160 // CH 6: configurations (0x80), burst mode (0x84), and threshholds (0x88), rsvd (0x8C)
161 // CH 7: configurations (0x90), burst mode (0x94), and threshholds (0x98), rsvd (0x9C)
162 // CH 8: configurations (0xA0), burst mode (0xA4), and threshholds (0xA8), rsvd (0xAC)
163 // CH 9: configurations (0xB0), burst mode (0xB4), and threshholds (0xB8), rsvd (0xBC)
164
165 // here are the 10 channels, CHAN_SETTINGS_T is 4 x uint32_t
166 __IO CHAN_SETTINGS_T ch_x_setting[10]; // 0x20 - 0xBC
167
168 // analog AUX ADC settings
169 // unfortunately the first one overlaps with the reserved field of the prior channel
170 // we could pull that channel from the array but that makes everything harder.
171 // so we just #define analog_settings0 to the right address below. Right after these
172 // 2 fields we have a MASSIVE gap. so we weren't short on space.
173 //__IO uint32_t analog_settings0; // 0xBC
175
176 // reserved
177 __IO uint32_t reserved2[15]; // 0xC4 - 0xFC
178
179 // DMA: start, reset, buffer size, buffer addr
180 __IO uint32_t enable_dma; // 0x100
181 __IO uint32_t reset_dma; // 0x104
182 __IO uint32_t dma_buffer_size; // 0x108
183 __IO uint32_t dma_buffer_addr; // 0x10C
184 __IO uint32_t dma_reserved1; // 0x110
185 __IO uint32_t dma_next_ptr_addr; // 0x114
186 __IO uint32_t dma_status; // 0x118
187 __IO uint32_t dma_reserved2; // 0x11C
188
189 // interrupts
190 __IO uint32_t interrupt_clear; // 0x120
191 __IO uint32_t interrupt_enable; // 0x124
192 __IO uint32_t interrupt_status; // 0x128
193
194 // result
195 __IO uint32_t result_oversample; // 0x12C
196 __IO uint32_t result_digital; // 0x130
197 __IO uint32_t result_analog; // 0x134
198
200
201#define analog_settings0 ch_x_setting[9].ch_x_reserved
202
203
204// *****************************************************************
205// these defines help when dealing with the CONTROL ENABLE register (0x00)
206
207#define ADC_REG_ENABLE_ADC_DISABLE 0x000
208#define ADC_REG_ENABLE_ADC_ENABLE 0x001
209#define ADC_REG_ENABLE_FREE_RUN_CLOCK 0x100
210#define ADC_REG_ENABLE_FREE_RUN_ENGINE 0x200
211
212// *****************************************************************
213// these defines help when dealing with the CONTROL RESET register (0x04)
214
215#define ADC_REG_RESET_ADC 0x001
216#define ADC_REG_RESET_FIFO 0x100
217
218// *****************************************************************
219// these defines help when dealing with the CONTROL START register (0x08)
220
221#define ADC_REG_START_ADC 0x01
222
223// *****************************************************************
224// these defines help when dealing with the CLOCK SETTINGS register (0x0C)
225
226// bit 0 = sample rate mode
227#define ADC_REG_TIMER_RATE_DEPENDS_ON_SOFTWARE 0x00
228#define ADC_REG_TIMER_RATE_DEPENDS_ON_TIMER 0x01
229// bit 1 = timer clock source
230#define ADC_REG_TIMER_USE_SYSTEM_CLOCK 0x00
231#define ADC_REG_TIMER_USE_SLOW_CLOCK 0x02
232// bit 2 = clock phase
233#define ADC_REG_TIMER_RISING_EDGE 0x00
234#define ADC_REG_TIMER_FALLING_EDGE 0x04
235// bit 3 to 6 = debug selection
236#define ADC_REG_TIMER_DEBUG_MASK 0x78
237// bit 16 to 31 (high 2 bytes) = timer clock divider
238#define ADC_REG_TIMER_CLOCK_DIV_MASK 0xFFFF0000
239#define ADC_REG_TIMER_CLOCK_DIV_SHIFT 16
240// one is added to the value given before being used to divide the clock
241// smallest value is 2 which would be a clk div of 3
242// largest value is 65535 which would be a clk div of 65536
243#define TR_HAL_ADC_MAX_CLOCK_DIVISOR 65536
244#define TR_HAL_ADC_MIN_CLOCK_DIVISOR 3
245
246// *****************************************************************
247// these defines help when dealing with the OVERSAMPLE SETTINGS register (0x10)
248
249// bit 0 to 3 = output resolution (chip default 2)
250#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_8_BIT 0x00
251#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_10_BIT 0x01
252#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_12_BIT 0x02
253#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_14_BIT 0x03
254
255// bits 4 to 7 = channel select
256#define ADC_REG_SAMPLE_SELECT_CHANNEL_0 0x00
257#define ADC_REG_SAMPLE_SELECT_CHANNEL_1 0x10
258#define ADC_REG_SAMPLE_SELECT_CHANNEL_2 0x20
259#define ADC_REG_SAMPLE_SELECT_CHANNEL_3 0x30
260#define ADC_REG_SAMPLE_SELECT_CHANNEL_4 0x40
261#define ADC_REG_SAMPLE_SELECT_CHANNEL_5 0x50
262#define ADC_REG_SAMPLE_SELECT_CHANNEL_6 0x60
263#define ADC_REG_SAMPLE_SELECT_CHANNEL_7 0x70
264#define ADC_REG_SAMPLE_SELECT_CHANNEL_8 0x80
265#define ADC_REG_SAMPLE_SELECT_CHANNEL_9 0x90
266
267// bits 8 to 11 = oversample rate
281
282// bits 12-15 are for testing
283#define ADC_REG_SAMPLE_VALUE_BYPASS 0x1000
284#define ADC_REG_SAMPLE_MSB_BIT_INVERSION 0x2000
285#define ADC_REG_SAMPLE_ENABLE_MANUAL_MODE1 0x4000
286#define ADC_REG_SAMPLE_ENABLE_MANUAL_MODE2 0x8000
287
288// bits 16 to 27 = ADC adjust value, used for calibration
289#define ADC_REG_SAMPLE_CALIBRATION_MASK 0x0FFF0000
290
291
292// *****************************************************************
293// these defines help when dealing with the CH_X_CONFIG register (0x20, 0x30, 0x40...)
294
295// 4 bits (0 to 3) of the P-channel
296#define ADC_CONFIG_REG_P_CHANNEL_AIN_0 0x00000000
297#define ADC_CONFIG_REG_P_CHANNEL_AIN_1 0x00000001
298#define ADC_CONFIG_REG_P_CHANNEL_AIN_2 0x00000002
299#define ADC_CONFIG_REG_P_CHANNEL_AIN_3 0x00000003
300#define ADC_CONFIG_REG_P_CHANNEL_AIN_4 0x00000004
301#define ADC_CONFIG_REG_P_CHANNEL_AIN_5 0x00000005
302#define ADC_CONFIG_REG_P_CHANNEL_AIN_6 0x00000006
303#define ADC_CONFIG_REG_P_CHANNEL_AIN_7 0x00000007
304#define ADC_CONFIG_REG_P_CHANNEL_NONE 0x0000000B
305
306// 4 bits (4 to 7) of the N-channel
307#define ADC_CONFIG_REG_N_CHANNEL_AIN_0 0x00000000
308#define ADC_CONFIG_REG_N_CHANNEL_AIN_1 0x00000010
309#define ADC_CONFIG_REG_N_CHANNEL_AIN_2 0x00000020
310#define ADC_CONFIG_REG_N_CHANNEL_AIN_3 0x00000030
311#define ADC_CONFIG_REG_N_CHANNEL_AIN_4 0x00000040
312#define ADC_CONFIG_REG_N_CHANNEL_AIN_5 0x00000050
313#define ADC_CONFIG_REG_N_CHANNEL_AIN_6 0x00000060
314#define ADC_CONFIG_REG_N_CHANNEL_AIN_7 0x00000070
315#define ADC_CONFIG_REG_N_CHANNEL_NONE 0x000000B0
316
317// 6 bits of VGA gain (8 to 13)
318//
319// upper 2 bits get multiplied by 6 dB
320// max value of 3 -> 3 x 6 = 18
321//
322// lower 4 bits get multiplied by 3 dB
323// max value of 15 -> 15 x 3 = 45
324//
325// so max value is 45 + 18 = 63
326#define ADC_CONFIG_REG_MAX_GAIN_SETTING 63
327
328// default is 0x14 = 0b010100
329// upper 2 bits = 01 = 1 -> 1 x 6 dB = 6 dB
330// lower 4 bits = 0100 = 4 -> 4 x 3 dB = 12 dB
331// -> 6 dB + 12 dB = 18 dB
332#define ADC_CONFIG_REG_DEFAULT_GAIN 0x00001400
333
334// 2 bits of channel select (14 to 15)
335#define ADC_CONFIG_REG_SELECT_REF_IN 0x00004000
336
337// 4 bits of PULL (16 to 19)
338#define ADC_CONFIG_REG_P_CHAN_PULL_NONE 0x00000000
339#define ADC_CONFIG_REG_P_CHAN_PULL_HIGH 0x00010000
340#define ADC_CONFIG_REG_P_CHAN_PULL_LOW 0x00020000
341#define ADC_CONFIG_REG_P_CHAN_VCM_VOLTAGE 0x00030000
342
343#define ADC_CONFIG_REG_N_CHAN_PULL_NONE 0x00000000
344#define ADC_CONFIG_REG_N_CHAN_PULL_HIGH 0x00040000
345#define ADC_CONFIG_REG_N_CHAN_PULL_LOW 0x00080000
346#define ADC_CONFIG_REG_N_CHAN_VCM_VOLTAGE 0x000C0000
347
348// shortcut for setting both
349#define ADC_CONFIG_REG_PULL_NONE 0x00000000
350#define ADC_CONFIG_REG_PULL_VCM_MODE 0x000F0000
351
352
353// 20 to 23 reserved
354
355// 3 bits of result aquisition time (24 to 26)
356#define ADC_CONFIG_REG_AQUISITION_TIME_0p3_uS 0x00000000
357#define ADC_CONFIG_REG_AQUISITION_TIME_1_uS 0x01000000
358#define ADC_CONFIG_REG_AQUISITION_TIME_2_uS 0x02000000
359#define ADC_CONFIG_REG_AQUISITION_TIME_3_uS 0x03000000
360#define ADC_CONFIG_REG_AQUISITION_TIME_4_uS 0x04000000
361#define ADC_CONFIG_REG_AQUISITION_TIME_8_uS 0x05000000
362#define ADC_CONFIG_REG_AQUISITION_TIME_12_uS 0x06000000
363#define ADC_CONFIG_REG_AQUISITION_TIME_16_uS 0x07000000
364
365// 3 bits of end delay time (28 to 30)
366#define ADC_CONFIG_REG_END_DELAY_TIME_0p3_uS 0x00000000
367#define ADC_CONFIG_REG_END_DELAY_TIME_1_uS 0x10000000
368#define ADC_CONFIG_REG_END_DELAY_TIME_2_uS 0x20000000
369#define ADC_CONFIG_REG_END_DELAY_TIME_3_uS 0x30000000
370#define ADC_CONFIG_REG_END_DELAY_TIME_4_uS 0x40000000
371#define ADC_CONFIG_REG_END_DELAY_TIME_8_uS 0x50000000
372#define ADC_CONFIG_REG_END_DELAY_TIME_12_uS 0x60000000
373#define ADC_CONFIG_REG_END_DELAY_TIME_16_uS 0x70000000
374
375// use this when uninit a channel
376#define ADC_CONFIG_REG_CLEAR_VALUE 0x240000FF
377
378
379// *****************************************************************
380// these defines help when dealing with the CH_X_BURST register (0x24, 0x34, 0x44...)
381#define ADC_BURST_REG_DISABLE_BURST 0x00
382#define ADC_BURST_REG_ENABLE_BURST 0x01
383
384// *****************************************************************
385// these defines help when dealing with the CH_X_THRESHHOLD register (0x28, 0x38, 0x48...)
386// this register is 14 bits of low threshhold (bits 0-13)
387// and then 14 buts of high threshhold (bits 16-29)
388// basically the low 2 bytes is low TH and high 2 bytes is high TH but only uses 14 bits
389
390#define ADC_THRESHHOLD_LOW_DEFAULT 0x00000000
391#define ADC_THRESHHOLD_HIGH_DEFAULT 0x3FFF0000
392
393// *****************************************************************
394// these defines help when dealing with the ENABLE DMA register (0x100)
395#define ADC_ENDMA_REG_ENABLE_DMA 0x01
396
397// *****************************************************************
398// these defines help when dealing with the RESET DMA register (0x104)
399#define ADC_ENDMA_REG_RESET_DMA 0x01
400
401// *****************************************************************
402// these defines help when dealing with the INTERRUPT registers (0x120, 0x124, 0x128)
403#define TR_HAL_ADC_INTERRUPT_DMA 0x000001
404#define TR_HAL_ADC_INTERRUPT_DONE 0x000004
405#define TR_HAL_ADC_INTERRUPT_VALID 0x000008
406#define TR_HAL_ADC_INTERRUPT_MODE_DONE 0x000010
407#define TR_HAL_ADC_INTERRUPT_CHAN_0 0x040000
408#define TR_HAL_ADC_INTERRUPT_CHAN_1 0x080000
409#define TR_HAL_ADC_INTERRUPT_CHAN_2 0x100000
410#define TR_HAL_ADC_INTERRUPT_CHAN_3 0x200000
411
412#define TR_HAL_ADC_INTERRUPT_LOW_THRESH 0x0003FF00
413#define TR_HAL_ADC_INTERRUPT_HIGH_THRESH 0x0FFC0000
414
415#define TR_HAL_ADC_INTERRUPT_ALL 0x0FFFFF1D
416#define TR_HAL_ADC_INTERRUPT_BASE 0x0000001D
417
418// these are the events that can come back to the callback
419#define TR_HAL_ADC_EVENT_CH_0_RESULT 0x01
420#define TR_HAL_ADC_EVENT_CH_1_RESULT 0x02
421#define TR_HAL_ADC_EVENT_CH_2_RESULT 0x04
422#define TR_HAL_ADC_EVENT_CH_3_RESULT 0x08
423#define TR_HAL_ADC_EVENT_ALL_CH_DONE 0x10
424#define TR_HAL_ADC_EVENT_DMA 0x20
425
426// *****************************************************************
427// these defines help when dealing with the RESULT OVERSAMPLE register (0x12C)
428#define TR_HAL_ADC_R0_RESULT_MASK 0x00003FFF
429
430
431// *****************************************************************
432// these defines help when dealing with the RESULT DIGITAL and RESULT ANALOG register (0x130, 0x134)
433#define TR_HAL_ADC_R1_RESULT_MASK 0x00000FFF
434#define TR_HAL_ADC_R2_RESULT_MASK 0x00000FFF
435
436
437// *****************************************************************
438// this orients the ADC REGISTERS struct with the correct address
439// so referencing a field will now read/write the correct ADC
440// register chip address
441#define ADC_REGISTERS ((ADC_REGISTERS_T *) CHIP_MEMORY_MAP_ADC_BASE)
442
443
447typedef void (*tr_hal_adc_event_callback_t) (uint32_t raw_result,
448 uint32_t converted_result,
449 uint32_t event_bitmask,
450 uint32_t int_status);
451
452
463
464
476
477
481#define TR_HAL_ADC_DEFAULT_GAIN 18
482
483
495
496
500#define TR_HAL_ADC_THRESH_LOW_DEFAULT 0x0000
501#define TR_HAL_ADC_THRESH_HIGH_DEFAULT 0x3FFF
502
503
513
514
531
532
537typedef struct
538{
539 // pin(s) to use for the ADC
540 // use both pin P (positive) and pin N (negative) when using a differential signal
541 // use just pin P when using a single ended signal
544
545 // mode: one-shot, timer, or scan
547
548 // start immediately or not?
550
551 // resolution (8-bit, 10-bit, 12-bit, 14-bit)
553
554 // VGA gain, this must be in increments of 3 dB
556
557 // pull
560
561 // aquisition time and end delay time
564
565 // clock select and clock divider
568
569 // enable burst
571
572 // oversample setting
574
575 // threshhold: high and low (for scan mode)
578
579 // interrupts
582
583 // event callback from HAL to App when a reading is ready
584 // if the app doesn't want this, then set it to NULL
586
587 // these are for doing conversion of an ADC reading to uV
588 // the values could be pulled from NV from cal values
589 // or set constant if there isn't enough flux
595
597
598
604#define DEFAULT_ADC_SINGLE_ENDED_CONFIG \
605 { \
606 .adc_pin_p = (tr_hal_gpio_pin_t) { DEFAULT_ADC_PIN }, \
607 .adc_pin_n = (tr_hal_gpio_pin_t) { TR_HAL_PIN_NOT_SET }, \
608 .mode = TR_HAL_ADC_MODE_ONE_SHOT, \
609 .start_now = false, \
610 .resolution = TR_HAL_ADC_MODE_RESOLUTION_12_BIT, \
611 .vga_gain_in_dB = TR_HAL_ADC_DEFAULT_GAIN , \
612 .pin_p_pull_mode = TR_HAL_ADC_PULL_SINGLE_ENDED, \
613 .pin_n_pull_mode = TR_HAL_ADC_PULL_NOT_USED, \
614 .aquisition_time = TR_HAL_ADC_TIME_16, \
615 .end_delay_time = TR_HAL_ADC_TIME_16, \
616 .clock_to_use = TR_HAL_ADC_USE_SLOW_CLOCK, \
617 .clock_divider = 4, \
618 .enable_burst_mode = false, \
619 .oversample = TR_HAL_ADC_REG_SAMPLE_NO_OVERSAMPLE, \
620 .threshhold_low = TR_HAL_ADC_THRESH_LOW_DEFAULT, \
621 .threshhold_high = TR_HAL_ADC_THRESH_HIGH_DEFAULT, \
622 .interrupt_enabled = false, \
623 .interrupt_priority = TR_HAL_INTERRUPT_PRIORITY_5, \
624 .event_handler_fx = NULL, \
625 .enable_microvolt_conversion = true, \
626 .min_expected_adc_reading = 3900, \
627 .max_expected_adc_reading = 12500, \
628 .min_microvolt_value = 0, \
629 .max_microvolt_value = 3300000, \
630 }
631
635
636#endif // T32CM11_ADC_H_
This file contains the CHIP SPECIFIC types and defines for the T32CM11.
tr_hal_int_pri_t
values and a range checking function for setting the interrupt priority in the Trident HAL APIs
Definition tr_hal_platform.h:34
tr_hal_adc_clock_t
Definition T32CM11_adc.h:508
#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_12_BIT
Definition T32CM11_adc.h:252
#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_8_BIT
Definition T32CM11_adc.h:250
#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_14_BIT
Definition T32CM11_adc.h:253
void(* tr_hal_adc_event_callback_t)(uint32_t raw_result, uint32_t converted_result, uint32_t event_bitmask, uint32_t int_status)
Definition T32CM11_adc.h:447
tr_hal_adc_mode_t
Definition T32CM11_adc.h:457
tr_hal_adc_channel_id_t
Definition T32CM11_adc.h:33
tr_hal_adc_resolution_t
Definition T32CM11_adc.h:469
#define ADC_REG_SAMPLE_OUTPUT_RESOLUTION_10_BIT
Definition T32CM11_adc.h:251
union tr_sadc_ana_set1_s tr_sadc_ana_set1_t
tr_hal_adc_oversample_t
Definition T32CM11_adc.h:269
tr_hal_time_t
Definition T32CM11_adc.h:520
tr_hal_adc_pull_mode_t
Definition T32CM11_adc.h:488
@ TR_HAL_ADC_USE_SYSTEM_CLOCK
Definition T32CM11_adc.h:509
@ TR_HAL_ADC_USE_SLOW_CLOCK
Definition T32CM11_adc.h:510
@ TR_HAL_ADC_MODE_TIMER
Definition T32CM11_adc.h:459
@ TR_HAL_ADC_MODE_SCAN
Definition T32CM11_adc.h:460
@ TR_HAL_ADC_MODE_ONE_SHOT
Definition T32CM11_adc.h:458
@ ADC_CHANNEL_0_ID
Definition T32CM11_adc.h:34
@ ADC_CHANNEL_1_ID
Definition T32CM11_adc.h:35
@ ADC_CHANNEL_2_ID
Definition T32CM11_adc.h:36
@ ADC_CHANNEL_3_ID
Definition T32CM11_adc.h:37
@ TR_HAL_ADC_MODE_RESOLUTION_12_BIT
Definition T32CM11_adc.h:472
@ TR_HAL_ADC_MODE_RESOLUTION_10_BIT
Definition T32CM11_adc.h:471
@ TR_HAL_ADC_MODE_RESOLUTION_8_BIT
Definition T32CM11_adc.h:470
@ TR_HAL_ADC_MODE_RESOLUTION_14_BIT
Definition T32CM11_adc.h:473
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_128
Definition T32CM11_adc.h:277
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_8
Definition T32CM11_adc.h:273
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_16
Definition T32CM11_adc.h:274
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_256
Definition T32CM11_adc.h:278
@ TR_HAL_ADC_REG_SAMPLE_NO_OVERSAMPLE
Definition T32CM11_adc.h:270
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_4
Definition T32CM11_adc.h:272
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_32
Definition T32CM11_adc.h:275
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_2
Definition T32CM11_adc.h:271
@ TR_HAL_ADC_REG_SAMPLE_OVERSAMPLE_64
Definition T32CM11_adc.h:276
@ TR_HAL_ADC_TIME_16
Definition T32CM11_adc.h:528
@ TR_HAL_ADC_TIME_3
Definition T32CM11_adc.h:524
@ TR_HAL_ADC_TIME_2
Definition T32CM11_adc.h:523
@ TR_HAL_ADC_TIME_4
Definition T32CM11_adc.h:525
@ TR_HAL_ADC_TIME_1
Definition T32CM11_adc.h:522
@ TR_HAL_ADC_TIME_12
Definition T32CM11_adc.h:527
@ TR_HAL_ADC_TIME_8
Definition T32CM11_adc.h:526
@ TR_HAL_ADC_TIME_HALF
Definition T32CM11_adc.h:521
@ TR_HAL_ADC_PULL_LOW
Definition T32CM11_adc.h:489
@ TR_HAL_ADC_PULL_NOT_USED
Definition T32CM11_adc.h:492
@ TR_HAL_ADC_PULL_SINGLE_ENDED
Definition T32CM11_adc.h:491
@ TR_HAL_ADC_PULL_HIGH
Definition T32CM11_adc.h:490
tr_hal_adc_clock_t
Definition T32CZ20_adc.h:646
void(* tr_hal_adc_event_callback_t)(uint32_t raw_result, uint32_t converted_result, uint32_t event_bitmask, uint32_t int_status)
Definition T32CZ20_adc.h:584
tr_hal_adc_mode_t
Definition T32CZ20_adc.h:594
tr_hal_adc_resolution_t
Definition T32CZ20_adc.h:606
union tr_sadc_ana_set1_s tr_sadc_ana_set1_t
tr_hal_adc_oversample_t
Definition T32CZ20_adc.h:368
tr_hal_time_t
Definition T32CZ20_adc.h:657
tr_hal_adc_pull_mode_t
Definition T32CZ20_adc.h:625
the struct we use so we can address registers using field names
Definition T32CM11_adc.h:122
__IO uint32_t dma_next_ptr_addr
Definition T32CM11_adc.h:185
__IO uint32_t reserved2[15]
Definition T32CM11_adc.h:177
__IO uint32_t dma_reserved1
Definition T32CM11_adc.h:184
__IO uint32_t interrupt_enable
Definition T32CM11_adc.h:191
__IO uint32_t result_oversample
Definition T32CM11_adc.h:195
__IO uint32_t control_start
Definition T32CM11_adc.h:126
__IO uint32_t dma_reserved2
Definition T32CM11_adc.h:187
__IO uint32_t oversample_settings
Definition T32CM11_adc.h:130
__IO tr_sadc_ana_set1_t analog_settings1
Definition T32CM11_adc.h:174
__IO CHAN_SETTINGS_T ch_x_setting[10]
Definition T32CM11_adc.h:166
__IO uint32_t dma_buffer_addr
Definition T32CM11_adc.h:183
__IO uint32_t control_reset
Definition T32CM11_adc.h:125
__IO uint32_t reset_dma
Definition T32CM11_adc.h:181
__IO uint32_t interrupt_status
Definition T32CM11_adc.h:192
__IO uint32_t dma_buffer_size
Definition T32CM11_adc.h:182
__IO uint32_t clock_settings
Definition T32CM11_adc.h:129
__IO uint32_t reserved1[3]
Definition T32CM11_adc.h:133
__IO uint32_t dma_status
Definition T32CM11_adc.h:186
__IO uint32_t interrupt_clear
Definition T32CM11_adc.h:190
__IO uint32_t result_digital
Definition T32CM11_adc.h:196
__IO uint32_t result_analog
Definition T32CM11_adc.h:197
__IO uint32_t enable_dma
Definition T32CM11_adc.h:180
__IO uint32_t control_enable
Definition T32CM11_adc.h:124
Definition T32CM11_adc.h:86
__IO uint32_t ch_x_burst
Definition T32CM11_adc.h:88
__IO uint32_t ch_x_reserved
Definition T32CM11_adc.h:90
__IO uint32_t ch_x_threshholds
Definition T32CM11_adc.h:89
__IO uint32_t ch_x_config
Definition T32CM11_adc.h:87
Definition T32CM11_adc.h:538
uint16_t threshhold_high
Definition T32CM11_adc.h:577
tr_hal_adc_pull_mode_t pin_n_pull_mode
Definition T32CM11_adc.h:559
uint16_t vga_gain_in_dB
Definition T32CM11_adc.h:555
tr_hal_adc_pull_mode_t pin_p_pull_mode
Definition T32CM11_adc.h:558
uint32_t clock_divider
Definition T32CM11_adc.h:567
uint16_t threshhold_low
Definition T32CM11_adc.h:576
tr_hal_gpio_pin_t adc_pin_n
Definition T32CM11_adc.h:543
tr_hal_adc_mode_t mode
Definition T32CM11_adc.h:546
tr_hal_adc_event_callback_t event_handler_fx
Definition T32CM11_adc.h:585
tr_hal_int_pri_t interrupt_priority
Definition T32CM11_adc.h:581
tr_hal_time_t end_delay_time
Definition T32CM11_adc.h:563
tr_hal_time_t aquisition_time
Definition T32CM11_adc.h:562
bool start_now
Definition T32CM11_adc.h:549
bool enable_microvolt_conversion
Definition T32CM11_adc.h:590
uint32_t min_microvolt_value
Definition T32CM11_adc.h:593
bool enable_burst_mode
Definition T32CM11_adc.h:570
tr_hal_adc_oversample_t oversample
Definition T32CM11_adc.h:573
bool interrupt_enabled
Definition T32CM11_adc.h:580
uint32_t min_expected_adc_reading
Definition T32CM11_adc.h:591
uint32_t max_microvolt_value
Definition T32CM11_adc.h:594
uint32_t max_expected_adc_reading
Definition T32CM11_adc.h:592
tr_hal_adc_resolution_t resolution
Definition T32CM11_adc.h:552
tr_hal_adc_clock_t clock_to_use
Definition T32CM11_adc.h:566
tr_hal_gpio_pin_t adc_pin_p
Definition T32CM11_adc.h:542
pin type
Definition tr_hal_platform.h:23
Definition T32CM11_adc.h:101
uint32_t CFG_AUX_CLK_SEL
Definition T32CM11_adc.h:107
uint32_t CFG_AUX_COMP
Definition T32CM11_adc.h:103
uint32_t CFG_AUX_PW
Definition T32CM11_adc.h:109
uint32_t RESERVED3
Definition T32CM11_adc.h:112
uint32_t CFG_AUX_TEST_MODE
Definition T32CM11_adc.h:105
uint32_t RESERVED2
Definition T32CM11_adc.h:110
uint32_t CFG_AUX_CMSEL
Definition T32CM11_adc.h:102
uint32_t CFG_EN_CLKAUX
Definition T32CM11_adc.h:111
uint32_t RESERVED1
Definition T32CM11_adc.h:108
uint32_t CFG_AUX_ADC_OUTPUTSTB
Definition T32CM11_adc.h:104
uint32_t CFG_AUX_VLDO
Definition T32CM11_adc.h:106
Definition T32CM11_adc.h:99
uint32_t reg
Definition T32CM11_adc.h:114
struct tr_sadc_ana_set1_s::tr_sadc_ana_set1_b bit