From 08cd479054b3917a90b8c7a3ca8c5b99f291b7f8 Mon Sep 17 00:00:00 2001 From: "Houri e Costa, Victor" Date: Mon, 13 Mar 2023 15:00:13 +0100 Subject: [PATCH] create method to enable and disable scan mode --- src/modm/platform/adc/stm32/adc.hpp.in | 12 ++++++++++++ src/modm/platform/adc/stm32/adc_impl.hpp.in | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/modm/platform/adc/stm32/adc.hpp.in b/src/modm/platform/adc/stm32/adc.hpp.in index 8a70d9752f..8e8b4d2abb 100644 --- a/src/modm/platform/adc/stm32/adc.hpp.in +++ b/src/modm/platform/adc/stm32/adc.hpp.in @@ -370,6 +370,18 @@ public: static inline void acknowledgeInterruptFlags(const InterruptFlag_t flags); + /** + * Enables scan mode + */ + static inline void + enableScanMode(); + + /** + * Disables scan mode + */ + static inline void + disableScanMode(); + private: /** * Select the frequency of the clock to the ADC. The clock is common diff --git a/src/modm/platform/adc/stm32/adc_impl.hpp.in b/src/modm/platform/adc/stm32/adc_impl.hpp.in index c4ed26e81f..3b2911f635 100644 --- a/src/modm/platform/adc/stm32/adc_impl.hpp.in +++ b/src/modm/platform/adc/stm32/adc_impl.hpp.in @@ -252,3 +252,15 @@ modm::platform::Adc{{ id }}::acknowledgeInterruptFlags(const InterruptFlag_t fla { ADC{{ per }}->SR = ~flags.value; } + +void +modm::platform::Adc{{ id }}::enableScanMode() +{ + ADC{{ per }}->CR1 |= (1 << ADC_CR1_SCAN); +} + +void +modm::platform::Adc{{ id }}::disableScanMode() +{ + ADC{{ per }}->CR1 &= ~(1 << ADC_CR1_SCAN); +}