// BASIC_RF_RX_INFO* basicRfReceivePacket(BASIC_RF_RX_INFO *pRRI)
// DESCRIPTION: This function is a part of the basic RF library, // but must be declared by the application. Once the application // has turned on the receiver, using basicRfReceiveOn(), all
// incoming packets will be received by the FIFOP interrupt
// service routine. When finished, the ISR will call the
// basicRfReceivePacket() function. Please note that this function
// must return quickly, since the next received packet will over
// write the active BASIC_RF_RX_INFO structure (pointed to by pRRI).
// ARGUMENT: BASIC_RF_RX_INFO * pRRI
// The reception structure, which contains all relevant info
// about the received packet.
// RETURN VALUE: BASIC_RF_RX_INFO*
// The pointer to the next BASIC_RF_RX_INFO structure to be used // by the FIFOP ISR.
// If there is only one buffer, then return pRRI.
BASIC_RF_RX_INFO* basicRfReceivePacket(BASIC_RF_RX_INFO *pRRI) {
// Adjust the led brightness
PWM0_SET_DUTY_CYCLE(pRRI->pPayload[0]);
// Blink the green LED
SET_GLED();
halWait(10000);
CLR_GLED();
// Continue using the (one and only) reception structure
return pRRI;
} // basicRfReceivePacket
Listing 1—A simple blinking
LED example grounds some of the theory in easily understood C code courtesy of
Chipcon’s simple wireless dimmer/RF range tester demonstration. This excerpt shows
how your application uses a function prototyped in the RF library to perform an
application-specific task based on the contents of the received payload.