1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

mrf24j40: read address from device

This change modifies the mrf24j40 driver to read the address directly
from the device instead of returning the netdev_ieee802154_t member
This commit is contained in:
Koen Zandberg 2018-11-15 16:59:56 +01:00
parent b291c638d3
commit f7bf03073c
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -122,7 +122,8 @@ static const uint8_t RSSI_value[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
uint16_t mrf24j40_get_addr_short(mrf24j40_t *dev)
{
return (dev->netdev.short_addr[0] << 8) | dev->netdev.short_addr[1];
return (mrf24j40_reg_read_short(dev, MRF24J40_REG_SADRL) << 8) |
mrf24j40_reg_read_short(dev, MRF24J40_REG_SADRH);
}
void mrf24j40_set_addr_short(mrf24j40_t *dev, uint16_t addr)
@ -147,7 +148,7 @@ uint64_t mrf24j40_get_addr_long(mrf24j40_t *dev)
uint8_t *ap = (uint8_t *)(&addr);
for (int i = 0; i < 8; i++) {
ap[i] = dev->netdev.long_addr[i];
ap[7 - i] = mrf24j40_reg_read_short(dev, (MRF24J40_REG_EADR0 + i));
}
return addr;
}