6.5.7. Radio

6.5.7.1. Functions

void RADIO_transferPktToTxFifo(UINT8_t bdHndl)

Function calls a CC2520 transmit function so that packet can be copied to the transmit FIFO buffer. Packet to be transmitted is identified by the memory handle passed as an input argument to this function.

Parameters:
  • bdHndl – Handle to the packet to be transmitted. Length of packet is available via this handle.

6.5.7.2. Globals

RADIO_state_t RADIO_state

Stores the current state of the radio. It is initialized to RADIO_STATE_IDLE. Indirect access to this variable is preferred via macros RADIO_getCurrState() and RADIO_setCurrState().

6.5.7.3. Macros

#define RADIO_TX_POWER_LEVEL_PLUS_5_DBM     5
#define RADIO_TX_POWER_LEVEL_PLUS_3_DBM     3
#define RADIO_TX_POWER_LEVEL_PLUS_2_DBM     2
#define RADIO_TX_POWER_LEVEL_PLUS_1_DBM     1
#define RADIO_TX_POWER_LEVEL_0_DBM          0
#define RADIO_TX_POWER_LEVEL_MINUS_2_DBM   -2
#define RADIO_TX_POWER_LEVEL_MINUS_4_DBM   -4
#define RADIO_TX_POWER_LEVEL_MINUS_7_DBM   -7
#define RADIO_TX_POWER_LEVEL_MINUS_18_DBM  -18


#define RADIO_RCVD_PKT_RSSI_INFO_LEN   CC2520_RCVD_PKT_RSSI_INFO_LEN
#define RADIO_RCVD_PKT_CORRELATION_INFO_LEN  CC2520_RCVD_PKT_CORRELATION_INFO_LEN

#define RADIO_getCurrState()  RADIO_state

#define RADIO_hardRxStart()  cc2520_hardRxStart()

#define RADIO_setCurrState(newState)  RADIO_state = (newState)

#define RADIO_hardRxStop()  cc2520_hardRxStop()

#define RADIO_softRxStart()  cc2520_softRxStart()

#define RADIO_startTxOnCCA() cc2520_insStrobe(CC2520_INS_STXONCCA)

#define RADIO_flushRx( ) cc2520_insStrobe(CC2520_INS_SFLUSHRX);

#define RADIO_flushTx( ) cc2520_insStrobe(CC2520_INS_SFLUSHTX);

#define RADIO_setChan(chan) cc2520_setPhyChan(chan)

#define RADIO_rxOvflProc( ) cc2520_rxOvflProc( )

#define RADIO_checkRadioErrors( ) cc2520_checkRadioErrors( )

#define RADIO_setFramePendingEveryAck( ) \
        cc2520_bitSet(CC2520_MAKE_BIT_ADDR(CC2520_FRMCTRL1, CC2520_FRMCTRL1_PENDING_OR_BIT_NR));

#define RADIO_clearFramePendingEveryAck( ) \
        cc2520_bitClear(CC2520_MAKE_BIT_ADDR(CC2520_FRMCTRL1, CC2520_FRMCTRL1_PENDING_OR_BIT_NR));

#define RADIO_cfgShortAddrFilter(shortAddr)  CC2520_setLocalShortAddr(shortAddr)

#define RADIO_cfgPanIdFilter(panId)  CC2520_setLocalPanId(panId)

#define RADIO_cfgExtAddrFilter(extAddr_p)  \
        cc2520_memWrite(CC2520_RAM_LOCAL_EXT_ADDR, MAC_EXT_ADDR_LEN, extAddr_p)

#define RADIO_enableAutoAck( ) \
        cc2520_bitSet(CC2520_MAKE_BIT_ADDR(CC2520_FRMCTRL0, \
                                           CC2520_FRMCTRL0_AUTOACK_BIT_NR));

#define RADIO_sendToTxFifo(buff_p, buffLen) \
        cc2520_writeToTxFifo((buffLen), (buff_p))

#define RADIO_setTxPower(powerInDbm) \
        cc2520_setTxPower((powerInDbm))

#define RADIO_txPowerSetPointValid(powerInDbm) \
        cc2520_txPowerSetPointValid((powerInDbm))


#define RADIO_enterLPM( )  \
do \
{  \
   cc2520_enterLPM( );  \
   RADIO_setCurrState(RADIO_STATE_LPM);  \
} while (0)


#define RADIO_exitLPM( ) \
do \
{  \
   cc2520_exitLPM( );  \
   RADIO_setCurrState(RADIO_STATE_IDLE);  \
} while (0)


#define RADIO_restart( )  \
do \
{  \
   RADIO_setCurrState(RADIO_STATE_UNKNOWN); \
   cc2520_exitLPM2( ); \
   RADIO_setCurrState(RADIO_STATE_IDLE); \
} while (0)

6.5.7.4. Type Definitions

typedef enum
{
   RADIO_STATE_UNKNOWN,
   RADIO_STATE_LPM,
   RADIO_STATE_IDLE,   // receiver off
   RADIO_STATE_RX_ON,  // receiver on
   RADIO_STATE_TX_ON   // transmitting
} RADIO_state_t;