From ffe6aed83e478300dae6671444dcbbdc993d4092 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Sat, 17 Nov 2018 22:35:01 +0100 Subject: [PATCH] cc2538_rf: Add NETOPT_ADDRESS{,_LONG} to getters --- cpu/cc2538/radio/cc2538_rf_netdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cpu/cc2538/radio/cc2538_rf_netdev.c b/cpu/cc2538/radio/cc2538_rf_netdev.c index e63e610d9e..8b291d647b 100644 --- a/cpu/cc2538/radio/cc2538_rf_netdev.c +++ b/cpu/cc2538/radio/cc2538_rf_netdev.c @@ -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;