diff --git a/_s_x1262_8h_source.html b/_s_x1262_8h_source.html index 6aba2e65..91ddb4c9 100644 --- a/_s_x1262_8h_source.html +++ b/_s_x1262_8h_source.html @@ -135,9 +135,9 @@ $(document).ready(function(){initNavTree('_s_x1262_8h_source.html',''); initResi
SX1262::SX1262
SX1262(Module *mod)
Default constructor.
Definition: SX1262.cpp:4
SX1262::beginFSK
int16_t beginFSK(float freq=434.0, float br=4.8, float freqDev=5.0, float rxBw=156.2, int8_t power=10, uint16_t preambleLength=16, float tcxoVoltage=1.6, bool useRegulatorLDO=false)
Initialization method for FSK modem.
Definition: SX1262.cpp:32
SX1262::begin
int16_t begin(float freq=434.0, float bw=125.0, uint8_t sf=9, uint8_t cr=7, uint8_t syncWord=RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power=10, uint16_t preambleLength=8, float tcxoVoltage=1.6, bool useRegulatorLDO=false)
Initialization method for LoRa modem.
Definition: SX1262.cpp:8
-
SX1262::setOutputPower
virtual int16_t setOutputPower(int8_t power)
Sets output power. Allowed values are in range from -9 to 22 dBm. This method is virtual to allow ove...
Definition: SX1262.cpp:84
+
SX1262::setOutputPower
virtual int16_t setOutputPower(int8_t power)
Sets output power. Allowed values are in range from -9 to 22 dBm. This method is virtual to allow ove...
Definition: SX1262.cpp:67
SX1262::setFrequency
int16_t setFrequency(float freq)
Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz.
Definition: SX1262.cpp:50
-
SX126x
Base class for SX126x series. All derived classes for SX126x (e.g. SX1262 or SX1268) inherit from thi...
Definition: SX126x.h:443
+
SX126x
Base class for SX126x series. All derived classes for SX126x (e.g. SX1262 or SX1268) inherit from thi...
Definition: SX126x.h:431
diff --git a/_s_x1268_8h_source.html b/_s_x1268_8h_source.html index 15b2c34f..95999a5b 100644 --- a/_s_x1268_8h_source.html +++ b/_s_x1268_8h_source.html @@ -131,12 +131,12 @@ $(document).ready(function(){initNavTree('_s_x1268_8h_source.html',''); initResi
96 #endif
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:31
SX1268
Derived class for SX1268 modules.
Definition: SX1268.h:21
-
SX1268::setOutputPower
int16_t setOutputPower(int8_t power)
Sets output power. Allowed values are in range from -9 to 22 dBm.
Definition: SX1268.cpp:79
+
SX1268::setOutputPower
int16_t setOutputPower(int8_t power)
Sets output power. Allowed values are in range from -9 to 22 dBm.
Definition: SX1268.cpp:68
SX1268::SX1268
SX1268(Module *mod)
Default constructor.
Definition: SX1268.cpp:4
SX1268::setFrequency
int16_t setFrequency(float freq)
Sets carrier frequency. Allowed values are in range from 410.0 to 810.0 MHz.
Definition: SX1268.cpp:50
SX1268::begin
int16_t begin(float freq=434.0, float bw=125.0, uint8_t sf=9, uint8_t cr=7, uint8_t syncWord=RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power=10, uint16_t preambleLength=8, float tcxoVoltage=1.6, bool useRegulatorLDO=false)
Initialization method for LoRa modem.
Definition: SX1268.cpp:8
SX1268::beginFSK
int16_t beginFSK(float freq=434.0, float br=4.8, float freqDev=5.0, float rxBw=156.2, int8_t power=10, uint16_t preambleLength=16, float tcxoVoltage=1.6, bool useRegulatorLDO=false)
Initialization method for FSK modem.
Definition: SX1268.cpp:32
-
SX126x
Base class for SX126x series. All derived classes for SX126x (e.g. SX1262 or SX1268) inherit from thi...
Definition: SX126x.h:443
+
SX126x
Base class for SX126x series. All derived classes for SX126x (e.g. SX1262 or SX1268) inherit from thi...
Definition: SX126x.h:431
diff --git a/_s_x126x_8h_source.html b/_s_x126x_8h_source.html index dda47e00..96d76865 100644 --- a/_s_x126x_8h_source.html +++ b/_s_x126x_8h_source.html @@ -276,523 +276,511 @@ $(document).ready(function(){initNavTree('_s_x126x_8h_source.html',''); initResi
188 #define RADIOLIB_SX126X_CALIBRATE_RC64K_ON 0b00000001 // 0 0 enabled
189 #define RADIOLIB_SX126X_CALIBRATE_ALL 0b01111111 // 6 0 calibrate all blocks
190 
-
191 //RADIOLIB_SX126X_CMD_CALIBRATE_IMAGE
-
192 #define RADIOLIB_SX126X_CAL_IMG_430_MHZ_1 0x6B
-
193 #define RADIOLIB_SX126X_CAL_IMG_430_MHZ_2 0x6F
-
194 #define RADIOLIB_SX126X_CAL_IMG_470_MHZ_1 0x75
-
195 #define RADIOLIB_SX126X_CAL_IMG_470_MHZ_2 0x81
-
196 #define RADIOLIB_SX126X_CAL_IMG_779_MHZ_1 0xC1
-
197 #define RADIOLIB_SX126X_CAL_IMG_779_MHZ_2 0xC5
-
198 #define RADIOLIB_SX126X_CAL_IMG_863_MHZ_1 0xD7
-
199 #define RADIOLIB_SX126X_CAL_IMG_863_MHZ_2 0xDB
-
200 #define RADIOLIB_SX126X_CAL_IMG_902_MHZ_1 0xE1
-
201 #define RADIOLIB_SX126X_CAL_IMG_902_MHZ_2 0xE9
-
202 
-
203 //RADIOLIB_SX126X_CMD_SET_PA_CONFIG
-
204 #define RADIOLIB_SX126X_PA_CONFIG_HP_MAX 0x07
-
205 #define RADIOLIB_SX126X_PA_CONFIG_PA_LUT 0x01
-
206 #define RADIOLIB_SX126X_PA_CONFIG_SX1262_8 0x00
-
207 
-
208 //RADIOLIB_SX126X_CMD_SET_RX_TX_FALLBACK_MODE
-
209 #define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_FS 0x40 // 7 0 after Rx/Tx go to: FS mode
-
210 #define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_XOSC 0x30 // 7 0 standby with crystal oscillator
-
211 #define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_RC 0x20 // 7 0 standby with RC oscillator (default)
-
212 
-
213 //RADIOLIB_SX126X_CMD_SET_DIO_IRQ_PARAMS
-
214 #define RADIOLIB_SX126X_IRQ_LR_FHSS_HOP 0b0100000000000000 // 14 14 PA ramped up during LR-FHSS hop
-
215 #define RADIOLIB_SX126X_IRQ_TIMEOUT 0b0000001000000000 // 9 9 Rx or Tx timeout
-
216 #define RADIOLIB_SX126X_IRQ_CAD_DETECTED 0b0000000100000000 // 8 8 channel activity detected
-
217 #define RADIOLIB_SX126X_IRQ_CAD_DONE 0b0000000010000000 // 7 7 channel activity detection finished
-
218 #define RADIOLIB_SX126X_IRQ_CRC_ERR 0b0000000001000000 // 6 6 wrong CRC received
-
219 #define RADIOLIB_SX126X_IRQ_HEADER_ERR 0b0000000000100000 // 5 5 LoRa header CRC error
-
220 #define RADIOLIB_SX126X_IRQ_HEADER_VALID 0b0000000000010000 // 4 4 valid LoRa header received
-
221 #define RADIOLIB_SX126X_IRQ_SYNC_WORD_VALID 0b0000000000001000 // 3 3 valid sync word detected
-
222 #define RADIOLIB_SX126X_IRQ_PREAMBLE_DETECTED 0b0000000000000100 // 2 2 preamble detected
-
223 #define RADIOLIB_SX126X_IRQ_RX_DONE 0b0000000000000010 // 1 1 packet received
-
224 #define RADIOLIB_SX126X_IRQ_TX_DONE 0b0000000000000001 // 0 0 packet transmission completed
-
225 #define RADIOLIB_SX126X_IRQ_RX_DEFAULT 0b0000001001100010 // 14 0 default for Rx (RX_DONE, TIMEOUT, CRC_ERR and HEADER_ERR)
-
226 #define RADIOLIB_SX126X_IRQ_ALL 0b0100001111111111 // 14 0 all interrupts
-
227 #define RADIOLIB_SX126X_IRQ_NONE 0b0000000000000000 // 14 0 no interrupts
-
228 
-
229 //RADIOLIB_SX126X_CMD_SET_DIO2_AS_RF_SWITCH_CTRL
-
230 #define RADIOLIB_SX126X_DIO2_AS_IRQ 0x00 // 7 0 DIO2 configuration: IRQ
-
231 #define RADIOLIB_SX126X_DIO2_AS_RF_SWITCH 0x01 // 7 0 RF switch control
-
232 
-
233 //RADIOLIB_SX126X_CMD_SET_DIO3_AS_TCXO_CTRL
-
234 #define RADIOLIB_SX126X_DIO3_OUTPUT_1_6 0x00 // 7 0 DIO3 voltage output for TCXO: 1.6 V
-
235 #define RADIOLIB_SX126X_DIO3_OUTPUT_1_7 0x01 // 7 0 1.7 V
-
236 #define RADIOLIB_SX126X_DIO3_OUTPUT_1_8 0x02 // 7 0 1.8 V
-
237 #define RADIOLIB_SX126X_DIO3_OUTPUT_2_2 0x03 // 7 0 2.2 V
-
238 #define RADIOLIB_SX126X_DIO3_OUTPUT_2_4 0x04 // 7 0 2.4 V
-
239 #define RADIOLIB_SX126X_DIO3_OUTPUT_2_7 0x05 // 7 0 2.7 V
-
240 #define RADIOLIB_SX126X_DIO3_OUTPUT_3_0 0x06 // 7 0 3.0 V
-
241 #define RADIOLIB_SX126X_DIO3_OUTPUT_3_3 0x07 // 7 0 3.3 V
-
242 
-
243 //RADIOLIB_SX126X_CMD_SET_PACKET_TYPE
-
244 #define RADIOLIB_SX126X_PACKET_TYPE_GFSK 0x00 // 7 0 packet type: GFSK
-
245 #define RADIOLIB_SX126X_PACKET_TYPE_LORA 0x01 // 7 0 LoRa
-
246 #define RADIOLIB_SX126X_PACKET_TYPE_LR_FHSS 0x03 // 7 0 LR-FHSS
-
247 
-
248 //RADIOLIB_SX126X_CMD_SET_TX_PARAMS
-
249 #define RADIOLIB_SX126X_PA_RAMP_10U 0x00 // 7 0 ramp time: 10 us
-
250 #define RADIOLIB_SX126X_PA_RAMP_20U 0x01 // 7 0 20 us
-
251 #define RADIOLIB_SX126X_PA_RAMP_40U 0x02 // 7 0 40 us
-
252 #define RADIOLIB_SX126X_PA_RAMP_80U 0x03 // 7 0 80 us
-
253 #define RADIOLIB_SX126X_PA_RAMP_200U 0x04 // 7 0 200 us
-
254 #define RADIOLIB_SX126X_PA_RAMP_800U 0x05 // 7 0 800 us
-
255 #define RADIOLIB_SX126X_PA_RAMP_1700U 0x06 // 7 0 1700 us
-
256 #define RADIOLIB_SX126X_PA_RAMP_3400U 0x07 // 7 0 3400 us
-
257 
-
258 //RADIOLIB_SX126X_CMD_SET_MODULATION_PARAMS
-
259 #define RADIOLIB_SX126X_GFSK_FILTER_NONE 0x00 // 7 0 GFSK filter: none
-
260 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_0_3 0x08 // 7 0 Gaussian, BT = 0.3
-
261 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_0_5 0x09 // 7 0 Gaussian, BT = 0.5
-
262 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_0_7 0x0A // 7 0 Gaussian, BT = 0.7
-
263 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_1 0x0B // 7 0 Gaussian, BT = 1
-
264 #define RADIOLIB_SX126X_GFSK_RX_BW_4_8 0x1F // 7 0 GFSK Rx bandwidth: 4.8 kHz
-
265 #define RADIOLIB_SX126X_GFSK_RX_BW_5_8 0x17 // 7 0 5.8 kHz
-
266 #define RADIOLIB_SX126X_GFSK_RX_BW_7_3 0x0F // 7 0 7.3 kHz
-
267 #define RADIOLIB_SX126X_GFSK_RX_BW_9_7 0x1E // 7 0 9.7 kHz
-
268 #define RADIOLIB_SX126X_GFSK_RX_BW_11_7 0x16 // 7 0 11.7 kHz
-
269 #define RADIOLIB_SX126X_GFSK_RX_BW_14_6 0x0E // 7 0 14.6 kHz
-
270 #define RADIOLIB_SX126X_GFSK_RX_BW_19_5 0x1D // 7 0 19.5 kHz
-
271 #define RADIOLIB_SX126X_GFSK_RX_BW_23_4 0x15 // 7 0 23.4 kHz
-
272 #define RADIOLIB_SX126X_GFSK_RX_BW_29_3 0x0D // 7 0 29.3 kHz
-
273 #define RADIOLIB_SX126X_GFSK_RX_BW_39_0 0x1C // 7 0 39.0 kHz
-
274 #define RADIOLIB_SX126X_GFSK_RX_BW_46_9 0x14 // 7 0 46.9 kHz
-
275 #define RADIOLIB_SX126X_GFSK_RX_BW_58_6 0x0C // 7 0 58.6 kHz
-
276 #define RADIOLIB_SX126X_GFSK_RX_BW_78_2 0x1B // 7 0 78.2 kHz
-
277 #define RADIOLIB_SX126X_GFSK_RX_BW_93_8 0x13 // 7 0 93.8 kHz
-
278 #define RADIOLIB_SX126X_GFSK_RX_BW_117_3 0x0B // 7 0 117.3 kHz
-
279 #define RADIOLIB_SX126X_GFSK_RX_BW_156_2 0x1A // 7 0 156.2 kHz
-
280 #define RADIOLIB_SX126X_GFSK_RX_BW_187_2 0x12 // 7 0 187.2 kHz
-
281 #define RADIOLIB_SX126X_GFSK_RX_BW_234_3 0x0A // 7 0 234.3 kHz
-
282 #define RADIOLIB_SX126X_GFSK_RX_BW_312_0 0x19 // 7 0 312.0 kHz
-
283 #define RADIOLIB_SX126X_GFSK_RX_BW_373_6 0x11 // 7 0 373.6 kHz
-
284 #define RADIOLIB_SX126X_GFSK_RX_BW_467_0 0x09 // 7 0 467.0 kHz
-
285 #define RADIOLIB_SX126X_LORA_BW_7_8 0x00 // 7 0 LoRa bandwidth: 7.8 kHz
-
286 #define RADIOLIB_SX126X_LORA_BW_10_4 0x08 // 7 0 10.4 kHz
-
287 #define RADIOLIB_SX126X_LORA_BW_15_6 0x01 // 7 0 15.6 kHz
-
288 #define RADIOLIB_SX126X_LORA_BW_20_8 0x09 // 7 0 20.8 kHz
-
289 #define RADIOLIB_SX126X_LORA_BW_31_25 0x02 // 7 0 31.25 kHz
-
290 #define RADIOLIB_SX126X_LORA_BW_41_7 0x0A // 7 0 41.7 kHz
-
291 #define RADIOLIB_SX126X_LORA_BW_62_5 0x03 // 7 0 62.5 kHz
-
292 #define RADIOLIB_SX126X_LORA_BW_125_0 0x04 // 7 0 125.0 kHz
-
293 #define RADIOLIB_SX126X_LORA_BW_250_0 0x05 // 7 0 250.0 kHz
-
294 #define RADIOLIB_SX126X_LORA_BW_500_0 0x06 // 7 0 500.0 kHz
-
295 #define RADIOLIB_SX126X_LORA_CR_4_5 0x01 // 7 0 LoRa coding rate: 4/5
-
296 #define RADIOLIB_SX126X_LORA_CR_4_6 0x02 // 7 0 4/6
-
297 #define RADIOLIB_SX126X_LORA_CR_4_7 0x03 // 7 0 4/7
-
298 #define RADIOLIB_SX126X_LORA_CR_4_8 0x04 // 7 0 4/8
-
299 #define RADIOLIB_SX126X_LORA_LOW_DATA_RATE_OPTIMIZE_OFF 0x00 // 7 0 LoRa low data rate optimization: disabled
-
300 #define RADIOLIB_SX126X_LORA_LOW_DATA_RATE_OPTIMIZE_ON 0x01 // 7 0 enabled
-
301 
-
302 //RADIOLIB_SX126X_CMD_SET_PACKET_PARAMS
-
303 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_OFF 0x00 // 7 0 GFSK minimum preamble length before reception starts: detector disabled
-
304 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_8 0x04 // 7 0 8 bits
-
305 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16 0x05 // 7 0 16 bits
-
306 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_24 0x06 // 7 0 24 bits
-
307 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_32 0x07 // 7 0 32 bits
-
308 #define RADIOLIB_SX126X_GFSK_ADDRESS_FILT_OFF 0x00 // 7 0 GFSK address filtering: disabled
-
309 #define RADIOLIB_SX126X_GFSK_ADDRESS_FILT_NODE 0x01 // 7 0 node only
-
310 #define RADIOLIB_SX126X_GFSK_ADDRESS_FILT_NODE_BROADCAST 0x02 // 7 0 node and broadcast
-
311 #define RADIOLIB_SX126X_GFSK_PACKET_FIXED 0x00 // 7 0 GFSK packet type: fixed (payload length known in advance to both sides)
-
312 #define RADIOLIB_SX126X_GFSK_PACKET_VARIABLE 0x01 // 7 0 variable (payload length added to packet)
-
313 #define RADIOLIB_SX126X_GFSK_CRC_OFF 0x01 // 7 0 GFSK packet CRC: disabled
-
314 #define RADIOLIB_SX126X_GFSK_CRC_1_BYTE 0x00 // 7 0 1 byte
-
315 #define RADIOLIB_SX126X_GFSK_CRC_2_BYTE 0x02 // 7 0 2 byte
-
316 #define RADIOLIB_SX126X_GFSK_CRC_1_BYTE_INV 0x04 // 7 0 1 byte, inverted
-
317 #define RADIOLIB_SX126X_GFSK_CRC_2_BYTE_INV 0x06 // 7 0 2 byte, inverted
-
318 #define RADIOLIB_SX126X_GFSK_WHITENING_OFF 0x00 // 7 0 GFSK data whitening: disabled
-
319 #define RADIOLIB_SX126X_GFSK_WHITENING_ON 0x01 // 7 0 enabled
-
320 #define RADIOLIB_SX126X_LORA_HEADER_EXPLICIT 0x00 // 7 0 LoRa header mode: explicit
-
321 #define RADIOLIB_SX126X_LORA_HEADER_IMPLICIT 0x01 // 7 0 implicit
-
322 #define RADIOLIB_SX126X_LORA_CRC_OFF 0x00 // 7 0 LoRa CRC mode: disabled
-
323 #define RADIOLIB_SX126X_LORA_CRC_ON 0x01 // 7 0 enabled
-
324 #define RADIOLIB_SX126X_LORA_IQ_STANDARD 0x00 // 7 0 LoRa IQ setup: standard
-
325 #define RADIOLIB_SX126X_LORA_IQ_INVERTED 0x01 // 7 0 inverted
-
326 
-
327 //RADIOLIB_SX126X_CMD_SET_CAD_PARAMS
-
328 #define RADIOLIB_SX126X_CAD_ON_1_SYMB 0x00 // 7 0 number of symbols used for CAD: 1
-
329 #define RADIOLIB_SX126X_CAD_ON_2_SYMB 0x01 // 7 0 2
-
330 #define RADIOLIB_SX126X_CAD_ON_4_SYMB 0x02 // 7 0 4
-
331 #define RADIOLIB_SX126X_CAD_ON_8_SYMB 0x03 // 7 0 8
-
332 #define RADIOLIB_SX126X_CAD_ON_16_SYMB 0x04 // 7 0 16
-
333 #define RADIOLIB_SX126X_CAD_GOTO_STDBY 0x00 // 7 0 after CAD is done, always go to STDBY_RC mode
-
334 #define RADIOLIB_SX126X_CAD_GOTO_RX 0x01 // 7 0 after CAD is done, go to Rx mode if activity is detected
-
335 #define RADIOLIB_SX126X_CAD_PARAM_DEFAULT 0xFF // 7 0 used by the CAD methods to specify default parameter value
-
336 #define RADIOLIB_SX126X_CAD_PARAM_DET_MIN 10 // 7 0 default detMin CAD parameter
-
337 
-
338 //RADIOLIB_SX126X_CMD_GET_STATUS
-
339 #define RADIOLIB_SX126X_STATUS_MODE_STDBY_RC 0b00100000 // 6 4 current chip mode: STDBY_RC
-
340 #define RADIOLIB_SX126X_STATUS_MODE_STDBY_XOSC 0b00110000 // 6 4 STDBY_XOSC
-
341 #define RADIOLIB_SX126X_STATUS_MODE_FS 0b01000000 // 6 4 FS
-
342 #define RADIOLIB_SX126X_STATUS_MODE_RX 0b01010000 // 6 4 RX
-
343 #define RADIOLIB_SX126X_STATUS_MODE_TX 0b01100000 // 6 4 TX
-
344 #define RADIOLIB_SX126X_STATUS_DATA_AVAILABLE 0b00000100 // 3 1 command status: packet received and data can be retrieved
-
345 #define RADIOLIB_SX126X_STATUS_CMD_TIMEOUT 0b00000110 // 3 1 SPI command timed out
-
346 #define RADIOLIB_SX126X_STATUS_CMD_INVALID 0b00001000 // 3 1 invalid SPI command
-
347 #define RADIOLIB_SX126X_STATUS_CMD_FAILED 0b00001010 // 3 1 SPI command failed to execute
-
348 #define RADIOLIB_SX126X_STATUS_TX_DONE 0b00001100 // 3 1 packet transmission done
-
349 #define RADIOLIB_SX126X_STATUS_SPI_FAILED 0b11111111 // 7 0 SPI transaction failed
-
350 
-
351 //RADIOLIB_SX126X_CMD_GET_PACKET_STATUS
-
352 #define RADIOLIB_SX126X_GFSK_RX_STATUS_PREAMBLE_ERR 0b10000000 // 7 7 GFSK Rx status: preamble error
-
353 #define RADIOLIB_SX126X_GFSK_RX_STATUS_SYNC_ERR 0b01000000 // 6 6 sync word error
-
354 #define RADIOLIB_SX126X_GFSK_RX_STATUS_ADRS_ERR 0b00100000 // 5 5 address error
-
355 #define RADIOLIB_SX126X_GFSK_RX_STATUS_CRC_ERR 0b00010000 // 4 4 CRC error
-
356 #define RADIOLIB_SX126X_GFSK_RX_STATUS_LENGTH_ERR 0b00001000 // 3 3 length error
-
357 #define RADIOLIB_SX126X_GFSK_RX_STATUS_ABORT_ERR 0b00000100 // 2 2 abort error
-
358 #define RADIOLIB_SX126X_GFSK_RX_STATUS_PACKET_RECEIVED 0b00000010 // 2 2 packet received
-
359 #define RADIOLIB_SX126X_GFSK_RX_STATUS_PACKET_SENT 0b00000001 // 2 2 packet sent
-
360 
-
361 //RADIOLIB_SX126X_CMD_GET_DEVICE_ERRORS
-
362 #define RADIOLIB_SX126X_PA_RAMP_ERR 0b100000000 // 8 8 device errors: PA ramping failed
-
363 #define RADIOLIB_SX126X_PLL_LOCK_ERR 0b001000000 // 6 6 PLL failed to lock
-
364 #define RADIOLIB_SX126X_XOSC_START_ERR 0b000100000 // 5 5 crystal oscillator failed to start
-
365 #define RADIOLIB_SX126X_IMG_CALIB_ERR 0b000010000 // 4 4 image calibration failed
-
366 #define RADIOLIB_SX126X_ADC_CALIB_ERR 0b000001000 // 3 3 ADC calibration failed
-
367 #define RADIOLIB_SX126X_PLL_CALIB_ERR 0b000000100 // 2 2 PLL calibration failed
-
368 #define RADIOLIB_SX126X_RC13M_CALIB_ERR 0b000000010 // 1 1 RC13M calibration failed
-
369 #define RADIOLIB_SX126X_RC64K_CALIB_ERR 0b000000001 // 0 0 RC64K calibration failed
-
370 
-
371 //RADIOLIB_SX126X_CMD_SET_LBT_SCAN_PARAMS + RADIOLIB_SX126X_CMD_SET_SPECTR_SCAN_PARAMS
-
372 #define RADIOLIB_SX126X_SCAN_INTERVAL_7_68_US 10 // 7 0 RSSI reading interval: 7.68 us
-
373 #define RADIOLIB_SX126X_SCAN_INTERVAL_8_20_US 11 // 7 0 8.20 us
-
374 #define RADIOLIB_SX126X_SCAN_INTERVAL_8_68_US 12 // 7 0 8.68 us
-
375 
-
376 // SX126X SPI register variables
-
377 //RADIOLIB_SX126X_REG_HOPPING_ENABLE
-
378 #define RADIOLIB_SX126X_HOPPING_ENABLED 0b00000001 // 0 0 intra-packet hopping for LR-FHSS: enabled
-
379 #define RADIOLIB_SX126X_HOPPING_DISABLED 0b00000000 // 0 0 (disabled)
+
191 //RADIOLIB_SX126X_CMD_SET_PA_CONFIG
+
192 #define RADIOLIB_SX126X_PA_CONFIG_HP_MAX 0x07
+
193 #define RADIOLIB_SX126X_PA_CONFIG_PA_LUT 0x01
+
194 #define RADIOLIB_SX126X_PA_CONFIG_SX1262_8 0x00
+
195 
+
196 //RADIOLIB_SX126X_CMD_SET_RX_TX_FALLBACK_MODE
+
197 #define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_FS 0x40 // 7 0 after Rx/Tx go to: FS mode
+
198 #define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_XOSC 0x30 // 7 0 standby with crystal oscillator
+
199 #define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_RC 0x20 // 7 0 standby with RC oscillator (default)
+
200 
+
201 //RADIOLIB_SX126X_CMD_SET_DIO_IRQ_PARAMS
+
202 #define RADIOLIB_SX126X_IRQ_LR_FHSS_HOP 0b0100000000000000 // 14 14 PA ramped up during LR-FHSS hop
+
203 #define RADIOLIB_SX126X_IRQ_TIMEOUT 0b0000001000000000 // 9 9 Rx or Tx timeout
+
204 #define RADIOLIB_SX126X_IRQ_CAD_DETECTED 0b0000000100000000 // 8 8 channel activity detected
+
205 #define RADIOLIB_SX126X_IRQ_CAD_DONE 0b0000000010000000 // 7 7 channel activity detection finished
+
206 #define RADIOLIB_SX126X_IRQ_CRC_ERR 0b0000000001000000 // 6 6 wrong CRC received
+
207 #define RADIOLIB_SX126X_IRQ_HEADER_ERR 0b0000000000100000 // 5 5 LoRa header CRC error
+
208 #define RADIOLIB_SX126X_IRQ_HEADER_VALID 0b0000000000010000 // 4 4 valid LoRa header received
+
209 #define RADIOLIB_SX126X_IRQ_SYNC_WORD_VALID 0b0000000000001000 // 3 3 valid sync word detected
+
210 #define RADIOLIB_SX126X_IRQ_PREAMBLE_DETECTED 0b0000000000000100 // 2 2 preamble detected
+
211 #define RADIOLIB_SX126X_IRQ_RX_DONE 0b0000000000000010 // 1 1 packet received
+
212 #define RADIOLIB_SX126X_IRQ_TX_DONE 0b0000000000000001 // 0 0 packet transmission completed
+
213 #define RADIOLIB_SX126X_IRQ_RX_DEFAULT 0b0000001001100010 // 14 0 default for Rx (RX_DONE, TIMEOUT, CRC_ERR and HEADER_ERR)
+
214 #define RADIOLIB_SX126X_IRQ_ALL 0b0100001111111111 // 14 0 all interrupts
+
215 #define RADIOLIB_SX126X_IRQ_NONE 0b0000000000000000 // 14 0 no interrupts
+
216 
+
217 //RADIOLIB_SX126X_CMD_SET_DIO2_AS_RF_SWITCH_CTRL
+
218 #define RADIOLIB_SX126X_DIO2_AS_IRQ 0x00 // 7 0 DIO2 configuration: IRQ
+
219 #define RADIOLIB_SX126X_DIO2_AS_RF_SWITCH 0x01 // 7 0 RF switch control
+
220 
+
221 //RADIOLIB_SX126X_CMD_SET_DIO3_AS_TCXO_CTRL
+
222 #define RADIOLIB_SX126X_DIO3_OUTPUT_1_6 0x00 // 7 0 DIO3 voltage output for TCXO: 1.6 V
+
223 #define RADIOLIB_SX126X_DIO3_OUTPUT_1_7 0x01 // 7 0 1.7 V
+
224 #define RADIOLIB_SX126X_DIO3_OUTPUT_1_8 0x02 // 7 0 1.8 V
+
225 #define RADIOLIB_SX126X_DIO3_OUTPUT_2_2 0x03 // 7 0 2.2 V
+
226 #define RADIOLIB_SX126X_DIO3_OUTPUT_2_4 0x04 // 7 0 2.4 V
+
227 #define RADIOLIB_SX126X_DIO3_OUTPUT_2_7 0x05 // 7 0 2.7 V
+
228 #define RADIOLIB_SX126X_DIO3_OUTPUT_3_0 0x06 // 7 0 3.0 V
+
229 #define RADIOLIB_SX126X_DIO3_OUTPUT_3_3 0x07 // 7 0 3.3 V
+
230 
+
231 //RADIOLIB_SX126X_CMD_SET_PACKET_TYPE
+
232 #define RADIOLIB_SX126X_PACKET_TYPE_GFSK 0x00 // 7 0 packet type: GFSK
+
233 #define RADIOLIB_SX126X_PACKET_TYPE_LORA 0x01 // 7 0 LoRa
+
234 #define RADIOLIB_SX126X_PACKET_TYPE_LR_FHSS 0x03 // 7 0 LR-FHSS
+
235 
+
236 //RADIOLIB_SX126X_CMD_SET_TX_PARAMS
+
237 #define RADIOLIB_SX126X_PA_RAMP_10U 0x00 // 7 0 ramp time: 10 us
+
238 #define RADIOLIB_SX126X_PA_RAMP_20U 0x01 // 7 0 20 us
+
239 #define RADIOLIB_SX126X_PA_RAMP_40U 0x02 // 7 0 40 us
+
240 #define RADIOLIB_SX126X_PA_RAMP_80U 0x03 // 7 0 80 us
+
241 #define RADIOLIB_SX126X_PA_RAMP_200U 0x04 // 7 0 200 us
+
242 #define RADIOLIB_SX126X_PA_RAMP_800U 0x05 // 7 0 800 us
+
243 #define RADIOLIB_SX126X_PA_RAMP_1700U 0x06 // 7 0 1700 us
+
244 #define RADIOLIB_SX126X_PA_RAMP_3400U 0x07 // 7 0 3400 us
+
245 
+
246 //RADIOLIB_SX126X_CMD_SET_MODULATION_PARAMS
+
247 #define RADIOLIB_SX126X_GFSK_FILTER_NONE 0x00 // 7 0 GFSK filter: none
+
248 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_0_3 0x08 // 7 0 Gaussian, BT = 0.3
+
249 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_0_5 0x09 // 7 0 Gaussian, BT = 0.5
+
250 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_0_7 0x0A // 7 0 Gaussian, BT = 0.7
+
251 #define RADIOLIB_SX126X_GFSK_FILTER_GAUSS_1 0x0B // 7 0 Gaussian, BT = 1
+
252 #define RADIOLIB_SX126X_GFSK_RX_BW_4_8 0x1F // 7 0 GFSK Rx bandwidth: 4.8 kHz
+
253 #define RADIOLIB_SX126X_GFSK_RX_BW_5_8 0x17 // 7 0 5.8 kHz
+
254 #define RADIOLIB_SX126X_GFSK_RX_BW_7_3 0x0F // 7 0 7.3 kHz
+
255 #define RADIOLIB_SX126X_GFSK_RX_BW_9_7 0x1E // 7 0 9.7 kHz
+
256 #define RADIOLIB_SX126X_GFSK_RX_BW_11_7 0x16 // 7 0 11.7 kHz
+
257 #define RADIOLIB_SX126X_GFSK_RX_BW_14_6 0x0E // 7 0 14.6 kHz
+
258 #define RADIOLIB_SX126X_GFSK_RX_BW_19_5 0x1D // 7 0 19.5 kHz
+
259 #define RADIOLIB_SX126X_GFSK_RX_BW_23_4 0x15 // 7 0 23.4 kHz
+
260 #define RADIOLIB_SX126X_GFSK_RX_BW_29_3 0x0D // 7 0 29.3 kHz
+
261 #define RADIOLIB_SX126X_GFSK_RX_BW_39_0 0x1C // 7 0 39.0 kHz
+
262 #define RADIOLIB_SX126X_GFSK_RX_BW_46_9 0x14 // 7 0 46.9 kHz
+
263 #define RADIOLIB_SX126X_GFSK_RX_BW_58_6 0x0C // 7 0 58.6 kHz
+
264 #define RADIOLIB_SX126X_GFSK_RX_BW_78_2 0x1B // 7 0 78.2 kHz
+
265 #define RADIOLIB_SX126X_GFSK_RX_BW_93_8 0x13 // 7 0 93.8 kHz
+
266 #define RADIOLIB_SX126X_GFSK_RX_BW_117_3 0x0B // 7 0 117.3 kHz
+
267 #define RADIOLIB_SX126X_GFSK_RX_BW_156_2 0x1A // 7 0 156.2 kHz
+
268 #define RADIOLIB_SX126X_GFSK_RX_BW_187_2 0x12 // 7 0 187.2 kHz
+
269 #define RADIOLIB_SX126X_GFSK_RX_BW_234_3 0x0A // 7 0 234.3 kHz
+
270 #define RADIOLIB_SX126X_GFSK_RX_BW_312_0 0x19 // 7 0 312.0 kHz
+
271 #define RADIOLIB_SX126X_GFSK_RX_BW_373_6 0x11 // 7 0 373.6 kHz
+
272 #define RADIOLIB_SX126X_GFSK_RX_BW_467_0 0x09 // 7 0 467.0 kHz
+
273 #define RADIOLIB_SX126X_LORA_BW_7_8 0x00 // 7 0 LoRa bandwidth: 7.8 kHz
+
274 #define RADIOLIB_SX126X_LORA_BW_10_4 0x08 // 7 0 10.4 kHz
+
275 #define RADIOLIB_SX126X_LORA_BW_15_6 0x01 // 7 0 15.6 kHz
+
276 #define RADIOLIB_SX126X_LORA_BW_20_8 0x09 // 7 0 20.8 kHz
+
277 #define RADIOLIB_SX126X_LORA_BW_31_25 0x02 // 7 0 31.25 kHz
+
278 #define RADIOLIB_SX126X_LORA_BW_41_7 0x0A // 7 0 41.7 kHz
+
279 #define RADIOLIB_SX126X_LORA_BW_62_5 0x03 // 7 0 62.5 kHz
+
280 #define RADIOLIB_SX126X_LORA_BW_125_0 0x04 // 7 0 125.0 kHz
+
281 #define RADIOLIB_SX126X_LORA_BW_250_0 0x05 // 7 0 250.0 kHz
+
282 #define RADIOLIB_SX126X_LORA_BW_500_0 0x06 // 7 0 500.0 kHz
+
283 #define RADIOLIB_SX126X_LORA_CR_4_5 0x01 // 7 0 LoRa coding rate: 4/5
+
284 #define RADIOLIB_SX126X_LORA_CR_4_6 0x02 // 7 0 4/6
+
285 #define RADIOLIB_SX126X_LORA_CR_4_7 0x03 // 7 0 4/7
+
286 #define RADIOLIB_SX126X_LORA_CR_4_8 0x04 // 7 0 4/8
+
287 #define RADIOLIB_SX126X_LORA_LOW_DATA_RATE_OPTIMIZE_OFF 0x00 // 7 0 LoRa low data rate optimization: disabled
+
288 #define RADIOLIB_SX126X_LORA_LOW_DATA_RATE_OPTIMIZE_ON 0x01 // 7 0 enabled
+
289 
+
290 //RADIOLIB_SX126X_CMD_SET_PACKET_PARAMS
+
291 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_OFF 0x00 // 7 0 GFSK minimum preamble length before reception starts: detector disabled
+
292 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_8 0x04 // 7 0 8 bits
+
293 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16 0x05 // 7 0 16 bits
+
294 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_24 0x06 // 7 0 24 bits
+
295 #define RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_32 0x07 // 7 0 32 bits
+
296 #define RADIOLIB_SX126X_GFSK_ADDRESS_FILT_OFF 0x00 // 7 0 GFSK address filtering: disabled
+
297 #define RADIOLIB_SX126X_GFSK_ADDRESS_FILT_NODE 0x01 // 7 0 node only
+
298 #define RADIOLIB_SX126X_GFSK_ADDRESS_FILT_NODE_BROADCAST 0x02 // 7 0 node and broadcast
+
299 #define RADIOLIB_SX126X_GFSK_PACKET_FIXED 0x00 // 7 0 GFSK packet type: fixed (payload length known in advance to both sides)
+
300 #define RADIOLIB_SX126X_GFSK_PACKET_VARIABLE 0x01 // 7 0 variable (payload length added to packet)
+
301 #define RADIOLIB_SX126X_GFSK_CRC_OFF 0x01 // 7 0 GFSK packet CRC: disabled
+
302 #define RADIOLIB_SX126X_GFSK_CRC_1_BYTE 0x00 // 7 0 1 byte
+
303 #define RADIOLIB_SX126X_GFSK_CRC_2_BYTE 0x02 // 7 0 2 byte
+
304 #define RADIOLIB_SX126X_GFSK_CRC_1_BYTE_INV 0x04 // 7 0 1 byte, inverted
+
305 #define RADIOLIB_SX126X_GFSK_CRC_2_BYTE_INV 0x06 // 7 0 2 byte, inverted
+
306 #define RADIOLIB_SX126X_GFSK_WHITENING_OFF 0x00 // 7 0 GFSK data whitening: disabled
+
307 #define RADIOLIB_SX126X_GFSK_WHITENING_ON 0x01 // 7 0 enabled
+
308 #define RADIOLIB_SX126X_LORA_HEADER_EXPLICIT 0x00 // 7 0 LoRa header mode: explicit
+
309 #define RADIOLIB_SX126X_LORA_HEADER_IMPLICIT 0x01 // 7 0 implicit
+
310 #define RADIOLIB_SX126X_LORA_CRC_OFF 0x00 // 7 0 LoRa CRC mode: disabled
+
311 #define RADIOLIB_SX126X_LORA_CRC_ON 0x01 // 7 0 enabled
+
312 #define RADIOLIB_SX126X_LORA_IQ_STANDARD 0x00 // 7 0 LoRa IQ setup: standard
+
313 #define RADIOLIB_SX126X_LORA_IQ_INVERTED 0x01 // 7 0 inverted
+
314 
+
315 //RADIOLIB_SX126X_CMD_SET_CAD_PARAMS
+
316 #define RADIOLIB_SX126X_CAD_ON_1_SYMB 0x00 // 7 0 number of symbols used for CAD: 1
+
317 #define RADIOLIB_SX126X_CAD_ON_2_SYMB 0x01 // 7 0 2
+
318 #define RADIOLIB_SX126X_CAD_ON_4_SYMB 0x02 // 7 0 4
+
319 #define RADIOLIB_SX126X_CAD_ON_8_SYMB 0x03 // 7 0 8
+
320 #define RADIOLIB_SX126X_CAD_ON_16_SYMB 0x04 // 7 0 16
+
321 #define RADIOLIB_SX126X_CAD_GOTO_STDBY 0x00 // 7 0 after CAD is done, always go to STDBY_RC mode
+
322 #define RADIOLIB_SX126X_CAD_GOTO_RX 0x01 // 7 0 after CAD is done, go to Rx mode if activity is detected
+
323 #define RADIOLIB_SX126X_CAD_PARAM_DEFAULT 0xFF // 7 0 used by the CAD methods to specify default parameter value
+
324 #define RADIOLIB_SX126X_CAD_PARAM_DET_MIN 10 // 7 0 default detMin CAD parameter
+
325 
+
326 //RADIOLIB_SX126X_CMD_GET_STATUS
+
327 #define RADIOLIB_SX126X_STATUS_MODE_STDBY_RC 0b00100000 // 6 4 current chip mode: STDBY_RC
+
328 #define RADIOLIB_SX126X_STATUS_MODE_STDBY_XOSC 0b00110000 // 6 4 STDBY_XOSC
+
329 #define RADIOLIB_SX126X_STATUS_MODE_FS 0b01000000 // 6 4 FS
+
330 #define RADIOLIB_SX126X_STATUS_MODE_RX 0b01010000 // 6 4 RX
+
331 #define RADIOLIB_SX126X_STATUS_MODE_TX 0b01100000 // 6 4 TX
+
332 #define RADIOLIB_SX126X_STATUS_DATA_AVAILABLE 0b00000100 // 3 1 command status: packet received and data can be retrieved
+
333 #define RADIOLIB_SX126X_STATUS_CMD_TIMEOUT 0b00000110 // 3 1 SPI command timed out
+
334 #define RADIOLIB_SX126X_STATUS_CMD_INVALID 0b00001000 // 3 1 invalid SPI command
+
335 #define RADIOLIB_SX126X_STATUS_CMD_FAILED 0b00001010 // 3 1 SPI command failed to execute
+
336 #define RADIOLIB_SX126X_STATUS_TX_DONE 0b00001100 // 3 1 packet transmission done
+
337 #define RADIOLIB_SX126X_STATUS_SPI_FAILED 0b11111111 // 7 0 SPI transaction failed
+
338 
+
339 //RADIOLIB_SX126X_CMD_GET_PACKET_STATUS
+
340 #define RADIOLIB_SX126X_GFSK_RX_STATUS_PREAMBLE_ERR 0b10000000 // 7 7 GFSK Rx status: preamble error
+
341 #define RADIOLIB_SX126X_GFSK_RX_STATUS_SYNC_ERR 0b01000000 // 6 6 sync word error
+
342 #define RADIOLIB_SX126X_GFSK_RX_STATUS_ADRS_ERR 0b00100000 // 5 5 address error
+
343 #define RADIOLIB_SX126X_GFSK_RX_STATUS_CRC_ERR 0b00010000 // 4 4 CRC error
+
344 #define RADIOLIB_SX126X_GFSK_RX_STATUS_LENGTH_ERR 0b00001000 // 3 3 length error
+
345 #define RADIOLIB_SX126X_GFSK_RX_STATUS_ABORT_ERR 0b00000100 // 2 2 abort error
+
346 #define RADIOLIB_SX126X_GFSK_RX_STATUS_PACKET_RECEIVED 0b00000010 // 2 2 packet received
+
347 #define RADIOLIB_SX126X_GFSK_RX_STATUS_PACKET_SENT 0b00000001 // 2 2 packet sent
+
348 
+
349 //RADIOLIB_SX126X_CMD_GET_DEVICE_ERRORS
+
350 #define RADIOLIB_SX126X_PA_RAMP_ERR 0b100000000 // 8 8 device errors: PA ramping failed
+
351 #define RADIOLIB_SX126X_PLL_LOCK_ERR 0b001000000 // 6 6 PLL failed to lock
+
352 #define RADIOLIB_SX126X_XOSC_START_ERR 0b000100000 // 5 5 crystal oscillator failed to start
+
353 #define RADIOLIB_SX126X_IMG_CALIB_ERR 0b000010000 // 4 4 image calibration failed
+
354 #define RADIOLIB_SX126X_ADC_CALIB_ERR 0b000001000 // 3 3 ADC calibration failed
+
355 #define RADIOLIB_SX126X_PLL_CALIB_ERR 0b000000100 // 2 2 PLL calibration failed
+
356 #define RADIOLIB_SX126X_RC13M_CALIB_ERR 0b000000010 // 1 1 RC13M calibration failed
+
357 #define RADIOLIB_SX126X_RC64K_CALIB_ERR 0b000000001 // 0 0 RC64K calibration failed
+
358 
+
359 //RADIOLIB_SX126X_CMD_SET_LBT_SCAN_PARAMS + RADIOLIB_SX126X_CMD_SET_SPECTR_SCAN_PARAMS
+
360 #define RADIOLIB_SX126X_SCAN_INTERVAL_7_68_US 10 // 7 0 RSSI reading interval: 7.68 us
+
361 #define RADIOLIB_SX126X_SCAN_INTERVAL_8_20_US 11 // 7 0 8.20 us
+
362 #define RADIOLIB_SX126X_SCAN_INTERVAL_8_68_US 12 // 7 0 8.68 us
+
363 
+
364 // SX126X SPI register variables
+
365 //RADIOLIB_SX126X_REG_HOPPING_ENABLE
+
366 #define RADIOLIB_SX126X_HOPPING_ENABLED 0b00000001 // 0 0 intra-packet hopping for LR-FHSS: enabled
+
367 #define RADIOLIB_SX126X_HOPPING_DISABLED 0b00000000 // 0 0 (disabled)
+
368 
+
369 //RADIOLIB_SX126X_REG_LORA_SYNC_WORD_MSB + LSB
+
370 #define RADIOLIB_SX126X_SYNC_WORD_PUBLIC 0x34 // actually 0x3444 NOTE: The low nibbles in each byte (0x_4_4) are masked out since apparently, they're reserved.
+
371 #define RADIOLIB_SX126X_SYNC_WORD_PRIVATE 0x12 // actually 0x1424 You couldn't make this up if you tried.
+
372 
+
373 // RADIOLIB_SX126X_REG_TX_BITBANG_ENABLE_1
+
374 #define RADIOLIB_SX126X_TX_BITBANG_1_DISABLED 0b00000000 // 6 4 Tx bitbang: disabled (default)
+
375 #define RADIOLIB_SX126X_TX_BITBANG_1_ENABLED 0b00010000 // 6 4 enabled
+
376 
+
377 // RADIOLIB_SX126X_REG_TX_BITBANG_ENABLE_0
+
378 #define RADIOLIB_SX126X_TX_BITBANG_0_DISABLED 0b00000000 // 3 0 Tx bitbang: disabled (default)
+
379 #define RADIOLIB_SX126X_TX_BITBANG_0_ENABLED 0b00001100 // 3 0 enabled
380 
-
381 //RADIOLIB_SX126X_REG_LORA_SYNC_WORD_MSB + LSB
-
382 #define RADIOLIB_SX126X_SYNC_WORD_PUBLIC 0x34 // actually 0x3444 NOTE: The low nibbles in each byte (0x_4_4) are masked out since apparently, they're reserved.
-
383 #define RADIOLIB_SX126X_SYNC_WORD_PRIVATE 0x12 // actually 0x1424 You couldn't make this up if you tried.
-
384 
-
385 // RADIOLIB_SX126X_REG_TX_BITBANG_ENABLE_1
-
386 #define RADIOLIB_SX126X_TX_BITBANG_1_DISABLED 0b00000000 // 6 4 Tx bitbang: disabled (default)
-
387 #define RADIOLIB_SX126X_TX_BITBANG_1_ENABLED 0b00010000 // 6 4 enabled
+
381 // RADIOLIB_SX126X_REG_DIOX_OUT_ENABLE
+
382 #define RADIOLIB_SX126X_DIO1_OUT_DISABLED 0b00000010 // 1 1 DIO1 output: disabled
+
383 #define RADIOLIB_SX126X_DIO1_OUT_ENABLED 0b00000000 // 1 1 enabled
+
384 #define RADIOLIB_SX126X_DIO2_OUT_DISABLED 0b00000100 // 2 2 DIO2 output: disabled
+
385 #define RADIOLIB_SX126X_DIO2_OUT_ENABLED 0b00000000 // 2 2 enabled
+
386 #define RADIOLIB_SX126X_DIO3_OUT_DISABLED 0b00001000 // 3 3 DIO3 output: disabled
+
387 #define RADIOLIB_SX126X_DIO3_OUT_ENABLED 0b00000000 // 3 3 enabled
388 
-
389 // RADIOLIB_SX126X_REG_TX_BITBANG_ENABLE_0
-
390 #define RADIOLIB_SX126X_TX_BITBANG_0_DISABLED 0b00000000 // 3 0 Tx bitbang: disabled (default)
-
391 #define RADIOLIB_SX126X_TX_BITBANG_0_ENABLED 0b00001100 // 3 0 enabled
-
392 
-
393 // RADIOLIB_SX126X_REG_DIOX_OUT_ENABLE
-
394 #define RADIOLIB_SX126X_DIO1_OUT_DISABLED 0b00000010 // 1 1 DIO1 output: disabled
-
395 #define RADIOLIB_SX126X_DIO1_OUT_ENABLED 0b00000000 // 1 1 enabled
-
396 #define RADIOLIB_SX126X_DIO2_OUT_DISABLED 0b00000100 // 2 2 DIO2 output: disabled
-
397 #define RADIOLIB_SX126X_DIO2_OUT_ENABLED 0b00000000 // 2 2 enabled
-
398 #define RADIOLIB_SX126X_DIO3_OUT_DISABLED 0b00001000 // 3 3 DIO3 output: disabled
-
399 #define RADIOLIB_SX126X_DIO3_OUT_ENABLED 0b00000000 // 3 3 enabled
-
400 
-
401 // RADIOLIB_SX126X_REG_DIOX_IN_ENABLE
-
402 #define RADIOLIB_SX126X_DIO1_IN_DISABLED 0b00000000 // 1 1 DIO1 input: disabled
-
403 #define RADIOLIB_SX126X_DIO1_IN_ENABLED 0b00000010 // 1 1 enabled
-
404 #define RADIOLIB_SX126X_DIO2_IN_DISABLED 0b00000000 // 2 2 DIO2 input: disabled
-
405 #define RADIOLIB_SX126X_DIO2_IN_ENABLED 0b00000100 // 2 2 enabled
-
406 #define RADIOLIB_SX126X_DIO3_IN_DISABLED 0b00000000 // 3 3 DIO3 input: disabled
-
407 #define RADIOLIB_SX126X_DIO3_IN_ENABLED 0b00001000 // 3 3 enabled
-
408 
-
409 // RADIOLIB_SX126X_REG_RX_GAIN
-
410 #define RADIOLIB_SX126X_RX_GAIN_BOOSTED 0x96 // 7 0 Rx gain: boosted
-
411 #define RADIOLIB_SX126X_RX_GAIN_POWER_SAVING 0x94 // 7 0 power saving
-
412 #define RADIOLIB_SX126X_RX_GAIN_SPECTRAL_SCAN 0xCB // 7 0 spectral scan
-
413 
-
414 // RADIOLIB_SX126X_REG_PATCH_UPDATE_ENABLE
-
415 #define RADIOLIB_SX126X_PATCH_UPDATE_DISABLED 0b00000000 // 4 4 patch update: disabled
-
416 #define RADIOLIB_SX126X_PATCH_UPDATE_ENABLED 0b00010000 // 4 4 enabled
-
417 
-
418 // RADIOLIB_SX126X_REG_SPECTRAL_SCAN_STATUS
-
419 #define RADIOLIB_SX126X_SPECTRAL_SCAN_NONE 0x00 // 7 0 spectral scan status: none
-
420 #define RADIOLIB_SX126X_SPECTRAL_SCAN_ONGOING 0x0F // 7 0 ongoing
-
421 #define RADIOLIB_SX126X_SPECTRAL_SCAN_ABORTED 0xF0 // 7 0 aborted
-
422 #define RADIOLIB_SX126X_SPECTRAL_SCAN_COMPLETED 0xFF // 7 0 completed
-
423 
-
424 // RADIOLIB_SX126X_REG_RSSI_AVG_WINDOW
-
425 #define RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT (0x05 << 2) // 7 0 default RSSI average window
-
426 
-
427 // RADIOLIB_SX126X_REG_ANA_LNA
-
428 #define RADIOLIB_SX126X_LNA_RNG_DISABLED 0b00000001 // 0 0 random number: disabled
-
429 #define RADIOLIB_SX126X_LNA_RNG_ENABLED 0b00000000 // 0 0 enabled
-
430 
-
431 // RADIOLIB_SX126X_REG_ANA_MIXER
-
432 #define RADIOLIB_SX126X_MIXER_RNG_DISABLED 0b00000001 // 7 7 random number: disabled
-
433 #define RADIOLIB_SX126X_MIXER_RNG_ENABLED 0b00000000 // 7 7 enabled
-
434 
-
435 // size of the spectral scan result
-
436 #define RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE (33)
-
437 
-
443 class SX126x: public PhysicalLayer {
-
444  public:
-
445  // introduce PhysicalLayer overloads
-
446  using PhysicalLayer::transmit;
-
447  using PhysicalLayer::receive;
-
448  using PhysicalLayer::startTransmit;
-
449  using PhysicalLayer::readData;
-
450 
-
455  SX126x(Module* mod);
-
456 
-
457  Module* getMod();
-
458 
-
462  bool XTAL;
-
463 
-
464  // basic methods
-
465 
-
475  int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false);
-
476 
-
488  int16_t beginFSK(float br, float freqDev, float rxBw, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false);
-
489 
-
496  int16_t reset(bool verify = true);
-
497 
-
506  int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
-
507 
-
515  int16_t receive(uint8_t* data, size_t len) override;
-
516 
-
522  int16_t transmitDirect(uint32_t frf = 0) override;
-
523 
-
529  int16_t receiveDirect() override;
-
530 
-
535  int16_t scanChannel() override;
-
536 
-
544  int16_t scanChannel(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
-
545 
-
552  int16_t sleep(bool retainConfig = true);
-
553 
-
558  int16_t standby() override;
-
559 
-
567  int16_t standby(uint8_t mode, bool wakeup = true);
-
568 
-
569  // interrupt methods
-
570 
-
575  void setDio1Action(void (*func)(void));
-
576 
-
580  void clearDio1Action();
-
581 
-
586  void setPacketReceivedAction(void (*func)(void));
-
587 
-
591  void clearPacketReceivedAction();
-
592 
-
597  void setPacketSentAction(void (*func)(void));
-
598 
-
602  void clearPacketSentAction();
-
603 
-
608  void setChannelScanAction(void (*func)(void));
-
609 
-
613  void clearChannelScanAction();
-
614 
-
623  int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
-
624 
-
629  int16_t finishTransmit() override;
-
630 
-
637  int16_t startReceive();
-
638 
-
654  int16_t startReceive(uint32_t timeout, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE, size_t len = 0);
+
389 // RADIOLIB_SX126X_REG_DIOX_IN_ENABLE
+
390 #define RADIOLIB_SX126X_DIO1_IN_DISABLED 0b00000000 // 1 1 DIO1 input: disabled
+
391 #define RADIOLIB_SX126X_DIO1_IN_ENABLED 0b00000010 // 1 1 enabled
+
392 #define RADIOLIB_SX126X_DIO2_IN_DISABLED 0b00000000 // 2 2 DIO2 input: disabled
+
393 #define RADIOLIB_SX126X_DIO2_IN_ENABLED 0b00000100 // 2 2 enabled
+
394 #define RADIOLIB_SX126X_DIO3_IN_DISABLED 0b00000000 // 3 3 DIO3 input: disabled
+
395 #define RADIOLIB_SX126X_DIO3_IN_ENABLED 0b00001000 // 3 3 enabled
+
396 
+
397 // RADIOLIB_SX126X_REG_RX_GAIN
+
398 #define RADIOLIB_SX126X_RX_GAIN_BOOSTED 0x96 // 7 0 Rx gain: boosted
+
399 #define RADIOLIB_SX126X_RX_GAIN_POWER_SAVING 0x94 // 7 0 power saving
+
400 #define RADIOLIB_SX126X_RX_GAIN_SPECTRAL_SCAN 0xCB // 7 0 spectral scan
+
401 
+
402 // RADIOLIB_SX126X_REG_PATCH_UPDATE_ENABLE
+
403 #define RADIOLIB_SX126X_PATCH_UPDATE_DISABLED 0b00000000 // 4 4 patch update: disabled
+
404 #define RADIOLIB_SX126X_PATCH_UPDATE_ENABLED 0b00010000 // 4 4 enabled
+
405 
+
406 // RADIOLIB_SX126X_REG_SPECTRAL_SCAN_STATUS
+
407 #define RADIOLIB_SX126X_SPECTRAL_SCAN_NONE 0x00 // 7 0 spectral scan status: none
+
408 #define RADIOLIB_SX126X_SPECTRAL_SCAN_ONGOING 0x0F // 7 0 ongoing
+
409 #define RADIOLIB_SX126X_SPECTRAL_SCAN_ABORTED 0xF0 // 7 0 aborted
+
410 #define RADIOLIB_SX126X_SPECTRAL_SCAN_COMPLETED 0xFF // 7 0 completed
+
411 
+
412 // RADIOLIB_SX126X_REG_RSSI_AVG_WINDOW
+
413 #define RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT (0x05 << 2) // 7 0 default RSSI average window
+
414 
+
415 // RADIOLIB_SX126X_REG_ANA_LNA
+
416 #define RADIOLIB_SX126X_LNA_RNG_DISABLED 0b00000001 // 0 0 random number: disabled
+
417 #define RADIOLIB_SX126X_LNA_RNG_ENABLED 0b00000000 // 0 0 enabled
+
418 
+
419 // RADIOLIB_SX126X_REG_ANA_MIXER
+
420 #define RADIOLIB_SX126X_MIXER_RNG_DISABLED 0b00000001 // 7 7 random number: disabled
+
421 #define RADIOLIB_SX126X_MIXER_RNG_ENABLED 0b00000000 // 7 7 enabled
+
422 
+
423 // size of the spectral scan result
+
424 #define RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE (33)
+
425 
+
431 class SX126x: public PhysicalLayer {
+
432  public:
+
433  // introduce PhysicalLayer overloads
+
434  using PhysicalLayer::transmit;
+
435  using PhysicalLayer::receive;
+
436  using PhysicalLayer::startTransmit;
+
437  using PhysicalLayer::readData;
+
438 
+
443  SX126x(Module* mod);
+
444 
+
445  Module* getMod();
+
446 
+
450  bool XTAL;
+
451 
+
452  // basic methods
+
453 
+
463  int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false);
+
464 
+
476  int16_t beginFSK(float br, float freqDev, float rxBw, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false);
+
477 
+
484  int16_t reset(bool verify = true);
+
485 
+
494  int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
+
495 
+
503  int16_t receive(uint8_t* data, size_t len) override;
+
504 
+
510  int16_t transmitDirect(uint32_t frf = 0) override;
+
511 
+
517  int16_t receiveDirect() override;
+
518 
+
523  int16_t scanChannel() override;
+
524 
+
532  int16_t scanChannel(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
+
533 
+
540  int16_t sleep(bool retainConfig = true);
+
541 
+
546  int16_t standby() override;
+
547 
+
555  int16_t standby(uint8_t mode, bool wakeup = true);
+
556 
+
557  // interrupt methods
+
558 
+
563  void setDio1Action(void (*func)(void));
+
564 
+
568  void clearDio1Action();
+
569 
+
574  void setPacketReceivedAction(void (*func)(void));
+
575 
+
579  void clearPacketReceivedAction();
+
580 
+
585  void setPacketSentAction(void (*func)(void));
+
586 
+
590  void clearPacketSentAction();
+
591 
+
596  void setChannelScanAction(void (*func)(void));
+
597 
+
601  void clearChannelScanAction();
+
602 
+
611  int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
+
612 
+
617  int16_t finishTransmit() override;
+
618 
+
625  int16_t startReceive();
+
626 
+
642  int16_t startReceive(uint32_t timeout, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE, size_t len = 0);
+
643 
+
654  int16_t startReceiveDutyCycle(uint32_t rxPeriod, uint32_t sleepPeriod, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
655 
-
666  int16_t startReceiveDutyCycle(uint32_t rxPeriod, uint32_t sleepPeriod, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
-
667 
-
682  int16_t startReceiveDutyCycleAuto(uint16_t senderPreambleLength = 0, uint16_t minSymbols = 8, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
-
683 
-
688  uint16_t getIrqStatus();
-
689 
-
698  int16_t readData(uint8_t* data, size_t len) override;
-
699 
-
705  int16_t startChannelScan() override;
-
706 
-
715  int16_t startChannelScan(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
-
716 
-
721  int16_t getChannelScanResult() override;
-
722 
-
723  // configuration methods
-
724 
-
730  int16_t setBandwidth(float bw);
-
731 
-
737  int16_t setSpreadingFactor(uint8_t sf);
-
738 
-
744  int16_t setCodingRate(uint8_t cr);
-
745 
-
752  int16_t setSyncWord(uint8_t syncWord, uint8_t controlBits = 0x44);
-
753 
-
759  int16_t setCurrentLimit(float currentLimit);
-
760 
-
765  float getCurrentLimit();
-
766 
-
772  int16_t setPreambleLength(size_t preambleLength) override;
-
773 
-
779  int16_t setFrequencyDeviation(float freqDev) override;
-
780 
-
786  int16_t setBitRate(float br);
-
787 
-
793  int16_t setDataRate(DataRate_t dr) override;
-
794 
-
801  int16_t setRxBandwidth(float rxBw);
-
802 
-
811  int16_t setRxBoostedGainMode(bool rxbgm, bool persist = true);
-
812 
-
820  int16_t setDataShaping(uint8_t sh) override;
-
821 
-
828  int16_t setSyncWord(uint8_t* syncWord, size_t len) override;
-
829 
-
837  int16_t setSyncBits(uint8_t *syncWord, uint8_t bitsLen);
-
838 
-
844  int16_t setNodeAddress(uint8_t nodeAddr);
-
845 
-
852  int16_t setBroadcastAddress(uint8_t broadAddr);
-
853 
-
858  int16_t disableAddressFiltering();
-
859 
-
868  int16_t setCRC(uint8_t len, uint16_t initial = 0x1D0F, uint16_t polynomial = 0x1021, bool inverted = true);
-
869 
-
877  int16_t setWhitening(bool enabled, uint16_t initial = 0x01FF);
-
878 
-
888  int16_t setTCXO(float voltage, uint32_t delay = 5000);
+
670  int16_t startReceiveDutyCycleAuto(uint16_t senderPreambleLength = 0, uint16_t minSymbols = 8, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
+
671 
+
676  uint16_t getIrqStatus();
+
677 
+
686  int16_t readData(uint8_t* data, size_t len) override;
+
687 
+
693  int16_t startChannelScan() override;
+
694 
+
703  int16_t startChannelScan(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
+
704 
+
709  int16_t getChannelScanResult() override;
+
710 
+
711  // configuration methods
+
712 
+
718  int16_t setBandwidth(float bw);
+
719 
+
725  int16_t setSpreadingFactor(uint8_t sf);
+
726 
+
732  int16_t setCodingRate(uint8_t cr);
+
733 
+
740  int16_t setSyncWord(uint8_t syncWord, uint8_t controlBits = 0x44);
+
741 
+
747  int16_t setCurrentLimit(float currentLimit);
+
748 
+
753  float getCurrentLimit();
+
754 
+
760  int16_t setPreambleLength(size_t preambleLength) override;
+
761 
+
767  int16_t setFrequencyDeviation(float freqDev) override;
+
768 
+
774  int16_t setBitRate(float br);
+
775 
+
781  int16_t setDataRate(DataRate_t dr) override;
+
782 
+
789  int16_t setRxBandwidth(float rxBw);
+
790 
+
799  int16_t setRxBoostedGainMode(bool rxbgm, bool persist = true);
+
800 
+
808  int16_t setDataShaping(uint8_t sh) override;
+
809 
+
816  int16_t setSyncWord(uint8_t* syncWord, size_t len) override;
+
817 
+
825  int16_t setSyncBits(uint8_t *syncWord, uint8_t bitsLen);
+
826 
+
832  int16_t setNodeAddress(uint8_t nodeAddr);
+
833 
+
840  int16_t setBroadcastAddress(uint8_t broadAddr);
+
841 
+
846  int16_t disableAddressFiltering();
+
847 
+
856  int16_t setCRC(uint8_t len, uint16_t initial = 0x1D0F, uint16_t polynomial = 0x1021, bool inverted = true);
+
857 
+
865  int16_t setWhitening(bool enabled, uint16_t initial = 0x01FF);
+
866 
+
876  int16_t setTCXO(float voltage, uint32_t delay = 5000);
+
877 
+
882  int16_t setDio2AsRfSwitch(bool enable = true);
+
883 
+
888  float getDataRate() const;
889 
-
894  int16_t setDio2AsRfSwitch(bool enable = true);
-
895 
-
900  float getDataRate() const;
-
901 
-
907  float getRSSI(bool packet = true);
-
908 
-
913  float getSNR();
-
914 
-
922  float getFrequencyError();
-
923 
-
929  size_t getPacketLength(bool update = true) override;
-
930 
-
936  int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_SX126X_MAX_PACKET_LENGTH);
-
937 
-
943  int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_SX126X_MAX_PACKET_LENGTH);
-
944 
-
950  uint32_t getTimeOnAir(size_t len) override;
-
951 
-
957  uint32_t calculateRxTimeout(uint32_t timeoutUs);
-
958 
-
965  int16_t irqRxDoneRxTimeout(uint16_t &irqFlags, uint16_t &irqMask);
-
966 
-
971  bool isRxTimeout();
-
972 
-
978  int16_t implicitHeader(size_t len);
+
895  float getRSSI(bool packet = true);
+
896 
+
901  float getSNR();
+
902 
+
910  float getFrequencyError();
+
911 
+
917  size_t getPacketLength(bool update = true) override;
+
918 
+
924  int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_SX126X_MAX_PACKET_LENGTH);
+
925 
+
931  int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_SX126X_MAX_PACKET_LENGTH);
+
932 
+
938  uint32_t getTimeOnAir(size_t len) override;
+
939 
+
945  uint32_t calculateRxTimeout(uint32_t timeoutUs);
+
946 
+
953  int16_t irqRxDoneRxTimeout(uint16_t &irqFlags, uint16_t &irqMask);
+
954 
+
959  bool isRxTimeout();
+
960 
+
966  int16_t implicitHeader(size_t len);
+
967 
+
972  int16_t explicitHeader();
+
973 
+
978  int16_t setRegulatorLDO();
979 
-
984  int16_t explicitHeader();
+
984  int16_t setRegulatorDCDC();
985 
-
990  int16_t setRegulatorLDO();
-
991 
-
996  int16_t setRegulatorDCDC();
-
997 
-
1003  int16_t setEncoding(uint8_t encoding) override;
-
1004 
-
1006  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
-
1007 
-
1009  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
-
1010 
-
1019  int16_t forceLDRO(bool enable);
-
1020 
-
1027  int16_t autoLDRO();
-
1028 
-
1033  uint8_t randomByte();
-
1034 
-
1040  int16_t invertIQ(bool enable) override;
-
1041 
-
1042  #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
-
1047  void setDirectAction(void (*func)(void));
-
1048 
-
1053  void readBit(uint32_t pin);
-
1054  #endif
-
1055 
-
1065  int16_t uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile = true);
-
1066 
-
1074  int16_t spectralScanStart(uint16_t numSamples, uint8_t window = RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT, uint8_t interval = RADIOLIB_SX126X_SCAN_INTERVAL_8_20_US);
-
1075 
-
1079  void spectralScanAbort();
-
1080 
-
1085  int16_t spectralScanGetStatus();
-
1086 
-
1092  int16_t spectralScanGetResult(uint16_t* results);
-
1093 
-
1105  int16_t setPaConfig(uint8_t paDutyCycle, uint8_t deviceSel, uint8_t hpMax = RADIOLIB_SX126X_PA_CONFIG_HP_MAX, uint8_t paLut = RADIOLIB_SX126X_PA_CONFIG_PA_LUT);
-
1106 
-
1107 #if !RADIOLIB_GODMODE
-
1108  protected:
-
1109 #endif
-
1110  // SX126x SPI command implementations
-
1111  int16_t setFs();
-
1112  int16_t setTx(uint32_t timeout = 0);
-
1113  int16_t setRx(uint32_t timeout);
-
1114  int16_t setCad(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
-
1115  int16_t writeRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
-
1116  int16_t readRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
-
1117  int16_t writeBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
-
1118  int16_t readBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
-
1119  int16_t setDioIrqParams(uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask = RADIOLIB_SX126X_IRQ_NONE, uint16_t dio3Mask = RADIOLIB_SX126X_IRQ_NONE);
-
1120  virtual int16_t clearIrqStatus(uint16_t clearIrqParams = RADIOLIB_SX126X_IRQ_ALL);
-
1121  int16_t setRfFrequency(uint32_t frf);
-
1122  int16_t calibrateImage(uint8_t* data);
-
1123  uint8_t getPacketType();
-
1124  int16_t setTxParams(uint8_t power, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U);
-
1125  int16_t setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro);
-
1126  int16_t setModulationParamsFSK(uint32_t br, uint8_t sh, uint8_t rxBw, uint32_t freqDev);
-
1127  int16_t setPacketParams(uint16_t preambleLen, uint8_t crcType, uint8_t payloadLen, uint8_t hdrType, uint8_t invertIQ);
-
1128  int16_t setPacketParamsFSK(uint16_t preambleLen, uint8_t crcType, uint8_t syncWordLen, uint8_t addrCmp, uint8_t whiten, uint8_t packType = RADIOLIB_SX126X_GFSK_PACKET_VARIABLE, uint8_t payloadLen = 0xFF, uint8_t preambleDetectorLen = RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16);
-
1129  int16_t setBufferBaseAddress(uint8_t txBaseAddress = 0x00, uint8_t rxBaseAddress = 0x00);
-
1130  int16_t setRegulatorMode(uint8_t mode);
-
1131  uint8_t getStatus();
-
1132  uint32_t getPacketStatus();
-
1133  uint16_t getDeviceErrors();
-
1134  int16_t clearDeviceErrors();
-
1135 
-
1136  int16_t startReceiveCommon(uint32_t timeout = RADIOLIB_SX126X_RX_TIMEOUT_INF, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
-
1137  int16_t setFrequencyRaw(float freq);
-
1138  int16_t setPacketMode(uint8_t mode, uint8_t len);
-
1139  int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
-
1140  int16_t directMode();
-
1141  int16_t packetMode();
-
1142 
-
1143  // fixes to errata
-
1144  int16_t fixSensitivity();
-
1145  int16_t fixPaClamping(bool enable = true);
-
1146  int16_t fixImplicitTimeout();
-
1147  int16_t fixInvertedIQ(uint8_t iqConfig);
+
991  int16_t setEncoding(uint8_t encoding) override;
+
992 
+
994  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
+
995 
+
997  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
+
998 
+
1007  int16_t forceLDRO(bool enable);
+
1008 
+
1015  int16_t autoLDRO();
+
1016 
+
1021  uint8_t randomByte();
+
1022 
+
1028  int16_t invertIQ(bool enable) override;
+
1029 
+
1030  #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
+
1035  void setDirectAction(void (*func)(void));
+
1036 
+
1041  void readBit(uint32_t pin);
+
1042  #endif
+
1043 
+
1053  int16_t uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile = true);
+
1054 
+
1062  int16_t spectralScanStart(uint16_t numSamples, uint8_t window = RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT, uint8_t interval = RADIOLIB_SX126X_SCAN_INTERVAL_8_20_US);
+
1063 
+
1067  void spectralScanAbort();
+
1068 
+
1073  int16_t spectralScanGetStatus();
+
1074 
+
1080  int16_t spectralScanGetResult(uint16_t* results);
+
1081 
+
1093  int16_t setPaConfig(uint8_t paDutyCycle, uint8_t deviceSel, uint8_t hpMax = RADIOLIB_SX126X_PA_CONFIG_HP_MAX, uint8_t paLut = RADIOLIB_SX126X_PA_CONFIG_PA_LUT);
+
1094 
+
1095 #if !RADIOLIB_GODMODE
+
1096  protected:
+
1097 #endif
+
1098  // SX126x SPI command implementations
+
1099  int16_t setFs();
+
1100  int16_t setTx(uint32_t timeout = 0);
+
1101  int16_t setRx(uint32_t timeout);
+
1102  int16_t setCad(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
+
1103  int16_t writeRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
+
1104  int16_t readRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
+
1105  int16_t writeBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
+
1106  int16_t readBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
+
1107  int16_t setDioIrqParams(uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask = RADIOLIB_SX126X_IRQ_NONE, uint16_t dio3Mask = RADIOLIB_SX126X_IRQ_NONE);
+
1108  virtual int16_t clearIrqStatus(uint16_t clearIrqParams = RADIOLIB_SX126X_IRQ_ALL);
+
1109  int16_t setRfFrequency(uint32_t frf);
+
1110  int16_t calibrateImage(float freqMin, float freqMax);
+
1111  uint8_t getPacketType();
+
1112  int16_t setTxParams(uint8_t power, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U);
+
1113  int16_t setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro);
+
1114  int16_t setModulationParamsFSK(uint32_t br, uint8_t sh, uint8_t rxBw, uint32_t freqDev);
+
1115  int16_t setPacketParams(uint16_t preambleLen, uint8_t crcType, uint8_t payloadLen, uint8_t hdrType, uint8_t invertIQ);
+
1116  int16_t setPacketParamsFSK(uint16_t preambleLen, uint8_t crcType, uint8_t syncWordLen, uint8_t addrCmp, uint8_t whiten, uint8_t packType = RADIOLIB_SX126X_GFSK_PACKET_VARIABLE, uint8_t payloadLen = 0xFF, uint8_t preambleDetectorLen = RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16);
+
1117  int16_t setBufferBaseAddress(uint8_t txBaseAddress = 0x00, uint8_t rxBaseAddress = 0x00);
+
1118  int16_t setRegulatorMode(uint8_t mode);
+
1119  uint8_t getStatus();
+
1120  uint32_t getPacketStatus();
+
1121  uint16_t getDeviceErrors();
+
1122  int16_t clearDeviceErrors();
+
1123 
+
1124  int16_t startReceiveCommon(uint32_t timeout = RADIOLIB_SX126X_RX_TIMEOUT_INF, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
+
1125  int16_t setFrequencyRaw(float freq);
+
1126  int16_t setPacketMode(uint8_t mode, uint8_t len);
+
1127  int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
+
1128  int16_t directMode();
+
1129  int16_t packetMode();
+
1130 
+
1131  // fixes to errata
+
1132  int16_t fixSensitivity();
+
1133  int16_t fixPaClamping(bool enable = true);
+
1134  int16_t fixImplicitTimeout();
+
1135  int16_t fixInvertedIQ(uint8_t iqConfig);
+
1136 
+
1137 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
+
1138  protected:
+
1139 #endif
+
1140  Module* mod;
+
1141 
+
1142  // common low-level SPI interface
+
1143  static int16_t SPIparseStatus(uint8_t in);
+
1144 
+
1145 #if !RADIOLIB_GODMODE
+
1146  protected:
+
1147 #endif
1148 
-
1149 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
-
1150  protected:
-
1151 #endif
-
1152  Module* mod;
+
1149  uint8_t bandwidth = 0, spreadingFactor = 0, codingRate = 0, ldrOptimize = 0, crcTypeLoRa = 0, headerType = 0;
+
1150  uint16_t preambleLengthLoRa = 0;
+
1151  float bandwidthKhz = 0;
+
1152  bool ldroAuto = true;
1153 
-
1154  // common low-level SPI interface
-
1155  static int16_t SPIparseStatus(uint8_t in);
-
1156 
-
1157 #if !RADIOLIB_GODMODE
-
1158  protected:
-
1159 #endif
+
1154  uint32_t bitRate = 0, frequencyDev = 0;
+
1155  uint8_t rxBandwidth = 0, pulseShape = 0, crcTypeFSK = 0, syncWordLength = 0, addrComp = 0, whitening = 0, packetType = 0;
+
1156  uint16_t preambleLengthFSK = 0;
+
1157  float rxBandwidthKhz = 0;
+
1158 
+
1159  float dataRateMeasured = 0;
1160 
-
1161  uint8_t bandwidth = 0, spreadingFactor = 0, codingRate = 0, ldrOptimize = 0, crcTypeLoRa = 0, headerType = 0;
-
1162  uint16_t preambleLengthLoRa = 0;
-
1163  float bandwidthKhz = 0;
-
1164  bool ldroAuto = true;
-
1165 
-
1166  uint32_t bitRate = 0, frequencyDev = 0;
-
1167  uint8_t rxBandwidth = 0, pulseShape = 0, crcTypeFSK = 0, syncWordLength = 0, addrComp = 0, whitening = 0, packetType = 0;
-
1168  uint16_t preambleLengthFSK = 0;
-
1169  float rxBandwidthKhz = 0;
-
1170 
-
1171  float dataRateMeasured = 0;
-
1172 
-
1173  uint32_t tcxoDelay = 0;
-
1174 
-
1175  size_t implicitLen = 0;
-
1176  uint8_t invertIQEnabled = RADIOLIB_SX126X_LORA_IQ_STANDARD;
-
1177  const char* chipType;
-
1178 
-
1179  // Allow subclasses to define different TX modes
-
1180  uint8_t txMode = Module::MODE_TX;
-
1181 
-
1182  int16_t config(uint8_t modem);
-
1183  bool findChip(const char* verStr);
-
1184 };
-
1185 
-
1186 #endif
-
1187 
-
1188 #endif
+
1161  uint32_t tcxoDelay = 0;
+
1162 
+
1163  size_t implicitLen = 0;
+
1164  uint8_t invertIQEnabled = RADIOLIB_SX126X_LORA_IQ_STANDARD;
+
1165  const char* chipType;
+
1166 
+
1167  // Allow subclasses to define different TX modes
+
1168  uint8_t txMode = Module::MODE_TX;
+
1169 
+
1170  int16_t config(uint8_t modem);
+
1171  bool findChip(const char* verStr);
+
1172 };
+
1173 
+
1174 #endif
+
1175 
+
1176 #endif
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:31
Module::RFSWITCH_MAX_PINS
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code.
Definition: Module.h:42
Module::MODE_TX
@ MODE_TX
Definition: Module.h:71
@@ -803,7 +791,7 @@ $(document).ready(function(){initNavTree('_s_x126x_8h_source.html',''); initResi
PhysicalLayer::getRSSI
virtual float getRSSI()
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
Definition: PhysicalLayer.cpp:284
PhysicalLayer::receive
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
PhysicalLayer::sleep
virtual int16_t sleep()
Sets module to sleep.
Definition: PhysicalLayer.cpp:118
-
SX126x
Base class for SX126x series. All derived classes for SX126x (e.g. SX1262 or SX1268) inherit from thi...
Definition: SX126x.h:443
+
SX126x
Base class for SX126x series. All derived classes for SX126x (e.g. SX1262 or SX1268) inherit from thi...
Definition: SX126x.h:431
SX126x::startChannelScan
int16_t startChannelScan() override
Interrupt-driven channel activity detection method. DIO1 will be activated when LoRa preamble is dete...
Definition: SX126x.cpp:741
SX126x::setPacketSentAction
void setPacketSentAction(void(*func)(void))
Sets interrupt service routine to call when a packet is sent.
Definition: SX126x.cpp:502
SX126x::getFrequencyError
float getFrequencyError()
Gets frequency error of the latest received packet. WARNING: This functionality is based on SX128x im...
Definition: SX126x.cpp:1350
@@ -871,7 +859,7 @@ $(document).ready(function(){initNavTree('_s_x126x_8h_source.html',''); initResi
SX126x::clearPacketReceivedAction
void clearPacketReceivedAction()
Clears interrupt service routine to call when a packet is received.
Definition: SX126x.cpp:498
SX126x::setPacketReceivedAction
void setPacketReceivedAction(void(*func)(void))
Sets interrupt service routine to call when a packet is received.
Definition: SX126x.cpp:494
SX126x::setPreambleLength
int16_t setPreambleLength(size_t preambleLength) override
Sets preamble length for LoRa or FSK modem. Allowed values range from 1 to 65535.
Definition: SX126x.cpp:900
-
SX126x::XTAL
bool XTAL
Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
Definition: SX126x.h:462
+
SX126x::XTAL
bool XTAL
Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
Definition: SX126x.h:450
SX126x::implicitHeader
int16_t implicitHeader(size_t len)
Set implicit header mode for future reception/transmission.
Definition: SX126x.cpp:1458
SX126x::getSNR
float getSNR()
Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem.
Definition: SX126x.cpp:1334
SX126x::setDio2AsRfSwitch
int16_t setDio2AsRfSwitch(bool enable=true)
Set DIO2 to function as RF switch (default in Semtech example designs).
Definition: SX126x.cpp:1700