mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #15149 from benpicco/cpu/samd21-gclk7
cpu/samd21: improve GCLK7 magic
This commit is contained in:
commit
60802f864a
@ -205,7 +205,7 @@ static void poweroff(pwm_t dev)
|
||||
*cfg->tim.mclk &= ~cfg->tim.mclk_mask;
|
||||
#else
|
||||
PM->APBCMASK.reg &= ~cfg->tim.pm_mask;
|
||||
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_GEN_GCLK7
|
||||
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_GEN(SAM0_GCLK_DISABLED)
|
||||
| GCLK_CLKCTRL_ID(cfg->tim.gclk_id);
|
||||
#endif
|
||||
}
|
||||
|
@ -252,8 +252,8 @@ static void clk_init(void)
|
||||
#endif
|
||||
|
||||
/* redirect all peripherals to a disabled clock generator (7) by default */
|
||||
for (int i = 0x3; i <= 0x22; i++) {
|
||||
GCLK->CLKCTRL.reg = ( GCLK_CLKCTRL_ID(i) | GCLK_CLKCTRL_GEN_GCLK7 );
|
||||
for (unsigned i = 0x3; i <= GCLK_CLKCTRL_ID_Msk; i++) {
|
||||
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(i) | GCLK_CLKCTRL_GEN(SAM0_GCLK_DISABLED);
|
||||
while (GCLK->STATUS.bit.SYNCBUSY) {}
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ enum {
|
||||
SAM0_GCLK_1MHZ, /**< 1 MHz clock for xTimer */
|
||||
SAM0_GCLK_32KHZ, /**< 32 kHz clock */
|
||||
SAM0_GCLK_1KHZ, /**< 1 kHz clock */
|
||||
SAM0_GCLK_DISABLED = 0xF, /**< disabled GCLK */
|
||||
};
|
||||
/** @} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user