Functions
rfhelp.h File Reference

Go to the source code of this file.

Functions

void rfhelp_init (void)
 
void rfhelp_restart (void)
 
int rfhelp_send_data (char *data, int len)
 
int rfhelp_send_data_crc (char *data, int len)
 
int rfhelp_read_rx_data (char *data, int *len, int *pipe)
 
int rfhelp_read_rx_data_crc (char *data, int *len, int *pipe)
 
int rfhelp_rf_status (void)
 
void rfhelp_set_tx_addr (const char *addr, int addr_len)
 
void rfhelp_set_rx_addr (int pipe, const char *addr, int addr_len)
 
void rfhelp_power_down (void)
 
void rfhelp_power_up (void)
 

Function Documentation

void rfhelp_init ( void  )
void rfhelp_power_down ( void  )
void rfhelp_power_up ( void  )
int rfhelp_read_rx_data ( char *  data,
int *  len,
int *  pipe 
)

Read data from the RX fifo

Parameters
dataPointer to the array in which to store the data.
lenPointer to variable storing the data length.
pipePointer to the pipe on which the data was received. Can be 0.
Returns
1: Read OK, more data to read. 0: Read OK -1: No RX data -2: Wrong length read. Something is likely wrong.
int rfhelp_read_rx_data_crc ( char *  data,
int *  len,
int *  pipe 
)

Same as rfhelp_read_rx_data, but will check if there is a valid CRC in the end of the payload.

Parameters
dataPointer to the array in which to store the data.
lenPointer to variable storing the data length.
pipePointer to the pipe on which the data was received. Can be 0.
Returns
1: Read OK, more data to read. 0: Read OK -1: No RX data -2: Wrong length read. Something is likely wrong. -3: Data read, but CRC does not match.
void rfhelp_restart ( void  )

Re-init the rf chip

int rfhelp_rf_status ( void  )
int rfhelp_send_data ( char *  data,
int  len 
)

Set TX mode, send data, wait for result, set RX mode.

Parameters
dataThe data to be sent.
lenLength of the data.
Returns
0: Send OK. -1: Max RT. -2: Timeout
int rfhelp_send_data_crc ( char *  data,
int  len 
)

Same as rfhelp_send_data, but will add a crc checksum to the end. This is useful for protecting against corruption between the NRF and the MCU in case there are errors on the SPI bus.

Parameters
dataThe data to be sent.
lenLength of the data. Should be no more than 30 bytes.
Returns
0: Send OK. -1: Max RT. -2: Timeout
void rfhelp_set_rx_addr ( int  pipe,
const char *  addr,
int  addr_len 
)
void rfhelp_set_tx_addr ( const char *  addr,
int  addr_len 
)