|
FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
SPI device driver for Nordic Semiconductor nRF24L01+ support, with IRQ. More...
#include <fastarduino/devices/nrf24l01p.h>


Public Member Functions | |
| IRQ_NRF24L01 (uint16_t net, uint8_t dev) | |
| Construct NRF transceiver with given channel and pin numbers for SPI slave select, activity enable and interrupt. | |
| void | begin () |
| Start up the device driver. | |
| void | end () |
| Shut down the device driver. | |
Public Member Functions inherited from devices::rf::NRF24L01< CSN, CE > | |
| NRF24L01 (uint16_t net, uint8_t dev) | |
| Construct NRF transceiver with given channel and pin numbers for SPI slave select, activity enable and interrupt. | |
| uint8_t | get_channel () const |
| Get driver channel. | |
| uint16_t | get_network_address () const |
| Get driver network address. | |
| uint8_t | get_device_address () const |
| Get driver device address. | |
| void | set_address (int16_t net, uint8_t dev) |
| Set network and device address. | |
| void | set_channel (uint8_t channel) |
| Set device transmission channel. | |
| void | begin () |
| Start up the device driver. | |
| void | end () |
| Shut down the device driver. | |
| void | powerup () |
| Set power up mode. | |
| void | standby () |
| Set standby mode. | |
| void | powerdown () |
| Set power down. | |
| template<typename T , typename TREF = const T&> | |
| int | send (uint8_t dest, uint8_t port, TREF buf) |
| Send message with given object reference. | |
| int | send (uint8_t dest, uint8_t port) |
| Send an empty message. | |
| template<typename T , typename TREF = T&> | |
| int | recv (uint8_t &src, uint8_t &port, TREF buf, uint32_t ms=0L) |
| Receive message and store into given object reference. | |
| int | recv (uint8_t &src, uint8_t &port, uint32_t ms=0L) |
| Receive an empty message. | |
| void | set_output_power_level (int8_t dBm) |
| Set output power level (-30..10 dBm) | |
| uint16_t | get_trans () const |
| Return number of transmitted messages. | |
| uint16_t | get_retrans () const |
| Return number of retransmissions. | |
| uint16_t | get_drops () const |
| Return number of dropped messages. | |
| template<typename T , typename TREF = const T&> | |
| int | broadcast (uint8_t port, TREF buf) |
| Broadcast message with given object reference. | |
| bool | is_broadcast () const |
| Return true if the latest received message was a broadcast otherwise false. | |
Additional Inherited Members | |
Static Public Attributes inherited from devices::rf::NRF24L01< CSN, CE > | |
| static const uint8_t | BROADCAST = 0x00 |
| Broadcast device address. | |
| static const size_t | DEVICE_PAYLOAD_MAX = 32 |
| Maximum size of payload on device. | |
| static const size_t | PAYLOAD_MAX = DEVICE_PAYLOAD_MAX - 2 |
| Maximum size of payload. | |
Protected Types inherited from devices::rf::NRF24L01< CSN, CE > | |
| enum class | Command : uint8_t { R_REGISTER = 0x00 , W_REGISTER = 0x20 , REG_MASK = 0x1f , R_RX_PAYLOAD = 0x61 , W_TX_PAYLOAD = 0xa0 , FLUSH_TX = 0xe1 , FLUSH_RX = 0xe2 , REUSE_TX_PL = 0xe3 , R_RX_PL_WID = 0x60 , W_ACK_PAYLOAD = 0xa8 , PIPE_MASK = 0x07 , W_TX_PAYLOAD_NO_ACK = 0xb0 , NOP = 0xff } |
| SPI Commands (See chap. More... | |
| enum class | Register : uint8_t { CONFIG = 0x00 , EN_AA = 0x01 , EN_RXADDR = 0x02 , SETUP_AW = 0x03 , SETUP_RETR = 0x04 , RF_CH = 0x05 , RF_SETUP = 0x06 , STATUS = 0x07 , OBSERVE_TX = 0x08 , RPD = 0x09 , RX_ADDR_P0 = 0x0a , RX_ADDR_P1 = 0x0b , RX_ADDR_P2 = 0x0c , RX_ADDR_P3 = 0x0d , RX_ADDR_P4 = 0x0e , RX_ADDR_P5 = 0x0f , TX_ADDR = 0x10 , RX_PW_P0 = 0x11 , RX_PW_P1 = 0x12 , RX_PW_P2 = 0x13 , RX_PW_P3 = 0x14 , RX_PW_P4 = 0x15 , RX_PW_P5 = 0x16 , FIFO_STATUS = 0x17 , DYNPD = 0x1c , FEATURE = 0x1d } |
| NRF transceiver registers map (See chap. More... | |
| enum class | State : uint8_t { POWER_DOWN_STATE = 0 , STANDBY_STATE , RX_STATE , TX_STATE } |
| NRF transceiver states (See chap. More... | |
Protected Member Functions inherited from spi::SPIDevice< CSN > | |
| SPIDevice () INLINE=default | |
Create a new SPIDevice; this sets up the CS pin for later use during transfers. | |
| void | start_transfer () |
| Start an SPI transfer to this device. | |
| void | end_transfer () INLINE |
| End the current SPI ransfer tot hsi device. | |
Protected Member Functions inherited from spi::AbstractSPIDevice | |
| AbstractSPIDevice (const AbstractSPIDevice &)=delete | |
| AbstractSPIDevice & | operator= (const AbstractSPIDevice &)=delete |
| uint8_t | transfer (uint8_t data) |
| Transfer one byte to the currently selected SPI slave device through MOSI pin, and get the byte returned by the device through MISO pin. | |
| void | transfer (uint8_t *data, uint16_t size) |
| Transfer an array of payload data to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin. | |
| void | transfer (const uint8_t *data, uint16_t size) |
| Transfer an array of payload data to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost. | |
| void | transfer (uint8_t *data, uint16_t size, uint8_t sent) |
Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin. | |
| void | transfer (uint16_t size, uint8_t sent) |
Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost. | |
SPI device driver for Nordic Semiconductor nRF24L01+ support, with IRQ.
nRF24L01+ is a cheap 2.4GHz RX/TX chip.
It must be powered at 3.3V maximum but all its input pins are 5V tolerant, hence no level shifting is needed to operate it.
NRF24L01P
+------------+
(GND)------------—1-|GND | (3V3)------------—2-|VCC | (Dn)-------------—3-|CE | (Dn)-------------—4-|CSN | (SCK)------------—5-|SCK | (MOSI)-----------—6-|MOSI | (MISO)-----------—7-|MISO | (PCIn/EXTn)------—8-|IRQ | +---------—+ Notes:
| CSN | the board::DigitalPin connected to the CSN pin |
| CE | the board::DigitalPin connected to the CE pin |
| IRQ | the board::ExternalInterruptPin connected to the IRQ pin |
Definition at line 630 of file nrf24l01p.h.
|
inline |
Construct NRF transceiver with given channel and pin numbers for SPI slave select, activity enable and interrupt.
Default in parenthesis (Standard/Mega Arduino/TinyX4).
| [in] | net | network address. |
| [in] | dev | device address. |
Definition at line 640 of file nrf24l01p.h.
|
inline |
Start up the device driver.
This must be called before any transmission or reception can take place.
Definition at line 649 of file nrf24l01p.h.
|
inline |
Shut down the device driver.
Definition at line 658 of file nrf24l01p.h.