8000 stm32/adc: Use macros defined by HAL for H7. · micropython/micropython@dbcfec7 · GitHub
[go: up one dir, main page]

Skip to content

Commit dbcfec7

Browse files
yn386dpgeorge
authored andcommitted
stm32/adc: Use macros defined by HAL for H7.
For STM32H7, the following macro's value are different by ADC's version: * ADC_CAL_ADDRESS * ADC_CAL1 * TEMPSENSOR_CAL2_ADDR Using macros defined by HAL become less dependent on ADC's version. Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
1 parent 842657a commit dbcfec7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ports/stm32/adc.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,18 @@
107107
#define ADC_CAL2 ((uint16_t *)(ADC_CAL_ADDRESS + 4))
108108
#define ADC_CAL_BITS (12)
109109

110-
#elif defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32L1) || defined(STM32L4) || defined(STM32N6) || defined(STM32WB)
110+
#elif defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32H7) || defined(STM32L1) || defined(STM32L4) || defined(STM32N6) || defined(STM32WB)
111111

112112
#define ADC_SCALE_V (((float)VREFINT_CAL_VREF) / 1000.0f)
113113
#define ADC_CAL_ADDRESS (VREFINT_CAL_ADDR)
114114
#define ADC_CAL1 (TEMPSENSOR_CAL1_ADDR)
115115
#define ADC_CAL2 (TEMPSENSOR_CAL2_ADDR)
116-
#define ADC_CAL_BITS (12) // UM2319/UM2570, __HAL_ADC_CALC_TEMPERATURE: 'corresponds to a resolution of 12 bits'
117-
118-
#elif defined(STM32H7)
119116

120-
#define ADC_SCALE_V (3.3f)
121-
#define ADC_CAL_ADDRESS (0x1FF1E860)
122-
#define ADC_CAL1 ((uint16_t *)(0x1FF1E820))
123-
#define ADC_CAL2 ((uint16_t *)(0x1FF1E840))
117+
#if defined(STM32H7)
124118
#define ADC_CAL_BITS (16)
119+
#else
120+
#define ADC_CAL_BITS (12) // UM2319/UM2570, __HAL_ADC_CALC_TEMPERATURE: 'corresponds to a resolution of 12 bits'
121+
#endif
125122

126123
#else
127124

0 commit comments

Comments
 (0)
0