node_id on cc2538dk

This commit is contained in:
thomas-ha 2016-03-10 18:36:47 +01:00
parent 217e623337
commit 57a47bb12f
1 changed files with 4 additions and 0 deletions

View File

@ -38,6 +38,7 @@
#include "contiki.h" #include "contiki.h"
#include "node-id.h" #include "node-id.h"
#include "linkaddr.h"
#include "net/rpl/rpl.h" #include "net/rpl/rpl.h"
#include "net/ipv6/uip-ds6-route.h" #include "net/ipv6/uip-ds6-route.h"
#include "net/mac/tsch/tsch.h" #include "net/mac/tsch/tsch.h"
@ -131,6 +132,7 @@ net_init(uip_ipaddr_t *br_prefix)
PROCESS_THREAD(node_process, ev, data) PROCESS_THREAD(node_process, ev, data)
{ {
static struct etimer et; static struct etimer et;
static unsigned short node_id;
PROCESS_BEGIN(); PROCESS_BEGIN();
/* 3 possible roles: /* 3 possible roles:
@ -142,6 +144,8 @@ PROCESS_THREAD(node_process, ev, data)
static enum { role_6ln, role_6dr, role_6dr_sec } node_role; static enum { role_6ln, role_6dr, role_6dr_sec } node_role;
node_role = role_6ln; node_role = role_6ln;
node_id = linkaddr_node_addr.u8[LINKADDR_SIZE - 2] | linkaddr_node_addr.u8[LINKADDR_SIZE - 1];
/* Set node with ID == 1 as coordinator, convenient in Cooja. */ /* Set node with ID == 1 as coordinator, convenient in Cooja. */
if(node_id == 1) { if(node_id == 1) {
if(LLSEC802154_CONF_SECURITY_LEVEL) { if(LLSEC802154_CONF_SECURITY_LEVEL) {