RadioLib
Universal wireless communication library for Arduino
|
Control class for RF69 module. Also serves as base class for SX1231. More...
#include <RF69.h>
Public Member Functions | |
RF69 (Module *module) | |
Default constructor. More... | |
int16_t | begin (float freq=RADIOLIB_RF69_DEFAULT_FREQ, float br=RADIOLIB_RF69_DEFAULT_BR, float freqDev=RADIOLIB_RF69_DEFAULT_FREQDEV, float rxBw=RADIOLIB_RF69_DEFAULT_RXBW, int8_t pwr=RADIOLIB_RF69_DEFAULT_POWER, uint8_t preambleLen=RADIOLIB_RF69_DEFAULT_PREAMBLELEN) |
Initialization method. More... | |
void | reset () |
Reset method. Will reset the chip to the default state using RST pin. | |
int16_t | transmit (const uint8_t *data, size_t len, uint8_t addr=0) override |
Blocking binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer. More... | |
int16_t | receive (uint8_t *data, size_t len) override |
Blocking binary receive method. Overloads for string-based transmissions are implemented in PhysicalLayer. More... | |
int16_t | sleep () override |
Sets the module to sleep mode. More... | |
int16_t | standby () override |
Sets the module to standby mode. More... | |
int16_t | standby (uint8_t mode) override |
Sets the module to standby. More... | |
int16_t | transmitDirect (uint32_t frf=0) override |
Starts direct mode transmission. More... | |
int16_t | receiveDirect () override |
Starts direct mode reception. More... | |
int16_t | packetMode () |
Stops direct mode. It is required to call this method to switch from direct transmissions to packet-based transmissions. | |
void | setAESKey (uint8_t *key) |
Sets AES key. More... | |
int16_t | enableAES () |
Enables AES encryption. More... | |
int16_t | disableAES () |
Disables AES encryption. More... | |
void | setDio0Action (void(*func)(void)) |
Sets interrupt service routine to call when DIO0 activates. More... | |
void | clearDio0Action () |
Clears interrupt service routine to call when DIO0 activates. | |
void | setDio1Action (void(*func)(void)) |
Sets interrupt service routine to call when DIO1 activates. More... | |
void | clearDio1Action () |
Clears interrupt service routine to call when DIO1 activates. | |
void | setPacketReceivedAction (void(*func)(void)) override |
Sets interrupt service routine to call when a packet is received. More... | |
void | clearPacketReceivedAction () override |
Clears interrupt service routine to call when a packet is received. | |
void | setPacketSentAction (void(*func)(void)) override |
Sets interrupt service routine to call when a packet is sent. More... | |
void | clearPacketSentAction () override |
Clears interrupt service routine to call when a packet is sent. | |
void | setFifoEmptyAction (void(*func)(void)) |
Set interrupt service routine function to call when FIFO is empty. More... | |
void | clearFifoEmptyAction () |
Clears interrupt service routine to call when FIFO is empty. | |
void | setFifoThreshold (uint8_t threshold) |
Set FIFO threshold level. Be aware that threshold is also set in setFifoFullAction method. setFifoThreshold method must be called AFTER calling setFifoFullAction! More... | |
void | setFifoFullAction (void(*func)(void)) |
Set interrupt service routine function to call when FIFO is full. More... | |
void | clearFifoFullAction () |
Clears interrupt service routine to call when FIFO is full. | |
bool | fifoAdd (uint8_t *data, int totalLen, int *remLen) |
Set interrupt service routine function to call when FIFO is empty. More... | |
bool | fifoGet (volatile uint8_t *data, int totalLen, volatile int *rcvLen) |
Set interrupt service routine function to call when FIFO is sufficiently full to read. More... | |
int16_t | startTransmit (const uint8_t *data, size_t len, uint8_t addr=0) override |
Interrupt-driven binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer. More... | |
int16_t | finishTransmit () override |
Clean up after transmission is done. More... | |
int16_t | startReceive () override |
Interrupt-driven receive method. GDO0 will be activated when full packet is received. More... | |
int16_t | startReceive (uint32_t timeout, uint32_t irqFlags, uint32_t irqMask, size_t len) override |
Interrupt-driven receive method, implemented for compatibility with PhysicalLayer. More... | |
int16_t | readData (uint8_t *data, size_t len) override |
Reads data received after calling startReceive method. When the packet length is not known in advance, getPacketLength method must be called BEFORE calling readData! More... | |
int16_t | setFrequency (float freq) override |
Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510.0 MHz and 862.0 to 1020.0 MHz. More... | |
int16_t | getFrequency (float *freq) |
Gets carrier frequency. More... | |
int16_t | setBitRate (float br) override |
Sets bit rate. Allowed values range from 0.5 to 300.0 kbps. More... | |
int16_t | setRxBandwidth (float rxBw) |
Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6, 20.8, 25.0, 31.3, 41.7, 50.0, 62.5, 83.3, 100.0, 125.0, 166.7, 200.0, 250.0, 333.3, 400.0 and 500.0 kHz. More... | |
int16_t | setFrequencyDeviation (float freqDev) override |
Sets frequency deviation. More... | |
int16_t | getFrequencyDeviation (float *freqDev) |
Gets frequency deviation. More... | |
int16_t | setOutputPower (int8_t pwr, bool highPower=false) |
Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to 20 dBm (RF69H/HC/HCW). More... | |
int16_t | setSyncWord (uint8_t *syncWord, size_t len, uint8_t maxErrBits=0) |
Sets sync word. Up to 8 bytes can be set as sync word. More... | |
int16_t | setPreambleLength (uint8_t preambleLen) |
Sets preamble length. More... | |
int16_t | setNodeAddress (uint8_t nodeAddr) |
Sets node address. Calling this method will also enable address filtering for node address only. More... | |
int16_t | setBroadcastAddress (uint8_t broadAddr) |
Sets broadcast address. Calling this method will also enable address filtering for node and broadcast address. More... | |
int16_t | disableAddressFiltering () |
Disables address filtering. Calling this method will also erase previously set addresses. More... | |
void | setAmbientTemperature (int16_t tempAmbient) |
Sets ambient temperature. Required to correct values from on-board temperature sensor. More... | |
int16_t | getTemperature () |
Measures temperature. More... | |
size_t | getPacketLength (bool update=true) override |
Query modem for the packet length of received payload. More... | |
int16_t | setOOK (bool enable) |
Enables/disables OOK modulation instead of FSK. Note: This function calls setRxBandwidth again, since register values differ based on OOK mode being enabled/disabled. More... | |
int16_t | setOokThresholdType (uint8_t type) |
Selects the type of threshold in the OOK data slicer. More... | |
int16_t | setOokFixedThreshold (uint8_t value) |
Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer in OOK when Peak mode is used. More... | |
int16_t | setOokPeakThresholdDecrement (uint8_t value) |
Period of decrement of the RSSI threshold in the OOK demodulator. More... | |
int16_t | fixedPacketLengthMode (uint8_t len=RADIOLIB_RF69_MAX_PACKET_LENGTH) |
Set modem in fixed packet length mode. More... | |
int16_t | variablePacketLengthMode (uint8_t maxLen=RADIOLIB_RF69_MAX_PACKET_LENGTH) |
Set modem in variable packet length mode. More... | |
int16_t | enableSyncWordFiltering (uint8_t maxErrBits=0) |
Enable sync word filtering and generation. More... | |
int16_t | disableSyncWordFiltering () |
Disable preamble and sync word filtering and generation. More... | |
int16_t | enableContinuousModeBitSync () |
Enable Bit synchronization in continuous mode. More... | |
int16_t | disableContinuousModeBitSync () |
Disable Bit synchronization in continuous mode. More... | |
int16_t | setCrcFiltering (bool crcOn=true) |
Enable CRC filtering and generation. More... | |
int16_t | setPromiscuousMode (bool enable=true) |
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC). More... | |
int16_t | setDataShaping (uint8_t sh) override |
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5 or RADIOLIB_SHAPING_1_0. Set to RADIOLIB_SHAPING_NONE to disable data shaping. More... | |
int16_t | setEncoding (uint8_t encoding) override |
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER and RADIOLIB_ENCODING_WHITENING. More... | |
int16_t | setLnaTestBoost (bool value) |
Enable/disable LNA Boost mode (disabled by default). More... | |
float | getRSSI () override |
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. More... | |
int16_t | setRSSIThreshold (float dbm) |
Sets the RSSI value above which the RSSI interrupt is signaled. More... | |
void | setRfSwitchPins (uint32_t rxEn, uint32_t txEn) |
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over those pins to automatically switch between various modes: When idle both pins will be LOW, during TX the txEn pin will be HIGH, during RX the rxPin will be HIGH. More... | |
void | setRfSwitchTable (const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]) |
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over those pins to automatically switch between various modes. More... | |
uint8_t | randomByte () override |
Get one truly random byte from RSSI noise. More... | |
int16_t | getChipVersion () |
Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working. More... | |
void | setDirectAction (void(*func)(void)) override |
Set interrupt service routine function to call when data bit is received in direct mode. More... | |
void | readBit (uint32_t pin) override |
Function to read and process data bit in direct reception mode. More... | |
int16_t | setDIOMapping (uint32_t pin, uint32_t value) override |
Configure DIO pin mapping to get a given signal on a DIO pin (if available). More... | |
int16_t | transmit (const char *str, uint8_t addr=0) |
C-string transmit method. More... | |
virtual int16_t | transmit (const uint8_t *data, size_t len, uint8_t addr=0) |
Binary transmit method. Must be implemented in module class. More... | |
virtual int16_t | receive (uint8_t *data, size_t len) |
Binary receive method. Must be implemented in module class. More... | |
int16_t | startTransmit (const char *str, uint8_t addr=0) |
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method, this one is non-blocking. Interrupt pin will be activated when transmission finishes. More... | |
virtual int16_t | startTransmit (const uint8_t *data, size_t len, uint8_t addr=0) |
Interrupt-driven binary transmit method. More... | |
virtual int16_t | readData (uint8_t *data, size_t len) |
Reads data that was received after calling startReceive method. More... | |
Public Member Functions inherited from PhysicalLayer | |
PhysicalLayer (float step, size_t maxLen) | |
Default constructor. More... | |
int16_t | transmit (const char *str, uint8_t addr=0) |
C-string transmit method. More... | |
int16_t | startTransmit (const char *str, uint8_t addr=0) |
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method, this one is non-blocking. Interrupt pin will be activated when transmission finishes. More... | |
virtual int16_t | invertIQ (bool enable) |
Set IQ inversion. Must be implemented in module class if the module supports it. More... | |
virtual int16_t | setOutputPower (int8_t power) |
Set output power. Must be implemented in module class if the module supports it. More... | |
virtual int16_t | checkOutputPower (int8_t power, int8_t *clipped) |
Check if output power is configurable. Must be implemented in module class if the module supports it. More... | |
virtual int16_t | setSyncWord (uint8_t *sync, size_t len) |
Set sync word. Must be implemented in module class if the module supports it. More... | |
virtual int16_t | setPreambleLength (size_t len) |
Set preamble length. Must be implemented in module class if the module supports it. More... | |
virtual int16_t | setDataRate (DataRate_t dr) |
Set data. Must be implemented in module class if the module supports it. More... | |
virtual int16_t | checkDataRate (DataRate_t dr) |
Check the data rate can be configured by this module. Must be implemented in module class if the module supports it. More... | |
float | getFreqStep () const |
Gets the module frequency step size that was set in constructor. More... | |
virtual float | getSNR () |
Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem. More... | |
virtual RadioLibTime_t | getTimeOnAir (size_t len) |
Get expected time-on-air for a given size of payload. More... | |
virtual RadioLibTime_t | calculateRxTimeout (RadioLibTime_t timeoutUs) |
Calculate the timeout value for this specific module / series (in number of symbols or units of time). More... | |
uint32_t | getIrqMapped (RadioLibIrqFlags_t irq) |
Convert from radio-agnostic IRQ flags to radio-specific flags. More... | |
int16_t | checkIrq (RadioLibIrqType_t irq) |
Check whether a specific IRQ bit is set (e.g. RxTimeout, CadDone). More... | |
int16_t | setIrq (RadioLibIrqFlags_t irq) |
Set interrupt on specific IRQ bit(s) (e.g. RxTimeout, CadDone). Keep in mind that not all radio modules support all RADIOLIB_IRQ_ flags! More... | |
int16_t | clearIrq (RadioLibIrqFlags_t irq) |
Clear interrupt on a specific IRQ bit (e.g. RxTimeout, CadDone). Keep in mind that not all radio modules support all RADIOLIB_IRQ_ flags! More... | |
virtual uint32_t | getIrqFlags () |
Read currently active IRQ flags. Must be implemented in module class. More... | |
virtual int16_t | setIrqFlags (uint32_t irq) |
Set interrupt on DIO1 to be sent on a specific IRQ bit (e.g. RxTimeout, CadDone). Must be implemented in module class. More... | |
virtual int16_t | clearIrqFlags (uint32_t irq) |
Clear interrupt on a specific IRQ bit (e.g. RxTimeout, CadDone). Must be implemented in module class. More... | |
virtual int16_t | startChannelScan () |
Interrupt-driven channel activity detection method. Interrupt will be activated when packet is detected. Must be implemented in module class. More... | |
virtual int16_t | startChannelScan (const ChannelScanConfig_t &config) |
Interrupt-driven channel activity detection method. interrupt will be activated when packet is detected. Must be implemented in module class. More... | |
virtual int16_t | getChannelScanResult () |
Read the channel scan result. More... | |
virtual int16_t | scanChannel () |
Check whether the current communication channel is free or occupied. Performs CAD for LoRa modules, or RSSI measurement for FSK modules. More... | |
virtual int16_t | scanChannel (const ChannelScanConfig_t &config) |
Check whether the current communication channel is free or occupied. Performs CAD for LoRa modules, or RSSI measurement for FSK modules. More... | |
int32_t | random (int32_t max) |
Get truly random number in range 0 - max. More... | |
int32_t | random (int32_t min, int32_t max) |
Get truly random number in range min - max. More... | |
int16_t | startDirect () |
Configure module parameters for direct modes. Must be called prior to "ham" modes like RTTY or AX.25. Only available in FSK mode. More... | |
int16_t | setDirectSyncWord (uint32_t syncWord, uint8_t len) |
Set sync word to be used to determine start of packet in direct reception mode. More... | |
int16_t | available () |
Get the number of direct mode bytes currently available in buffer. More... | |
void | dropSync () |
Forcefully drop synchronization. | |
uint8_t | read (bool drop=true) |
Get data from direct mode buffer. More... | |
virtual void | setChannelScanAction (void(*func)(void)) |
Sets interrupt service routine to call when a channel scan is finished. More... | |
virtual void | clearChannelScanAction () |
Clears interrupt service routine to call when a channel scan is finished. | |
virtual int16_t | setModem (ModemType_t modem) |
Set modem for the radio to use. Will perform full reset and reconfigure the radio using its default parameters. More... | |
virtual int16_t | getModem (ModemType_t *modem) |
Get modem currently in use by the radio. More... | |
Control class for RF69 module. Also serves as base class for SX1231.
RF69::RF69 | ( | Module * | module | ) |
Default constructor.
module | Instance of Module that will be used to communicate with the radio. |
int16_t RF69::begin | ( | float | freq = RADIOLIB_RF69_DEFAULT_FREQ , |
float | br = RADIOLIB_RF69_DEFAULT_BR , |
||
float | freqDev = RADIOLIB_RF69_DEFAULT_FREQDEV , |
||
float | rxBw = RADIOLIB_RF69_DEFAULT_RXBW , |
||
int8_t | pwr = RADIOLIB_RF69_DEFAULT_POWER , |
||
uint8_t | preambleLen = RADIOLIB_RF69_DEFAULT_PREAMBLELEN |
||
) |
Initialization method.
freq | Carrier frequency in MHz. Defaults to 434.0 MHz. |
br | Bit rate to be used in kbps. Defaults to 4.8 kbps. |
freqDev | Frequency deviation from carrier frequency in kHz Defaults to 5.0 kHz. |
rxBw | Receiver bandwidth in kHz. Defaults to 125.0 kHz. |
pwr | Output power in dBm. Defaults to 10 dBm. |
preambleLen | Preamble Length in bits. Defaults to 16 bits. |
int16_t RF69::disableAddressFiltering | ( | ) |
Disables address filtering. Calling this method will also erase previously set addresses.
int16_t RF69::disableAES | ( | ) |
Disables AES encryption.
int16_t RF69::disableContinuousModeBitSync | ( | ) |
Disable Bit synchronization in continuous mode.
int16_t RF69::disableSyncWordFiltering | ( | ) |
Disable preamble and sync word filtering and generation.
int16_t RF69::enableAES | ( | ) |
Enables AES encryption.
int16_t RF69::enableContinuousModeBitSync | ( | ) |
Enable Bit synchronization in continuous mode.
int16_t RF69::enableSyncWordFiltering | ( | uint8_t | maxErrBits = 0 | ) |
Enable sync word filtering and generation.
maxErrBits | Maximum allowed number of error bits in sync word. |
bool RF69::fifoAdd | ( | uint8_t * | data, |
int | totalLen, | ||
int * | remLen | ||
) |
Set interrupt service routine function to call when FIFO is empty.
data | Pointer to the transmission buffer. |
totalLen | Total number of bytes to transmit. |
remLen | Pointer to a counter holding the number of bytes that have been transmitted so far. |
bool RF69::fifoGet | ( | volatile uint8_t * | data, |
int | totalLen, | ||
volatile int * | rcvLen | ||
) |
Set interrupt service routine function to call when FIFO is sufficiently full to read.
data | Pointer to a buffer that stores the receive data. |
totalLen | Total number of bytes to receive. |
rcvLen | Pointer to a counter holding the number of bytes that have been received so far. |
|
overridevirtual |
int16_t RF69::fixedPacketLengthMode | ( | uint8_t | len = RADIOLIB_RF69_MAX_PACKET_LENGTH | ) |
int16_t RF69::getChipVersion | ( | ) |
Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
int16_t RF69::getFrequency | ( | float * | freq | ) |
Gets carrier frequency.
[out] | freq | Variable to write carrier frequency currently set, in MHz. |
int16_t RF69::getFrequencyDeviation | ( | float * | freqDev | ) |
Gets frequency deviation.
[out] | freqDev | Where to write the frequency deviation currently set, in kHz. |
|
overridevirtual |
Query modem for the packet length of received payload.
update | Update received packet length. Will return cached value when set to false. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
Reimplemented from PhysicalLayer.
int16_t RF69::getTemperature | ( | ) |
Measures temperature.
|
overridevirtual |
|
overridevirtual |
Function to read and process data bit in direct reception mode.
pin | Pin on which to read. |
Reimplemented from PhysicalLayer.
int16_t PhysicalLayer::readData |
Reads data that was received after calling startReceive method.
data | Pointer to array to save the received binary data. |
len | Number of bytes that will be read. When set to 0, the packet length will be retrieved automatically. When more bytes than received are requested, only the number of bytes requested will be returned. |
|
overridevirtual |
Reads data received after calling startReceive method. When the packet length is not known in advance, getPacketLength method must be called BEFORE calling readData!
data | Pointer to array to save the received binary data. |
len | Number of bytes that will be read. When set to 0, the packet length will be retrieved automatically. When more bytes than received are requested, only the number of bytes requested will be returned. |
Reimplemented from PhysicalLayer.
int16_t PhysicalLayer::receive |
Binary receive method. Must be implemented in module class.
data | Pointer to array to save the received binary data. |
len | Packet length, needed for some modules under special circumstances (e.g. LoRa implicit header mode). |
|
overridevirtual |
Blocking binary receive method. Overloads for string-based transmissions are implemented in PhysicalLayer.
data | Binary data to be sent. |
len | Number of bytes to send. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
void RF69::setAESKey | ( | uint8_t * | key | ) |
Sets AES key.
key | Key to be used for AES encryption. Must be exactly 16 bytes long. |
void RF69::setAmbientTemperature | ( | int16_t | tempAmbient | ) |
Sets ambient temperature. Required to correct values from on-board temperature sensor.
tempAmbient | Ambient temperature in degrees Celsius. |
|
overridevirtual |
Sets bit rate. Allowed values range from 0.5 to 300.0 kbps.
br | Bit rate to be set in kbps. |
Reimplemented from PhysicalLayer.
Reimplemented in SX1233.
int16_t RF69::setBroadcastAddress | ( | uint8_t | broadAddr | ) |
Sets broadcast address. Calling this method will also enable address filtering for node and broadcast address.
broadAddr | Node address to be set. |
int16_t RF69::setCrcFiltering | ( | bool | crcOn = true | ) |
Enable CRC filtering and generation.
crcOn | Set or unset CRC filtering. |
|
overridevirtual |
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5 or RADIOLIB_SHAPING_1_0. Set to RADIOLIB_SHAPING_NONE to disable data shaping.
sh | Gaussian shaping bandwidth-time product that will be used for data shaping |
Reimplemented from PhysicalLayer.
void RF69::setDio0Action | ( | void(*)(void) | func | ) |
Sets interrupt service routine to call when DIO0 activates.
func | ISR to call. |
void RF69::setDio1Action | ( | void(*)(void) | func | ) |
Sets interrupt service routine to call when DIO1 activates.
func | ISR to call. |
|
overridevirtual |
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
pin | Pin number onto which a signal is to be placed. |
value | The value that indicates which function to place on that pin. See chip datasheet for details. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
Set interrupt service routine function to call when data bit is received in direct mode.
func | Pointer to interrupt service routine. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER and RADIOLIB_ENCODING_WHITENING.
encoding | Encoding to be used. |
Reimplemented from PhysicalLayer.
void RF69::setFifoEmptyAction | ( | void(*)(void) | func | ) |
Set interrupt service routine function to call when FIFO is empty.
func | Pointer to interrupt service routine. |
void RF69::setFifoFullAction | ( | void(*)(void) | func | ) |
Set interrupt service routine function to call when FIFO is full.
func | Pointer to interrupt service routine. |
void RF69::setFifoThreshold | ( | uint8_t | threshold | ) |
Set FIFO threshold level. Be aware that threshold is also set in setFifoFullAction method. setFifoThreshold method must be called AFTER calling setFifoFullAction!
threshold | Threshold level in bytes. |
|
overridevirtual |
Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510.0 MHz and 862.0 to 1020.0 MHz.
freq | Carrier frequency to be set in MHz. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
Sets frequency deviation.
freqDev | Frequency deviation to be set in kHz. |
Reimplemented from PhysicalLayer.
int16_t RF69::setLnaTestBoost | ( | bool | value | ) |
Enable/disable LNA Boost mode (disabled by default).
value | True to enable, false to disable. |
int16_t RF69::setNodeAddress | ( | uint8_t | nodeAddr | ) |
Sets node address. Calling this method will also enable address filtering for node address only.
nodeAddr | Node address to be set. |
int16_t RF69::setOOK | ( | bool | enable | ) |
Enables/disables OOK modulation instead of FSK. Note: This function calls setRxBandwidth again, since register values differ based on OOK mode being enabled/disabled.
enable | Enable (true) or disable (false) OOK. |
int16_t RF69::setOokFixedThreshold | ( | uint8_t | value | ) |
Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer in OOK when Peak mode is used.
value | Fixed threshold value (in dB) in the OOK demodulator. Used when OokThresType = RADIOLIB_RF69_OOK_THRESH_FIXED. |
int16_t RF69::setOokPeakThresholdDecrement | ( | uint8_t | value | ) |
Period of decrement of the RSSI threshold in the OOK demodulator.
value | Use defines RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_X_X_CHIP |
int16_t RF69::setOokThresholdType | ( | uint8_t | type | ) |
Selects the type of threshold in the OOK data slicer.
type | Threshold type: RADIOLIB_RF69_OOK_THRESH_PEAK(default), RADIOLIB_RF69_OOK_THRESH_FIXED or RADIOLIB_RF69_OOK_THRESH_AVERAGE |
int16_t RF69::setOutputPower | ( | int8_t | pwr, |
bool | highPower = false |
||
) |
Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to 20 dBm (RF69H/HC/HCW).
pwr | Output power to be set in dBm. |
highPower | Set to true when using modules high power port (RF69H/HC/HCW). Defaults to false (models without high power port - RF69C/CW). |
|
overridevirtual |
Sets interrupt service routine to call when a packet is received.
func | ISR to call. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
Sets interrupt service routine to call when a packet is sent.
func | ISR to call. |
Reimplemented from PhysicalLayer.
int16_t RF69::setPreambleLength | ( | uint8_t | preambleLen | ) |
Sets preamble length.
preambleLen | Preamble length to be set (in bits), allowed values: 16, 24, 32, 48, 64, 96, 128 and 192. |
int16_t RF69::setPromiscuousMode | ( | bool | enable = true | ) |
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
enable | Set or unset promiscuous mode. |
void RF69::setRfSwitchPins | ( | uint32_t | rxEn, |
uint32_t | txEn | ||
) |
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over those pins to automatically switch between various modes: When idle both pins will be LOW, during TX the txEn
pin will be HIGH, during RX the rxPin
will be HIGH.
Radiolib will automatically set the pin mode and value of these pins, so do not control them from the sketch.
When more than two pins or more control over the output values are needed, use the setRfSwitchTable() function.
rxEn | RX enable pin. |
txEn | TX enable pin. |
void RF69::setRfSwitchTable | ( | const uint32_t(&) | pins[Module::RFSWITCH_MAX_PINS], |
const Module::RfSwitchMode_t | table[] | ||
) |
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over those pins to automatically switch between various modes.
Radiolib will automatically set the pin mode and value of these pins, so do not control them from the sketch.
pins | A reference to an array of pins to control. This should always be an array of 3 elements. If you need less pins, use RADIOLIB_NC for the unused elements. |
table | A reference to an array of pin values to use for each supported mode. Each element is an RfSwitchMode_T struct that lists the mode for which it applies and the values for each of the pins passed in the pins argument respectively. |
The pins
array will be copied into the Module object, so the original array can be deallocated after this call. However, a reference to the table
array will be stored, so that array must remain valid as long RadioLib is being used.
The mode
field in each table row should normally use any of the MODE_*
constants from the Module::OpMode_t enum. However, some radios support additional modes and will define their own OpMode_t enum.
The length of the table is variable (to support radios that add additional modes), so the table must always be terminated with the special END_OF_MODE_TABLE value.
Normally all modes should be listed in the table, but for some radios, modes can be omitted to indicate they are not supported (e.g. when a radio has a high power and low power TX mode but external circuitry only supports low power). If applicable, this is documented in the radio class itself.
For example, on a board that has an RF switch with an enable pin connected to PA0 and a TX/RX select pin connected to PA1:
int16_t RF69::setRSSIThreshold | ( | float | dbm | ) |
Sets the RSSI value above which the RSSI interrupt is signaled.
dbm | A dBm value between -127.5 and 0 inclusive |
int16_t RF69::setRxBandwidth | ( | float | rxBw | ) |
Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6, 20.8, 25.0, 31.3, 41.7, 50.0, 62.5, 83.3, 100.0, 125.0, 166.7, 200.0, 250.0, 333.3, 400.0 and 500.0 kHz.
rxBw | Receiver bandwidth to be set in kHz. |
int16_t RF69::setSyncWord | ( | uint8_t * | syncWord, |
size_t | len, | ||
uint8_t | maxErrBits = 0 |
||
) |
Sets sync word. Up to 8 bytes can be set as sync word.
syncWord | Pointer to the array of sync word bytes. |
len | Sync word length in bytes. |
maxErrBits | Maximum allowed number of bit errors in received sync word. Defaults to 0. |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Sets the module to standby.
mode | Standby mode to be used. No effect, implemented only for PhysicalLayer compatibility. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Reimplemented from PhysicalLayer.
|
overridevirtual |
Interrupt-driven receive method, implemented for compatibility with PhysicalLayer.
timeout | Ignored. |
irqFlags | Ignored. |
irqMask | Ignored. |
len | Ignored. |
Reimplemented from PhysicalLayer.
int16_t PhysicalLayer::startTransmit |
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method, this one is non-blocking. Interrupt pin will be activated when transmission finishes.
str | C-string that will be transmitted. |
addr | Node address to transmit the packet to. Only used in FSK mode. |
int16_t PhysicalLayer::startTransmit |
Interrupt-driven binary transmit method.
data | Binary data that will be transmitted. |
len | Length of binary data to transmit (in bytes). |
addr | Node address to transmit the packet to. Only used in FSK mode. |
|
overridevirtual |
Interrupt-driven binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer.
data | Binary data to be sent. |
len | Number of bytes to send. |
addr | Address to send the data to. Will only be added if address filtering was enabled. |
Reimplemented from PhysicalLayer.
int16_t PhysicalLayer::transmit |
C-string transmit method.
str | C-string that will be transmitted. |
addr | Node address to transmit the packet to. Only used in FSK mode. |
int16_t PhysicalLayer::transmit |
Binary transmit method. Must be implemented in module class.
data | Binary data that will be transmitted. |
len | Length of binary data to transmit (in bytes). |
addr | Node address to transmit the packet to. Only used in FSK mode. |
|
overridevirtual |
Blocking binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer.
data | Binary data to be sent. |
len | Number of bytes to send. |
addr | Address to send the data to. Will only be added if address filtering was enabled. |
Reimplemented from PhysicalLayer.
|
overridevirtual |
Starts direct mode transmission.
frf | Raw RF frequency value. Defaults to 0, required for quick frequency shifts in RTTY. |
Reimplemented from PhysicalLayer.
int16_t RF69::variablePacketLengthMode | ( | uint8_t | maxLen = RADIOLIB_RF69_MAX_PACKET_LENGTH | ) |
Set modem in variable packet length mode.
maxLen | Maximum packet length. |