Skip to content

Commit 26a87ee

Browse files
committed
Improved handling of cc2x3x rf_flags
1 parent 43f2790 commit 26a87ee

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

cpu/cc2430/dev/cc2430_rf.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@
7676
#define PRINTF(...) do {} while (0)
7777
#endif
7878

79-
#define RX_ACTIVE 0x80
80-
#define TX_ACK 0x40
81-
#define TX_ON_AIR 0x20
82-
#define WAS_OFF 0x10
79+
/* rf_flags bits */
80+
#define RX_ACTIVE 0x80
81+
#define TX_ACK 0x40
82+
#define TX_ON_AIR 0x20
83+
#define WAS_OFF 0x10
84+
#define INITIALISED 0x01
85+
8386
#define RX_NO_DMA
8487
/* Bits of the last byte in the RX FIFO */
8588
#define CRC_BIT_MASK 0x80
@@ -102,7 +105,6 @@ uint8_t rf_error = 0;
102105
PROCESS(cc2430_rf_process, "CC2430 RF driver");
103106
#endif
104107
/*---------------------------------------------------------------------------*/
105-
static uint8_t rf_initialized = 0;
106108
static uint8_t __data rf_flags;
107109
static uint8_t rf_channel;
108110

@@ -308,7 +310,7 @@ cc2430_rf_send_ack(uint8_t pending)
308310
static int
309311
init(void)
310312
{
311-
if(rf_initialized) {
313+
if(rf_flags & INITIALISED) {
312314
return 0;
313315
}
314316

@@ -358,7 +360,8 @@ init(void)
358360

359361
RF_TX_LED_OFF();
360362
RF_RX_LED_OFF();
361-
rf_initialized = 1;
363+
364+
rf_flags |= INITIALISED;
362365

363366
#if !NETSTACK_CONF_SHORTCUTS
364367
process_start(&cc2430_rf_process, NULL);

cpu/cc253x/dev/cc2530-rf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ off(void)
475475
CC2530_CSP_ISRFOFF();
476476
CC2530_CSP_ISFLUSHRX();
477477

478-
rf_flags = 0;
478+
rf_flags &= ~RX_ACTIVE;
479479

480480
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
481481
return 1;

0 commit comments

Comments
 (0)