![]() |
nrf24l01+ Library
|
Library for use of the nrf24l01+ radio module with a PIC32. More...
#include <plib.h>
#include "inttypes.h"
Go to the source code of this file.
Functions | |
void | init_SPI () |
Set up SPI for the radio. | |
void | nrf_setup () |
Sets up the radio, SPI, and interrupts. Also resets all radio registers to their default values. | |
void | nrf_read_reg (char reg, char *buff, int len) |
Read a register and store the data in an array. Can be multiple bytes of data. More... | |
void | nrf_write_reg (char reg, char *data, char len) |
Write to a register from an array. Can be multiple bytes of data. More... | |
void | nrf_flush_tx () |
Flush the TX FIFO. | |
void | nrf_flush_rx () |
Flush the RX FIFO. | |
int | nrf_get_payload_width () |
Get the width of the top payload in the RX FIFO. More... | |
void | nrf_write_payload (char *data, char len) |
Write a payload to the TX FIFO. More... | |
void | nrf_read_payload (char *buff) |
Read a payload from the RX FIFO. More... | |
int | nrf_get_payload (char *buff, char len) |
Read a received payload. More... | |
int | nrf_payload_available () |
Check if a payload is available to be read. More... | |
int | nrf_get_pipe () |
Get the number of the pipe the most recent payload was received on. More... | |
int | nrf_get_width () |
Get the width of the most recently received payload. More... | |
void | nrf_pwrup () |
Sets the power up bit in the status register in order to leave the power down state. | |
void | nrf_pwrdown () |
Clears the power up bit in the status register in order to enter the power down state. | |
void | nrf_state_pwr_down () |
Put the radio in the power down state. | |
void | nrf_state_standby_1 () |
Put the radio in the standby 1 state. | |
void | nrf_state_rx_mode () |
Put the radio in the rx mode state. | |
void | nrf_set_prim_rx () |
Set the PRIM_RX bit in the CONFIG register. | |
void | nrf_clear_prim_rx () |
Clear the PRIM_RX bit in the CONFIG register. | |
void | nrf_set_transmit_pwr (char power) |
Set power of transmitter. More... | |
void | nrf_set_transmit_rate (char rate) |
Set data rate. More... | |
void | nrf_set_ard (char ard) |
Set the auto retransmit delay. More... | |
void | nrf_set_arc (char arc) |
Set the auto retransmit count. More... | |
void | nrf_set_rf_ch (char ch) |
Set the RF frequency the radio will operate at. More... | |
char | nrf_received_pipe_num () |
Returns the pipe data is available in. More... | |
void | nrf_set_address_width (char width) |
Set the address width of RX and TX pipes. More... | |
void | nrf_start_cont_wave (char pwr) |
Send a constant carrier wave out at specified power. More... | |
void | nrf_stop_cont_wave () |
Stop sending the carrier wave. More... | |
char | nrf_received_pwr () |
Check the power of the signal the nrf42l01 is receiving. More... | |
void | nrf_en_aa (int pipe) |
Enable auto-acknowledge for a pipe. More... | |
void | nrf_dis_aa (int pipe) |
Disable auto-acknowledge for a pipe. More... | |
void | nrf_en_rxaddr (int pipe) |
Enable a pipe to receive packets. More... | |
void | nrf_dis_rxaddr (int pipe) |
Disable a pipe from receiving packets. More... | |
void | nrf_set_pw (char width, int pipe) |
Set the width received static payloads should be. More... | |
void | nrf_en_dpl (int pipe) |
Enable dynamic payload length for a pipe. More... | |
void | nrf_dis_dpl (int pipe) |
Disable dynamic payload length for a pipe. More... | |
void | nrf_en_dyn_ack () |
Enable dynamic auto-acknowledgements. More... | |
void | nrf_dis_dyn_ack () |
Disable dynamic auto-acknowledgements. More... | |
int | nrf_set_rx_addr (int pipe, uint64_t address, int len) |
Set the address of a pipe. More... | |
void | nrf_set_tx_addr (uint64_t address) |
Set the address for transmitting. More... | |
void | nrf_reset () |
Resets all registers to their default values as listed on the datasheet. More... | |
int | nrf_send_payload (char *data, char len) |
Send a payload over the radio. More... | |
Library for use of the nrf24l01+ radio module with a PIC32.
void nrf_dis_dyn_ack | ( | ) |
Disable dynamic auto-acknowledgements.
Disables sending payloads without using auto-acknowlegment without disabling the auto-acknowledge setting on the transmitter or receiver.
void nrf_en_dyn_ack | ( | ) |
Enable dynamic auto-acknowledgements.
Enables sending payloads without using auto-acknowlegment without disabling the auto-acknowledge setting on the transmitter or receiver. The SENDNOACK function can then be used to do this.
void nrf_read_payload | ( | char * | buff | ) |
Read a payload from the RX FIFO.
buff | Pointer to array where data will be written. |
void nrf_read_reg | ( | char | reg, |
char * | buff, | ||
int | len | ||
) |
Read a register and store the data in an array. Can be multiple bytes of data.
reg | The register to read from. Use constants in nrf24l01.h |
buff | Pointer to the array the data will be stored in. LSB first. |
len | How many bytes of data need to be read. (1-5 bytes) |
void nrf_set_ard | ( | char | ard | ) |
Set the auto retransmit delay.
Set how long the nrf24l01 should wait between retransmitting packets after not receiving an acknowledgement packet. Delay is defined as the end of one transmission to the start of the next. The delay is set according to the equation, delay = 250 + ard * 250 (us).
ard | The length of auto retransmit delay to be set. |
void nrf_write_payload | ( | char * | data, |
char | len | ||
) |
Write a payload to the TX FIFO.
data | Pointer to data to be written. |
len | How many bytes of data will be written. (1-32 bytes) |
void nrf_write_reg | ( | char | reg, |
char * | data, | ||
char | len | ||
) |
Write to a register from an array. Can be multiple bytes of data.
reg | The register to read from. Use constants in nrf24l01.h |
buff | Pointer to the array data will be read from. LSB first. |
len | How many bytes of data to be written. (1-5 bytes) |