RadioLib
Universal wireless communication library for Arduino
|
Derived class for Si4431 modules. More...
#include <Si4431.h>
Public Member Functions | |
Si4431 (Module *mod) | |
Default constructor. More... | |
int16_t | begin (float freq=434.0, float br=4.8, float freqDev=5.0, float rxBw=181.1, int8_t power=10, uint8_t preambleLen=16) |
Initialization method. Must be called at least once from Arduino sketch to initialize the module. More... | |
int16_t | setOutputPower (int8_t power) override |
Sets output power. Allowed values range from -8 to 13 dBm in 3 dBm steps. More... | |
Public Member Functions inherited from Si4432 | |
Si4432 (Module *mod) | |
Default constructor. More... | |
int16_t | begin (float freq=434.0, float br=4.8, float freqDev=5.0, float rxBw=181.1, int8_t power=10, uint8_t preambleLen=16) |
Initialization method. Must be called at least once from Arduino sketch to initialize the module. More... | |
int16_t | setFrequency (float freq) override |
Sets carrier frequency. Allowed values range from 240.0 MHz to 930.0 MHz. More... | |
int16_t | setOutputPower (int8_t power) override |
Sets output power. Allowed values range from -1 to 20 dBm in 3 dBm steps. More... | |
Public Member Functions inherited from Si443x | |
Si443x (Module *mod) | |
Default constructor. More... | |
int16_t | begin (float br, float freqDev, float rxBw, uint8_t preambleLen) |
Initialization method. More... | |
void | reset () |
Reset method. Will reset the chip to the default state using SDN pin. | |
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 64 bytes long. 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 64 bytes long. For overloads to receive Arduino String, see PhysicalLayer::receive. More... | |
int16_t | sleep () override |
Sets the 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 module to standby (with XTAL on). More... | |
int16_t | standby (uint8_t mode) override |
Sets the module to standby. More... | |
int16_t | transmitDirect (uint32_t frf=0) override |
Enables direct transmission mode. While in direct mode, the module will not be able to transmit or receive packets. More... | |
int16_t | receiveDirect () override |
Enables direct reception mode. While in direct mode, the module will not be able to transmit or receive packets. More... | |
int16_t | packetMode () |
Disables direct mode and enables packet mode, allowing the module to receive packets. More... | |
void | setIrqAction (void(*func)(void)) |
Sets interrupt service routine to call when IRQ activates. More... | |
void | clearIrqAction () |
Clears interrupt service routine to call when IRQ 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. | |
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 64 bytes long. More... | |
int16_t | finishTransmit () override |
Clean up after transmission is done. More... | |
int16_t | startReceive () override |
Interrupt-driven receive method. IRQ will be activated when full valid 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 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 | setBitRate (float br) override |
Sets FSK bit rate. Allowed values range from 0.123 to 256.0 kbps. More... | |
int16_t | setFrequencyDeviation (float freqDev) override |
Sets FSK frequency deviation from carrier frequency. Allowed values range from 0.625 to 320.0 kHz. More... | |
int16_t | setRxBandwidth (float rxBw) |
Sets receiver bandwidth. Allowed values range from 2.6 to 620.7 kHz. More... | |
int16_t | setSyncWord (uint8_t *syncWord, size_t len) override |
Sets sync word. Up to 4 bytes can be set as sync word. More... | |
int16_t | setPreambleLength (uint8_t preambleLen) |
Sets preamble length. More... | |
size_t | getPacketLength (bool update=true) override |
Query modem for the packet length of received payload. 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... | |
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_5 or RADIOLIB_SHAPING_1_0. Set to RADIOLIB_SHAPING_NONE to disable data shaping. 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 RADIOLIB_SI443X_DEVICE_VERSION (0x06) if Si443x 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 | fixedPacketLengthMode (uint8_t len=RADIOLIB_SI443X_MAX_PACKET_LENGTH) |
Set modem in fixed packet length mode. More... | |
int16_t | variablePacketLengthMode (uint8_t maxLen=RADIOLIB_SI443X_MAX_PACKET_LENGTH) |
Set modem in variable packet length mode. 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 | 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 | 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 | 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... | |
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 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 | 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... | |
Derived class for Si4431 modules.
Si4431::Si4431 | ( | Module * | mod | ) |
Default constructor.
mod | Instance of Module that will be used to communicate with the radio chip. |
int16_t Si4431::begin | ( | float | freq = 434.0 , |
float | br = 4.8 , |
||
float | freqDev = 5.0 , |
||
float | rxBw = 181.1 , |
||
int8_t | power = 10 , |
||
uint8_t | preambleLen = 16 |
||
) |
Initialization method. Must be called at least once from Arduino sketch to initialize the module.
freq | Carrier frequency in MHz. Allowed values range from 240.0 MHz to 930.0 MHz. |
br | Bit rate of the FSK transmission in kbps (kilobits per second). Allowed values range from 0.123 to 256.0 kbps. |
freqDev | Frequency deviation of the FSK transmission in kHz. Allowed values range from 0.625 to 320.0 kbps. |
rxBw | Receiver bandwidth in kHz. Allowed values range from 2.6 to 620.7 kHz. |
power | Transmission output power in dBm. Allowed values range from -8 to 13 dBm in 3 dBm steps. |
preambleLen | Preamble Length in bits. Defaults to 16 bits. |
|
overridevirtual |
Sets output power. Allowed values range from -8 to 13 dBm in 3 dBm steps.
power | Output power to be set in dBm. |
Reimplemented from PhysicalLayer.