sam3: Add enable_pclock() helper function
Add a helper function to enable peripheral clocks. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user