fixed clock switch

This commit is contained in:
Mario Hüttel 2016-09-27 17:41:53 +02:00
parent 9bce46516a
commit 1844e46167

View File

@ -214,12 +214,11 @@ void initModuleHw(){
}
void switchPrescaler(uint8_t clkdiv) {
SDIO->POWER = 0;
__DSB();
SDIO->CLKCR &= ~SDIO_CLKCR_CLKDIV; // Clear prescaler
SDIO->CLKCR |= (SDIO_CLKCR_CLKDIV & clkdiv); // Set bits
__DSB();
SDIO->POWER = SDIO_POWER_PWRCTRL_0 | SDIO_POWER_PWRCTRL_1;
uint32_t reg;
reg = SDIO->CLKCR;
reg &= ~SDIO_CLKCR_CLKDIV; // Clear prescaler
reg |= (SDIO_CLKCR_CLKDIV & clkdiv); // Set bits
SDIO->CLKCR = reg;
}