Support for changing PANID and channel from project-conf.h
modified: cpu/avr/radio/rf230bb/rf230bb.c modified: platform/avr-rss2/contiki-conf.h modified: platform/avr-rss2/contiki-main.c
This commit is contained in:
parent
99402348eb
commit
9e5aed5df6
|
@ -1291,6 +1291,21 @@ rf230_listen_channel(uint8_t c)
|
||||||
radio_set_trx_state(RX_ON);
|
radio_set_trx_state(RX_ON);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
rf230_get_panid(void)
|
||||||
|
{
|
||||||
|
unsigned pan;
|
||||||
|
uint8_t byte;
|
||||||
|
|
||||||
|
byte = hal_register_read(RG_PAN_ID_1);
|
||||||
|
pan = byte;
|
||||||
|
byte = hal_register_read(RG_PAN_ID_0);
|
||||||
|
pan = (pan << 8) + byte;
|
||||||
|
|
||||||
|
return pan;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rf230_set_pan_addr(unsigned pan,
|
rf230_set_pan_addr(unsigned pan,
|
||||||
unsigned addr,
|
unsigned addr,
|
||||||
|
|
|
@ -78,10 +78,6 @@
|
||||||
#define NETSTACK_CONF_RADIO rf230_driver
|
#define NETSTACK_CONF_RADIO rf230_driver
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CHANNEL_802_15_4
|
|
||||||
#define CHANNEL_802_15_4 26
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
|
/* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
|
||||||
#ifndef RF230_CONF_AUTOACK
|
#ifndef RF230_CONF_AUTOACK
|
||||||
#define RF230_CONF_AUTOACK 1
|
#define RF230_CONF_AUTOACK 1
|
||||||
|
|
|
@ -314,8 +314,18 @@ initialize(void)
|
||||||
memcpy(&uip_lladdr.addr, &addr.u8, sizeof(linkaddr_t));
|
memcpy(&uip_lladdr.addr, &addr.u8, sizeof(linkaddr_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef IEEE802154_CONF_PANID
|
||||||
|
rf230_set_pan_addr(IEEE802154_CONF_PANID, params_get_panaddr(), (uint8_t *)&addr.u8);
|
||||||
|
#else
|
||||||
rf230_set_pan_addr(params_get_panid(), params_get_panaddr(), (uint8_t *)&addr.u8);
|
rf230_set_pan_addr(params_get_panid(), params_get_panaddr(), (uint8_t *)&addr.u8);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CHANNEL_CONF_802_15_4
|
||||||
|
rf230_set_channel(CHANNEL_CONF_802_15_4);
|
||||||
|
#else
|
||||||
rf230_set_channel(params_get_channel());
|
rf230_set_channel(params_get_channel());
|
||||||
|
#endif
|
||||||
|
|
||||||
rf230_set_txpower(params_get_txpower());
|
rf230_set_txpower(params_get_txpower());
|
||||||
|
|
||||||
#if NETSTACK_CONF_WITH_IPV6
|
#if NETSTACK_CONF_WITH_IPV6
|
||||||
|
@ -339,8 +349,8 @@ initialize(void)
|
||||||
NETSTACK_NETWORK.init();
|
NETSTACK_NETWORK.init();
|
||||||
|
|
||||||
#if ANNOUNCE_BOOT
|
#if ANNOUNCE_BOOT
|
||||||
PRINTA("MAC=%s, RDC=%s, NETWORK=%s, channel=%-u, check-rate-Hz=%-u, tx-power=%-u\n", NETSTACK_MAC.name,
|
PRINTA("PAN=0x%X, XMAC=%s, RDC=%s, NETWORK=%s, channel=%-u, check-rate-Hz=%-u, tx-power=%-u\n", rf230_get_panid(),
|
||||||
NETSTACK_RDC.name, NETSTACK_NETWORK.name, rf230_get_channel(),
|
NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name, rf230_get_channel(),
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 : NETSTACK_RDC.channel_check_interval()),
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 : NETSTACK_RDC.channel_check_interval()),
|
||||||
rf230_get_txpower());
|
rf230_get_txpower());
|
||||||
#if UIP_CONF_IPV6_RPL
|
#if UIP_CONF_IPV6_RPL
|
||||||
|
@ -349,7 +359,6 @@ initialize(void)
|
||||||
#if UIP_CONF_ROUTER
|
#if UIP_CONF_ROUTER
|
||||||
PRINTA("Routing Enabled\n");
|
PRINTA("Routing Enabled\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ANNOUNCE_BOOT */
|
#endif /* ANNOUNCE_BOOT */
|
||||||
|
|
||||||
#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4
|
#if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4
|
||||||
|
|
Loading…
Reference in a new issue