1 #if !defined(_RADIOLIB_SX1272_H)
2 #define _RADIOLIB_SX1272_H
4 #include "../../TypeDef.h"
6 #if !RADIOLIB_EXCLUDE_SX127X
8 #include "../../Module.h"
12 #define RADIOLIB_SX1272_REG_AGC_REF 0x43
13 #define RADIOLIB_SX1272_REG_AGC_THRESH_1 0x44
14 #define RADIOLIB_SX1272_REG_AGC_THRESH_2 0x45
15 #define RADIOLIB_SX1272_REG_AGC_THRESH_3 0x46
16 #define RADIOLIB_SX1272_REG_PLL_HOP 0x4B
17 #define RADIOLIB_SX1272_REG_TCXO 0x58
18 #define RADIOLIB_SX1272_REG_PA_DAC 0x5A
19 #define RADIOLIB_SX1272_REG_PLL 0x5C
20 #define RADIOLIB_SX1272_REG_PLL_LOW_PN 0x5E
21 #define RADIOLIB_SX1272_REG_FORMER_TEMP 0x6C
22 #define RADIOLIB_SX1272_REG_BIT_RATE_FRAC 0x70
26 #define RADIOLIB_SX1272_FRF_MSB 0xE4
27 #define RADIOLIB_SX1272_FRF_MID 0xC0
28 #define RADIOLIB_SX1272_FRF_LSB 0x00
31 #define RADIOLIB_SX1272_BW_125_00_KHZ 0b00000000
32 #define RADIOLIB_SX1272_BW_250_00_KHZ 0b01000000
33 #define RADIOLIB_SX1272_BW_500_00_KHZ 0b10000000
34 #define RADIOLIB_SX1272_CR_4_5 0b00001000
35 #define RADIOLIB_SX1272_CR_4_6 0b00010000
36 #define RADIOLIB_SX1272_CR_4_7 0b00011000
37 #define RADIOLIB_SX1272_CR_4_8 0b00100000
38 #define RADIOLIB_SX1272_HEADER_EXPL_MODE 0b00000000
39 #define RADIOLIB_SX1272_HEADER_IMPL_MODE 0b00000100
40 #define RADIOLIB_SX1272_RX_CRC_MODE_OFF 0b00000000
41 #define RADIOLIB_SX1272_RX_CRC_MODE_ON 0b00000010
42 #define RADIOLIB_SX1272_LOW_DATA_RATE_OPT_OFF 0b00000000
43 #define RADIOLIB_SX1272_LOW_DATA_RATE_OPT_ON 0b00000001
46 #define RADIOLIB_SX1272_AGC_AUTO_OFF 0b00000000
47 #define RADIOLIB_SX1272_AGC_AUTO_ON 0b00000100
50 #define RADIOLIB_SX1272_CHIP_VERSION 0x22
54 #define RADIOLIB_SX1272_NO_SHAPING 0b00000000
55 #define RADIOLIB_SX1272_FSK_GAUSSIAN_1_0 0b00001000
56 #define RADIOLIB_SX1272_FSK_GAUSSIAN_0_5 0b00010000
57 #define RADIOLIB_SX1272_FSK_GAUSSIAN_0_3 0b00011000
58 #define RADIOLIB_SX1272_OOK_FILTER_BR 0b00001000
59 #define RADIOLIB_SX1272_OOK_FILTER_2BR 0b00010000
62 #define RADIOLIB_SX1272_LOW_PN_TX_PLL_OFF 0b00010000
63 #define RADIOLIB_SX1272_LOW_PN_TX_PLL_ON 0b00000000
66 #define RADIOLIB_SX1272_FIFO_FILL_CONDITION_SYNC_ADDRESS 0b00000000
67 #define RADIOLIB_SX1272_FIFO_FILL_CONDITION_ALWAYS 0b00001000
70 #define RADIOLIB_SX1272_AGC_REFERENCE_LEVEL 0x13
73 #define RADIOLIB_SX1272_AGC_STEP_1 0x0E
76 #define RADIOLIB_SX1272_AGC_STEP_2 0x50
77 #define RADIOLIB_SX1272_AGC_STEP_3 0x0B
80 #define RADIOLIB_SX1272_AGC_STEP_4 0xD0
81 #define RADIOLIB_SX1272_AGC_STEP_5 0x0B
84 #define RADIOLIB_SX1272_PLL_LOW_PN_BANDWIDTH_75_KHZ 0b00000000
85 #define RADIOLIB_SX1272_PLL_LOW_PN_BANDWIDTH_150_KHZ 0b01000000
86 #define RADIOLIB_SX1272_PLL_LOW_PN_BANDWIDTH_225_KHZ 0b10000000
87 #define RADIOLIB_SX1272_PLL_LOW_PN_BANDWIDTH_300_KHZ 0b11000000
121 int16_t
begin(
float freq = 915.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);
135 int16_t
beginFSK(
float freq = 915.0,
float br = 4.8,
float freqDev = 5.0,
float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16,
bool enableOOK =
false);
140 void reset()
override;
240 float getRSSI(
bool packet =
true,
bool skipReceive =
false);
250 int16_t
setCRC(
bool enable,
bool mode =
false);
280 #if !RADIOLIB_GODMODE
283 int16_t setBandwidthRaw(uint8_t newBandwidth);
284 int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor);
285 int16_t setCodingRateRaw(uint8_t newCodingRate);
286 int16_t setHeaderType(uint8_t headerType,
size_t len = 0xFF);
289 void errataFix(
bool rx);
291 #if !RADIOLIB_GODMODE
294 bool ldroAuto =
true;
295 bool ldroEnabled =
false;
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:68
virtual float getRSSI()
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
Definition: PhysicalLayer.cpp:289
Derived class for SX1272 modules. Also used as base class for SX1273. Both modules use the same basic...
Definition: SX1272.h:94
void reset() override
Reset method. Will reset the chip to the default state using RST pin.
Definition: SX1272.cpp:76
int16_t setBandwidth(float bw)
Sets LoRa link bandwidth. Allowed values are 125, 250 and 500 kHz. Only available in LoRa mode.
Definition: SX1272.cpp:96
int16_t checkDataRate(DataRate_t dr) override
Check the data rate can be configured by this module.
Definition: SX1272.cpp:255
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: SX1272.cpp:388
int16_t forceLDRO(bool enable)
Forces LoRa low data rate optimization. Only available in LoRa mode. After calling this method,...
Definition: SX1272.cpp:455
int16_t implicitHeader(size_t len)
Set implicit header mode for future reception/transmission. Required for spreading factor 6.
Definition: SX1272.cpp:478
int16_t setDataRate(DataRate_t dr) override
Set data.
Definition: SX1272.cpp:226
int16_t setSpreadingFactor(uint8_t sf)
Sets LoRa link spreading factor. Allowed values range from 6 to 12. Only available in LoRa mode.
Definition: SX1272.cpp:134
int16_t beginFSK(float freq=915.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: SX1272.cpp:41
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: SX1272.cpp:357
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: SX1272.cpp:188
SX1272(Module *mod)
Default constructor. Called from Arduino sketch when creating new LoRa instance.
Definition: SX1272.cpp:5
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: SX1272.cpp:222
int16_t autoLDRO()
Re-enables automatic LDRO configuration. Only available in LoRa mode. After calling this method,...
Definition: SX1272.cpp:469
int16_t setCRC(bool enable, bool mode=false)
Enables/disables CRC check of received packets.
Definition: SX1272.cpp:426
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: SX1272.cpp:320
int16_t explicitHeader()
Set explicit header mode for future reception/transmission.
Definition: SX1272.cpp:482
int16_t begin(float freq=915.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: SX1272.cpp:9
int16_t setOutputPower(int8_t power) override
Sets transmission output power. Allowed values range from -1 to 14 dBm (RFO pin) or +2 to +20 dBm (PA...
Definition: SX1272.cpp:278
int16_t setFrequency(float freq)
Sets carrier frequency. Allowed values range from 860.0 MHz to 1020.0 MHz.
Definition: SX1272.cpp:85
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:38