diff --git a/cpu/samd21/cpu.c b/cpu/samd21/cpu.c index f6c59bccb258b24744b5335ab2a6852a804fb83d..9590e9fccd4180d0b30581cf22d1e57de9722c6b 100644 --- a/cpu/samd21/cpu.c +++ b/cpu/samd21/cpu.c @@ -161,11 +161,10 @@ static void clk_init(void) } SYSCTRL->DFLLCTRL.bit.ENABLE = 1; - while ((SYSCTRL->PCLKSR.reg & (SYSCTRL_PCLKSR_DFLLRDY | - SYSCTRL_PCLKSR_DFLLLCKF | - SYSCTRL_PCLKSR_DFLLLCKC)) == 0) { - /* Wait for DFLLLXXX sync */ - } + uint32_t mask = SYSCTRL_PCLKSR_DFLLRDY | + SYSCTRL_PCLKSR_DFLLLCKF | + SYSCTRL_PCLKSR_DFLLLCKC; + while ((SYSCTRL->PCLKSR.reg & mask) != mask) { } /* Wait for DFLL lock */ /* select the DFLL as source for clock generator 0 (CPU core clock) */ GCLK->GENDIV.reg = (GCLK_GENDIV_DIV(1U) | GCLK_GENDIV_ID(0));