Go to the documentation of this file.
8 #ifndef NRF24L01_INTERFACE_H_
9 #define NRF24L01_INTERFACE_H_
14 #define NRF24L01_RFI_MAX_MSG_SIZE (32)
15 #define NRF24L01_RFI_SCAN_TYPE (0) //Channel scanning type.
21 #define MRF_NRF24L01 //Mesh RF interface of this file is NRF24L01
33 NRF24L01_RFI(RF24 &Radio, HardwareSPI& _spi, uint8_t IRQ_pin = 255, ThreadLock* _lock = NULL);
43 bool send(uint8_t* data, uint8_t dataSize)
override;
45 bool recv(uint8_t* data, uint8_t& dataSize, int8_t& rssi)
override;
49 bool sleep()
override;
57 bool setPower(uint8_t power)
override;
69 uint8_t
scanChannels(uint8_t startChannel, uint8_t endChannel, uint8_t retries = 50,
OSTREAM *stream = NULL)
override;
72 return scanChannels(startChannel, endChannel, 50, stream);
79 #ifndef RF_NO_INTERNAL_TMP_BUFFER
86 HardwareSPI*
spi = NULL;
This file contains interface (pattern) class, that has to be overridden to create driver for radio wh...
Definition: NRF24L01_interface.h:23
Radio frequency interface, that helps to use meshNet with different radios or communication types....
Definition: RFInterface.h:48
bool wakeUp() override
Override this method to temporary power on (wake up) the radio from sleep. If the radio cannot sleep,...
Definition: NRF24L01_interface.cpp:175
bool send(uint8_t *data, uint8_t dataSize) override
Override this method to send data through radio.
Definition: NRF24L01_interface.cpp:107
uint8_t available() override
Override this method to get raw size of received frame in bytes.
Definition: NRF24L01_interface.cpp:138
uint8_t lastChannel
Definition: NRF24L01_interface.h:89
void handle() override
This method is included in meshNet::handle() method and it is included in main loop.
Definition: NRF24L01_interface.cpp:299
bool hasError() override
Override this method to check if radio has some error or is not connected to MCU. If this method retu...
Definition: NRF24L01_interface.cpp:103
void printDetails(OSTREAM *stream) override
This method is used to print radio details to stream (usually to Serial port). Method is also called,...
Definition: NRF24L01_interface.cpp:303
const static uint32_t dummy_address
Definition: NRF24L01_interface.h:93
uint8_t scanChannels(uint8_t startChannel, uint8_t endChannel, OSTREAM *stream=NULL) override
This method has to scan all free channels and returns channel with minimum interferences....
Definition: NRF24L01_interface.h:71
uint8_t scanChannels(uint8_t startChannel, uint8_t endChannel, uint8_t retries=50, OSTREAM *stream=NULL) override
This method has to scan all free channels and returns channel with minimum interferences....
Definition: NRF24L01_interface.cpp:316
bool checkInterference() override
Override this method to check, if there is currently an interference in the air. If interference chec...
Definition: NRF24L01_interface.cpp:201
const uint8_t MinChannelNumber
Minimum channel number. When this value is equal or higher than MaxChannelNumber, radio channel canno...
Definition: RFInterface.h:272
bool sleep() override
Override this method to temporary power off the radio. If the radio cannot sleep, just return true.
Definition: NRF24L01_interface.cpp:149
RF24 * radio
RF_NO_INTERNAL_TMP_BUFFER.
Definition: NRF24L01_interface.h:85
bool init() override
Override this method to initialize radio and communication with it.
Definition: NRF24L01_interface.cpp:30
bool setChannel(uint8_t channel) override
Override this method to set radio channel. If channels cannot be set on selected radio,...
Definition: NRF24L01_interface.cpp:205
uint8_t IRQ_Pin
Definition: NRF24L01_interface.h:87
rf24_datarate_e lastSpeed
Definition: NRF24L01_interface.h:90
uint8_t internalTmpBuffer[NRF24L01_RFI_MAX_MSG_SIZE]
Definition: NRF24L01_interface.h:81
#define OSTREAM
Definition: meshConfig.h:41
bool setReceiveInterruptCallback(void(*InterruptCallback)(void)) override
Override this method to set receive message interrupt method. If interrupt cannot be set or is not su...
Definition: NRF24L01_interface.cpp:281
bool setFullSpeed(bool enableFullSpeed) override
Override this method to set full or slow speed (data rate). If speed cannot be set,...
Definition: NRF24L01_interface.cpp:255
#define NRF24L01_RFI_MAX_MSG_SIZE
Definition: NRF24L01_interface.h:14
bool recv(uint8_t *data, uint8_t &dataSize, int8_t &rssi) override
Override this method to read data from radio buffer.
Definition: NRF24L01_interface.cpp:117
NRF24L01_RFI(RF24 &Radio, HardwareSPI &_spi, uint8_t IRQ_pin=255, ThreadLock *_lock=NULL)
Constructor.
Definition: NRF24L01_interface.cpp:7
bool deInit() override
Override this method to de-initialize radio and communication with it.
Definition: NRF24L01_interface.cpp:98
bool interruptHandle() override
This method has to be done, when ReceiveInterrupt happened.
Definition: NRF24L01_interface.cpp:293
bool scanChannelsWorking() override
Checks if channel scan is processed now.
Definition: NRF24L01_interface.cpp:533
bool scanWorking
Definition: NRF24L01_interface.h:91
uint8_t * getInternalTemporaryBuffer() override
Gets pointer to internal temporary buffer with size of MaxFrameLength. This buffer can be used for te...
Definition: NRF24L01_interface.cpp:551
HardwareSPI * spi
Definition: NRF24L01_interface.h:86
uint32_t getChannelsWidth() override
Gets width of each channels in kHz.
Definition: NRF24L01_interface.cpp:537
~NRF24L01_RFI() override
Definition: NRF24L01_interface.cpp:25
bool setPower(uint8_t power) override
Override this method to set radio output power. If radio output power cannot be set,...
Definition: NRF24L01_interface.cpp:232