31#ifndef LIBOPENCM3_ADC_H
32#define LIBOPENCM3_ADC_H
52#define ADC_GCOMP(adc) MMIO32((adc) + 0xC0)
57#define ADC_CR_DEEPPWD (1 << 29)
60#define ADC_CR_ADVREGEN (1 << 28)
65#define ADC_CFGR1_ALIGN (1 << 15)
68#define ADC_CFGR1_EXTSEL_SHIFT 5
69#define ADC_CFGR1_EXTSEL_MASK (0x1f << ADC_CFGR1_EXTSEL_SHIFT)
70#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
73#define ADC12_CFGR1_EXTSEL_TIM1_CC1 ADC_CFGR1_EXTSEL_VAL(0)
74#define ADC12_CFGR1_EXTSEL_TIM1_CC2 ADC_CFGR1_EXTSEL_VAL(1)
75#define ADC12_CFGR1_EXTSEL_TIM1_CC3 ADC_CFGR1_EXTSEL_VAL(2)
76#define ADC12_CFGR1_EXTSEL_TIM2_CC2 ADC_CFGR1_EXTSEL_VAL(3)
77#define ADC12_CFGR1_EXTSEL_TIM3_TRGO ADC_CFGR1_EXTSEL_VAL(4)
78#define ADC12_CFGR1_EXTSEL_TIM4_CC4 ADC_CFGR1_EXTSEL_VAL(5)
79#define ADC12_CFGR1_EXTSEL_EXTI11 ADC_CFGR1_EXTSEL_VAL(6)
80#define ADC12_CFGR1_EXTSEL_TIM8_TRGO ADC_CFGR1_EXTSEL_VAL(7)
81#define ADC12_CFGR1_EXTSEL_TIM8_TRGO2 ADC_CFGR1_EXTSEL_VAL(8)
82#define ADC12_CFGR1_EXTSEL_TIM1_TRGO ADC_CFGR1_EXTSEL_VAL(9)
83#define ADC12_CFGR1_EXTSEL_TIM1_TRGO2 ADC_CFGR1_EXTSEL_VAL(10)
84#define ADC12_CFGR1_EXTSEL_TIM2_TRGO ADC_CFGR1_EXTSEL_VAL(11)
85#define ADC12_CFGR1_EXTSEL_TIM4_TRGO ADC_CFGR1_EXTSEL_VAL(12)
86#define ADC12_CFGR1_EXTSEL_TIM6_TRGO ADC_CFGR1_EXTSEL_VAL(13)
87#define ADC12_CFGR1_EXTSEL_TIM15_TRGO ADC_CFGR1_EXTSEL_VAL(14)
88#define ADC12_CFGR1_EXTSEL_TIM3_CC4 ADC_CFGR1_EXTSEL_VAL(15)
89#define ADC12_CFGR1_EXTSEL_TIM20_TRGO ADC_CFGR1_EXTSEL_VAL(16)
90#define ADC12_CFGR1_EXTSEL_TIM20_TRGO2 ADC_CFGR1_EXTSEL_VAL(17)
91#define ADC12_CFGR1_EXTSEL_TIM20_CC1 ADC_CFGR1_EXTSEL_VAL(18)
92#define ADC12_CFGR1_EXTSEL_TIM20_CC2 ADC_CFGR1_EXTSEL_VAL(19)
93#define ADC12_CFGR1_EXTSEL_TIM20_CC3 ADC_CFGR1_EXTSEL_VAL(20)
94#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG1 ADC_CFGR1_EXTSEL_VAL(21)
95#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG3 ADC_CFGR1_EXTSEL_VAL(22)
96#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG5 ADC_CFGR1_EXTSEL_VAL(23)
97#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG6 ADC_CFGR1_EXTSEL_VAL(24)
98#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG7 ADC_CFGR1_EXTSEL_VAL(25)
99#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG8 ADC_CFGR1_EXTSEL_VAL(26)
100#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG9 ADC_CFGR1_EXTSEL_VAL(27)
101#define ADC12_CFGR1_EXTSEL_HRTIM_ADC_TRG10 ADC_CFGR1_EXTSEL_VAL(28)
102#define ADC12_CFGR1_EXTSEL_LPTIMOUT ADC_CFGR1_EXTSEL_VAL(29)
103#define ADC12_CFGR1_EXTSEL_TIM7_TRGO ADC_CFGR1_EXTSEL_VAL(30)
105#define ADC345_CFGR1_EXTSEL_TIM3_CC1 ADC_CFGR1_EXTSEL_VAL(0)
106#define ADC345_CFGR1_EXTSEL_TIM2_CC3 ADC_CFGR1_EXTSEL_VAL(1)
107#define ADC345_CFGR1_EXTSEL_TIM1_CC3 ADC_CFGR1_EXTSEL_VAL(2)
108#define ADC345_CFGR1_EXTSEL_TIM8_CC1 ADC_CFGR1_EXTSEL_VAL(3)
109#define ADC345_CFGR1_EXTSEL_TIM3_TRGO ADC_CFGR1_EXTSEL_VAL(4)
110#define ADC345_CFGR1_EXTSEL_EXTI2 ADC_CFGR1_EXTSEL_VAL(5)
111#define ADC345_CFGR1_EXTSEL_TIM4_CC1 ADC_CFGR1_EXTSEL_VAL(6)
112#define ADC345_CFGR1_EXTSEL_TIM8_TRGO ADC_CFGR1_EXTSEL_VAL(7)
113#define ADC345_CFGR1_EXTSEL_TIM8_TRGO2 ADC_CFGR1_EXTSEL_VAL(8)
114#define ADC345_CFGR1_EXTSEL_TIM1_TRGO ADC_CFGR1_EXTSEL_VAL(9)
115#define ADC345_CFGR1_EXTSEL_TIM1_TRGO2 ADC_CFGR1_EXTSEL_VAL(10)
116#define ADC345_CFGR1_EXTSEL_TIM2_TRGO ADC_CFGR1_EXTSEL_VAL(11)
117#define ADC345_CFGR1_EXTSEL_TIM4_TRGO ADC_CFGR1_EXTSEL_VAL(12)
118#define ADC345_CFGR1_EXTSEL_TIM6_TRGO ADC_CFGR1_EXTSEL_VAL(13)
119#define ADC345_CFGR1_EXTSEL_TIM15_TRGO ADC_CFGR1_EXTSEL_VAL(14)
120#define ADC345_CFGR1_EXTSEL_TIM2_CC1 ADC_CFGR1_EXTSEL_VAL(15)
121#define ADC345_CFGR1_EXTSEL_TIM20_TRGO ADC_CFGR1_EXTSEL_VAL(16)
122#define ADC345_CFGR1_EXTSEL_TIM20_TRGO2 ADC_CFGR1_EXTSEL_VAL(17)
123#define ADC345_CFGR1_EXTSEL_TIM20_CC1 ADC_CFGR1_EXTSEL_VAL(18)
124#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG2 ADC_CFGR1_EXTSEL_VAL(19)
125#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG4 ADC_CFGR1_EXTSEL_VAL(20)
126#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG1 ADC_CFGR1_EXTSEL_VAL(21)
127#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG3 ADC_CFGR1_EXTSEL_VAL(22)
128#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG5 ADC_CFGR1_EXTSEL_VAL(23)
129#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG6 ADC_CFGR1_EXTSEL_VAL(24)
130#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG7 ADC_CFGR1_EXTSEL_VAL(25)
131#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG8 ADC_CFGR1_EXTSEL_VAL(26)
132#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG9 ADC_CFGR1_EXTSEL_VAL(27)
133#define ADC345_CFGR1_EXTSEL_HRTIM_ADC_TRG10 ADC_CFGR1_EXTSEL_VAL(28)
134#define ADC345_CFGR1_EXTSEL_LPTIMOUT ADC_CFGR1_EXTSEL_VAL(29)
135#define ADC345_CFGR1_EXTSEL_TIM7_TRGO ADC_CFGR1_EXTSEL_VAL(30)
140#define ADC_CFGR2_ROVSE (1 << 0)
143#define ADC_CFGR2_JOVSE (1 << 1)
146#define ADC_CFGR2_OVSR_SHIFT 2
147#define ADC_CFGR2_OVSR_MASK (0x7 << ADC_CFGR2_OVSR_SHIFT)
148#define ADC_CFGR2_OVSR_VAL(x) ((x) << ADC_CFGR2_OVSR_SHIFT)
150#define ADC_CFGR2_OVSR_2x ADC_CFGR2_OVSR_VAL(0)
151#define ADC_CFGR2_OVSR_4x ADC_CFGR2_OVSR_VAL(1)
152#define ADC_CFGR2_OVSR_8x ADC_CFGR2_OVSR_VAL(2)
153#define ADC_CFGR2_OVSR_16x ADC_CFGR2_OVSR_VAL(3)
154#define ADC_CFGR2_OVSR_32x ADC_CFGR2_OVSR_VAL(4)
155#define ADC_CFGR2_OVSR_64x ADC_CFGR2_OVSR_VAL(5)
156#define ADC_CFGR2_OVSR_128x ADC_CFGR2_OVSR_VAL(6)
157#define ADC_CFGR2_OVSR_256x ADC_CFGR2_OVSR_VAL(7)
160#define ADC_CFGR2_OVSS_SHIFT 5
161#define ADC_CFGR2_OVSS_MASK (0xf << ADC_CFGR2_OVSS_SHIFT)
162#define ADC_CFGR2_OVSS_VAL(x) ((x) << ADC_CFGR2_OVSS_SHIFT)
165#define ADC_CFGR2_TROVS (1 << 9)
168#define ADC_CFGR2_ROVSM (1 << 10)
171#define ADC_CFGR2_GCOMP (1 << 16)
174#define ADC_CFGR2_SWTRIG (1 << 25)
177#define ADC_CFGR2_BULB (1 << 26)
180#define ADC_CFGR2_SMPTRIG (1 << 27)
188#define ADC_SMPR_SMP_2DOT5CYC 0x0
189#define ADC_SMPR_SMP_6DOT5CYC 0x1
190#define ADC_SMPR_SMP_12DOT5CYC 0x2
191#define ADC_SMPR_SMP_24DOT5CYC 0x3
192#define ADC_SMPR_SMP_47DOT5CYC 0x4
193#define ADC_SMPR_SMP_92DOT5CYC 0x5
194#define ADC_SMPR_SMP_247DOT5CYC 0x6
195#define ADC_SMPR_SMP_640DOT5CYC 0x7
197#define ADC_SMPR1_SMP_PLUSONE (1 << 31)
224#define ADC_JSQR_JL_LSB 0
225#define ADC_JSQR_JL_SHIFT 0
226#define ADC_JSQR_JSQ4_LSB 27
227#define ADC_JSQR_JSQ3_LSB 21
228#define ADC_JSQR_JSQ2_LSB 15
229#define ADC_JSQR_JSQ1_LSB 9
231#define ADC_JSQR_JSQ_VAL(n, val) ((val) << (((n) - 1) * 6 + 8))
232#define ADC_JSQR_JL_VAL(val) (((val) - 1) << ADC_JSQR_JL_SHIFT)
246#define ADC_JSQR_JEXTEN_DISABLED (0x0 << 7)
247#define ADC_JSQR_JEXTEN_RISING_EDGE (0x1 << 7)
248#define ADC_JSQR_JEXTEN_FALLING_EDGE (0x2 << 7)
249#define ADC_JSQR_JEXTEN_BOTH_EDGES (0x3 << 7)
251#define ADC_JSQR_JEXTEN_MASK (0x3 << 7)
254#define ADC_JSQR_JEXTSEL_SHIFT 2
256#define ADC12_JSQR_JEXTSEL_TIM1_TRGO (0 << ADC_JSQR_JEXTSEL_SHIFT)
257#define ADC12_JSQR_JEXTSEL_TIM1_CC4 (1 << ADC_JSQR_JEXTSEL_SHIFT)
258#define ADC12_JSQR_JEXTSEL_TIM2_TRGO (2 << ADC_JSQR_JEXTSEL_SHIFT)
259#define ADC12_JSQR_JEXTSEL_TIM2_CC1 (3 << ADC_JSQR_JEXTSEL_SHIFT)
260#define ADC12_JSQR_JEXTSEL_TIM3_CC4 (4 << ADC_JSQR_JEXTSEL_SHIFT)
261#define ADC12_JSQR_JEXTSEL_TIM4_TRGO (5 << ADC_JSQR_JEXTSEL_SHIFT)
262#define ADC12_JSQR_JEXTSEL_EXTI15 (6 << ADC_JSQR_JEXTSEL_SHIFT)
263#define ADC12_JSQR_JEXTSEL_TIM8_CC4 (7 << ADC_JSQR_JEXTSEL_SHIFT)
264#define ADC12_JSQR_JEXTSEL_TIM1_TRGO2 (8 << ADC_JSQR_JEXTSEL_SHIFT)
265#define ADC12_JSQR_JEXTSEL_TIM8_TRGO (9 << ADC_JSQR_JEXTSEL_SHIFT)
266#define ADC12_JSQR_JEXTSEL_TIM8_TRGO2 (10 << ADC_JSQR_JEXTSEL_SHIFT)
267#define ADC12_JSQR_JEXTSEL_TIM3_CC3 (11 << ADC_JSQR_JEXTSEL_SHIFT)
268#define ADC12_JSQR_JEXTSEL_TIM3_TRGO (12 << ADC_JSQR_JEXTSEL_SHIFT)
269#define ADC12_JSQR_JEXTSEL_TIM3_CC1 (13 << ADC_JSQR_JEXTSEL_SHIFT)
270#define ADC12_JSQR_JEXTSEL_TIM6_TRGO (14 << ADC_JSQR_JEXTSEL_SHIFT)
271#define ADC12_JSQR_JEXTSEL_TIM15_TRGO (15 << ADC_JSQR_JEXTSEL_SHIFT)
272#define ADC12_JSQR_JEXTSEL_TIM20_TRGO (16 << ADC_JSQR_JEXTSEL_SHIFT)
273#define ADC12_JSQR_JEXTSEL_TIM20_TRGO2 (17 << ADC_JSQR_JEXTSEL_SHIFT)
274#define ADC12_JSQR_JEXTSEL_TIM20_CC4 (18 << ADC_JSQR_JEXTSEL_SHIFT)
275#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG2 (19 << ADC_JSQR_JEXTSEL_SHIFT)
276#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG4 (20 << ADC_JSQR_JEXTSEL_SHIFT)
277#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG5 (21 << ADC_JSQR_JEXTSEL_SHIFT)
278#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG6 (22 << ADC_JSQR_JEXTSEL_SHIFT)
279#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG7 (23 << ADC_JSQR_JEXTSEL_SHIFT)
280#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG8 (24 << ADC_JSQR_JEXTSEL_SHIFT)
281#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG9 (25 << ADC_JSQR_JEXTSEL_SHIFT)
282#define ADC12_JSQR_JEXTSEL_HRTIM_ADC_TRG10 (26 << ADC_JSQR_JEXTSEL_SHIFT)
283#define ADC12_JSQR_JEXTSEL_TIM16_CC1 (27 << ADC_JSQR_JEXTSEL_SHIFT)
284#define ADC12_JSQR_JEXTSEL_LPTIMOUT (29 << ADC_JSQR_JEXTSEL_SHIFT)
285#define ADC12_JSQR_JEXTSEL_TIM7_TRGO (30 << ADC_JSQR_JEXTSEL_SHIFT)
287#define ADC345_JSQR_JEXTSEL_TIM1_TRGO (0 << ADC_JSQR_JEXTSEL_SHIFT)
288#define ADC345_JSQR_JEXTSEL_TIM1_CC4 (1 << ADC_JSQR_JEXTSEL_SHIFT)
289#define ADC345_JSQR_JEXTSEL_TIM2_TRGO (2 << ADC_JSQR_JEXTSEL_SHIFT)
290#define ADC345_JSQR_JEXTSEL_TIM8_CC2 (3 << ADC_JSQR_JEXTSEL_SHIFT)
291#define ADC345_JSQR_JEXTSEL_TIM4_CC3 (4 << ADC_JSQR_JEXTSEL_SHIFT)
292#define ADC345_JSQR_JEXTSEL_TIM4_TRGO (5 << ADC_JSQR_JEXTSEL_SHIFT)
293#define ADC345_JSQR_JEXTSEL_TIM4_CC4 (6 << ADC_JSQR_JEXTSEL_SHIFT)
294#define ADC345_JSQR_JEXTSEL_TIM8_CC4 (7 << ADC_JSQR_JEXTSEL_SHIFT)
295#define ADC345_JSQR_JEXTSEL_TIM1_TRGO2 (8 << ADC_JSQR_JEXTSEL_SHIFT)
296#define ADC345_JSQR_JEXTSEL_TIM8_TRGO (9 << ADC_JSQR_JEXTSEL_SHIFT)
297#define ADC345_JSQR_JEXTSEL_TIM8_TRGO2 (10 << ADC_JSQR_JEXTSEL_SHIFT)
298#define ADC345_JSQR_JEXTSEL_TIM1_CC3 (11 << ADC_JSQR_JEXTSEL_SHIFT)
299#define ADC345_JSQR_JEXTSEL_TIM3_TRGO (12 << ADC_JSQR_JEXTSEL_SHIFT)
300#define ADC345_JSQR_JEXTSEL_EXTI3 (13 << ADC_JSQR_JEXTSEL_SHIFT)
301#define ADC345_JSQR_JEXTSEL_TIM6_TRGO (14 << ADC_JSQR_JEXTSEL_SHIFT)
302#define ADC345_JSQR_JEXTSEL_TIM15_TRGO (15 << ADC_JSQR_JEXTSEL_SHIFT)
303#define ADC345_JSQR_JEXTSEL_TIM20_TRGO (16 << ADC_JSQR_JEXTSEL_SHIFT)
304#define ADC345_JSQR_JEXTSEL_TIM20_TRGO2 (17 << ADC_JSQR_JEXTSEL_SHIFT)
305#define ADC345_JSQR_JEXTSEL_TIM20_CC2 (18 << ADC_JSQR_JEXTSEL_SHIFT)
306#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG2 (19 << ADC_JSQR_JEXTSEL_SHIFT)
307#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG4 (20 << ADC_JSQR_JEXTSEL_SHIFT)
308#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG5 (21 << ADC_JSQR_JEXTSEL_SHIFT)
309#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG6 (22 << ADC_JSQR_JEXTSEL_SHIFT)
310#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG7 (23 << ADC_JSQR_JEXTSEL_SHIFT)
311#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG8 (24 << ADC_JSQR_JEXTSEL_SHIFT)
312#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG9 (25 << ADC_JSQR_JEXTSEL_SHIFT)
313#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG10 (26 << ADC_JSQR_JEXTSEL_SHIFT)
314#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG1 (27 << ADC_JSQR_JEXTSEL_SHIFT)
315#define ADC345_JSQR_JEXTSEL_HRTIM_ADC_TRG3 (28 << ADC_JSQR_JEXTSEL_SHIFT)
316#define ADC345_JSQR_JEXTSEL_LPTIMOUT (29 << ADC_JSQR_JEXTSEL_SHIFT)
317#define ADC345_JSQR_JEXTSEL_TIM7_TRGO (30 << ADC_JSQR_JEXTSEL_SHIFT)
319#define ADC_JSQR_JEXTSEL_MASK (0x1F << ADC_JSQR_JEXTSEL_SHIFT)
322#define ADC_JSQR_JL_1_CONVERSION (0x0 << 0)
323#define ADC_JSQR_JL_2_CONVERSIONS (0x1 << 0)
324#define ADC_JSQR_JL_3_CONVERSIONS (0x2 << 0)
325#define ADC_JSQR_JL_4_CONVERSIONS (0x3 << 0)
330#define ADC_OFR1_OFFSET1_EN (1 << 31)
343#define ADC_OFR2_OFFSET2_EN (1 << 31)
356#define ADC_OFR3_OFFSET3_EN (1 << 31)
369#define ADC_OFR4_OFFSET4_EN (1 << 31)
396#define ADC_CSR_JQOVF_SLV (1 << 26)
399#define ADC_CSR_AWD3_SLV (1 << 25)
402#define ADC_CSR_AWD2_SLV (1 << 24)
405#define ADC_CSR_AWD1_SLV (1 << 23)
408#define ADC_CSR_JEOS_SLV (1 << 22)
411#define ADC_CSR_JEOC_SLV (1 << 21)
414#define ADC_CSR_OVR_SLV (1 << 20)
417#define ADC_CSR_EOS_SLV (1 << 19)
420#define ADC_CSR_EOC_SLV (1 << 18)
423#define ADC_CSR_EOSMP_SLV (1 << 17)
426#define ADC_CSR_ADRDY_SLV (1 << 16)
429#define ADC_CSR_JQOVF_MST (1 << 10)
432#define ADC_CSR_AWD3_MST (1 << 9)
435#define ADC_CSR_AWD2_MST (1 << 8)
438#define ADC_CSR_AWD1_MST (1 << 7)
441#define ADC_CSR_JEOS_MST (1 << 6)
444#define ADC_CSR_JEOC_MST (1 << 5)
447#define ADC_CSR_OVR_MST (1 << 4)
450#define ADC_CSR_EOS_MST (1 << 3)
453#define ADC_CSR_EOC_MST (1 << 2)
456#define ADC_CSR_EOSMP_MST (1 << 1)
459#define ADC_CSR_ADRDY_MST (1 << 0)
465#define ADC_CCR_PRESC_MASK (0xf)
466#define ADC_CCR_PRESC_SHIFT (18)
469#define ADC_CCR_PRESC_NODIV (0x0)
470#define ADC_CCR_PRESC_DIV2 (0x1)
471#define ADC_CCR_PRESC_DIV4 (0x2)
472#define ADC_CCR_PRESC_DIV6 (0x3)
473#define ADC_CCR_PRESC_DIV8 (0x4)
474#define ADC_CCR_PRESC_DIV10 (0x5)
475#define ADC_CCR_PRESC_DIV12 (0x6)
476#define ADC_CCR_PRESC_DIV16 (0x7)
477#define ADC_CCR_PRESC_DIV32 (0x8)
478#define ADC_CCR_PRESC_DIV64 (0x9)
479#define ADC_CCR_PRESC_DIV128 (0xa)
480#define ADC_CCR_PRESC_DIV256 (0xb)
484#define ADC_CCR_CKMODE_CKX (0x0 << 16)
485#define ADC_CCR_CKMODE_DIV1 (0x1 << 16)
486#define ADC_CCR_CKMODE_DIV2 (0x2 << 16)
487#define ADC_CCR_CKMODE_DIV4 (0x3 << 16)
489#define ADC_CCR_CKMODE_MASK (0x3 << 16)
492#define ADC_CCR_MDMA_DISABLE (0x0 << 14)
494#define ADC_CCR_MDMA_12_10_BIT (0x2 << 14)
495#define ADC_CCR_MDMA_8_6_BIT (0x3 << 14)
498#define ADC_CCR_DMACFG (1 << 13)
501#define ADC_CCR_DELAY_SHIFT 8
513#define ADC_CCR_DUAL_INDEPENDENT 0x0
520#define ADC_CCR_DUAL_REG_SIMUL_AND_INJECTED_SIMUL 0x1
525#define ADC_CCR_DUAL_REG_SIMUL_AND_ALTERNATE_TRIG 0x2
530#define ADC_CCR_DUAL_REG_INTERLEAVED_AND_INJECTED_SIMUL 0x3
533#define ADC_CCR_DUAL_INJECTED_SIMUL 0x5
535#define ADC_CCR_DUAL_REGULAR_SIMUL 0x6
537#define ADC_CCR_DUAL_INTERLEAVED 0x7
539#define ADC_CCR_DUAL_ALTERNATE_TRIG 0x9
542#define ADC_CCR_DUAL_MASK (0x1f)
543#define ADC_CCR_DUAL_SHIFT 0
556#define ADC_CHANNEL_TEMP 16
557#define ADC_CHANNEL_VBAT 17
558#define ADC_CHANNEL_VREF 18
561#define ADC_CHANNEL_COUNT 19
562#define ADC_CHANNEL_IS_FAST(x) ((x) <= 5)
void adc_disable_automatic_injected_group_conversion(uint32_t adc)
ADC Disable Automatic Injected Conversions.
void adc_set_watchdog_high_threshold(uint32_t adc, uint16_t threshold)
ADC Set Analog Watchdog Upper Threshold.
void adc_enable_discontinuous_mode_injected(uint32_t adc)
ADC Enable Discontinuous Mode for Injected Conversions.
void adc_disable_eos_interrupt(uint32_t adc)
ADC Disable Regular End-Of-Sequence Interrupt.
void adc_disable_discontinuous_mode_regular(uint32_t adc)
ADC Disable Discontinuous Mode for Regular Conversions.
void adc_enable_all_awd_interrupt(uint32_t adc)
ADC Enable Analog Watchdog Interrupt.
void adc_disable_deeppwd(uint32_t adc)
ADC Disable Deep-Power-Down Mdoe.
void adc_enable_eos_interrupt(uint32_t adc)
ADC Enable Regular End-Of-Sequence Interrupt.
void adc_start_conversion_injected(uint32_t adc)
ADC Software Triggered Conversion on Injected Channels.
void adc_enable_discontinuous_mode_regular(uint32_t adc, uint8_t length)
ADC Enable Discontinuous Mode for Regular Conversions.
void adc_disable_eoc_interrupt_injected(uint32_t adc)
ADC Disable Injected End-Of-Conversion Interrupt.
void adc_set_injected_sequence(uint32_t adc, uint8_t length, uint8_t channel[])
ADC Set an Injected Channel Conversion Sequence.
void adc_enable_deeppwd(uint32_t adc)
ADC Enable Deep-Power-Down Mdoe.
void adc_enable_analog_watchdog_on_all_channels(uint32_t adc)
ADC Enable Analog Watchdog for All Regular and/or Injected Channels.
void adc_enable_external_trigger_regular(uint32_t adc, uint32_t trigger, uint32_t polarity)
ADC Enable an External Trigger for Regular Channels.
void adc_disable_all_awd_interrupt(uint32_t adc)
ADC Disable Analog Watchdog Interrupt.
void adc_enable_external_trigger_injected(uint32_t adc, uint32_t trigger, uint32_t polarity)
ADC Enable an External Trigger for Injected Channels.
void adc_disable_external_trigger_injected(uint32_t adc)
ADC Disable an External Trigger for Injected Channels.
void adc_enable_eos_interrupt_injected(uint32_t adc)
ADC Enable Injected End-Of-Sequence Interrupt.
void adc_enable_automatic_injected_group_conversion(uint32_t adc)
ADC Enable Automatic Injected Conversions.
void adc_set_clk_prescale(uint32_t adc, uint32_t prescale)
ADC Set Clock Prescale.
void adc_set_multi_mode(uint32_t adc, uint32_t mode)
ADC set multi mode.
bool adc_awd(uint32_t adc)
ADC Read the Analog Watchdog Flag.
void adc_enable_eoc_interrupt_injected(uint32_t adc)
ADC Enable Injected End-Of-Conversion Interrupt.
void adc_enable_analog_watchdog_injected(uint32_t adc)
ADC Enable Analog Watchdog for Injected Conversions.
uint32_t adc_read_injected(uint32_t adc, uint8_t reg)
ADC Read from an Injected Conversion Result Register.
void adc_disable_eos_interrupt_injected(uint32_t adc)
ADC Disable Injected End-Of-Sequence Interrupt.
void adc_set_injected_offset(uint32_t adc, uint8_t reg, uint32_t offset)
ADC Set the Injected Channel Data Offset.
void adc_enable_analog_watchdog_on_selected_channel(uint32_t adc, uint8_t channel)
ADC Enable Analog Watchdog for a Selected Channel.
void adc_disable_analog_watchdog_injected(uint32_t adc)
ADC Disable Analog Watchdog for Injected Conversions.
void adc_enable_analog_watchdog_regular(uint32_t adc)
ADC Enable Analog Watchdog for Regular Conversions.
bool adc_eoc_injected(uint32_t adc)
ADC Read the End-of-Conversion Flag for Injected Conversion.
void adc_set_watchdog_low_threshold(uint32_t adc, uint16_t threshold)
ADC Set Analog Watchdog Lower Threshold.
bool adc_eos_injected(uint32_t adc)
ADC Read the End-of-Sequence Flag for Injected Conversions.
void adc_set_clk_source(uint32_t adc, uint32_t source)
ADC Set Clock Source.
void adc_disable_external_trigger_regular(uint32_t adc)
ADC Disable an External Trigger for Regular Channels.
void adc_disable_discontinuous_mode_injected(uint32_t adc)
ADC Disable Discontinuous Mode for Injected Conversions.
void adc_disable_analog_watchdog_regular(uint32_t adc)
ADC Enable Analog Watchdog for Regular Conversions.