Skip to content

Commit 841439d

Browse files
committed
stm32/adc: Simplify ADC calibration settings.
Combine the common settings for L1/L4/WB with existing G0/G4/H5 settings. Signed-off-by: Damien George <[email protected]>
1 parent ea2000b commit 841439d

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

ports/stm32/adc.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@
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)
110+
#elif defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32L1) || defined(STM32L4) || defined(STM32WB)
111111

112112
#define ADC_SCALE_V (((float)VREFINT_CAL_VREF) / 1000.0f)
113-
#define ADC_CAL_ADDRESS VREFINT_CAL_ADDR
114-
#define ADC_CAL1 TEMPSENSOR_CAL1_ADDR
115-
#define ADC_CAL2 TEMPSENSOR_CAL2_ADDR
113+
#define ADC_CAL_ADDRESS (VREFINT_CAL_ADDR)
114+
#define ADC_CAL1 (TEMPSENSOR_CAL1_ADDR)
115+
#define ADC_CAL2 (TEMPSENSOR_CAL2_ADDR)
116116
#define ADC_CAL_BITS (12) // UM2319/UM2570, __HAL_ADC_CALC_TEMPERATURE: 'corresponds to a resolution of 12 bits'
117117

118118
#elif defined(STM32H7)
@@ -123,22 +123,6 @@
123123
#define ADC_CAL2 ((uint16_t *)(0x1FF1E840))
124124
#define ADC_CAL_BITS (16)
125125

126-
#elif defined(STM32L1)
127-
128-
#define ADC_SCALE_V (VREFINT_CAL_VREF / 1000.0f)
129-
#define ADC_CAL_ADDRESS (VREFINT_CAL_ADDR)
130-
#define ADC_CAL1 (TEMPSENSOR_CAL1_ADDR)
131-
#define ADC_CAL2 (TEMPSENSOR_CAL2_ADDR)
132-
#define ADC_CAL_BITS (12)
133-
134-
#elif defined(STM32L4) || defined(STM32WB)
135-
136-
#define ADC_SCALE_V (VREFINT_CAL_VREF / 1000.0f)
137-
#define ADC_CAL_ADDRESS (VREFINT_CAL_ADDR)
138-
#define ADC_CAL1 (TEMPSENSOR_CAL1_ADDR)
139-
#define ADC_CAL2 (TEMPSENSOR_CAL2_ADDR)
140-
#define ADC_CAL_BITS (12)
141-
142126
#else
143127

144128
#error Unsupported processor

0 commit comments

Comments
 (0)