1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18:
19:
20: #ifndef __DEV_ADC_STM32L4_H__
21: #define __DEV_ADC_STM32L4_H__
22:
23: #define DEV_ADC_UNITNM (3)
24: #define DEV_ADC_1 (0)
25: #define DEV_ADC_2 (1)
26: #define DEV_ADC_3 (2)
27:
28:
29: #define ADC_CH_NUM (19)
30: #define ADC_MAX_SQ (16)
31:
32: 33: 34:
35: #define RCC_CCIPR_ADCSEL 0x30000000
36:
37: 38: 39:
40:
41:
42: #define ADC_CSR (0x50040300UL)
43: #define ADC_CCR (0x50040308UL)
44: #define ADC_CDR (0x5004030CUL)
45:
46:
47: #define ADC1_BASE (0x50040000UL)
48: #define ADC2_BASE (0x50040100UL)
49: #define ADC3_BASE (0x50040200UL)
50:
51:
52: #define ADCx_ISR (0x00)
53: #define ADCx_IER (0x04)
54: #define ADCx_CR (0x08)
55: #define ADCx_CFGR (0x0C)
56: #define ADCx_CFGR2 (0x10)
57: #define ADCx_SMPR1 (0x14)
58: #define ADCx_SMPR2 (0x18)
59: #define ADCx_TR1 (0x20)
60: #define ADCx_TR2 (0x24)
61: #define ADCx_TR3 (0x28)
62: #define ADCx_SQR1 (0x30)
63: #define ADCx_SQR2 (0x34)
64: #define ADCx_SQR3 (0x38)
65: #define ADCx_SQR4 (0x3C)
66: #define ADCx_DR (0x40)
67: #define ADCx_JSQR (0x4C)
68: #define ADCx_OFR1 (0x60)
69: #define ADCx_OFR2 (0x64)
70: #define ADCx_OFR3 (0x68)
71: #define ADCx_OFR4 (0x6C)
72: #define ADCx_JDR1 (0x80)
73: #define ADCx_JDR2 (0x84)
74: #define ADCx_JDR3 (0x88)
75: #define ADCx_JDR4 (0x8C)
76: #define ADCx_AWD2CR (0xA0)
77: #define ADCx_AWD3CR (0xA4)
78: #define ADCx_DIFSEL (0xB0)
79: #define ADCx_CALFACT (0xB4)
80:
81: #define ADC_ISR_ADRDY (1<<0)
82: #define ADC_ISR_EOC (1<<2)
83: #define ADC_ISR_EOS (1<<3)
84:
85: #define ADC_IER_ADRDYIE (1<<0)
86: #define ADC_IER_EOCIE (1<<2)
87: #define ADC_IER_OVRIE (1<<4)
88:
89:
90: #define ADC_CR_ADEN (1<<0)
91: #define ADC_CR_ADDIS (1<<1)
92: #define ADC_CR_ADSTART (1<<2)
93: #define ADC_CR_ADSTP (1<<4)
94: #define ADC_CR_ADVREGEN (1<<28)
95: #define ADC_CR_DEEPPWD (1<<29)
96: #define ADC_CR_ADCAL (1<<31)
97:
98: 99: 100:
101: #define INTNO_INTADC1_2 18
102: #define INTNO_INTADC3 47
103:
104: #endif