Skip to content

Commit

Permalink
🐛 STM32 ADC Resolution = 12 bit (or ADC_RESOLUTION) (#22789)
Browse files Browse the repository at this point in the history
  • Loading branch information
CRCinAU authored and thinkyhead committed Oct 3, 2021
1 parent 2b54a9c commit 2630eef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Marlin/src/HAL/STM32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,13 @@ static inline int freeMemory() {

#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)

#ifdef ADC_RESOLUTION
#define HAL_ADC_RESOLUTION ADC_RESOLUTION
#else
#define HAL_ADC_RESOLUTION 12
#endif

#define HAL_ADC_VREF 3.3
#define HAL_ADC_RESOLUTION ADC_RESOLUTION // 12
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
#define HAL_READ_ADC() HAL_adc_result
#define HAL_ADC_READY() true
Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/HAL/STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,13 @@ static inline int freeMemory() {

void HAL_adc_init();

#ifdef ADC_RESOLUTION
#define HAL_ADC_RESOLUTION ADC_RESOLUTION
#else
#define HAL_ADC_RESOLUTION 12
#endif

#define HAL_ADC_VREF 3.3
#define HAL_ADC_RESOLUTION 10
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
#define HAL_READ_ADC() HAL_adc_result
#define HAL_ADC_READY() true
Expand Down
1 change: 0 additions & 1 deletion ini/stm32-common.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ build_flags = ${common.build_flags}
-std=gnu++14 -DHAL_STM32
-DUSBCON -DUSBD_USE_CDC
-DTIM_IRQ_PRIO=13
-DADC_RESOLUTION=12
build_unflags = -std=gnu++11
src_filter = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/shared/backtrace>
extra_scripts = ${common.extra_scripts}
Expand Down

0 comments on commit 2630eef

Please sign in to comment.