Skip to content

Commit

Permalink
kw2xrf: Don't set netdev values in addr setters
Browse files Browse the repository at this point in the history
  • Loading branch information
bergzand committed Dec 1, 2018
1 parent 6990d33 commit 27dbea1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/kw2xrf/kw2xrf_getset.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,10 @@ void kw2xrf_set_addr_short(kw2xrf_t *dev, uint16_t addr)
uint8_t val_ar[2];
val_ar[0] = (addr >> 8);
val_ar[1] = (uint8_t)addr;
dev->netdev.short_addr[0] = val_ar[1];
dev->netdev.short_addr[1] = val_ar[0];
#ifdef MODULE_SIXLOWPAN
/* https://tools.ietf.org/html/rfc4944#section-12 requires the first bit to
* 0 for unicast addresses */
dev->netdev.short_addr[1] &= 0x7F;
val_arr[0] &= 0x7F;
#endif
kw2xrf_write_iregs(dev, MKW2XDMI_MACSHORTADDRS0_LSB, val_ar,
IEEE802154_SHORT_ADDRESS_LEN);
Expand All @@ -285,7 +283,6 @@ void kw2xrf_set_addr_long(kw2xrf_t *dev, uint64_t addr)
uint8_t *ap = (uint8_t *)(&tmp);

for (unsigned i = 0; i < IEEE802154_LONG_ADDRESS_LEN; i++) {
dev->netdev.long_addr[i] = (uint8_t)(addr >> (i * 8));
ap[i] = (addr >> ((IEEE802154_LONG_ADDRESS_LEN - 1 - i) * 8));
}

Expand Down

0 comments on commit 27dbea1

Please sign in to comment.