From 57a47bb12f6639c1cccb87b06bd6862ed693a8e7 Mon Sep 17 00:00:00 2001 From: thomas-ha Date: Thu, 10 Mar 2016 18:36:47 +0100 Subject: [PATCH] node_id on cc2538dk --- examples/ipv6/rpl-tsch/node.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/ipv6/rpl-tsch/node.c b/examples/ipv6/rpl-tsch/node.c index 2aee41d81..beceff326 100644 --- a/examples/ipv6/rpl-tsch/node.c +++ b/examples/ipv6/rpl-tsch/node.c @@ -38,6 +38,7 @@ #include "contiki.h" #include "node-id.h" +#include "linkaddr.h" #include "net/rpl/rpl.h" #include "net/ipv6/uip-ds6-route.h" #include "net/mac/tsch/tsch.h" @@ -131,6 +132,7 @@ net_init(uip_ipaddr_t *br_prefix) PROCESS_THREAD(node_process, ev, data) { static struct etimer et; + static unsigned short node_id; PROCESS_BEGIN(); /* 3 possible roles: @@ -142,6 +144,8 @@ PROCESS_THREAD(node_process, ev, data) static enum { role_6ln, role_6dr, role_6dr_sec } node_role; 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. */ if(node_id == 1) { if(LLSEC802154_CONF_SECURITY_LEVEL) {