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:
Kevin O'Connor
2018-12-28 19:00:29 -05:00
parent b4baabe408
commit 4683036f98
10 changed files with 32 additions and 22 deletions

View File

@@ -23,9 +23,7 @@ spi_init(void)
gpio_peripheral(GPIO('A', 27), 'A', 0); // Arduino 76
// Enable SPI clocks
if (!(PMC->PMC_PCSR0 & (1u << PERIPH_ID))) {
PMC->PMC_PCER0 = (1 << PERIPH_ID);
}
enable_pclock(PERIPH_ID);
/* Disable SPI */
REGPTR->SPI_CR = SPI_CR_SPIDIS;