1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sam0_common: correct sercom_set_gen for sercom5. it assumes SERCOM5 GEN clock is in sequence, but is not, need to put a specific if test

This commit is contained in:
Federico Pellegrin 2018-09-02 13:39:08 +02:00
parent e8dfabd4c4
commit bfdafe877e

View File

@ -352,8 +352,13 @@ static inline void sercom_set_gen(void *sercom, uint32_t gclk)
(SERCOM0_GCLK_ID_CORE + sercom_id(sercom)));
while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) {}
#elif defined(CPU_FAM_SAML21)
GCLK->PCHCTRL[SERCOM0_GCLK_ID_CORE + sercom_id(sercom)].reg =
if (sercom_id(sercom) < 5) {
GCLK->PCHCTRL[SERCOM0_GCLK_ID_CORE + sercom_id(sercom)].reg =
(GCLK_PCHCTRL_CHEN | gclk);
} else {
GCLK->PCHCTRL[SERCOM5_GCLK_ID_CORE].reg =
(GCLK_PCHCTRL_CHEN | gclk);
}
#endif
}