Changed name of the simple-cc2420 module to cc2420: changed all function names and variable names from simple_cc2420_* to cc2420_*.
This commit is contained in:
parent
6b187328bd
commit
66876625d4
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: shell-sky.c,v 1.5 2008/07/01 21:02:51 adamdunkels Exp $
|
* $Id: shell-sky.c,v 1.6 2008/07/02 09:05:40 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,10 +119,10 @@ do_rssi(void)
|
||||||
|
|
||||||
rime_mac->off(0);
|
rime_mac->off(0);
|
||||||
|
|
||||||
simple_cc2420_on();
|
cc2420_on();
|
||||||
for(channel = 11; channel <= 26; ++channel) {
|
for(channel = 11; channel <= 26; ++channel) {
|
||||||
simple_cc2420_set_channel(channel);
|
cc2420_set_channel(channel);
|
||||||
rssi_samples[sample].channel[channel - 11] = simple_cc2420_rssi() + 53;
|
rssi_samples[sample].channel[channel - 11] = cc2420_rssi() + 53;
|
||||||
}
|
}
|
||||||
|
|
||||||
rime_mac->on();
|
rime_mac->on();
|
||||||
|
@ -225,9 +225,9 @@ PROCESS_THREAD(shell_txpower_process, ev, data)
|
||||||
out the current txpower. */
|
out the current txpower. */
|
||||||
|
|
||||||
if(newptr == data) {
|
if(newptr == data) {
|
||||||
msg.txpower = simple_cc2420_get_txpower();
|
msg.txpower = cc2420_get_txpower();
|
||||||
} else {
|
} else {
|
||||||
simple_cc2420_set_txpower(msg.txpower);
|
cc2420_set_txpower(msg.txpower);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.len = 1;
|
msg.len = 1;
|
||||||
|
@ -249,10 +249,10 @@ PROCESS_THREAD(shell_rfchannel_process, ev, data)
|
||||||
/* If no channel was given on the command line, we print out the
|
/* If no channel was given on the command line, we print out the
|
||||||
current channel. */
|
current channel. */
|
||||||
if(newptr == data) {
|
if(newptr == data) {
|
||||||
msg.channel = simple_cc2420_get_channel();
|
msg.channel = cc2420_get_channel();
|
||||||
} else {
|
} else {
|
||||||
msg.channel = shell_strtolong(data, &newptr);
|
msg.channel = shell_strtolong(data, &newptr);
|
||||||
simple_cc2420_set_channel(msg.channel);
|
cc2420_set_channel(msg.channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.len = 1;
|
msg.len = 1;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: cc2420.c,v 1.23 2008/07/01 21:02:51 adamdunkels Exp $
|
* @(#)$Id: cc2420.c,v 1.24 2008/07/02 09:05:40 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This code is almost device independent and should be easy to port.
|
* This code is almost device independent and should be easy to port.
|
||||||
|
@ -59,12 +59,12 @@
|
||||||
#define FOOTER_LEN 2
|
#define FOOTER_LEN 2
|
||||||
#define CRC_LEN 2
|
#define CRC_LEN 2
|
||||||
|
|
||||||
#if SIMPLE_CC2420_CONF_TIMESTAMPS
|
#if CC2420_CONF_TIMESTAMPS
|
||||||
#include "net/rime/timesynch.h"
|
#include "net/rime/timesynch.h"
|
||||||
#define TIMESTAMP_LEN 3
|
#define TIMESTAMP_LEN 3
|
||||||
#else /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#else /* CC2420_CONF_TIMESTAMPS */
|
||||||
#define TIMESTAMP_LEN 0
|
#define TIMESTAMP_LEN 0
|
||||||
#endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#endif /* CC2420_CONF_TIMESTAMPS */
|
||||||
|
|
||||||
struct timestamp {
|
struct timestamp {
|
||||||
uint16_t time;
|
uint16_t time;
|
||||||
|
@ -82,43 +82,43 @@ struct timestamp {
|
||||||
#define PRINTF(...) do {} while (0)
|
#define PRINTF(...) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void simple_cc2420_arch_init(void);
|
void cc2420_arch_init(void);
|
||||||
|
|
||||||
/* XXX hack: these will be made as Chameleon packet attributes */
|
/* XXX hack: these will be made as Chameleon packet attributes */
|
||||||
rtimer_clock_t simple_cc2420_time_of_arrival, simple_cc2420_time_of_departure;
|
rtimer_clock_t cc2420_time_of_arrival, cc2420_time_of_departure;
|
||||||
|
|
||||||
int simple_cc2420_authority_level_of_sender;
|
int cc2420_authority_level_of_sender;
|
||||||
|
|
||||||
static rtimer_clock_t setup_time_for_transmission;
|
static rtimer_clock_t setup_time_for_transmission;
|
||||||
static unsigned long total_time_for_transmission, total_transmission_len;
|
static unsigned long total_time_for_transmission, total_transmission_len;
|
||||||
static int num_transmissions;
|
static int num_transmissions;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(simple_cc2420_process, "CC2420 driver");
|
PROCESS(cc2420_process, "CC2420 driver");
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void (* receiver_callback)(const struct radio_driver *);
|
static void (* receiver_callback)(const struct radio_driver *);
|
||||||
|
|
||||||
int simple_cc2420_on(void);
|
int cc2420_on(void);
|
||||||
int simple_cc2420_off(void);
|
int cc2420_off(void);
|
||||||
|
|
||||||
int simple_cc2420_read(void *buf, unsigned short bufsize);
|
int cc2420_read(void *buf, unsigned short bufsize);
|
||||||
|
|
||||||
int simple_cc2420_send(const void *data, unsigned short len);
|
int cc2420_send(const void *data, unsigned short len);
|
||||||
|
|
||||||
void simple_cc2420_set_receiver(void (* recv)(const struct radio_driver *d));
|
void cc2420_set_receiver(void (* recv)(const struct radio_driver *d));
|
||||||
|
|
||||||
|
|
||||||
signed char simple_cc2420_last_rssi;
|
signed char cc2420_last_rssi;
|
||||||
uint8_t simple_cc2420_last_correlation;
|
uint8_t cc2420_last_correlation;
|
||||||
|
|
||||||
const struct radio_driver simple_cc2420_driver =
|
const struct radio_driver cc2420_driver =
|
||||||
{
|
{
|
||||||
simple_cc2420_send,
|
cc2420_send,
|
||||||
simple_cc2420_read,
|
cc2420_read,
|
||||||
simple_cc2420_set_receiver,
|
cc2420_set_receiver,
|
||||||
simple_cc2420_on,
|
cc2420_on,
|
||||||
simple_cc2420_off,
|
cc2420_off,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t receive_on;
|
static uint8_t receive_on;
|
||||||
|
@ -207,18 +207,18 @@ setreg(enum cc2420_register regname, unsigned value)
|
||||||
#define RXBPF_LOCUR (1 << 13);
|
#define RXBPF_LOCUR (1 << 13);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
simple_cc2420_set_receiver(void (* recv)(const struct radio_driver *))
|
cc2420_set_receiver(void (* recv)(const struct radio_driver *))
|
||||||
{
|
{
|
||||||
receiver_callback = recv;
|
receiver_callback = recv;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
simple_cc2420_init(void)
|
cc2420_init(void)
|
||||||
{
|
{
|
||||||
uint16_t reg;
|
uint16_t reg;
|
||||||
{
|
{
|
||||||
int s = splhigh();
|
int s = splhigh();
|
||||||
simple_cc2420_arch_init(); /* Initalize ports and SPI. */
|
cc2420_arch_init(); /* Initalize ports and SPI. */
|
||||||
DISABLE_FIFOP_INT();
|
DISABLE_FIFOP_INT();
|
||||||
FIFOP_INT_INIT();
|
FIFOP_INT_INIT();
|
||||||
splx(s);
|
splx(s);
|
||||||
|
@ -261,14 +261,14 @@ simple_cc2420_init(void)
|
||||||
reg &= ~RXFIFO_PROTECTION;
|
reg &= ~RXFIFO_PROTECTION;
|
||||||
setreg(CC2420_SECCTRL0, reg);
|
setreg(CC2420_SECCTRL0, reg);
|
||||||
|
|
||||||
simple_cc2420_set_pan_addr(0xffff, 0x0000, NULL);
|
cc2420_set_pan_addr(0xffff, 0x0000, NULL);
|
||||||
simple_cc2420_set_channel(26);
|
cc2420_set_channel(26);
|
||||||
|
|
||||||
process_start(&simple_cc2420_process, NULL);
|
process_start(&cc2420_process, NULL);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
simple_cc2420_send(const void *payload, unsigned short payload_len)
|
cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint8_t total_len;
|
uint8_t total_len;
|
||||||
|
@ -276,7 +276,7 @@ simple_cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
|
|
||||||
GET_LOCK();
|
GET_LOCK();
|
||||||
|
|
||||||
PRINTF("simple_cc2420: sending %d bytes\n", payload_len);
|
PRINTF("cc2420: sending %d bytes\n", payload_len);
|
||||||
|
|
||||||
RIMESTATS_ADD(lltx);
|
RIMESTATS_ADD(lltx);
|
||||||
|
|
||||||
|
@ -291,11 +291,11 @@ simple_cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
|
|
||||||
FASTSPI_WRITE_FIFO(payload, payload_len);
|
FASTSPI_WRITE_FIFO(payload, payload_len);
|
||||||
|
|
||||||
#if SIMPLE_CC2420_CONF_TIMESTAMPS
|
#if CC2420_CONF_TIMESTAMPS
|
||||||
timestamp.authority_level = timesynch_authority_level();
|
timestamp.authority_level = timesynch_authority_level();
|
||||||
timestamp.time = timesynch_time();
|
timestamp.time = timesynch_time();
|
||||||
FASTSPI_WRITE_FIFO(×tamp, TIMESTAMP_LEN);
|
FASTSPI_WRITE_FIFO(×tamp, TIMESTAMP_LEN);
|
||||||
#endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#endif /* CC2420_CONF_TIMESTAMPS */
|
||||||
|
|
||||||
/* The TX FIFO can only hold one packet. Make sure to not overrun
|
/* The TX FIFO can only hold one packet. Make sure to not overrun
|
||||||
* FIFO by waiting for transmission to start here and synchronizing
|
* FIFO by waiting for transmission to start here and synchronizing
|
||||||
|
@ -320,9 +320,9 @@ simple_cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
|
|
||||||
for(i = LOOP_20_SYMBOLS; i > 0; i--) {
|
for(i = LOOP_20_SYMBOLS; i > 0; i--) {
|
||||||
if(SFD_IS_1) {
|
if(SFD_IS_1) {
|
||||||
#if SIMPLE_CC2420_CONF_TIMESTAMPS
|
#if CC2420_CONF_TIMESTAMPS
|
||||||
rtimer_clock_t txtime = timesynch_time();
|
rtimer_clock_t txtime = timesynch_time();
|
||||||
#endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#endif /* CC2420_CONF_TIMESTAMPS */
|
||||||
|
|
||||||
if(receive_on) {
|
if(receive_on) {
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
|
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
|
||||||
|
@ -333,7 +333,7 @@ simple_cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
accurate measurement of the transmission time.*/
|
accurate measurement of the transmission time.*/
|
||||||
while(status() & BV(CC2420_TX_ACTIVE));
|
while(status() & BV(CC2420_TX_ACTIVE));
|
||||||
|
|
||||||
#if SIMPLE_CC2420_CONF_TIMESTAMPS
|
#if CC2420_CONF_TIMESTAMPS
|
||||||
setup_time_for_transmission = txtime - timestamp.time;
|
setup_time_for_transmission = txtime - timestamp.time;
|
||||||
|
|
||||||
if(num_transmissions < 10000) {
|
if(num_transmissions < 10000) {
|
||||||
|
@ -342,10 +342,10 @@ simple_cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
num_transmissions++;
|
num_transmissions++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#endif /* CC2420_CONF_TIMESTAMPS */
|
||||||
|
|
||||||
#ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
|
#ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
|
||||||
ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,simple_cc2420_get_txpower());
|
ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,cc2420_get_txpower());
|
||||||
#endif
|
#endif
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
|
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
|
||||||
if(receive_on) {
|
if(receive_on) {
|
||||||
|
@ -360,7 +360,7 @@ simple_cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
/* If we are using WITH_SEND_CCA, we get here if the packet wasn't
|
/* If we are using WITH_SEND_CCA, we get here if the packet wasn't
|
||||||
transmitted because of other channel activity. */
|
transmitted because of other channel activity. */
|
||||||
RIMESTATS_ADD(contentiondrop);
|
RIMESTATS_ADD(contentiondrop);
|
||||||
PRINTF("simple_cc2420: do_send() transmission never started\n");
|
PRINTF("cc2420: do_send() transmission never started\n");
|
||||||
RELEASE_LOCK();
|
RELEASE_LOCK();
|
||||||
return -3; /* Transmission never started! */
|
return -3; /* Transmission never started! */
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ simple_cc2420_send(const void *payload, unsigned short payload_len)
|
||||||
static volatile uint8_t packet_seen;
|
static volatile uint8_t packet_seen;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
simple_cc2420_off(void)
|
cc2420_off(void)
|
||||||
{
|
{
|
||||||
if(receive_on == 0) {
|
if(receive_on == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -389,7 +389,7 @@ simple_cc2420_off(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
simple_cc2420_on(void)
|
cc2420_on(void)
|
||||||
{
|
{
|
||||||
if(receive_on) {
|
if(receive_on) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -404,13 +404,13 @@ simple_cc2420_on(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
simple_cc2420_get_channel(void)
|
cc2420_get_channel(void)
|
||||||
{
|
{
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
simple_cc2420_set_channel(int c)
|
cc2420_set_channel(int c)
|
||||||
{
|
{
|
||||||
uint16_t f;
|
uint16_t f;
|
||||||
/*
|
/*
|
||||||
|
@ -440,7 +440,7 @@ simple_cc2420_set_channel(int c)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
simple_cc2420_set_pan_addr(unsigned pan,
|
cc2420_set_pan_addr(unsigned pan,
|
||||||
unsigned addr,
|
unsigned addr,
|
||||||
const uint8_t *ieee_addr)
|
const uint8_t *ieee_addr)
|
||||||
{
|
{
|
||||||
|
@ -463,51 +463,51 @@ simple_cc2420_set_pan_addr(unsigned pan,
|
||||||
*/
|
*/
|
||||||
static volatile rtimer_clock_t interrupt_time;
|
static volatile rtimer_clock_t interrupt_time;
|
||||||
static volatile int interrupt_time_set;
|
static volatile int interrupt_time_set;
|
||||||
#if SIMPLE_CC2420_TIMETABLE_PROFILING
|
#if CC2420_TIMETABLE_PROFILING
|
||||||
#define simple_cc2420_timetable_size 16
|
#define cc2420_timetable_size 16
|
||||||
TIMETABLE(simple_cc2420_timetable);
|
TIMETABLE(cc2420_timetable);
|
||||||
TIMETABLE_AGGREGATE(aggregate_time, 10);
|
TIMETABLE_AGGREGATE(aggregate_time, 10);
|
||||||
#endif /* SIMPLE_CC2420_TIMETABLE_PROFILING */
|
#endif /* CC2420_TIMETABLE_PROFILING */
|
||||||
int
|
int
|
||||||
simple_cc2420_interrupt(void)
|
cc2420_interrupt(void)
|
||||||
{
|
{
|
||||||
interrupt_time = timesynch_time();
|
interrupt_time = timesynch_time();
|
||||||
interrupt_time_set = 1;
|
interrupt_time_set = 1;
|
||||||
|
|
||||||
CLEAR_FIFOP_INT();
|
CLEAR_FIFOP_INT();
|
||||||
process_poll(&simple_cc2420_process);
|
process_poll(&cc2420_process);
|
||||||
packet_seen++;
|
packet_seen++;
|
||||||
#if SIMPLE_CC2420_TIMETABLE_PROFILING
|
#if CC2420_TIMETABLE_PROFILING
|
||||||
timetable_clear(&simple_cc2420_timetable);
|
timetable_clear(&cc2420_timetable);
|
||||||
TIMETABLE_TIMESTAMP(simple_cc2420_timetable, "interrupt");
|
TIMETABLE_TIMESTAMP(cc2420_timetable, "interrupt");
|
||||||
#endif /* SIMPLE_CC2420_TIMETABLE_PROFILING */
|
#endif /* CC2420_TIMETABLE_PROFILING */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(simple_cc2420_process, ev, data)
|
PROCESS_THREAD(cc2420_process, ev, data)
|
||||||
{
|
{
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
PRINTF("simple_cc2420_process: started\n");
|
PRINTF("cc2420_process: started\n");
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
|
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
|
||||||
#if SIMPLE_CC2420_TIMETABLE_PROFILING
|
#if CC2420_TIMETABLE_PROFILING
|
||||||
TIMETABLE_TIMESTAMP(simple_cc2420_timetable, "poll");
|
TIMETABLE_TIMESTAMP(cc2420_timetable, "poll");
|
||||||
#endif /* SIMPLE_CC2420_TIMETABLE_PROFILING */
|
#endif /* CC2420_TIMETABLE_PROFILING */
|
||||||
|
|
||||||
if(receiver_callback != NULL) {
|
if(receiver_callback != NULL) {
|
||||||
PRINTF("simple_cc2420_process: calling receiver callback\n");
|
PRINTF("cc2420_process: calling receiver callback\n");
|
||||||
receiver_callback(&simple_cc2420_driver);
|
receiver_callback(&cc2420_driver);
|
||||||
#if SIMPLE_CC2420_TIMETABLE_PROFILING
|
#if CC2420_TIMETABLE_PROFILING
|
||||||
TIMETABLE_TIMESTAMP(simple_cc2420_timetable, "end");
|
TIMETABLE_TIMESTAMP(cc2420_timetable, "end");
|
||||||
timetable_aggregate_compute_detailed(&aggregate_time,
|
timetable_aggregate_compute_detailed(&aggregate_time,
|
||||||
&simple_cc2420_timetable);
|
&cc2420_timetable);
|
||||||
timetable_clear(&simple_cc2420_timetable);
|
timetable_clear(&cc2420_timetable);
|
||||||
#endif /* SIMPLE_CC2420_TIMETABLE_PROFILING */
|
#endif /* CC2420_TIMETABLE_PROFILING */
|
||||||
} else {
|
} else {
|
||||||
uint8_t dummy;
|
uint8_t dummy;
|
||||||
PRINTF("simple_cc2420_process not receiving function\n");
|
PRINTF("cc2420_process not receiving function\n");
|
||||||
FASTSPI_READ_FIFO_BYTE(dummy);
|
FASTSPI_READ_FIFO_BYTE(dummy);
|
||||||
FASTSPI_STROBE(CC2420_SFLUSHRX);
|
FASTSPI_STROBE(CC2420_SFLUSHRX);
|
||||||
FASTSPI_STROBE(CC2420_SFLUSHRX);
|
FASTSPI_STROBE(CC2420_SFLUSHRX);
|
||||||
|
@ -518,7 +518,7 @@ PROCESS_THREAD(simple_cc2420_process, ev, data)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
simple_cc2420_read(void *buf, unsigned short bufsize)
|
cc2420_read(void *buf, unsigned short bufsize)
|
||||||
{
|
{
|
||||||
uint8_t footer[2];
|
uint8_t footer[2];
|
||||||
int len;
|
int len;
|
||||||
|
@ -530,19 +530,19 @@ simple_cc2420_read(void *buf, unsigned short bufsize)
|
||||||
packet_seen = 0;
|
packet_seen = 0;
|
||||||
|
|
||||||
if(interrupt_time_set) {
|
if(interrupt_time_set) {
|
||||||
#if SIMPLE_CC2420_CONF_TIMESTAMPS
|
#if CC2420_CONF_TIMESTAMPS
|
||||||
simple_cc2420_time_of_arrival = interrupt_time;
|
cc2420_time_of_arrival = interrupt_time;
|
||||||
#endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#endif /* CC2420_CONF_TIMESTAMPS */
|
||||||
interrupt_time_set = 0;
|
interrupt_time_set = 0;
|
||||||
} else {
|
} else {
|
||||||
simple_cc2420_time_of_arrival = 0;
|
cc2420_time_of_arrival = 0;
|
||||||
}
|
}
|
||||||
simple_cc2420_time_of_departure = 0;
|
cc2420_time_of_departure = 0;
|
||||||
GET_LOCK();
|
GET_LOCK();
|
||||||
|
|
||||||
FASTSPI_READ_FIFO_BYTE(len);
|
FASTSPI_READ_FIFO_BYTE(len);
|
||||||
|
|
||||||
if(len > SIMPLE_CC2420_MAX_PACKET_LEN) {
|
if(len > CC2420_MAX_PACKET_LEN) {
|
||||||
uint8_t dummy;
|
uint8_t dummy;
|
||||||
/* Oops, we must be out of sync. */
|
/* Oops, we must be out of sync. */
|
||||||
FASTSPI_READ_FIFO_BYTE(dummy);
|
FASTSPI_READ_FIFO_BYTE(dummy);
|
||||||
|
@ -555,44 +555,44 @@ simple_cc2420_read(void *buf, unsigned short bufsize)
|
||||||
|
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
/* Read payload and two bytes of footer */
|
/* Read payload and two bytes of footer */
|
||||||
PRINTF("simple_cc2420_read: len %d\n", len);
|
PRINTF("cc2420_read: len %d\n", len);
|
||||||
if(len <= FOOTER_LEN + TIMESTAMP_LEN) {
|
if(len <= FOOTER_LEN + TIMESTAMP_LEN) {
|
||||||
FASTSPI_READ_FIFO_GARBAGE(len);
|
FASTSPI_READ_FIFO_GARBAGE(len);
|
||||||
RIMESTATS_ADD(tooshort);
|
RIMESTATS_ADD(tooshort);
|
||||||
} else if(len - FOOTER_LEN - TIMESTAMP_LEN > bufsize) {
|
} else if(len - FOOTER_LEN - TIMESTAMP_LEN > bufsize) {
|
||||||
PRINTF("simple_cc2420_read too big len=%d bufsize %d\n", len, bufsize);
|
PRINTF("cc2420_read too big len=%d bufsize %d\n", len, bufsize);
|
||||||
// FASTSPI_READ_FIFO_GARBAGE(2);
|
// FASTSPI_READ_FIFO_GARBAGE(2);
|
||||||
FASTSPI_READ_FIFO_NO_WAIT(buf, bufsize);
|
FASTSPI_READ_FIFO_NO_WAIT(buf, bufsize);
|
||||||
FASTSPI_READ_FIFO_GARBAGE(len - bufsize - FOOTER_LEN - TIMESTAMP_LEN);
|
FASTSPI_READ_FIFO_GARBAGE(len - bufsize - FOOTER_LEN - TIMESTAMP_LEN);
|
||||||
#if SIMPLE_CC2420_CONF_TIMESTAMPS
|
#if CC2420_CONF_TIMESTAMPS
|
||||||
FASTSPI_READ_FIFO_NO_WAIT(&t, TIMESTAMP_LEN); /* Time stamp */
|
FASTSPI_READ_FIFO_NO_WAIT(&t, TIMESTAMP_LEN); /* Time stamp */
|
||||||
#endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#endif /* CC2420_CONF_TIMESTAMPS */
|
||||||
FASTSPI_READ_FIFO_NO_WAIT(footer, FOOTER_LEN);
|
FASTSPI_READ_FIFO_NO_WAIT(footer, FOOTER_LEN);
|
||||||
len = TIMESTAMP_LEN + FOOTER_LEN;
|
len = TIMESTAMP_LEN + FOOTER_LEN;
|
||||||
RIMESTATS_ADD(toolong);
|
RIMESTATS_ADD(toolong);
|
||||||
} else {
|
} else {
|
||||||
FASTSPI_READ_FIFO_NO_WAIT(buf, len - FOOTER_LEN - TIMESTAMP_LEN);
|
FASTSPI_READ_FIFO_NO_WAIT(buf, len - FOOTER_LEN - TIMESTAMP_LEN);
|
||||||
/* PRINTF("simple_cc2420_read: data\n");*/
|
/* PRINTF("cc2420_read: data\n");*/
|
||||||
FASTSPI_READ_FIFO_NO_WAIT(&t, TIMESTAMP_LEN); /* Time stamp */
|
FASTSPI_READ_FIFO_NO_WAIT(&t, TIMESTAMP_LEN); /* Time stamp */
|
||||||
FASTSPI_READ_FIFO_NO_WAIT(footer, FOOTER_LEN);
|
FASTSPI_READ_FIFO_NO_WAIT(footer, FOOTER_LEN);
|
||||||
/* PRINTF("simple_cc2420_read: footer\n");*/
|
/* PRINTF("cc2420_read: footer\n");*/
|
||||||
if(footer[1] & FOOTER1_CRC_OK) {
|
if(footer[1] & FOOTER1_CRC_OK) {
|
||||||
simple_cc2420_last_rssi = footer[0];
|
cc2420_last_rssi = footer[0];
|
||||||
simple_cc2420_last_correlation = footer[1] & FOOTER1_CORRELATION;
|
cc2420_last_correlation = footer[1] & FOOTER1_CORRELATION;
|
||||||
RIMESTATS_ADD(llrx);
|
RIMESTATS_ADD(llrx);
|
||||||
} else {
|
} else {
|
||||||
RIMESTATS_ADD(badcrc);
|
RIMESTATS_ADD(badcrc);
|
||||||
len = TIMESTAMP_LEN + FOOTER_LEN;
|
len = TIMESTAMP_LEN + FOOTER_LEN;
|
||||||
}
|
}
|
||||||
#if SIMPLE_CC2420_CONF_TIMESTAMPS
|
#if CC2420_CONF_TIMESTAMPS
|
||||||
simple_cc2420_time_of_departure =
|
cc2420_time_of_departure =
|
||||||
t.time +
|
t.time +
|
||||||
setup_time_for_transmission +
|
setup_time_for_transmission +
|
||||||
(total_time_for_transmission * (len - 2)) / total_transmission_len;
|
(total_time_for_transmission * (len - 2)) / total_transmission_len;
|
||||||
|
|
||||||
simple_cc2420_authority_level_of_sender = t.authority_level;
|
cc2420_authority_level_of_sender = t.authority_level;
|
||||||
|
|
||||||
#endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
|
#endif /* CC2420_CONF_TIMESTAMPS */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,13 +601,13 @@ simple_cc2420_read(void *buf, unsigned short bufsize)
|
||||||
*/
|
*/
|
||||||
if(FIFOP_IS_1 && !FIFO_IS_1) {
|
if(FIFOP_IS_1 && !FIFO_IS_1) {
|
||||||
uint8_t dummy;
|
uint8_t dummy;
|
||||||
/* printf("simple_cc2420_read: FIFOP_IS_1 1\n");*/
|
/* printf("cc2420_read: FIFOP_IS_1 1\n");*/
|
||||||
FASTSPI_READ_FIFO_BYTE(dummy);
|
FASTSPI_READ_FIFO_BYTE(dummy);
|
||||||
strobe(CC2420_SFLUSHRX);
|
strobe(CC2420_SFLUSHRX);
|
||||||
strobe(CC2420_SFLUSHRX);
|
strobe(CC2420_SFLUSHRX);
|
||||||
} else if(FIFOP_IS_1) {
|
} else if(FIFOP_IS_1) {
|
||||||
/* Another packet has been received and needs attention. */
|
/* Another packet has been received and needs attention. */
|
||||||
process_poll(&simple_cc2420_process);
|
process_poll(&cc2420_process);
|
||||||
packet_seen = 1;
|
packet_seen = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ simple_cc2420_read(void *buf, unsigned short bufsize)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
simple_cc2420_set_txpower(uint8_t power)
|
cc2420_set_txpower(uint8_t power)
|
||||||
{
|
{
|
||||||
uint16_t reg;
|
uint16_t reg;
|
||||||
|
|
||||||
|
@ -633,29 +633,29 @@ simple_cc2420_set_txpower(uint8_t power)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
simple_cc2420_get_txpower(void)
|
cc2420_get_txpower(void)
|
||||||
{
|
{
|
||||||
return (int)(getreg(CC2420_TXCTRL) & 0x001f);
|
return (int)(getreg(CC2420_TXCTRL) & 0x001f);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
simple_cc2420_rssi(void)
|
cc2420_rssi(void)
|
||||||
{
|
{
|
||||||
int rssi;
|
int rssi;
|
||||||
int radio_was_off = 0;
|
int radio_was_off = 0;
|
||||||
|
|
||||||
if(!receive_on) {
|
if(!receive_on) {
|
||||||
radio_was_off = 1;
|
radio_was_off = 1;
|
||||||
simple_cc2420_on();
|
cc2420_on();
|
||||||
}
|
}
|
||||||
while(!(status() & BV(CC2420_RSSI_VALID))) {
|
while(!(status() & BV(CC2420_RSSI_VALID))) {
|
||||||
/* printf("simple_cc2420_rssi: RSSI not valid.\n");*/
|
/* printf("cc2420_rssi: RSSI not valid.\n");*/
|
||||||
}
|
}
|
||||||
|
|
||||||
rssi = (int)((signed char)getreg(CC2420_RSSI));
|
rssi = (int)((signed char)getreg(CC2420_RSSI));
|
||||||
|
|
||||||
if(radio_was_off) {
|
if(radio_was_off) {
|
||||||
simple_cc2420_off();
|
cc2420_off();
|
||||||
}
|
}
|
||||||
return rssi;
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: cc2420.h,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $
|
* $Id: cc2420.h,v 1.7 2008/07/02 09:05:40 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,50 +38,50 @@
|
||||||
* Adam Dunkels <adam@sics.se>
|
* Adam Dunkels <adam@sics.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SIMPLE_CC2420_H__
|
#ifndef __CC2420_H__
|
||||||
#define __SIMPLE_CC2420_H__
|
#define __CC2420_H__
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "dev/radio.h"
|
#include "dev/radio.h"
|
||||||
|
|
||||||
void simple_cc2420_init(void);
|
void cc2420_init(void);
|
||||||
|
|
||||||
#define SIMPLE_CC2420_MAX_PACKET_LEN 127
|
#define CC2420_MAX_PACKET_LEN 127
|
||||||
|
|
||||||
void simple_cc2420_set_channel(int channel);
|
void cc2420_set_channel(int channel);
|
||||||
int simple_cc2420_get_channel(void);
|
int cc2420_get_channel(void);
|
||||||
|
|
||||||
void simple_cc2420_set_pan_addr(unsigned pan,
|
void cc2420_set_pan_addr(unsigned pan,
|
||||||
unsigned addr,
|
unsigned addr,
|
||||||
const uint8_t *ieee_addr);
|
const uint8_t *ieee_addr);
|
||||||
|
|
||||||
extern signed char simple_cc2420_last_rssi;
|
extern signed char cc2420_last_rssi;
|
||||||
extern uint8_t simple_cc2420_last_correlation;
|
extern uint8_t cc2420_last_correlation;
|
||||||
|
|
||||||
int simple_cc2420_rssi(void);
|
int cc2420_rssi(void);
|
||||||
|
|
||||||
extern const struct radio_driver simple_cc2420_driver;
|
extern const struct radio_driver cc2420_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \param power Between 1 and 31.
|
* \param power Between 1 and 31.
|
||||||
*/
|
*/
|
||||||
void simple_cc2420_set_txpower(uint8_t power);
|
void cc2420_set_txpower(uint8_t power);
|
||||||
int simple_cc2420_get_txpower(void);
|
int cc2420_get_txpower(void);
|
||||||
#define SIMPLE_CC2420_TXPOWER_MAX 31
|
#define CC2420_TXPOWER_MAX 31
|
||||||
#define SIMPLE_CC2420_TXPOWER_MIN 0
|
#define CC2420_TXPOWER_MIN 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interrupt function, called from the simple-cc2420-arch driver.
|
* Interrupt function, called from the simple-cc2420-arch driver.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int simple_cc2420_interrupt(void);
|
int cc2420_interrupt(void);
|
||||||
|
|
||||||
/* XXX hack: these will be made as Chameleon packet attributes */
|
/* XXX hack: these will be made as Chameleon packet attributes */
|
||||||
extern rtimer_clock_t simple_cc2420_time_of_arrival,
|
extern rtimer_clock_t cc2420_time_of_arrival,
|
||||||
simple_cc2420_time_of_departure;
|
cc2420_time_of_departure;
|
||||||
extern int simple_cc2420_authority_level_of_sender;
|
extern int cc2420_authority_level_of_sender;
|
||||||
|
|
||||||
int simple_cc2420_on(void);
|
int cc2420_on(void);
|
||||||
int simple_cc2420_off(void);
|
int cc2420_off(void);
|
||||||
|
|
||||||
#endif /* __SIMPLE_CC2420_H__ */
|
#endif /* __CC2420_H__ */
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: timesynch.c,v 1.4 2008/07/01 21:02:51 adamdunkels Exp $
|
* $Id: timesynch.c,v 1.5 2008/07/02 09:05:40 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,11 +105,11 @@ incoming_packet(void)
|
||||||
packet. If the sending node has a lower authority level than we
|
packet. If the sending node has a lower authority level than we
|
||||||
have, we synchronize to the time of the sending node and set our
|
have, we synchronize to the time of the sending node and set our
|
||||||
own authority level to be one more than the sending node. */
|
own authority level to be one more than the sending node. */
|
||||||
if(simple_cc2420_authority_level_of_sender < authority_level) {
|
if(cc2420_authority_level_of_sender < authority_level) {
|
||||||
adjust_offset(simple_cc2420_time_of_departure,
|
adjust_offset(cc2420_time_of_departure,
|
||||||
simple_cc2420_time_of_arrival);
|
cc2420_time_of_arrival);
|
||||||
if(simple_cc2420_authority_level_of_sender + 1 != authority_level) {
|
if(cc2420_authority_level_of_sender + 1 != authority_level) {
|
||||||
authority_level = simple_cc2420_authority_level_of_sender + 1;
|
authority_level = cc2420_authority_level_of_sender + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: cc2420-arch.c,v 1.1 2008/07/01 21:02:51 adamdunkels Exp $
|
* @(#)$Id: cc2420-arch.c,v 1.2 2008/07/02 09:05:40 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -40,17 +40,17 @@
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
interrupt(PORT1_VECTOR)
|
interrupt(PORT1_VECTOR)
|
||||||
simple_cc24240_port1_interrupt(void)
|
cc24240_port1_interrupt(void)
|
||||||
{
|
{
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
if(simple_cc2420_interrupt()) {
|
if(cc2420_interrupt()) {
|
||||||
LPM4_EXIT;
|
LPM4_EXIT;
|
||||||
}
|
}
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
simple_cc2420_arch_init(void)
|
cc2420_arch_init(void)
|
||||||
{
|
{
|
||||||
spi_init();
|
spi_init();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: contiki-sky-main.c,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $
|
* @(#)$Id: contiki-sky-main.c,v 1.7 2008/07/02 09:05:41 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -126,7 +126,7 @@ main(int argc, char **argv)
|
||||||
#endif /* WITH_UIP */
|
#endif /* WITH_UIP */
|
||||||
|
|
||||||
printf("Starting %s "
|
printf("Starting %s "
|
||||||
"($Id: contiki-sky-main.c,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $)\n", __FILE__);
|
"($Id: contiki-sky-main.c,v 1.7 2008/07/02 09:05:41 adamdunkels Exp $)\n", __FILE__);
|
||||||
ds2411_init();
|
ds2411_init();
|
||||||
sensors_light_init();
|
sensors_light_init();
|
||||||
sht11_init();
|
sht11_init();
|
||||||
|
@ -164,14 +164,14 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
set_rime_addr();
|
set_rime_addr();
|
||||||
|
|
||||||
simple_cc2420_init();
|
cc2420_init();
|
||||||
simple_cc2420_set_pan_addr(panId, 0 /*XXX*/, ds2411_id);
|
cc2420_set_pan_addr(panId, 0 /*XXX*/, ds2411_id);
|
||||||
simple_cc2420_set_channel(RF_CHANNEL);
|
cc2420_set_channel(RF_CHANNEL);
|
||||||
|
|
||||||
simple_cc2420_set_txpower(31);
|
cc2420_set_txpower(31);
|
||||||
nullmac_init(&simple_cc2420_driver);
|
nullmac_init(&cc2420_driver);
|
||||||
rime_init(&nullmac_driver);
|
rime_init(&nullmac_driver);
|
||||||
// xmac_init(&simple_cc2420_driver);
|
// xmac_init(&cc2420_driver);
|
||||||
// rime_init(&xmac_driver);
|
// rime_init(&xmac_driver);
|
||||||
|
|
||||||
/* rimeaddr_set_node_addr*/
|
/* rimeaddr_set_node_addr*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: energest-demo.c,v 1.6 2008/07/01 21:02:51 adamdunkels Exp $
|
* $Id: energest-demo.c,v 1.7 2008/07/02 09:05:41 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,8 +125,8 @@ do_sending(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
simple_cc2420_set_channel(11);
|
cc2420_set_channel(11);
|
||||||
simple_cc2420_set_txpower(1);
|
cc2420_set_txpower(1);
|
||||||
|
|
||||||
for(i = 0;i < send_amount; i++) {
|
for(i = 0;i < send_amount; i++) {
|
||||||
rimebuf_copyfrom(send_string, send_length);
|
rimebuf_copyfrom(send_string, send_length);
|
||||||
|
@ -135,8 +135,8 @@ do_sending(void)
|
||||||
abc_send(&abc);
|
abc_send(&abc);
|
||||||
mac->off(0);
|
mac->off(0);
|
||||||
}
|
}
|
||||||
simple_cc2420_set_txpower(31);
|
cc2420_set_txpower(31);
|
||||||
simple_cc2420_set_channel(RF_CHANNEL);
|
cc2420_set_channel(RF_CHANNEL);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(output_process, ev, data)
|
PROCESS_THREAD(output_process, ev, data)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: sky-collect.c,v 1.5 2008/07/01 21:02:51 adamdunkels Exp $
|
* $Id: sky-collect.c,v 1.6 2008/07/02 09:05:41 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,10 +134,10 @@ do_rssi(void)
|
||||||
|
|
||||||
rime_mac->off(0);
|
rime_mac->off(0);
|
||||||
|
|
||||||
simple_cc2420_on();
|
cc2420_on();
|
||||||
for(channel = 11; channel <= 26; ++channel) {
|
for(channel = 11; channel <= 26; ++channel) {
|
||||||
simple_cc2420_set_channel(channel);
|
cc2420_set_channel(channel);
|
||||||
rssi_samples[sample].channel[channel - 11] = simple_cc2420_rssi() + 53;
|
rssi_samples[sample].channel[channel - 11] = cc2420_rssi() + 53;
|
||||||
}
|
}
|
||||||
|
|
||||||
rime_mac->on();
|
rime_mac->on();
|
||||||
|
@ -160,7 +160,7 @@ do_rssi(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
recv(rimeaddr_t *originator, uint8_t seqno, uint8_t hops)
|
recv(const rimeaddr_t *originator, uint8_t seqno, uint8_t hops)
|
||||||
{
|
{
|
||||||
struct sky_collect_msg *msg;
|
struct sky_collect_msg *msg;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: contiki-sky-main.c,v 1.31 2008/07/01 21:02:51 adamdunkels Exp $
|
* @(#)$Id: contiki-sky-main.c,v 1.32 2008/07/02 09:05:41 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -232,13 +232,13 @@ main(int argc, char **argv)
|
||||||
process_start(&sensors_process, NULL);
|
process_start(&sensors_process, NULL);
|
||||||
ctimer_init();
|
ctimer_init();
|
||||||
|
|
||||||
simple_cc2420_init();
|
cc2420_init();
|
||||||
simple_cc2420_set_pan_addr(panId, 0 /*XXX*/, ds2411_id);
|
cc2420_set_pan_addr(panId, 0 /*XXX*/, ds2411_id);
|
||||||
simple_cc2420_set_channel(RF_CHANNEL);
|
cc2420_set_channel(RF_CHANNEL);
|
||||||
#if WITH_NULLMAC
|
#if WITH_NULLMAC
|
||||||
rime_init(nullmac_init(&simple_cc2420_driver));
|
rime_init(nullmac_init(&cc2420_driver));
|
||||||
#else
|
#else
|
||||||
rime_init(xmac_init(&simple_cc2420_driver));
|
rime_init(xmac_init(&cc2420_driver));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf(CONTIKI_VERSION_STRING " started. ");
|
printf(CONTIKI_VERSION_STRING " started. ");
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: radio-sensor.c,v 1.2 2008/07/01 21:02:51 adamdunkels Exp $
|
* @(#)$Id: radio-sensor.c,v 1.3 2008/07/02 09:05:41 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
|
@ -71,10 +71,10 @@ value(int type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case RADIO_SENSOR_LAST_PACKET:
|
case RADIO_SENSOR_LAST_PACKET:
|
||||||
return simple_cc2420_last_correlation;
|
return cc2420_last_correlation;
|
||||||
case RADIO_SENSOR_LAST_VALUE:
|
case RADIO_SENSOR_LAST_VALUE:
|
||||||
default:
|
default:
|
||||||
return simple_cc2420_last_rssi;
|
return cc2420_last_rssi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue