summaryrefslogtreecommitdiff
path: root/ucoo/hal/adc
diff options
context:
space:
mode:
authorNicolas Schodet2015-04-29 10:58:15 +0200
committerNicolas Schodet2019-10-07 00:44:50 +0200
commit0ad5dc5b09f749e8d3b1db737d7283ab58412c96 (patch)
tree7c5be2c27af249e5dbaba7ae4c448a9345126f76 /ucoo/hal/adc
parent2b6317815bf86c80047c5d3b42602f81b8c21d01 (diff)
Use new rcc_periph_clock_{enable,disable}
Diffstat (limited to 'ucoo/hal/adc')
-rw-r--r--ucoo/hal/adc/adc_hard.stm32f4.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/ucoo/hal/adc/adc_hard.stm32f4.cc b/ucoo/hal/adc/adc_hard.stm32f4.cc
index 444117f..c89d610 100644
--- a/ucoo/hal/adc/adc_hard.stm32f4.cc
+++ b/ucoo/hal/adc/adc_hard.stm32f4.cc
@@ -28,6 +28,10 @@
namespace ucoo {
+static const enum rcc_periph_clken adc_clken[] = {
+ RCC_ADC1, RCC_ADC2, RCC_ADC3
+};
+
AdcHard::AdcHard (int n)
: n_ (n)
{
@@ -44,7 +48,7 @@ AdcHard::~AdcHard ()
void
AdcHard::enable ()
{
- rcc_peripheral_enable_clock (&RCC_APB2ENR, RCC_APB2ENR_ADC1EN << n_);
+ rcc_periph_clock_enable (adc_clken[n_]);
ADC_CR2 (base_) = ADC_CR2_ADON;
}
@@ -52,7 +56,7 @@ void
AdcHard::disable ()
{
ADC_CR2 (base_) = 0;
- rcc_peripheral_disable_clock (&RCC_APB2ENR, RCC_APB2ENR_ADC1EN << n_);
+ rcc_periph_clock_disable (adc_clken[n_]);
}
int