rf12_recvDone()
The recvDone() function should be called often, to keep receptions and transmissions going. The driver is interrupt driven for all low-level byte-by-byte operation, but needs to be polled to go through the different stages needed to fully process a received packet and to resume reception after sending out a packet.
If the result is true, then a packet has been received and is available for processing. The following global variables will be set:
volatile byte rf12_hdr
Contains the header byte of the received packet - with flag bits and node ID of either the sender or the receiver.
volatile byte rf12_len
The number of data bytes in the packet. A value in the range 0 .. 66.
volatile byte rf12_data
A pointer to the received data.
volatile byte rf12_crc
CRC of the received packet, zero indicates correct reception. If non-zero, then rf12_hdr, rf12_len, and rf12_data should not be relied upon.
To send an acknowledgement, call rf12_sendStart() - but only right after rf12_recvDone() returns true. This is commonly done using the following macros.
if(RF12_WANTS_ACK){
rf12_sendStart(RF12_ACK_REPLY,0,0);
}
(See here for more information)
#include <RF12.h>
#include <Ports.h> // needed to avoid a linker error :(
byte rf12_recvDone();
Parameters
None.