RF24G 0.9
Simple Abstraction Layer for the nRF24L01
Loading...
Searching...
No Matches
List of all members
RF24_G Class Reference

Primary public interface

These are the main methods you need to send and receive data.

 RF24_G ()
 
 RF24_G (uint8_t address)
 
 RF24_G (uint8_t address, uint8_t _cepin, uint8_t _cspin)
 
bool available ()
 
bool write (packet *_packet)
 
bool read (packet *_packet)
 
bool setChannel (uint8_t channel)
 

Detailed Description

Examples
rf24g_receive.cpp, and rf24g_send.cpp.

Constructor & Destructor Documentation

◆ RF24_G() [1/3]

RF24_G::RF24_G ( )

Default Constructor

Creates a new instance of the radio object. This configures tmrh20's driver to default settings.
Use this if you want to instantiate the radio class, but initialize it later.

◆ RF24_G() [2/3]

RF24_G::RF24_G ( uint8_t address)

Constructor

Creates a new instance of the radio object for NRF52x devices. This configures tmrh20's driver. Before using, you create an instance

Parameters
addressThe address of tis radio instance

◆ RF24_G() [3/3]

RF24_G::RF24_G ( uint8_t address,
uint8_t _cepin,
uint8_t _cspin )

Constructor

Creates a new instance of the radio object for RF24 devices. This configures tmrh20's driver. Before using, you create an instance and send in the unique pins that this chip is connected to. If you have followed the wiring diagram on the first page, the CE pin should be 7 and the CS pin should be 8.

Parameters
addressThe address of tis radio instance
_cepinThe pin attached to Chip Enable (CE) pin on the RF module
_cspinThe pin attached to Chip Select (CS) pin

Member Function Documentation

◆ available()

bool RF24_G::available ( )

Checks if there is a packet received packet to be read

Returns
True if a packet is available, false if not.
Examples
rf24g_receive.cpp, and rf24g_send.cpp.

◆ write()

bool RF24_G::write ( packet * _packet)

Writes data to a packet. The packet is passed by reference, this means we need to use the & operator.

//write() example:
int var;
if (radio.write( &packet) == false) {
Serial.println("Transmission failed!")
}
Definition rf24g.h:36
Returns
True if a packet was sent successfully, false if not.
Note
Just because a packet was not sent successfully, it does not mean a packet was not received by the target radio!
This could be due to the sender not receiving the confirmation that the target radio has received the packet.
This could be fixed with a 3 way handshake, but that is not supported in hardware and would be slow in software.
If you are afraid to send the same data twice, don't worry. Duplicate packets are taken care of at the reciving side.
Examples
rf24g_receive.cpp, and rf24g_send.cpp.

◆ read()

bool RF24_G::read ( packet * _packet)

Reads a packet. The packet is passed by reference, this means we need to use the & operator.

//read() example:
int var;
if (radio.read( &packet) == false) {
Serial.println("Receive failed!")
}
Returns
True if a packet was read successfully, false if not.
Examples
rf24g_receive.cpp, and rf24g_send.cpp.

◆ setChannel()

bool RF24_G::setChannel ( uint8_t channel)

Sets the channel to use

Note
The available channels are 0-125, but channels 108+ are out of the wifi band and recommended.
Returns
True if the channel was set successfully, false if not.

The documentation for this class was generated from the following files: