From 854da9635e019191f97b629612a59e10fece4772 Mon Sep 17 00:00:00 2001 From: Jacob Walser Date: Tue, 24 Sep 2019 00:02:39 -0400 Subject: [PATCH] stm32f0: adjust wwdg threshold signatures to support 12 bit resolution --- include/libopencm3/stm32/f0/adc.h | 4 ++-- lib/stm32/f0/adc.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libopencm3/stm32/f0/adc.h b/include/libopencm3/stm32/f0/adc.h index 573da943..bc88a578 100644 --- a/include/libopencm3/stm32/f0/adc.h +++ b/include/libopencm3/stm32/f0/adc.h @@ -190,8 +190,8 @@ void adc_calibrate_wait_finish(uint32_t adc) void adc_enable_analog_watchdog_on_all_channels(uint32_t adc); void adc_enable_analog_watchdog_on_selected_channel(uint32_t adc, uint8_t chan); void adc_disable_analog_watchdog(uint32_t adc); -void adc_set_watchdog_high_threshold(uint32_t adc, uint8_t threshold); -void adc_set_watchdog_low_threshold(uint32_t adc, uint8_t threshold); +void adc_set_watchdog_high_threshold(uint32_t adc, uint16_t threshold); +void adc_set_watchdog_low_threshold(uint32_t adc, uint16_t threshold); END_DECLS diff --git a/lib/stm32/f0/adc.c b/lib/stm32/f0/adc.c index 663099dd..c6f40092 100644 --- a/lib/stm32/f0/adc.c +++ b/lib/stm32/f0/adc.c @@ -516,10 +516,10 @@ void adc_disable_analog_watchdog(uint32_t adc) /** @brief ADC Set Analog Watchdog Upper Threshold * * @param[in] adc Unsigned int32. ADC base address (@ref adc_reg_base) - * @param[in] threshold Unsigned int8. Upper threshold value + * @param[in] threshold. Upper threshold value */ -void adc_set_watchdog_high_threshold(uint32_t adc, uint8_t threshold) +void adc_set_watchdog_high_threshold(uint32_t adc, uint16_t threshold) { ADC_TR1(adc) = (ADC_TR1(adc) & ~ADC_TR1_HT) | ADC_TR1_HT_VAL(threshold); } @@ -528,10 +528,10 @@ void adc_set_watchdog_high_threshold(uint32_t adc, uint8_t threshold) /** @brief ADC Set Analog Watchdog Lower Threshold * * @param[in] adc Unsigned int32. ADC base address (@ref adc_reg_base) - * @param[in] threshold Unsigned int8. Lower threshold value + * @param[in] threshold. Lower threshold value */ -void adc_set_watchdog_low_threshold(uint32_t adc, uint8_t threshold) +void adc_set_watchdog_low_threshold(uint32_t adc, uint16_t threshold) { ADC_TR1(adc) = (ADC_TR1(adc) & ~ADC_TR1_LT) | ADC_TR1_LT_VAL(threshold); }