RadioLib
Universal wireless communication library for Arduino
SX1278 Class Reference

Derived class for SX1278 modules. Also used as base class for SX1276, SX1277, SX1279, RFM95 and RFM96. All of these modules use the same basic hardware and only differ in parameter ranges (and names). More...

#include <SX1278.h>

Inheritance diagram for SX1278:
SX127x PhysicalLayer SX1276 SX1277 SX1279

Public Member Functions

 SX1278 (Module *mod)
 Default constructor. Called from Arduino sketch when creating new LoRa instance. More...
 
int16_t begin (float freq=434.0, float bw=125.0, uint8_t sf=9, uint8_t cr=7, uint8_t syncWord=RADIOLIB_SX127X_SYNC_WORD, int8_t power=10, uint16_t preambleLength=8, uint8_t gain=0)
 LoRa modem initialization method. Must be called at least once from Arduino sketch to initialize the module. More...
 
int16_t beginFSK (float freq=434.0, float br=4.8, float freqDev=5.0, float rxBw=125.0, int8_t power=10, uint16_t preambleLength=16, bool enableOOK=false)
 FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module. More...
 
void reset () override
 Reset method. Will reset the chip to the default state using RST pin.
 
int16_t setFrequency (float freq) override
 Sets carrier frequency. Allowed values range from 137.0 MHz to 525.0 MHz. More...
 
int16_t setBandwidth (float bw)
 Sets LoRa link bandwidth. Allowed values are 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250 and 500 kHz. Only available in LoRa mode. More...
 
int16_t setSpreadingFactor (uint8_t sf)
 Sets LoRa link spreading factor. Allowed values range from 6 to 12. Only available in LoRa mode. More...
 
int16_t setCodingRate (uint8_t cr)
 Sets LoRa link coding rate denominator. Allowed values range from 5 to 8. Only available in LoRa mode. More...
 
int16_t setBitRate (float br) override
 Sets FSK bit rate. Allowed values range from 0.5 to 300 kbps. Only available in FSK mode. More...
 
int16_t setDataRate (DataRate_t dr) override
 Set data. More...
 
int16_t checkDataRate (DataRate_t dr) override
 Check the data rate can be configured by this module. More...
 
int16_t setOutputPower (int8_t power) override
 Sets transmission output power. Allowed values range from -3 to 15 dBm (RFO pin) or +2 to +17 dBm (PA_BOOST pin). High power +20 dBm operation is also supported, on the PA_BOOST pin. Defaults to PA_BOOST. More...
 
int16_t setOutputPower (int8_t power, bool useRfo)
 Sets transmission output power. Allowed values range from -3 to 15 dBm (RFO pin) or +2 to +17 dBm (PA_BOOST pin). High power +20 dBm operation is also supported, on the PA_BOOST pin. More...
 
int16_t checkOutputPower (int8_t power, int8_t *clipped) override
 Check if output power is configurable. This method is needed for compatibility with PhysicalLayer::checkOutputPower. More...
 
int16_t checkOutputPower (int8_t power, int8_t *clipped, bool useRfo)
 Check if output power is configurable. More...
 
int16_t setGain (uint8_t gain)
 Sets gain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest gain. Set to 0 to enable automatic gain control (recommended). More...
 
int16_t setDataShaping (uint8_t sh) override
 Sets Gaussian filter bandwidth-time product that will be used for data shaping. Only available in FSK mode with FSK modulation. 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 setDataShapingOOK (uint8_t sh)
 Sets filter cutoff frequency that will be used for data shaping. Allowed values are 1 for frequency equal to bit rate and 2 for frequency equal to 2x bit rate. Set to 0 to disable data shaping. Only available in FSK mode with OOK modulation. More...
 
float getRSSI () override
 Gets recorded signal strength indicator. Overload with packet mode enabled for PhysicalLayer compatibility. More...
 
float getRSSI (bool packet, bool skipReceive=false)
 Gets recorded signal strength indicator. More...
 
int16_t setCRC (bool enable, bool mode=false)
 Enables/disables CRC check of received packets. More...
 
int16_t forceLDRO (bool enable)
 Forces LoRa low data rate optimization. Only available in LoRa mode. After calling this method, LDRO will always be set to the provided value, regardless of symbol length. To re-enable automatic LDRO configuration, call SX1278::autoLDRO() More...
 
int16_t autoLDRO ()
 Re-enables automatic LDRO configuration. Only available in LoRa mode. After calling this method, LDRO will be enabled automatically when symbol length exceeds 16 ms. More...
 
int16_t implicitHeader (size_t len)
 Set implicit header mode for future reception/transmission. Required for spreading factor 6. More...
 
int16_t explicitHeader ()
 Set explicit header mode for future reception/transmission. More...
 
int16_t setModem (ModemType_t modem) override
 Set modem for the radio to use. Will perform full reset and reconfigure the radio using its default parameters. More...
 
- Public Member Functions inherited from SX127x
 SX127x (Module *mod)
 Default constructor. Called internally when creating new LoRa instance. More...
 
int16_t begin (uint8_t *chipVersions, uint8_t numVersions, uint8_t syncWord, uint16_t preambleLength)
 Initialization method. Will be called with appropriate parameters when calling initialization method from derived class. More...
 
int16_t beginFSK (uint8_t *chipVersions, uint8_t numVersions, float freqDev, float rxBw, uint16_t preambleLength, bool enableOOK)
 Initialization method for FSK modem. Will be called with appropriate parameters when calling FSK initialization method from derived class. More...
 
int16_t transmit (const uint8_t *data, size_t len, uint8_t addr=0) override
 Binary transmit method. Will transmit arbitrary binary data up to 255 bytes long using LoRa or up to 63 bytes using FSK modem. For overloads to transmit Arduino String or C-string, see PhysicalLayer::transmit. More...
 
int16_t receive (uint8_t *data, size_t len) override
 Binary receive method. Will attempt to receive arbitrary binary data up to 255 bytes long using LoRa or up to 63 bytes using FSK modem. For overloads to receive Arduino String, see PhysicalLayer::receive. More...
 
int16_t scanChannel () override
 Performs scan for valid LoRa preamble in the current channel. More...
 
int16_t sleep () override
 Sets the LoRa module to sleep to save power. Module will not be able to transmit or receive any data while in sleep mode. Module will wake up automatically when methods like transmit or receive are called. More...
 
int16_t standby () override
 Sets the LoRa module to standby. More...
 
int16_t standby (uint8_t mode) override
 Sets the LoRa module to standby. More...
 
int16_t transmitDirect (uint32_t frf=0) override
 Enables direct transmission mode on pins DIO1 (clock) and DIO2 (data). While in direct mode, the module will not be able to transmit or receive packets. Can only be activated in FSK mode. More...
 
int16_t receiveDirect () override
 Enables direct reception mode on pins DIO1 (clock) and DIO2 (data). While in direct mode, the module will not be able to transmit or receive packets. Can only be activated in FSK mode. More...
 
int16_t packetMode ()
 Disables direct mode and enables packet mode, allowing the module to receive packets. Can only be activated in FSK mode. More...
 
void setDio0Action (void(*func)(void), uint32_t dir)
 Set interrupt service routine function to call when DIO0 activates. More...
 
void clearDio0Action ()
 Clears interrupt service routine to call when DIO0 activates.
 
void setDio1Action (void(*func)(void), uint32_t dir)
 Set interrupt service routine function 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 setChannelScanAction (void(*func)(void)) override
 Sets interrupt service routine to call when a channel scan is finished. More...
 
void clearChannelScanAction () override
 Clears interrupt service routine to call when a channel scan is finished.
 
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. Will start transmitting arbitrary binary data up to 255 bytes long using LoRa or up to 63 bytes using FSK modem. More...
 
int16_t finishTransmit () override
 Clean up after transmission is done. More...
 
int16_t startReceive () override
 Interrupt-driven receive method with default parameters. Implemented for compatibility with PhysicalLayer. More...
 
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) override
 Interrupt-driven receive method, implemented for compatibility with PhysicalLayer. More...
 
int16_t readData (uint8_t *data, size_t len) override
 Reads data that was 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 startChannelScan () override
 Interrupt-driven channel activity detection method. DIO0 will be activated when LoRa preamble is detected. DIO1 will be activated if there's no preamble detected before timeout. More...
 
int16_t getChannelScanResult () override
 Read the channel scan result. More...
 
int16_t setSyncWord (uint8_t syncWord)
 Sets LoRa sync word. Only available in LoRa mode. More...
 
int16_t setCurrentLimit (uint8_t currentLimit)
 Sets current limit for over current protection at transmitter amplifier. Allowed values range from 45 to 120 mA in 5 mA steps and 120 to 240 mA in 10 mA steps. More...
 
int16_t setPreambleLength (size_t preambleLength) override
 Sets LoRa or FSK preamble length. Allowed values range from 6 to 65535 in LoRa mode or 0 to 65535 in FSK mode. More...
 
int16_t invertPreamble (bool enable)
 Invert FSK preamble polarity. The default (non-inverted) is 0x55, the inverted is 0xAA. More...
 
float getFrequencyError (bool autoCorrect=false)
 Gets frequency error of the latest received packet. More...
 
float getAFCError ()
 Gets current AFC error. More...
 
float getSNR () override
 Gets signal-to-noise ratio of the latest received packet. Only available in LoRa mode. More...
 
float getDataRate () const
 Get data rate of the latest transmitted packet. More...
 
int16_t setFrequencyDeviation (float freqDev) override
 Sets FSK frequency deviation from carrier frequency. Allowed values depend on bit rate setting and must be lower than 200 kHz. Only available in FSK mode. More...
 
int16_t setRxBandwidth (float rxBw)
 Sets FSK receiver bandwidth. Allowed values range from 2.6 to 250 kHz. Only available in FSK mode. More...
 
int16_t setAFCBandwidth (float afcBw)
 Sets FSK automatic frequency correction bandwidth. Allowed values range from 2.6 to 250 kHz. Only available in FSK mode. More...
 
int16_t setAFC (bool isEnabled)
 Enables or disables FSK automatic frequency correction(AFC) More...
 
int16_t setAFCAGCTrigger (uint8_t trigger)
 Controls trigger of AFC and AGC. More...
 
int16_t setSyncWord (uint8_t *syncWord, size_t len) override
 Sets FSK sync word. Allowed sync words are up to 8 bytes long and can not contain null bytes. Only available in FSK mode. More...
 
int16_t setNodeAddress (uint8_t nodeAddr)
 Sets FSK node address. Calling this method will enable address filtering. Only available in FSK mode. More...
 
int16_t setBroadcastAddress (uint8_t broadAddr)
 Sets FSK broadcast address. Calling this method will enable address filtering. Only available in FSK mode. More...
 
int16_t disableAddressFiltering ()
 Disables FSK address filtering. More...
 
int16_t setOOK (bool enableOOK)
 Enables/disables OOK modulation instead of FSK. More...
 
int16_t setOokThresholdType (uint8_t type)
 Selects the type of threshold in the OOK data slicer. More...
 
int16_t setOokPeakThresholdDecrement (uint8_t value)
 Period of decrement of the RSSI threshold in the OOK demodulator. More...
 
int16_t setOokFixedOrFloorThreshold (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 setOokPeakThresholdStep (uint8_t value)
 Size of each decrement of the RSSI threshold in the OOK demodulator. More...
 
int16_t enableBitSync ()
 Enable Bit synchronizer. More...
 
int16_t disableBitSync ()
 Disable Bit synchronizer (not allowed in Packet mode). More...
 
size_t getPacketLength (bool update=true) override
 Query modem for the packet length of received payload. More...
 
int16_t fixedPacketLengthMode (uint8_t len=RADIOLIB_SX127X_MAX_PACKET_LENGTH_FSK)
 Set modem in fixed packet length mode. Available in FSK mode only. More...
 
int16_t variablePacketLengthMode (uint8_t maxLen=RADIOLIB_SX127X_MAX_PACKET_LENGTH_FSK)
 Set modem in variable packet length mode. Available in FSK mode only. More...
 
float getNumSymbols (size_t len)
 Convert from bytes to LoRa symbols. More...
 
RadioLibTime_t getTimeOnAir (size_t len) override
 Get expected time-on-air for a given size of payload. More...
 
RadioLibTime_t calculateRxTimeout (RadioLibTime_t timeoutUs) override
 Calculate the timeout value for this specific module / series (in number of symbols or units of time) More...
 
uint32_t getIrqFlags () override
 Read currently active IRQ flags. More...
 
int16_t setIrqFlags (uint32_t irq) override
 Set interrupt on DIO1 to be sent on a specific IRQ bit (e.g. RxTimeout, CadDone). NOTE: Unlike other modules that support IRQ abstraction (SX126x, LR11x0, etc.), SX127x cannot configure multiple IRQs to signal using the same DIOx pin. This method tries to configure IRQs in a "best effort" approach, and will skip conflicting flags. RADIOLIB_ERR_INVALID_IRQ will be returned in this case. More...
 
int16_t clearIrqFlags (uint32_t irq) override
 Clear interrupt on a specific IRQ bit (e.g. RxTimeout, CadDone). More...
 
int16_t setCrcFiltering (bool enable=true)
 Enable CRC filtering and generation. More...
 
int16_t setRSSIConfig (uint8_t smoothingSamples, int8_t offset=0)
 Sets RSSI measurement configuration in FSK mode. More...
 
int16_t setEncoding (uint8_t encoding) override
 Sets transmission encoding. Only available in FSK mode. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER and RADIOLIB_ENCODING_WHITENING. More...
 
uint16_t getIRQFlags ()
 Reads currently active IRQ flags, can be used to check which event caused an interrupt. In LoRa mode, this is the content of SX127X_REG_IRQ_FLAGS register. In FSK mode, this is the contents of SX127X_REG_IRQ_FLAGS_2 (MSB) and SX127X_REG_IRQ_FLAGS_1 (LSB) registers. More...
 
uint8_t getModemStatus ()
 Reads modem status. Only available in LoRa mode. More...
 
int8_t getTempRaw ()
 Reads uncalibrated temperature value. This function will change operating mode and should not be called during Tx, Rx or CAD. 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 SX1278_CHIP_VERSION (0x12) or SX1272_CHIP_VERSION (0x22) if SX127x is connected and working. More...
 
int16_t invertIQ (bool enable) override
 Enable/disable inversion of the I and Q signals. More...
 
int16_t getModem (ModemType_t *modem) override
 Get modem currently in use by the radio. 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 setFHSSHoppingPeriod (uint8_t freqHoppingPeriod)
 Sets the hopping period and enables FHSS. More...
 
uint8_t getFHSSHoppingPeriod (void)
 Gets FHSS hopping period. More...
 
uint8_t getFHSSChannel (void)
 Gets the FHSS channel in use. More...
 
void clearFHSSInt (void)
 Clear the FHSS interrupt.
 
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 setDIOPreambleDetect (bool usePreambleDetect)
 Configure DIO mapping to use RSSI or Preamble Detect for pins that support it. More...
 
int16_t setRSSIThreshold (float dbm)
 Sets the RSSI value above which the RSSI interrupt is signaled. More...
 
int16_t setLowBatteryThreshold (int8_t level, uint32_t pin=RADIOLIB_NC)
 Set low battery indicator threshold. 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...
 
float getFreqStep () const
 Gets the module frequency step size that was set in constructor. 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 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 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...
 

Detailed Description

Derived class for SX1278 modules. Also used as base class for SX1276, SX1277, SX1279, RFM95 and RFM96. All of these modules use the same basic hardware and only differ in parameter ranges (and names).

Constructor & Destructor Documentation

◆ SX1278()

SX1278::SX1278 ( Module mod)

Default constructor. Called from Arduino sketch when creating new LoRa instance.

Parameters
modInstance of Module that will be used to communicate with the LoRa chip.

Member Function Documentation

◆ autoLDRO()

int16_t SX1278::autoLDRO ( )

Re-enables automatic LDRO configuration. Only available in LoRa mode. After calling this method, LDRO will be enabled automatically when symbol length exceeds 16 ms.

Returns
Status Codes

◆ begin()

int16_t SX1278::begin ( float  freq = 434.0,
float  bw = 125.0,
uint8_t  sf = 9,
uint8_t  cr = 7,
uint8_t  syncWord = RADIOLIB_SX127X_SYNC_WORD,
int8_t  power = 10,
uint16_t  preambleLength = 8,
uint8_t  gain = 0 
)

LoRa modem initialization method. Must be called at least once from Arduino sketch to initialize the module.

Parameters
freqCarrier frequency in MHz. Allowed values range from 137.0 MHz to 525.0 MHz.
bwLoRa link bandwidth in kHz. Allowed values are 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250 and 500 kHz.
sfLoRa link spreading factor. Allowed values range from 6 to 12.
crLoRa link coding rate denominator. Allowed values range from 5 to 8.
syncWordLoRa sync word. Can be used to distinguish different networks. Note that value 0x34 is reserved for LoRaWAN networks.
powerTransmission output power in dBm. Allowed values range from 2 to 17 dBm.
preambleLengthLength of LoRa transmission preamble in symbols. The actual preamble length is 4.25 symbols longer than the set number. Allowed values range from 6 to 65535.
gainGain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest gain. Set to 0 to enable automatic gain control (recommended).
Returns
Status Codes

◆ beginFSK()

int16_t SX1278::beginFSK ( float  freq = 434.0,
float  br = 4.8,
float  freqDev = 5.0,
float  rxBw = 125.0,
int8_t  power = 10,
uint16_t  preambleLength = 16,
bool  enableOOK = false 
)

FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module.

Parameters
freqCarrier frequency in MHz. Allowed values range from 137.0 MHz to 525.0 MHz.
brBit rate of the FSK transmission in kbps (kilobits per second). Allowed values range from 1.2 to 300.0 kbps.
freqDevFrequency deviation of the FSK transmission in kHz. Allowed values range from 0.6 to 200.0 kHz. Note that the allowed range changes based on bit rate setting, so that the condition FreqDev + BitRate/2 <= 250 kHz is always met.
rxBwReceiver bandwidth in kHz. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6, 20.8, 25, 31.3, 41.7, 50, 62.5, 83.3, 100, 125, 166.7, 200 and 250 kHz.
powerTransmission output power in dBm. Allowed values range from 2 to 17 dBm.
preambleLengthLength of FSK preamble in bits.
enableOOKUse OOK modulation instead of FSK.
Returns
Status Codes

◆ checkDataRate()

int16_t SX1278::checkDataRate ( DataRate_t  dr)
overridevirtual

Check the data rate can be configured by this module.

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

Reimplemented from PhysicalLayer.

◆ checkOutputPower() [1/2]

int16_t SX1278::checkOutputPower ( int8_t  power,
int8_t *  clipped 
)
overridevirtual

Check if output power is configurable. This method is needed for compatibility with PhysicalLayer::checkOutputPower.

Parameters
powerOutput power in dBm, assumes PA_BOOST pin.
clippedClipped output power value to what is possible within the module's range.
Returns
Status Codes

Reimplemented from PhysicalLayer.

◆ checkOutputPower() [2/2]

int16_t SX1278::checkOutputPower ( int8_t  power,
int8_t *  clipped,
bool  useRfo 
)

Check if output power is configurable.

Parameters
powerOutput power in dBm.
clippedClipped output power value to what is possible within the module's range.
useRfoWhether to use the RFO (true) or the PA_BOOST (false) pin for the RF output.
Returns
Status Codes

◆ explicitHeader()

int16_t SX1278::explicitHeader ( )

Set explicit header mode for future reception/transmission.

Returns
Status Codes

◆ forceLDRO()

int16_t SX1278::forceLDRO ( bool  enable)

Forces LoRa low data rate optimization. Only available in LoRa mode. After calling this method, LDRO will always be set to the provided value, regardless of symbol length. To re-enable automatic LDRO configuration, call SX1278::autoLDRO()

Parameters
enableForce LDRO to be always enabled (true) or disabled (false).
Returns
Status Codes

◆ getRSSI() [1/2]

float SX1278::getRSSI ( )
overridevirtual

Gets recorded signal strength indicator. Overload with packet mode enabled for PhysicalLayer compatibility.

Returns
RSSI value in dBm.

Reimplemented from PhysicalLayer.

◆ getRSSI() [2/2]

float SX1278::getRSSI ( bool  packet,
bool  skipReceive = false 
)

Gets recorded signal strength indicator.

Parameters
packetWhether to read last packet RSSI, or the current value. LoRa mode only, ignored for FSK.
skipReceiveSet to true to skip putting radio in receive mode for the RSSI measurement in FSK/OOK mode.
Returns
RSSI value in dBm.

◆ implicitHeader()

int16_t SX1278::implicitHeader ( size_t  len)

Set implicit header mode for future reception/transmission. Required for spreading factor 6.

Parameters
lenPayload length in bytes.
Returns
Status Codes

◆ setBandwidth()

int16_t SX1278::setBandwidth ( float  bw)

Sets LoRa link bandwidth. Allowed values are 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250 and 500 kHz. Only available in LoRa mode.

Parameters
bwLoRa link bandwidth to be set in kHz.
Returns
Status Codes

◆ setBitRate()

int16_t SX1278::setBitRate ( float  br)
overridevirtual

Sets FSK bit rate. Allowed values range from 0.5 to 300 kbps. Only available in FSK mode.

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

Reimplemented from PhysicalLayer.

◆ setCodingRate()

int16_t SX1278::setCodingRate ( uint8_t  cr)

Sets LoRa link coding rate denominator. Allowed values range from 5 to 8. Only available in LoRa mode.

Parameters
crLoRa link coding rate denominator to be set.
Returns
Status Codes

◆ setCRC()

int16_t SX1278::setCRC ( bool  enable,
bool  mode = false 
)

Enables/disables CRC check of received packets.

Parameters
enableEnable (true) or disable (false) CRC.
modeSet CRC mode to SX127X_CRC_WHITENING_TYPE_CCITT for CCITT, polynomial X16 + X12 + X5 + 1 (false) or SX127X_CRC_WHITENING_TYPE_IBM for IBM, polynomial X16 + X15 + X2 + 1 (true). Only valid in FSK mode.
Returns
Status Codes

◆ setDataRate()

int16_t SX1278::setDataRate ( DataRate_t  dr)
overridevirtual

Set data.

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

Reimplemented from PhysicalLayer.

◆ setDataShaping()

int16_t SX1278::setDataShaping ( uint8_t  sh)
overridevirtual

Sets Gaussian filter bandwidth-time product that will be used for data shaping. Only available in FSK mode with FSK modulation. 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.

Parameters
shGaussian shaping bandwidth-time product that will be used for data shaping
Returns
Status Codes

Reimplemented from PhysicalLayer.

◆ setDataShapingOOK()

int16_t SX1278::setDataShapingOOK ( uint8_t  sh)

Sets filter cutoff frequency that will be used for data shaping. Allowed values are 1 for frequency equal to bit rate and 2 for frequency equal to 2x bit rate. Set to 0 to disable data shaping. Only available in FSK mode with OOK modulation.

Parameters
shCutoff frequency that will be used for data shaping
Returns
Status Codes

◆ setFrequency()

int16_t SX1278::setFrequency ( float  freq)
overridevirtual

Sets carrier frequency. Allowed values range from 137.0 MHz to 525.0 MHz.

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

Reimplemented from PhysicalLayer.

Reimplemented in SX1279.

◆ setGain()

int16_t SX1278::setGain ( uint8_t  gain)

Sets gain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest gain. Set to 0 to enable automatic gain control (recommended).

Parameters
gainGain of receiver LNA (low-noise amplifier) to be set.
Returns
Status Codes

◆ setModem()

int16_t SX1278::setModem ( ModemType_t  modem)
overridevirtual

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

Parameters
modemModem type to set - FSK or LoRa.
Returns
Status Codes

Reimplemented from PhysicalLayer.

Reimplemented in SX1279.

◆ setOutputPower() [1/2]

int16_t SX1278::setOutputPower ( int8_t  power)
overridevirtual

Sets transmission output power. Allowed values range from -3 to 15 dBm (RFO pin) or +2 to +17 dBm (PA_BOOST pin). High power +20 dBm operation is also supported, on the PA_BOOST pin. Defaults to PA_BOOST.

Parameters
powerTransmission output power in dBm.
Returns
Status Codes

Reimplemented from PhysicalLayer.

◆ setOutputPower() [2/2]

int16_t SX1278::setOutputPower ( int8_t  power,
bool  useRfo 
)

Sets transmission output power. Allowed values range from -3 to 15 dBm (RFO pin) or +2 to +17 dBm (PA_BOOST pin). High power +20 dBm operation is also supported, on the PA_BOOST pin.

Parameters
powerTransmission output power in dBm.
useRfoWhether to use the RFO (true) or the PA_BOOST (false) pin for the RF output.
Returns
Status Codes

◆ setSpreadingFactor()

int16_t SX1278::setSpreadingFactor ( uint8_t  sf)

Sets LoRa link spreading factor. Allowed values range from 6 to 12. Only available in LoRa mode.

Parameters
sfLoRa link spreading factor to be set.
Returns
Status Codes

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