1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

drivers/kw41zrf: fix wrong endianness in short_addr get/set

This commit is contained in:
Thomas Stilwell 2020-06-01 20:55:01 -05:00
parent 7286c32b5d
commit f23275af29

View File

@ -116,9 +116,11 @@ void kw41zrf_set_pan(kw41zrf_t *dev, uint16_t pan)
void kw41zrf_set_addr_short(kw41zrf_t *dev, const network_uint16_t *addr)
{
(void) dev;
/* radio hardware stores this in little endian */
ZLL->MACSHORTADDRS0 = (ZLL->MACSHORTADDRS0
& ~ZLL_MACSHORTADDRS0_MACSHORTADDRS0_MASK) |
ZLL_MACSHORTADDRS0_MACSHORTADDRS0(addr->u16);
ZLL_MACSHORTADDRS0_MACSHORTADDRS0(byteorder_swaps(
addr->u16));
}
void kw41zrf_set_addr_long(kw41zrf_t *dev, const eui64_t *addr)
@ -133,6 +135,8 @@ void kw41zrf_get_addr_short(kw41zrf_t *dev, network_uint16_t *addr)
(void) dev;
addr->u16 = (ZLL->MACSHORTADDRS0 & ZLL_MACSHORTADDRS0_MACSHORTADDRS0_MASK) >>
ZLL_MACSHORTADDRS0_MACSHORTADDRS0_SHIFT;
/* radio hardware stores this in little endian */
addr->u16 = byteorder_swaps(addr->u16);
}
void kw41zrf_get_addr_long(kw41zrf_t *dev, eui64_t *addr)