RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
LRxxxx Class Reference
Inheritance diagram for LRxxxx:
PhysicalLayer LR11x0 LR2021 LR1110 LR1120 LR1121

Public Member Functions

 LRxxxx (Module *mod)
 
int16_t reset ()
 Reset method. Will reset the chip to the default state using RST pin.
 
void setIrqAction (void(*func)(void))
 Sets interrupt service routine to call when IRQ1 activates.
 
void clearIrqAction ()
 Clears interrupt service routine to call when IRQ1 activates.
 
void setPacketReceivedAction (void(*func)(void)) override
 Sets interrupt service routine to call when a packet is received.
 
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.
 
void clearPacketSentAction () override
 Clears interrupt service routine to call when a packet is sent.
 
uint32_t getIrqStatus ()
 Reads the current IRQ status.
 
RadioLibTime_t calculateTimeOnAir (ModemType_t modem, DataRate_t dr, PacketConfig_t pc, size_t len) override
 Calculate the expected time-on-air for a given modem, data rate, packet configuration and payload size.
 
RadioLibTime_t calculateRxTimeout (RadioLibTime_t timeoutUs) override
 Calculate the timeout value for this specific module / series (in number of symbols or units of time)
 
- Public Member Functions inherited from PhysicalLayer
 PhysicalLayer ()
 Default constructor.
 
virtual ~PhysicalLayer ()=default
 Default destructor.
 
int16_t transmit (const char *str, uint8_t addr=0)
 C-string transmit method.
 
virtual int16_t transmit (const uint8_t *data, size_t len, uint8_t addr=0)
 Binary transmit method. Must be implemented in module class.
 
virtual int16_t sleep ()
 Sets module to sleep.
 
virtual int16_t standby ()
 Sets module to standby.
 
virtual int16_t standby (uint8_t mode)
 Sets module to a specific standby mode.
 
virtual int16_t startReceive ()
 Sets module to received mode using its default configuration.
 
virtual int16_t startReceive (uint32_t timeout, RadioLibIrqFlags_t irqFlags=RADIOLIB_IRQ_RX_DEFAULT_FLAGS, RadioLibIrqFlags_t irqMask=RADIOLIB_IRQ_RX_DEFAULT_MASK, size_t len=0)
 Interrupt-driven receive method. A DIO pin will be activated when full packet is received. Must be implemented in module class.
 
virtual int16_t receive (uint8_t *data, size_t len, RadioLibTime_t timeout=0)
 Binary receive method. Must be implemented in module class.
 
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.
 
virtual int16_t startTransmit (const uint8_t *data, size_t len, uint8_t addr=0)
 Interrupt-driven binary transmit method.
 
virtual int16_t finishTransmit ()
 Clean up after transmission is done.
 
virtual int16_t finishReceive ()
 Clean up after reception is done.
 
virtual int16_t readData (uint8_t *data, size_t len)
 Reads data that was received after calling startReceive method.
 
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.
 
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.
 
virtual int16_t setFrequency (float freq)
 Sets carrier frequency. Must be implemented in module class.
 
virtual int16_t setBitRate (float br)
 Sets FSK bit rate. Only available in FSK mode. Must be implemented in module class.
 
virtual int16_t setFrequencyDeviation (float freqDev)
 Sets FSK frequency deviation from carrier frequency. Only available in FSK mode. Must be implemented in module class.
 
virtual int16_t setDataShaping (uint8_t sh)
 Sets GFSK data shaping. Only available in FSK mode. Must be implemented in module class.
 
virtual int16_t setEncoding (uint8_t encoding)
 Sets FSK data encoding. Only available in FSK mode. Must be implemented in module class.
 
virtual int16_t invertIQ (bool enable)
 Set IQ inversion. Must be implemented in module class if the module supports it.
 
virtual int16_t setOutputPower (int8_t power)
 Set output power. Must be implemented in module class if the module supports it.
 
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.
 
virtual int16_t setSyncWord (uint8_t *sync, size_t len)
 Set sync word. Must be implemented in module class if the module supports it.
 
virtual int16_t setPreambleLength (size_t len)
 Set preamble length. Must be implemented in module class if the module supports it.
 
virtual int16_t setDataRate (DataRate_t dr, ModemType_t modem=RADIOLIB_MODEM_NONE)
 Set data rate. Must be implemented in module class if the module supports it.
 
virtual int16_t checkDataRate (DataRate_t dr, ModemType_t modem=RADIOLIB_MODEM_NONE)
 Check the data rate can be configured by this module. Must be implemented in module class if the module supports it.
 
virtual size_t getPacketLength (bool update=true)
 Query modem for the packet length of received payload. Must be implemented in module class.
 
virtual float getRSSI ()
 Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
 
virtual float getSNR ()
 Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem.
 
virtual RadioLibTime_t getTimeOnAir (size_t len)
 Get expected time-on-air for a given size of payload.
 
uint32_t getIrqMapped (RadioLibIrqFlags_t irq)
 Convert from radio-agnostic IRQ flags to radio-specific flags.
 
int16_t checkIrq (RadioLibIrqType_t irq)
 Check whether a specific IRQ bit is set (e.g. RxTimeout, CadDone).
 
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!
 
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!
 
virtual uint32_t getIrqFlags ()
 Read currently active IRQ flags. Must be implemented in module class.
 
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.
 
virtual int16_t clearIrqFlags (uint32_t irq)
 Clear interrupt on a specific IRQ bit (e.g. RxTimeout, CadDone). Must be implemented in module class.
 
virtual int16_t startChannelScan ()
 Interrupt-driven channel activity detection method. Interrupt will be activated when packet is detected. Must be implemented in module class.
 
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.
 
virtual int16_t getChannelScanResult ()
 Read the channel scan result.
 
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.
 
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.
 
int32_t random (int32_t max)
 Get truly random number in range 0 - max.
 
int32_t random (int32_t min, int32_t max)
 Get truly random number in range min - max.
 
virtual uint8_t randomByte ()
 Get one truly random byte from RSSI noise. Must be implemented in module class.
 
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.
 
int16_t setDirectSyncWord (uint32_t syncWord, uint8_t len)
 Set sync word to be used to determine start of packet in direct reception mode.
 
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.
 
virtual void readBit (uint32_t pin)
 Function to read and process data bit in direct reception mode. Must be implemented in module class.
 
int16_t available ()
 Get the number of direct mode bytes currently available in buffer.
 
void dropSync ()
 Forcefully drop synchronization.
 
uint8_t read (bool drop=true)
 Get data from direct mode buffer.
 
virtual void setChannelScanAction (void(*func)(void))
 Sets interrupt service routine to call when a channel scan is finished.
 
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.
 
virtual int16_t getModem (ModemType_t *modem)
 Get modem currently in use by the radio.
 
virtual int16_t stageMode (RadioModeType_t mode, RadioModeConfig_t *cfg)
 Stage mode of the radio to be launched later using launchMode.
 
virtual int16_t launchMode ()
 Launch previously staged mode.
 

Public Attributes

bool XTAL
 Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
 
- Public Attributes inherited from PhysicalLayer
float freqStep
 Frequency step of the synthesizer in Hz.
 
size_t maxPacketLength
 Maximum length of packet that can be received by the module.
 

Member Function Documentation

◆ calculateRxTimeout()

RadioLibTime_t LRxxxx::calculateRxTimeout ( RadioLibTime_t  timeoutUs)
overridevirtual

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 from PhysicalLayer.

◆ calculateTimeOnAir()

RadioLibTime_t LRxxxx::calculateTimeOnAir ( ModemType_t  modem,
DataRate_t  dr,
PacketConfig_t  pc,
size_t  len 
)
overridevirtual

Calculate the expected time-on-air for a given modem, data rate, packet configuration and payload size.

Parameters
modemModem type.
drData rate.
pcPacket config.
lenPayload length in bytes.
Returns
Expected time-on-air in microseconds.

Reimplemented from PhysicalLayer.

◆ clearPacketReceivedAction()

void LRxxxx::clearPacketReceivedAction ( )
overridevirtual

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

Reimplemented from PhysicalLayer.

◆ clearPacketSentAction()

void LRxxxx::clearPacketSentAction ( )
overridevirtual

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

Reimplemented from PhysicalLayer.

◆ getIrqStatus()

uint32_t LRxxxx::getIrqStatus ( )

Reads the current IRQ status.

Returns
IRQ status bits

◆ reset()

int16_t LRxxxx::reset ( )

Reset method. Will reset the chip to the default state using RST pin.

Returns
Status Codes

◆ setIrqAction()

void LRxxxx::setIrqAction ( void(*)(void)  func)

Sets interrupt service routine to call when IRQ1 activates.

Parameters
funcISR to call.

◆ setPacketReceivedAction()

void LRxxxx::setPacketReceivedAction ( void(*)(void)  func)
overridevirtual

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

Parameters
funcISR to call.

Reimplemented from PhysicalLayer.

◆ setPacketSentAction()

void LRxxxx::setPacketSentAction ( void(*)(void)  func)
overridevirtual

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

Parameters
funcISR to call.

Reimplemented from PhysicalLayer.


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