Added support for reading MAC from the cc253x flash
We still use the primary location by default (Info Page) but this is now configurable. This change is useful for users who wish to specify their own MAC address. Since the Info Page is read-only, they need to be able to use the secondary location
This commit is contained in:
parent
29090a3dda
commit
e95f94a9a8
3 changed files with 48 additions and 6 deletions
|
@ -46,6 +46,7 @@
|
|||
|
||||
#include "net/packetbuf.h"
|
||||
#include "net/rime/rimestats.h"
|
||||
#include "net/rime/rimeaddr.h"
|
||||
#include "net/netstack.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -142,13 +143,18 @@ cc2530_rf_power_set(uint8_t new_power)
|
|||
void
|
||||
cc2530_rf_set_addr(uint16_t pan)
|
||||
{
|
||||
#if RIMEADDR_SIZE==8 /* EXT_ADDR[7:0] is ignored when using short addresses */
|
||||
int i;
|
||||
for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) {
|
||||
((uint8_t *)&EXT_ADDR0)[i] = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 1 - i];
|
||||
}
|
||||
#endif
|
||||
|
||||
PAN_ID0 = pan & 0xFF;
|
||||
PAN_ID1 = pan >> 8;
|
||||
|
||||
SHORT_ADDR0 = ((uint8_t *)&X_IEEE_ADDR)[0];
|
||||
SHORT_ADDR1 = ((uint8_t *)&X_IEEE_ADDR)[1];
|
||||
|
||||
memcpy(&EXT_ADDR0, &X_IEEE_ADDR, 8);
|
||||
SHORT_ADDR0 = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 1];
|
||||
SHORT_ADDR1 = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 2];
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Netstack API radio driver functions */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue