33#ifdef LIBOPENCM3_ADC_H
35#ifndef LIBOPENCM3_ADC_COMMON_V2_MULTI_H
36#define LIBOPENCM3_ADC_COMMON_V2_MULTI_H
49#define ADC_SMPR2(adc) MMIO32((adc) + 0x18)
51#define ADC_TR2(adc) MMIO32((adc) + 0x24)
53#define ADC_TR3(adc) MMIO32((adc) + 0x28)
55#define ADC_SQR1(adc) MMIO32((adc) + 0x30)
56#define ADC_SQR2(adc) MMIO32((adc) + 0x34)
57#define ADC_SQR3(adc) MMIO32((adc) + 0x38)
58#define ADC_SQR4(adc) MMIO32((adc) + 0x3C)
61#define ADC_JSQR(adc) MMIO32((adc) + 0x4c)
64#define ADC_OFR1(adc) MMIO32((adc) + 0x60)
65#define ADC_OFR2(adc) MMIO32((adc) + 0x64)
66#define ADC_OFR3(adc) MMIO32((adc) + 0x68)
67#define ADC_OFR4(adc) MMIO32((adc) + 0x6C)
70#define ADC_JDR1(adc) MMIO32((adc) + 0x80)
71#define ADC_JDR2(adc) MMIO32((adc) + 0x84)
72#define ADC_JDR3(adc) MMIO32((adc) + 0x88)
73#define ADC_JDR4(adc) MMIO32((adc) + 0x8C)
76#define ADC_AWD2CR(adc) MMIO32((adc) + 0xA0)
78#define ADC_AWD3CR(adc) MMIO32((adc) + 0xA4)
81#define ADC_DIFSEL(adc) MMIO32((adc) + 0xB0)
84#define ADC_CALFACT(adc) MMIO32((adc) + 0xB4)
87#define ADC_CSR(adc) MMIO32((adc) + 0x300 + 0x0)
88#define ADC_CDR(adc) MMIO32((adc) + 0x300 + 0xc)
95#define ADC_ISR_JQOVF (1 << 10)
97#define ADC_ISR_AWD3 (1 << 9)
99#define ADC_ISR_AWD2 (1 << 8)
101#define ADC_ISR_JEOS (1 << 6)
103#define ADC_ISR_JEOC (1 << 5)
108#define ADC_IER_JQOVFIE (1 << 10)
110#define ADC_IER_AWD3IE (1 << 9)
112#define ADC_IER_AWD2IE (1 << 8)
114#define ADC_IER_JEOSIE (1 << 6)
116#define ADC_IER_JEOCIE (1 << 5)
121#define ADC_CR_ADCALDIF (1 << 30)
123#define ADC_CR_JADSTP (1 << 5)
125#define ADC_CR_JADSTART (1 << 3)
130#define ADC_CFGR1_JAUTO (1 << 25)
133#define ADC_CFGR1_JAWD1EN (1 << 24)
136#define ADC_CFGR1_JQM (1 << 21)
139#define ADC_CFGR1_JDISCEN (1 << 20)
142#define ADC_CFGR1_DISCNUM_SHIFT 17
143#define ADC_CFGR1_DISCNUM_MASK (0x7 << ADC_CFGR1_DISCNUM_SHIFT)
144#define ADC_CFGR1_DISCNUM_VAL(x) (((x) - 1) << ADC_CFGR1_DISCNUM_SHIFT)
148#define ADC_SQR1_L_SHIFT 0
149#define ADC_SQR1_L_MASK 0xf
150#define ADC_SQRx_SQx_MASK 0x1f
151#define ADC_SQR1_SQ1_SHIFT 6
152#define ADC_SQR1_SQ2_SHIFT 12
153#define ADC_SQR1_SQ3_SHIFT 18
154#define ADC_SQR1_SQ4_SHIFT 24
155#define ADC_SQR2_SQ5_SHIFT 0
156#define ADC_SQR2_SQ6_SHIFT 6
157#define ADC_SQR2_SQ7_SHIFT 12
158#define ADC_SQR2_SQ8_SHIFT 18
159#define ADC_SQR2_SQ9_SHIFT 24
160#define ADC_SQR3_SQ10_SHIFT 0
161#define ADC_SQR3_SQ11_SHIFT 6
162#define ADC_SQR3_SQ12_SHIFT 12
163#define ADC_SQR3_SQ13_SHIFT 18
164#define ADC_SQR3_SQ14_SHIFT 24
165#define ADC_SQR4_SQ15_SHIFT 0
166#define ADC_SQR4_SQ16_SHIFT 6
void adc_set_sample_time(uint32_t adc, uint8_t channel, uint8_t time)
ADC Set the Sample Time for a Single Channel.
void adc_disable_regulator(uint32_t adc)
Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power.
void adc_enable_regulator(uint32_t adc)
Enable the ADC Voltage regulator Before any use of the ADC, the ADC Voltage regulator must be enabled...