1#if !defined(_RADIOLIB_SX1278_H)
2#define _RADIOLIB_SX1278_H
4#include "../../TypeDef.h"
6#if !RADIOLIB_EXCLUDE_SX127X
8#include "../../Module.h"
12#define RADIOLIB_SX1278_REG_MODEM_CONFIG_3 0x26
13#define RADIOLIB_SX1278_REG_PLL_HOP 0x44
14#define RADIOLIB_SX1278_REG_TCXO 0x4B
15#define RADIOLIB_SX1278_REG_PA_DAC 0x4D
16#define RADIOLIB_SX1278_REG_FORMER_TEMP 0x5B
17#define RADIOLIB_SX1278_REG_BIT_RATE_FRAC 0x5D
18#define RADIOLIB_SX1278_REG_AGC_REF 0x61
19#define RADIOLIB_SX1278_REG_AGC_THRESH_1 0x62
20#define RADIOLIB_SX1278_REG_AGC_THRESH_2 0x63
21#define RADIOLIB_SX1278_REG_AGC_THRESH_3 0x64
22#define RADIOLIB_SX1278_REG_PLL 0x70
26#define RADIOLIB_SX1278_HIGH_FREQ 0b00000000
27#define RADIOLIB_SX1278_LOW_FREQ 0b00001000
30#define RADIOLIB_SX1278_FRF_MSB 0x6C
31#define RADIOLIB_SX1278_FRF_MID 0x80
32#define RADIOLIB_SX1278_FRF_LSB 0x00
35#define RADIOLIB_SX1278_MAX_POWER 0b01110000
36#define RADIOLIB_SX1278_LOW_POWER 0b00100000
39#define RADIOLIB_SX1278_LNA_BOOST_LF_OFF 0b00000000
42#define RADIOLIB_SX1278_BW_7_80_KHZ 0b00000000
43#define RADIOLIB_SX1278_BW_10_40_KHZ 0b00010000
44#define RADIOLIB_SX1278_BW_15_60_KHZ 0b00100000
45#define RADIOLIB_SX1278_BW_20_80_KHZ 0b00110000
46#define RADIOLIB_SX1278_BW_31_25_KHZ 0b01000000
47#define RADIOLIB_SX1278_BW_41_70_KHZ 0b01010000
48#define RADIOLIB_SX1278_BW_62_50_KHZ 0b01100000
49#define RADIOLIB_SX1278_BW_125_00_KHZ 0b01110000
50#define RADIOLIB_SX1278_BW_250_00_KHZ 0b10000000
51#define RADIOLIB_SX1278_BW_500_00_KHZ 0b10010000
52#define RADIOLIB_SX1278_CR_4_5 0b00000010
53#define RADIOLIB_SX1278_CR_4_6 0b00000100
54#define RADIOLIB_SX1278_CR_4_7 0b00000110
55#define RADIOLIB_SX1278_CR_4_8 0b00001000
56#define RADIOLIB_SX1278_HEADER_EXPL_MODE 0b00000000
57#define RADIOLIB_SX1278_HEADER_IMPL_MODE 0b00000001
60#define RADIOLIB_SX1278_RX_CRC_MODE_OFF 0b00000000
61#define RADIOLIB_SX1278_RX_CRC_MODE_ON 0b00000100
64#define RADIOLIB_SX1278_LOW_DATA_RATE_OPT_OFF 0b00000000
65#define RADIOLIB_SX1278_LOW_DATA_RATE_OPT_ON 0b00001000
66#define RADIOLIB_SX1278_AGC_AUTO_OFF 0b00000000
67#define RADIOLIB_SX1278_AGC_AUTO_ON 0b00000100
70#define RADIOLIB_SX1278_CHIP_VERSION 0x12
71#define RADIOLIB_SX1278_CHIP_VERSION_ALT 0x13
72#define RADIOLIB_SX1278_CHIP_VERSION_RFM9X 0x11
76#define RADIOLIB_SX1278_NO_SHAPING 0b00000000
77#define RADIOLIB_SX1278_FSK_GAUSSIAN_1_0 0b00100000
78#define RADIOLIB_SX1278_FSK_GAUSSIAN_0_5 0b01000000
79#define RADIOLIB_SX1278_FSK_GAUSSIAN_0_3 0b01100000
80#define RADIOLIB_SX1278_OOK_FILTER_BR 0b00100000
81#define RADIOLIB_SX1278_OOK_FILTER_2BR 0b01000000
84#define RADIOLIB_SX1278_AGC_REFERENCE_LEVEL_LF 0x19
85#define RADIOLIB_SX1278_AGC_REFERENCE_LEVEL_HF 0x1C
88#define RADIOLIB_SX1278_AGC_STEP_1_LF 0x0C
89#define RADIOLIB_SX1278_AGC_STEP_1_HF 0x0E
92#define RADIOLIB_SX1278_AGC_STEP_2_LF 0x40
93#define RADIOLIB_SX1278_AGC_STEP_2_HF 0x50
94#define RADIOLIB_SX1278_AGC_STEP_3 0x0B
97#define RADIOLIB_SX1278_AGC_STEP_4 0xC0
98#define RADIOLIB_SX1278_AGC_STEP_5 0x0C
132 virtual 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);
146 virtual 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);
151 void reset()
override;
278 float getRSSI(
bool packet,
bool skipReceive =
false);
287 int16_t
setCRC(
bool enable,
bool mode =
false);
324 int16_t
setModem(ModemType_t modem)
override;
329 int16_t setBandwidthRaw(uint8_t newBandwidth);
330 int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor);
331 int16_t setCodingRateRaw(uint8_t newCodingRate);
333 int16_t configFSK()
override;
334 void errataFix(
bool rx)
override;
339 bool ldroAuto =
true;
340 bool ldroEnabled =
false;
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition Module.h:73
Only exists as alias for SX1278, since there seems to be no difference between RFM98 and SX1278 modul...
Derived class for SX1278 modules. Also used as base class for SX1276, SX1277, SX1279,...
Definition SX1278.h:105
float getRSSI() override
Gets recorded signal strength indicator. Overload with packet mode enabled for PhysicalLayer compatib...
Definition SX1278.cpp:474
int16_t setDataShapingOOK(uint8_t sh)
Sets filter cutoff frequency that will be used for data shaping. Allowed values are 1 for frequency e...
Definition SX1278.cpp:441
int16_t setDataRate(DataRate_t dr) override
Set data.
Definition SX1278.cpp:240
int16_t setBandwidth(float bw)
Sets LoRa link bandwidth. Allowed values are 7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62....
Definition SX1278.cpp:96
int16_t implicitHeader(size_t len)
Set implicit header mode for future reception/transmission. Required for spreading factor 6.
Definition SX1278.cpp:538
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 p...
Definition SX1278.cpp:692
int16_t setOutputPower(int8_t power) override
Sets transmission output power. Allowed values range from -4 to 15 dBm (RFO pin) or +2 to +17 dBm (PA...
Definition SX1278.cpp:292
void reset() override
Reset method. Will reset the chip to the default state using RST pin.
Definition SX1278.cpp:76
int16_t forceLDRO(bool enable)
Forces LoRa low data rate optimization. Only available in LoRa mode. After calling this method,...
Definition SX1278.cpp:515
int16_t explicitHeader()
Set explicit header mode for future reception/transmission.
Definition SX1278.cpp:543
int16_t checkDataRate(DataRate_t dr) override
Check the data rate can be configured by this module.
Definition SX1278.cpp:269
int16_t setCodingRate(uint8_t cr)
Sets LoRa link coding rate denominator. Allowed values range from 5 to 8. Only available in LoRa mode...
Definition SX1278.cpp:202
virtual 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 m...
Definition SX1278.cpp:41
virtual 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 ...
Definition SX1278.cpp:9
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...
Definition SX1278.cpp:367
int16_t checkOutputPower(int8_t power, int8_t *clipped) override
Check if output power is configurable. This method is needed for compatibility with PhysicalLayer::ch...
Definition SX1278.cpp:339
int16_t setCRC(bool enable, bool mode=false)
Enables/disables CRC check of received packets.
Definition SX1278.cpp:486
int16_t setFrequency(float freq) override
Sets carrier frequency. Allowed values range from 137.0 MHz to 525.0 MHz.
Definition SX1278.cpp:85
int16_t autoLDRO()
Re-enables automatic LDRO configuration. Only available in LoRa mode. After calling this method,...
Definition SX1278.cpp:529
virtual int16_t setSpreadingFactor(uint8_t sf)
Sets LoRa link spreading factor. Allowed values range from 6 to 12. Only available in LoRa mode.
Definition SX1278.cpp:148
int16_t setDataShaping(uint8_t sh) override
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Only available in FSK...
Definition SX1278.cpp:405
int16_t setBitRate(float br) override
Sets FSK bit rate. Allowed values range from 0.5 to 300 kbps. Only available in FSK mode.
Definition SX1278.cpp:236
Base class for SX127x series. All derived classes for SX127x (e.g. SX1278 or SX1272) inherit from thi...
Definition SX127x.h:583
Common data rate structure.
Definition PhysicalLayer.h:74