cc2538_rf: Add NETOPT_ADDRESS{,_LONG} to getters

This commit is contained in:
Koen Zandberg 2018-11-17 22:35:01 +01:00
parent 836fe3dbba
commit ffe6aed83e
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -50,6 +50,24 @@ static int _get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len)
}
switch (opt) {
case NETOPT_ADDRESS:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
else {
*(uint16_t*)value = cc2538_get_addr_short();
}
return sizeof(uint16_t);
case NETOPT_ADDRESS_LONG:
if (max_len < sizeof(uint64_t)) {
return -EOVERFLOW;
}
else {
*(uint64_t*)value = cc2538_get_addr_long();
}
return sizeof(uint64_t);
case NETOPT_AUTOACK:
if (RFCORE->XREG_FRMCTRL0bits.AUTOACK) {
*((netopt_enable_t *)value) = NETOPT_ENABLE;