Skip to content

Commit

Permalink
create method to enable and disable scan mode
Browse files Browse the repository at this point in the history
  • Loading branch information
victorandrehc committed Mar 13, 2023
1 parent 241b0d1 commit 08cd479
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/modm/platform/adc/stm32/adc.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/modm/platform/adc/stm32/adc_impl.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 08cd479

Please sign in to comment.