Improved handling of cc2x3x rf_flags

This commit is contained in:
George Oikonomou 2012-04-30 17:21:23 +01:00
parent 43f2790357
commit 26a87ee9cb
2 changed files with 11 additions and 8 deletions

View file

@ -76,10 +76,13 @@
#define PRINTF(...) do {} while (0)
#endif
#define RX_ACTIVE 0x80
#define TX_ACK 0x40
#define TX_ON_AIR 0x20
#define WAS_OFF 0x10
/* rf_flags bits */
#define RX_ACTIVE 0x80
#define TX_ACK 0x40
#define TX_ON_AIR 0x20
#define WAS_OFF 0x10
#define INITIALISED 0x01
#define RX_NO_DMA
/* Bits of the last byte in the RX FIFO */
#define CRC_BIT_MASK 0x80
@ -102,7 +105,6 @@ uint8_t rf_error = 0;
PROCESS(cc2430_rf_process, "CC2430 RF driver");
#endif
/*---------------------------------------------------------------------------*/
static uint8_t rf_initialized = 0;
static uint8_t __data rf_flags;
static uint8_t rf_channel;
@ -308,7 +310,7 @@ cc2430_rf_send_ack(uint8_t pending)
static int
init(void)
{
if(rf_initialized) {
if(rf_flags & INITIALISED) {
return 0;
}
@ -358,7 +360,8 @@ init(void)
RF_TX_LED_OFF();
RF_RX_LED_OFF();
rf_initialized = 1;
rf_flags |= INITIALISED;
#if !NETSTACK_CONF_SHORTCUTS
process_start(&cc2430_rf_process, NULL);

View file

@ -475,7 +475,7 @@ off(void)
CC2530_CSP_ISRFOFF();
CC2530_CSP_ISFLUSHRX();
rf_flags = 0;
rf_flags &= ~RX_ACTIVE;
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
return 1;