Ver código fonte

🐛 STM32 ADC Resolution = 12 bit (or ADC_RESOLUTION) (#22789)

Steven Haigh 3 anos atrás
pai
commit
d7e597f3df
Nenhuma conta vinculada ao e-mail do autor do commit
3 arquivos alterados com 12 adições e 3 exclusões
  1. 6
    1
      Marlin/src/HAL/STM32/HAL.h
  2. 6
    1
      Marlin/src/HAL/STM32F1/HAL.h
  3. 0
    1
      ini/stm32-common.ini

+ 6
- 1
Marlin/src/HAL/STM32/HAL.h Ver arquivo

@@ -183,8 +183,13 @@ static inline int freeMemory() {
183 183
 
184 184
 #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)
185 185
 
186
+#ifdef ADC_RESOLUTION
187
+  #define HAL_ADC_RESOLUTION ADC_RESOLUTION
188
+#else
189
+  #define HAL_ADC_RESOLUTION 12
190
+#endif
191
+
186 192
 #define HAL_ADC_VREF         3.3
187
-#define HAL_ADC_RESOLUTION  ADC_RESOLUTION // 12
188 193
 #define HAL_START_ADC(pin)  HAL_adc_start_conversion(pin)
189 194
 #define HAL_READ_ADC()      HAL_adc_result
190 195
 #define HAL_ADC_READY()     true

+ 6
- 1
Marlin/src/HAL/STM32F1/HAL.h Ver arquivo

@@ -237,8 +237,13 @@ static inline int freeMemory() {
237 237
 
238 238
 void HAL_adc_init();
239 239
 
240
+#ifdef ADC_RESOLUTION
241
+  #define HAL_ADC_RESOLUTION ADC_RESOLUTION
242
+#else
243
+  #define HAL_ADC_RESOLUTION 12
244
+#endif
245
+
240 246
 #define HAL_ADC_VREF         3.3
241
-#define HAL_ADC_RESOLUTION  10
242 247
 #define HAL_START_ADC(pin)  HAL_adc_start_conversion(pin)
243 248
 #define HAL_READ_ADC()      HAL_adc_result
244 249
 #define HAL_ADC_READY()     true

+ 0
- 1
ini/stm32-common.ini Ver arquivo

@@ -16,7 +16,6 @@ build_flags      = ${common.build_flags}
16 16
                    -std=gnu++14 -DHAL_STM32
17 17
                    -DUSBCON -DUSBD_USE_CDC
18 18
                    -DTIM_IRQ_PRIO=13
19
-                   -DADC_RESOLUTION=12
20 19
 build_unflags    = -std=gnu++11
21 20
 src_filter       = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/shared/backtrace>
22 21
 extra_scripts    = ${common.extra_scripts}

Carregando…
Cancelar
Salvar