aboutsummaryrefslogtreecommitdiffstats
path: root/src/sam3/adc.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-12-28 19:00:29 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-07 19:33:26 -0500
commit4683036f98b319d1c36853c1a200d63c36b470ff (patch)
tree340620d721c54de9de57bbb3b514e3fcff8b1599 /src/sam3/adc.c
parentb4baabe4081a3c1473e970b776a5d760bf6689e3 (diff)
downloadkutter-4683036f98b319d1c36853c1a200d63c36b470ff.tar.gz
kutter-4683036f98b319d1c36853c1a200d63c36b470ff.tar.xz
kutter-4683036f98b319d1c36853c1a200d63c36b470ff.zip
sam3: Add enable_pclock() helper function
Add a helper function to enable peripheral clocks. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/sam3/adc.c')
-rw-r--r--src/sam3/adc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sam3/adc.c b/src/sam3/adc.c
index b9c5fb12..0baf9118 100644
--- a/src/sam3/adc.c
+++ b/src/sam3/adc.c
@@ -34,9 +34,9 @@ gpio_adc_setup(uint8_t pin)
break;
}
- if (!(PMC->PMC_PCSR1 & (1 << (ID_ADC-32)))) {
+ if (!is_enabled_pclock(ID_ADC)) {
// Setup ADC
- PMC->PMC_PCER1 = 1 << (ID_ADC-32);
+ enable_pclock(ID_ADC);
uint32_t prescal = SystemCoreClock / (2 * ADC_FREQ_MAX) - 1;
ADC->ADC_MR = (ADC_MR_PRESCAL(prescal)
| ADC_MR_STARTUP_SUT768