- Upgraded the Sensinode platform to use sicslowmac.c
- Improved the rime address setup, setting the RF driver addresses (byte order may not be correct)
This commit is contained in:
parent
49e9b0bdcb
commit
ec02eab6bc
|
@ -10,11 +10,12 @@
|
|||
#include "dev/uart.h"
|
||||
#include "dev/models.h"
|
||||
#include "dev/cc2430_rf.h"
|
||||
#include "net/mac/nullmac.h"
|
||||
#include "net/mac/sicslowmac.h"
|
||||
#include "net/mac/frame802154.h"
|
||||
#include "net/rime.h"
|
||||
|
||||
volatile int i, a;
|
||||
unsigned short node_id = 2; /* Manually sets MAC address when > 0 */
|
||||
unsigned short node_id = 0; /* Manually sets MAC address when > 0 */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
@ -58,6 +59,8 @@ set_rime_addr(void)
|
|||
{
|
||||
rimeaddr_t addr;
|
||||
uint8_t ft_buffer[8];
|
||||
uint8_t *addr_long = NULL;
|
||||
uint16_t addr_short = 0;
|
||||
int i;
|
||||
|
||||
/* TODO: This flash_read routine currently gets a different address
|
||||
|
@ -81,17 +84,25 @@ set_rime_addr(void)
|
|||
}
|
||||
} else {
|
||||
printf("Setting manual address from node_id\n");
|
||||
addr.u8[0] = node_id >> 8;
|
||||
addr.u8[1] = node_id & 0xff;
|
||||
addr.u8[1] = node_id >> 8;
|
||||
addr.u8[0] = node_id & 0xff;
|
||||
}
|
||||
#endif
|
||||
|
||||
rimeaddr_set_node_addr(&addr);
|
||||
printf("Rime configured with address ");
|
||||
for(i = 0; i < sizeof(addr.u8) - 1; i++) {
|
||||
for(i = (sizeof(addr.u8)) - 1; i > 0; i--) {
|
||||
printf("%02x:", addr.u8[i]);
|
||||
}
|
||||
printf("%02x\n", addr.u8[i]);
|
||||
|
||||
/* Set the cc2430 RF addresses */
|
||||
if (sizeof(addr.u8) == 6)
|
||||
addr_long = (uint8_t *) addr.u8;
|
||||
else
|
||||
addr_short = (addr.u8[1] * 256) + addr.u8[0];
|
||||
|
||||
cc2430_rf_set_addr(0xffff, addr_short, addr_long);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
|
@ -118,7 +129,7 @@ main(void)
|
|||
/* initialize the radio driver */
|
||||
|
||||
cc2430_rf_init();
|
||||
rime_init(nullmac_init(&cc2430_rf_driver));
|
||||
rime_init(sicslowmac_init(&cc2430_rf_driver));
|
||||
set_rime_addr();
|
||||
|
||||
/* start services */
|
||||
|
|
Loading…
Reference in a new issue