RadioLib
Universal wireless communication library for Arduino
PhysicalLayer Class Referenceabstract

Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN. Also extracts some common module-independent methods. Using this interface class allows to use the protocols on various modules without much code duplicity. Because this class is used mainly as interface, all of its virtual members must be implemented in the module class. More...

#include <PhysicalLayer.h>

Inheritance diagram for PhysicalLayer:
CC1101 ExternalRadio LR11x0 RF69 SX126x SX127x SX128x Si443x nRF24

Public Member Functions

 PhysicalLayer (float step, size_t maxLen)
 Default constructor. 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 sleep ()
 Sets module to sleep. More...
 
virtual int16_t standby ()
 Sets module to standby. More...
 
virtual int16_t standby (uint8_t mode)
 Sets module to a specific standby mode. More...
 
virtual int16_t startReceive ()
 Sets module to received mode using its default configuration. More...
 
virtual int16_t startReceive (uint32_t timeout, RadioLibIrqFlags_t irqFlags, RadioLibIrqFlags_t irqMask, size_t len)
 Interrupt-driven receive method. A DIO pin will be activated when full packet is received. 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 finishTransmit ()
 Clean up after transmission is done. More...
 
virtual int16_t readData (uint8_t *data, size_t len)
 Reads data that was received after calling startReceive method. More...
 
virtual int16_t transmitDirect (uint32_t frf=0)
 Enables direct transmission mode on pins DIO1 (clock) and DIO2 (data). Must be implemented in module class. While in direct mode, the module will not be able to transmit or receive packets. Can only be activated in FSK mode. More...
 
virtual int16_t receiveDirect ()
 Enables direct reception mode on pins DIO1 (clock) and DIO2 (data). Must be implemented in module class. While in direct mode, the module will not be able to transmit or receive packets. Can only be activated in FSK mode. More...
 
virtual int16_t setFrequency (float freq)
 Sets carrier frequency. Must be implemented in module class. More...
 
virtual int16_t setBitRate (float br)
 Sets FSK bit rate. Only available in FSK mode. Must be implemented in module class. More...
 
virtual int16_t setFrequencyDeviation (float freqDev)
 Sets FSK frequency deviation from carrier frequency. Only available in FSK mode. Must be implemented in module class. More...
 
virtual int16_t setDataShaping (uint8_t sh)
 Sets GFSK data shaping. Only available in FSK mode. Must be implemented in module class. More...
 
virtual int16_t setEncoding (uint8_t encoding)
 Sets FSK data encoding. Only available in FSK mode. Must be implemented in module class. 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 size_t getPacketLength (bool update=true)
 Query modem for the packet length of received payload. Must be implemented in module class. More...
 
virtual float getRSSI ()
 Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. 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...
 
virtual uint8_t randomByte ()
 Get one truly random byte from RSSI noise. Must be implemented in module class. 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...
 
virtual void setDirectAction (void(*func)(void))
 Set interrupt service routine function to call when data bit is received in direct mode. Must be implemented in module class. More...
 
virtual void readBit (uint32_t pin)
 Function to read and process data bit in direct reception mode. Must be implemented in module class. 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 int16_t setDIOMapping (uint32_t pin, uint32_t value)
 Configure DIO pin mapping to get a given signal on a DIO pin (if available). More...
 
virtual void setPacketReceivedAction (void(*func)(void))
 Sets interrupt service routine to call when a packet is received. More...
 
virtual void clearPacketReceivedAction ()
 Clears interrupt service routine to call when a packet is received.
 
virtual void setPacketSentAction (void(*func)(void))
 Sets interrupt service routine to call when a packet is sent. More...
 
virtual void clearPacketSentAction ()
 Clears interrupt service routine to call when a packet is sent.
 
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...
 

Friends

class AFSKClient
 
class RTTYClient
 
class MorseClient
 
class HellClient
 
class SSTVClient
 
class AX25Client
 
class FSK4Client
 
class PagerClient
 
class BellClient
 
class FT8Client
 
class LoRaWANNode
 
class M17Client
 

Detailed Description

Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN. Also extracts some common module-independent methods. Using this interface class allows to use the protocols on various modules without much code duplicity. Because this class is used mainly as interface, all of its virtual members must be implemented in the module class.

Constructor & Destructor Documentation

◆ PhysicalLayer()

PhysicalLayer::PhysicalLayer ( float  step,
size_t  maxLen 
)

Default constructor.

Parameters
stepFrequency step of the synthesizer in Hz.
maxLenMaximum length of packet that can be received by the module.

Member Function Documentation

◆ available()

int16_t PhysicalLayer::available ( )

Get the number of direct mode bytes currently available in buffer.

Returns
Number of available bytes.

◆ calculateRxTimeout()

RadioLibTime_t PhysicalLayer::calculateRxTimeout ( RadioLibTime_t  timeoutUs)
virtual

Calculate the timeout value for this specific module / series (in number of symbols or units of time).

Parameters
timeoutUsTimeout in microseconds to listen for.
Returns
Timeout value in a unit that is specific for the used module.

Reimplemented in SX127x, SX126x, and LR11x0.

◆ checkDataRate()

int16_t PhysicalLayer::checkDataRate ( DataRate_t  dr)
virtual

Check the data rate can be configured by this module. Must be implemented in module class if the module supports it.

Parameters
drData rate struct. Interpretation depends on currently active modem (FSK or LoRa).
Returns
Status Codes

Reimplemented in SX1278, SX1277, SX1273, SX1272, SX126x, LR11x0, and LLCC68.

◆ checkIrq()

int16_t PhysicalLayer::checkIrq ( RadioLibIrqType_t  irq)

Check whether a specific IRQ bit is set (e.g. RxTimeout, CadDone).

Parameters
irqIRQ type to check, one of RADIOLIB_IRQ_*.
Returns
1 when requested IRQ is set, 0 when it is not or RADIOLIB_ERR_UNSUPPORTED if the IRQ is not supported.

◆ checkOutputPower()

int16_t PhysicalLayer::checkOutputPower ( int8_t  power,
int8_t *  clipped 
)
virtual

Check if output power is configurable. Must be implemented in module class if the module supports it.

Parameters
powerOutput power in dBm. The allowed range depends on the module used.
clippedClipped output power value to what is possible within the module's range.
Returns
Status Codes

Reimplemented in SX128x, SX1278, SX1272, SX1268, SX1262, SX1261, LR1120, LR1110, and CC1101.

◆ clearIrq()

int16_t PhysicalLayer::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!

Parameters
irqFlags to set, multiple bits may be enabled. IRQ to enable corresponds to the bit index (RadioLibIrq_t). For example, if bit 0 is enabled, the module will enable its RADIOLIB_IRQ_TX_DONE (if it is supported).
Returns
Status Codes

◆ clearIrqFlags()

int16_t PhysicalLayer::clearIrqFlags ( uint32_t  irq)
virtual

Clear interrupt on a specific IRQ bit (e.g. RxTimeout, CadDone). Must be implemented in module class.

Parameters
irqModule-specific IRQ flags.
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ finishTransmit()

int16_t PhysicalLayer::finishTransmit ( )
virtual

Clean up after transmission is done.

Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ getChannelScanResult()

int16_t PhysicalLayer::getChannelScanResult ( )
virtual

Read the channel scan result.

Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ getFreqStep()

float PhysicalLayer::getFreqStep ( ) const

Gets the module frequency step size that was set in constructor.

Returns
Synthesizer frequency step size in Hz.

◆ getIrqFlags()

uint32_t PhysicalLayer::getIrqFlags ( )
virtual

Read currently active IRQ flags. Must be implemented in module class.

Returns
IRQ flags.

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ getIrqMapped()

uint32_t PhysicalLayer::getIrqMapped ( RadioLibIrqFlags_t  irq)

Convert from radio-agnostic IRQ flags to radio-specific flags.

Parameters
irqRadio-agnostic IRQ flags.
Returns
Flags for a specific radio module.

◆ getModem()

int16_t PhysicalLayer::getModem ( ModemType_t *  modem)
virtual

Get modem currently in use by the radio.

Parameters
modemPointer to a variable to save the retrieved configuration into.
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ getPacketLength()

size_t PhysicalLayer::getPacketLength ( bool  update = true)
virtual

Query modem for the packet length of received payload. Must be implemented in module class.

Parameters
updateUpdate received packet length. Will return cached value when set to false.
Returns
Length of last received packet in bytes.

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ getRSSI()

float PhysicalLayer::getRSSI ( )
virtual

Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.

Returns
RSSI of the last received packet in dBm.

Reimplemented in SX128x, SX1278, SX1272, SX126x, RF69, LR11x0, and CC1101.

◆ getSNR()

float PhysicalLayer::getSNR ( )
virtual

Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem.

Returns
SNR of the last received packet in dB.

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ getTimeOnAir()

RadioLibTime_t PhysicalLayer::getTimeOnAir ( size_t  len)
virtual

Get expected time-on-air for a given size of payload.

Parameters
lenPayload length in bytes.
Returns
Expected time-on-air in microseconds.

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ invertIQ()

int16_t PhysicalLayer::invertIQ ( bool  enable)
virtual

Set IQ inversion. Must be implemented in module class if the module supports it.

Parameters
enableTrue to use inverted IQ, false for non-inverted.
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ random() [1/2]

int32_t PhysicalLayer::random ( int32_t  max)

Get truly random number in range 0 - max.

Parameters
maxThe maximum value of the random number (non-inclusive).
Returns
Random number.

◆ random() [2/2]

int32_t PhysicalLayer::random ( int32_t  min,
int32_t  max 
)

Get truly random number in range min - max.

Parameters
minThe minimum value of the random number (inclusive).
maxThe maximum value of the random number (non-inclusive).
Returns
Random number.

◆ randomByte()

uint8_t PhysicalLayer::randomByte ( )
virtual

Get one truly random byte from RSSI noise. Must be implemented in module class.

Returns
TRNG byte.

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, LR11x0, and CC1101.

◆ read()

uint8_t PhysicalLayer::read ( bool  drop = true)

Get data from direct mode buffer.

Parameters
dropDrop synchronization on read - next reading will require waiting for the sync word again. Defaults to true.
Returns
Byte from direct mode buffer.

◆ readBit()

void PhysicalLayer::readBit ( uint32_t  pin)
virtual

Function to read and process data bit in direct reception mode. Must be implemented in module class.

Parameters
pinPin on which to read.

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, and CC1101.

◆ readData()

int16_t PhysicalLayer::readData ( uint8_t *  data,
size_t  len 
)
virtual

Reads data that was received after calling startReceive method.

Parameters
dataPointer to array to save the received binary data.
lenNumber 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.
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ receive()

int16_t PhysicalLayer::receive ( uint8_t *  data,
size_t  len 
)
virtual

Binary receive method. Must be implemented in module class.

Parameters
dataPointer to array to save the received binary data.
lenPacket length, needed for some modules under special circumstances (e.g. LoRa implicit header mode).
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ receiveDirect()

int16_t PhysicalLayer::receiveDirect ( )
virtual

Enables direct reception mode on pins DIO1 (clock) and DIO2 (data). Must be implemented in module class. While in direct mode, the module will not be able to transmit or receive packets. Can only be activated in FSK mode.

Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ scanChannel() [1/2]

int16_t PhysicalLayer::scanChannel ( )
virtual

Check whether the current communication channel is free or occupied. Performs CAD for LoRa modules, or RSSI measurement for FSK modules.

Returns
RADIOLIB_CHANNEL_FREE when channel is free, RADIOLIB_PREAMBLE_DETECTEDwhen occupied or other Status Codes.

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ scanChannel() [2/2]

int16_t PhysicalLayer::scanChannel ( const ChannelScanConfig_t config)
virtual

Check whether the current communication channel is free or occupied. Performs CAD for LoRa modules, or RSSI measurement for FSK modules.

Parameters
configScan configuration structure. Interpretation depends on currently active modem.
Returns
RADIOLIB_CHANNEL_FREE when channel is free, RADIOLIB_PREAMBLE_DETECTEDwhen occupied or other Status Codes.

Reimplemented in SX128x, SX126x, and LR11x0.

◆ setBitRate()

int16_t PhysicalLayer::setBitRate ( float  br)
virtual

Sets FSK bit rate. Only available in FSK mode. Must be implemented in module class.

Parameters
brBit rate to be set (in kbps).
Returns
Status Codes

Reimplemented in SX128x, SX1278, SX1272, SX126x, SX1233, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ setChannelScanAction()

void PhysicalLayer::setChannelScanAction ( void(*)(void)  func)
virtual

Sets interrupt service routine to call when a channel scan is finished.

Parameters
funcISR to call.

Reimplemented in SX127x, SX126x, and STM32WLx.

◆ setDataRate()

int16_t PhysicalLayer::setDataRate ( DataRate_t  dr)
virtual

Set data. Must be implemented in module class if the module supports it.

Parameters
drData rate struct. Interpretation depends on currently active modem (FSK or LoRa).
Returns
Status Codes

Reimplemented in SX128x, SX1278, SX1277, SX1273, SX1272, SX126x, LR11x0, and LLCC68.

◆ setDataShaping()

int16_t PhysicalLayer::setDataShaping ( uint8_t  sh)
virtual

Sets GFSK data shaping. Only available in FSK mode. Must be implemented in module class.

Parameters
shShaping to be set. See Data shaping filter values aliases. for possible values.
Returns
Status Codes

Reimplemented in ExternalRadio, SX128x, SX1278, SX1272, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ setDIOMapping()

int16_t PhysicalLayer::setDIOMapping ( uint32_t  pin,
uint32_t  value 
)
virtual

Configure DIO pin mapping to get a given signal on a DIO pin (if available).

Parameters
pinPin number onto which a signal is to be placed.
valueThe value that indicates which function to place on that pin. See chip datasheet for details.
Returns
Status Codes

Reimplemented in SX127x, RF69, and CC1101.

◆ setDirectAction()

void PhysicalLayer::setDirectAction ( void(*)(void)  func)
virtual

Set interrupt service routine function to call when data bit is received in direct mode. Must be implemented in module class.

Parameters
funcPointer to interrupt service routine.

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, and CC1101.

◆ setDirectSyncWord()

int16_t PhysicalLayer::setDirectSyncWord ( uint32_t  syncWord,
uint8_t  len 
)

Set sync word to be used to determine start of packet in direct reception mode.

Parameters
syncWordSync word bits.
lenSync word length in bits. Set to zero to disable sync word matching.
Returns
Status Codes

◆ setEncoding()

int16_t PhysicalLayer::setEncoding ( uint8_t  encoding)
virtual

Sets FSK data encoding. Only available in FSK mode. Must be implemented in module class.

Parameters
encodingEncoding to be used. See Encoding type aliases. for possible values.
Returns
Status Codes

Reimplemented in ExternalRadio, SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ setFrequency()

int16_t PhysicalLayer::setFrequency ( float  freq)
virtual

Sets carrier frequency. Must be implemented in module class.

Parameters
freqCarrier frequency to be set in MHz.
Returns
Status Codes

Reimplemented in SX128x, SX1279, SX1278, SX1277, SX1276, SX1272, SX1268, SX1262, Si4432, Si4430, RF69, nRF24, LR1120, LR1110, and CC1101.

◆ setFrequencyDeviation()

int16_t PhysicalLayer::setFrequencyDeviation ( float  freqDev)
virtual

Sets FSK frequency deviation from carrier frequency. Only available in FSK mode. Must be implemented in module class.

Parameters
freqDevFrequency deviation to be set (in kHz).
Returns
Status Codes

Reimplemented in ExternalRadio, SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ setIrq()

int16_t PhysicalLayer::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!

Parameters
irqFlags to set, multiple bits may be enabled. IRQ to enable corresponds to the bit index (RadioLibIrq_t). For example, if bit 0 is enabled, the module will enable its RADIOLIB_IRQ_TX_DONE (if it is supported).
Returns
Status Codes

◆ setIrqFlags()

int16_t PhysicalLayer::setIrqFlags ( uint32_t  irq)
virtual

Set interrupt on DIO1 to be sent on a specific IRQ bit (e.g. RxTimeout, CadDone). Must be implemented in module class.

Parameters
irqModule-specific IRQ flags.
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ setModem()

int16_t PhysicalLayer::setModem ( ModemType_t  modem)
virtual

Set modem for the radio to use. Will perform full reset and reconfigure the radio using its default parameters.

Parameters
modemModem type to set. Not all modems are implemented by all radio modules!
Returns
Status Codes

Reimplemented in SX128x, SX1279, SX1278, SX1277, SX1276, SX1273, SX1272, SX1268, SX1262, LR1120, LR1110, and LLCC68.

◆ setOutputPower()

int16_t PhysicalLayer::setOutputPower ( int8_t  power)
virtual

Set output power. Must be implemented in module class if the module supports it.

Parameters
powerOutput power in dBm. The allowed range depends on the module used.
Returns
Status Codes

Reimplemented in SX128x, nRF24, CC1101, SX1278, SX1272, SX1268, SX1262, SX1261, STM32WLx, Si4432, Si4431, Si4430, LR1120, and LR1110.

◆ setPacketReceivedAction()

void PhysicalLayer::setPacketReceivedAction ( void(*)(void)  func)
virtual

Sets interrupt service routine to call when a packet is received.

Parameters
funcISR to call.

Reimplemented in SX128x, SX127x, SX126x, STM32WLx, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ setPacketSentAction()

void PhysicalLayer::setPacketSentAction ( void(*)(void)  func)
virtual

Sets interrupt service routine to call when a packet is sent.

Parameters
funcISR to call.

Reimplemented in SX128x, SX127x, SX126x, STM32WLx, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ setPreambleLength()

int16_t PhysicalLayer::setPreambleLength ( size_t  len)
virtual

Set preamble length. Must be implemented in module class if the module supports it.

Parameters
lenPreamble length in bytes. Maximum length depends on the module used.
Returns
Status Codes

Reimplemented in SX127x, SX126x, and LR11x0.

◆ setSyncWord()

int16_t PhysicalLayer::setSyncWord ( uint8_t *  sync,
size_t  len 
)
virtual

Set sync word. Must be implemented in module class if the module supports it.

Parameters
syncPointer to the sync word.
lenSync word length in bytes. Maximum length depends on the module used.
Returns
Status Codes

Reimplemented in SX127x, SX126x, Si443x, and LR11x0.

◆ sleep()

int16_t PhysicalLayer::sleep ( )
virtual

Sets module to sleep.

Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, and LR11x0.

◆ standby() [1/2]

int16_t PhysicalLayer::standby ( )
virtual

Sets module to standby.

Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ standby() [2/2]

int16_t PhysicalLayer::standby ( uint8_t  mode)
virtual

Sets module to a specific standby mode.

Returns
Status Codes

Reimplemented in SX127x, Si443x, RF69, nRF24, and CC1101.

◆ startChannelScan() [1/2]

int16_t PhysicalLayer::startChannelScan ( )
virtual

Interrupt-driven channel activity detection method. Interrupt will be activated when packet is detected. Must be implemented in module class.

Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, and LR11x0.

◆ startChannelScan() [2/2]

int16_t PhysicalLayer::startChannelScan ( const ChannelScanConfig_t config)
virtual

Interrupt-driven channel activity detection method. interrupt will be activated when packet is detected. Must be implemented in module class.

Parameters
configScan configuration structure. Interpretation depends on currently active modem.
Returns
Status Codes

Reimplemented in SX128x, SX126x, and LR11x0.

◆ startDirect()

int16_t PhysicalLayer::startDirect ( )

Configure module parameters for direct modes. Must be called prior to "ham" modes like RTTY or AX.25. Only available in FSK mode.

Returns
Status Codes

◆ startReceive() [1/2]

int16_t PhysicalLayer::startReceive ( )
virtual

Sets module to received mode using its default configuration.

Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.

◆ startReceive() [2/2]

int16_t PhysicalLayer::startReceive ( uint32_t  timeout,
RadioLibIrqFlags_t  irqFlags,
RadioLibIrqFlags_t  irqMask,
size_t  len 
)
virtual

Interrupt-driven receive method. A DIO pin will be activated when full packet is received. Must be implemented in module class.

Parameters
timeoutRaw timeout value. Some modules use this argument to specify operation mode (single vs. continuous receive).
irqFlagsSets the IRQ flags.
irqMaskSets the mask of IRQ flags that will trigger the radio interrupt pin.
lenPacket length, needed for some modules under special circumstances (e.g. LoRa implicit header mode).
Returns
Status Codes

Reimplemented in LR11x0, Si443x, RF69, nRF24, CC1101, SX127x, and SX126x.

◆ startTransmit() [1/2]

int16_t PhysicalLayer::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.

Parameters
strC-string that will be transmitted.
addrNode address to transmit the packet to. Only used in FSK mode.
Returns
Status Codes

◆ startTransmit() [2/2]

int16_t PhysicalLayer::startTransmit ( const uint8_t *  data,
size_t  len,
uint8_t  addr = 0 
)
virtual

Interrupt-driven binary transmit method.

Parameters
dataBinary data that will be transmitted.
lenLength of binary data to transmit (in bytes).
addrNode address to transmit the packet to. Only used in FSK mode.
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, LR11x0, CC1101, and nRF24.

◆ transmit() [1/2]

int16_t PhysicalLayer::transmit ( const char *  str,
uint8_t  addr = 0 
)

C-string transmit method.

Parameters
strC-string that will be transmitted.
addrNode address to transmit the packet to. Only used in FSK mode.
Returns
Status Codes

◆ transmit() [2/2]

int16_t PhysicalLayer::transmit ( const uint8_t *  data,
size_t  len,
uint8_t  addr = 0 
)
virtual

Binary transmit method. Must be implemented in module class.

Parameters
dataBinary data that will be transmitted.
lenLength of binary data to transmit (in bytes).
addrNode address to transmit the packet to. Only used in FSK mode.
Returns
Status Codes

Reimplemented in SX128x, SX127x, SX126x, Si443x, RF69, LR11x0, CC1101, and nRF24.

◆ transmitDirect()

int16_t PhysicalLayer::transmitDirect ( uint32_t  frf = 0)
virtual

Enables direct transmission mode on pins DIO1 (clock) and DIO2 (data). Must be implemented in module class. While in direct mode, the module will not be able to transmit or receive packets. Can only be activated in FSK mode.

Parameters
frf24-bit raw frequency value to start transmitting at. Required for quick frequency shifts in RTTY.
Returns
Status Codes

Reimplemented in ExternalRadio, SX128x, SX127x, SX126x, Si443x, RF69, nRF24, LR11x0, and CC1101.


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