1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

sam0_common: fix sercom_id return value for SERCOM5 (#9875)

This commit is contained in:
Federico Pellegrin 2018-09-02 12:44:08 +02:00
parent e8dfabd4c4
commit d3cd2b71c0

View File

@ -299,7 +299,8 @@ static inline int sercom_id(void *sercom)
#if defined(CPU_FAM_SAMD21)
return ((((uint32_t)sercom) >> 10) & 0x7) - 2;
#elif defined(CPU_FAM_SAML21)
return ((((uint32_t)sercom) >> 10) & 0x7);
/* Left side handles SERCOM0-4 while right side handles unaligned address of SERCOM5 */
return ((((uint32_t)sercom) >> 10) & 0x7) + ((((uint32_t)sercom) >> 22) & 0x04);
#endif
}