1 #if !defined(_RADIOLIB_SX127X_H)
2 #define _RADIOLIB_SX127X_H
4 #include "../../TypeDef.h"
6 #if !defined(RADIOLIB_EXCLUDE_SX127X)
8 #include "../../Module.h"
10 #include "../../protocols/PhysicalLayer/PhysicalLayer.h"
13 #define RADIOLIB_SX127X_FREQUENCY_STEP_SIZE 61.03515625
14 #define RADIOLIB_SX127X_MAX_PACKET_LENGTH 255
15 #define RADIOLIB_SX127X_MAX_PACKET_LENGTH_FSK 64
16 #define RADIOLIB_SX127X_CRYSTAL_FREQ 32.0
17 #define RADIOLIB_SX127X_DIV_EXPONENT 19
20 #define RADIOLIB_SX127X_REG_FIFO 0x00
21 #define RADIOLIB_SX127X_REG_OP_MODE 0x01
22 #define RADIOLIB_SX127X_REG_FRF_MSB 0x06
23 #define RADIOLIB_SX127X_REG_FRF_MID 0x07
24 #define RADIOLIB_SX127X_REG_FRF_LSB 0x08
25 #define RADIOLIB_SX127X_REG_PA_CONFIG 0x09
26 #define RADIOLIB_SX127X_REG_PA_RAMP 0x0A
27 #define RADIOLIB_SX127X_REG_OCP 0x0B
28 #define RADIOLIB_SX127X_REG_LNA 0x0C
29 #define RADIOLIB_SX127X_REG_FIFO_ADDR_PTR 0x0D
30 #define RADIOLIB_SX127X_REG_FIFO_TX_BASE_ADDR 0x0E
31 #define RADIOLIB_SX127X_REG_FIFO_RX_BASE_ADDR 0x0F
32 #define RADIOLIB_SX127X_REG_FIFO_RX_CURRENT_ADDR 0x10
33 #define RADIOLIB_SX127X_REG_IRQ_FLAGS_MASK 0x11
34 #define RADIOLIB_SX127X_REG_IRQ_FLAGS 0x12
35 #define RADIOLIB_SX127X_REG_RX_NB_BYTES 0x13
36 #define RADIOLIB_SX127X_REG_RX_HEADER_CNT_VALUE_MSB 0x14
37 #define RADIOLIB_SX127X_REG_RX_HEADER_CNT_VALUE_LSB 0x15
38 #define RADIOLIB_SX127X_REG_RX_PACKET_CNT_VALUE_MSB 0x16
39 #define RADIOLIB_SX127X_REG_RX_PACKET_CNT_VALUE_LSB 0x17
40 #define RADIOLIB_SX127X_REG_MODEM_STAT 0x18
41 #define RADIOLIB_SX127X_REG_PKT_SNR_VALUE 0x19
42 #define RADIOLIB_SX127X_REG_PKT_RSSI_VALUE 0x1A
43 #define RADIOLIB_SX127X_REG_RSSI_VALUE 0x1B
44 #define RADIOLIB_SX127X_REG_HOP_CHANNEL 0x1C
45 #define RADIOLIB_SX127X_REG_MODEM_CONFIG_1 0x1D
46 #define RADIOLIB_SX127X_REG_MODEM_CONFIG_2 0x1E
47 #define RADIOLIB_SX127X_REG_SYMB_TIMEOUT_LSB 0x1F
48 #define RADIOLIB_SX127X_REG_PREAMBLE_MSB 0x20
49 #define RADIOLIB_SX127X_REG_PREAMBLE_LSB 0x21
50 #define RADIOLIB_SX127X_REG_PAYLOAD_LENGTH 0x22
51 #define RADIOLIB_SX127X_REG_MAX_PAYLOAD_LENGTH 0x23
52 #define RADIOLIB_SX127X_REG_HOP_PERIOD 0x24
53 #define RADIOLIB_SX127X_REG_FIFO_RX_BYTE_ADDR 0x25
54 #define RADIOLIB_SX127X_REG_FEI_MSB 0x28
55 #define RADIOLIB_SX127X_REG_FEI_MID 0x29
56 #define RADIOLIB_SX127X_REG_FEI_LSB 0x2A
57 #define RADIOLIB_SX127X_REG_RSSI_WIDEBAND 0x2C
58 #define RADIOLIB_SX127X_REG_DETECT_OPTIMIZE 0x31
59 #define RADIOLIB_SX127X_REG_INVERT_IQ 0x33
60 #define RADIOLIB_SX127X_REG_DETECTION_THRESHOLD 0x37
61 #define RADIOLIB_SX127X_REG_SYNC_WORD 0x39
62 #define RADIOLIB_SX127X_REG_INVERT_IQ2 0x3B
63 #define RADIOLIB_SX127X_REG_DIO_MAPPING_1 0x40
64 #define RADIOLIB_SX127X_REG_DIO_MAPPING_2 0x41
65 #define RADIOLIB_SX127X_REG_VERSION 0x42
69 #define RADIOLIB_SX127X_FSK_OOK 0b00000000
70 #define RADIOLIB_SX127X_LORA 0b10000000
71 #define RADIOLIB_SX127X_ACCESS_SHARED_REG_OFF 0b00000000
72 #define RADIOLIB_SX127X_ACCESS_SHARED_REG_ON 0b01000000
73 #define RADIOLIB_SX127X_SLEEP 0b00000000
74 #define RADIOLIB_SX127X_STANDBY 0b00000001
75 #define RADIOLIB_SX127X_FSTX 0b00000010
76 #define RADIOLIB_SX127X_TX 0b00000011
77 #define RADIOLIB_SX127X_FSRX 0b00000100
78 #define RADIOLIB_SX127X_RXCONTINUOUS 0b00000101
79 #define RADIOLIB_SX127X_RXSINGLE 0b00000110
80 #define RADIOLIB_SX127X_CAD 0b00000111
83 #define RADIOLIB_SX127X_PA_SELECT_RFO 0b00000000
84 #define RADIOLIB_SX127X_PA_SELECT_BOOST 0b10000000
85 #define RADIOLIB_SX127X_OUTPUT_POWER 0b00001111
89 #define RADIOLIB_SX127X_OCP_OFF 0b00000000
90 #define RADIOLIB_SX127X_OCP_ON 0b00100000
91 #define RADIOLIB_SX127X_OCP_TRIM 0b00001011
94 #define RADIOLIB_SX127X_LNA_GAIN_1 0b00100000
95 #define RADIOLIB_SX127X_LNA_GAIN_2 0b01000000
96 #define RADIOLIB_SX127X_LNA_GAIN_3 0b01100000
97 #define RADIOLIB_SX127X_LNA_GAIN_4 0b10000000
98 #define RADIOLIB_SX127X_LNA_GAIN_5 0b10100000
99 #define RADIOLIB_SX127X_LNA_GAIN_6 0b11000000
100 #define RADIOLIB_SX127X_LNA_BOOST_OFF 0b00000000
101 #define RADIOLIB_SX127X_LNA_BOOST_ON 0b00000011
104 #define RADIOLIB_SX127X_SF_6 0b01100000
105 #define RADIOLIB_SX127X_SF_7 0b01110000
106 #define RADIOLIB_SX127X_SF_8 0b10000000
107 #define RADIOLIB_SX127X_SF_9 0b10010000
108 #define RADIOLIB_SX127X_SF_10 0b10100000
109 #define RADIOLIB_SX127X_SF_11 0b10110000
110 #define RADIOLIB_SX127X_SF_12 0b11000000
111 #define RADIOLIB_SX127X_TX_MODE_SINGLE 0b00000000
112 #define RADIOLIB_SX127X_TX_MODE_CONT 0b00001000
113 #define RADIOLIB_SX127X_RX_TIMEOUT_MSB 0b00000000
116 #define RADIOLIB_SX127X_RX_TIMEOUT_LSB 0b01100100
119 #define RADIOLIB_SX127X_PREAMBLE_LENGTH_MSB 0b00000000
120 #define RADIOLIB_SX127X_PREAMBLE_LENGTH_LSB 0b00001000
123 #define RADIOLIB_SX127X_DETECT_OPTIMIZE_SF_6 0b00000101
124 #define RADIOLIB_SX127X_DETECT_OPTIMIZE_SF_7_12 0b00000011
127 #define RADIOLIB_SX127X_INVERT_IQ_RXPATH_ON 0b01000000
128 #define RADIOLIB_SX127X_INVERT_IQ_RXPATH_OFF 0b00000000
129 #define RADIOLIB_SX127X_INVERT_IQ_TXPATH_ON 0b00000001
130 #define RADIOLIB_SX127X_INVERT_IQ_TXPATH_OFF 0b00000000
133 #define RADIOLIB_SX127X_DETECTION_THRESHOLD_SF_6 0b00001100
134 #define RADIOLIB_SX127X_DETECTION_THRESHOLD_SF_7_12 0b00001010
137 #define RADIOLIB_SX127X_PA_BOOST_OFF 0b00000100
138 #define RADIOLIB_SX127X_PA_BOOST_ON 0b00000111
141 #define RADIOLIB_SX127X_HOP_PERIOD_OFF 0b00000000
142 #define RADIOLIB_SX127X_HOP_PERIOD_MAX 0b11111111
145 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_RX_TIMEOUT 0b10000000
146 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_RX_DONE 0b01000000
147 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_PAYLOAD_CRC_ERROR 0b00100000
148 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_VALID_HEADER 0b00010000
149 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_TX_DONE 0b00001000
150 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_CAD_DONE 0b00000100
151 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_FHSS_CHANGE_CHANNEL 0b00000010
152 #define RADIOLIB_SX127X_CLEAR_IRQ_FLAG_CAD_DETECTED 0b00000001
155 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_RX_TIMEOUT 0b01111111
156 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_RX_DONE 0b10111111
157 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_PAYLOAD_CRC_ERROR 0b11011111
158 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER 0b11101111
159 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_TX_DONE 0b11110111
160 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_CAD_DONE 0b11111011
161 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_FHSS_CHANGE_CHANNEL 0b11111101
162 #define RADIOLIB_SX127X_MASK_IRQ_FLAG_CAD_DETECTED 0b11111110
165 #define RADIOLIB_SX127X_FIFO_TX_BASE_ADDR_MAX 0b00000000
168 #define RADIOLIB_SX127X_FIFO_RX_BASE_ADDR_MAX 0b00000000
171 #define RADIOLIB_SX127X_SYNC_WORD 0x12
172 #define RADIOLIB_SX127X_SYNC_WORD_LORAWAN 0x34
175 #define RADIOLIB_SX127X_IQ2_ENABLE 0x19
176 #define RADIOLIB_SX127X_IQ2_DISABLE 0x1D
180 #define RADIOLIB_SX127X_REG_BITRATE_MSB 0x02
181 #define RADIOLIB_SX127X_REG_BITRATE_LSB 0x03
182 #define RADIOLIB_SX127X_REG_FDEV_MSB 0x04
183 #define RADIOLIB_SX127X_REG_FDEV_LSB 0x05
184 #define RADIOLIB_SX127X_REG_RX_CONFIG 0x0D
185 #define RADIOLIB_SX127X_REG_RSSI_CONFIG 0x0E
186 #define RADIOLIB_SX127X_REG_RSSI_COLLISION 0x0F
187 #define RADIOLIB_SX127X_REG_RSSI_THRESH 0x10
188 #define RADIOLIB_SX127X_REG_RSSI_VALUE_FSK 0x11
189 #define RADIOLIB_SX127X_REG_RX_BW 0x12
190 #define RADIOLIB_SX127X_REG_AFC_BW 0x13
191 #define RADIOLIB_SX127X_REG_OOK_PEAK 0x14
192 #define RADIOLIB_SX127X_REG_OOK_FIX 0x15
193 #define RADIOLIB_SX127X_REG_OOK_AVG 0x16
194 #define RADIOLIB_SX127X_REG_AFC_FEI 0x1A
195 #define RADIOLIB_SX127X_REG_AFC_MSB 0x1B
196 #define RADIOLIB_SX127X_REG_AFC_LSB 0x1C
197 #define RADIOLIB_SX127X_REG_FEI_MSB_FSK 0x1D
198 #define RADIOLIB_SX127X_REG_FEI_LSB_FSK 0x1E
199 #define RADIOLIB_SX127X_REG_PREAMBLE_DETECT 0x1F
200 #define RADIOLIB_SX127X_REG_RX_TIMEOUT_1 0x20
201 #define RADIOLIB_SX127X_REG_RX_TIMEOUT_2 0x21
202 #define RADIOLIB_SX127X_REG_RX_TIMEOUT_3 0x22
203 #define RADIOLIB_SX127X_REG_RX_DELAY 0x23
204 #define RADIOLIB_SX127X_REG_OSC 0x24
205 #define RADIOLIB_SX127X_REG_PREAMBLE_MSB_FSK 0x25
206 #define RADIOLIB_SX127X_REG_PREAMBLE_LSB_FSK 0x26
207 #define RADIOLIB_SX127X_REG_SYNC_CONFIG 0x27
208 #define RADIOLIB_SX127X_REG_SYNC_VALUE_1 0x28
209 #define RADIOLIB_SX127X_REG_SYNC_VALUE_2 0x29
210 #define RADIOLIB_SX127X_REG_SYNC_VALUE_3 0x2A
211 #define RADIOLIB_SX127X_REG_SYNC_VALUE_4 0x2B
212 #define RADIOLIB_SX127X_REG_SYNC_VALUE_5 0x2C
213 #define RADIOLIB_SX127X_REG_SYNC_VALUE_6 0x2D
214 #define RADIOLIB_SX127X_REG_SYNC_VALUE_7 0x2E
215 #define RADIOLIB_SX127X_REG_SYNC_VALUE_8 0x2F
216 #define RADIOLIB_SX127X_REG_PACKET_CONFIG_1 0x30
217 #define RADIOLIB_SX127X_REG_PACKET_CONFIG_2 0x31
218 #define RADIOLIB_SX127X_REG_PAYLOAD_LENGTH_FSK 0x32
219 #define RADIOLIB_SX127X_REG_NODE_ADRS 0x33
220 #define RADIOLIB_SX127X_REG_BROADCAST_ADRS 0x34
221 #define RADIOLIB_SX127X_REG_FIFO_THRESH 0x35
222 #define RADIOLIB_SX127X_REG_SEQ_CONFIG_1 0x36
223 #define RADIOLIB_SX127X_REG_SEQ_CONFIG_2 0x37
224 #define RADIOLIB_SX127X_REG_TIMER_RESOL 0x38
225 #define RADIOLIB_SX127X_REG_TIMER1_COEF 0x39
226 #define RADIOLIB_SX127X_REG_TIMER2_COEF 0x3A
227 #define RADIOLIB_SX127X_REG_IMAGE_CAL 0x3B
228 #define RADIOLIB_SX127X_REG_TEMP 0x3C
229 #define RADIOLIB_SX127X_REG_LOW_BAT 0x3D
230 #define RADIOLIB_SX127X_REG_IRQ_FLAGS_1 0x3E
231 #define RADIOLIB_SX127X_REG_IRQ_FLAGS_2 0x3F
235 #define RADIOLIB_SX127X_MODULATION_FSK 0b00000000
236 #define RADIOLIB_SX127X_MODULATION_OOK 0b00100000
237 #define RADIOLIB_SX127X_RX 0b00000101
240 #define RADIOLIB_SX127X_BITRATE_MSB 0x1A
241 #define RADIOLIB_SX127X_BITRATE_LSB 0x0B
244 #define RADIOLIB_SX127X_FDEV_MSB 0x00
245 #define RADIOLIB_SX127X_FDEV_LSB 0x52
248 #define RADIOLIB_SX127X_RESTART_RX_ON_COLLISION_OFF 0b00000000
249 #define RADIOLIB_SX127X_RESTART_RX_ON_COLLISION_ON 0b10000000
250 #define RADIOLIB_SX127X_RESTART_RX_WITHOUT_PLL_LOCK 0b01000000
251 #define RADIOLIB_SX127X_RESTART_RX_WITH_PLL_LOCK 0b00100000
252 #define RADIOLIB_SX127X_AFC_AUTO_OFF 0b00000000
253 #define RADIOLIB_SX127X_AFC_AUTO_ON 0b00010000
254 #define RADIOLIB_SX127X_AGC_AUTO_OFF 0b00000000
255 #define RADIOLIB_SX127X_AGC_AUTO_ON 0b00001000
256 #define RADIOLIB_SX127X_RX_TRIGGER_NONE 0b00000000
257 #define RADIOLIB_SX127X_RX_TRIGGER_RSSI_INTERRUPT 0b00000001
258 #define RADIOLIB_SX127X_RX_TRIGGER_PREAMBLE_DETECT 0b00000110
259 #define RADIOLIB_SX127X_RX_TRIGGER_BOTH 0b00000111
262 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_2 0b00000000
263 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_4 0b00000001
264 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_8 0b00000010
265 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_16 0b00000011
266 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_32 0b00000100
267 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_64 0b00000101
268 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_128 0b00000110
269 #define RADIOLIB_SX127X_RSSI_SMOOTHING_SAMPLES_256 0b00000111
272 #define RADIOLIB_SX127X_RSSI_COLLISION_THRESHOLD 0x0A
275 #define RADIOLIB_SX127X_RSSI_THRESHOLD 0xFF
278 #define RADIOLIB_SX127X_RX_BW_MANT_16 0b00000000
279 #define RADIOLIB_SX127X_RX_BW_MANT_20 0b00001000
280 #define RADIOLIB_SX127X_RX_BW_MANT_24 0b00010000
281 #define RADIOLIB_SX127X_RX_BW_EXP 0b00000101
284 #define RADIOLIB_SX127X_RX_BW_MANT_AFC 0b00001000
285 #define RADIOLIB_SX127X_RX_BW_EXP_AFC 0b00000011
288 #define RADIOLIB_SX127X_BIT_SYNC_OFF 0b00000000
289 #define RADIOLIB_SX127X_BIT_SYNC_ON 0b00100000
290 #define RADIOLIB_SX127X_OOK_THRESH_FIXED 0b00000000
291 #define RADIOLIB_SX127X_OOK_THRESH_PEAK 0b00001000
292 #define RADIOLIB_SX127X_OOK_THRESH_AVERAGE 0b00010000
293 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_0_5_DB 0b00000000
294 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_1_0_DB 0b00000001
295 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_1_5_DB 0b00000010
296 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_2_0_DB 0b00000011
297 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_3_0_DB 0b00000100
298 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_4_0_DB 0b00000101
299 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_5_0_DB 0b00000110
300 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_STEP_6_0_DB 0b00000111
303 #define RADIOLIB_SX127X_OOK_FIXED_THRESHOLD 0x0C
306 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_1_1_CHIP 0b00000000
307 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_1_2_CHIP 0b00100000
308 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_1_4_CHIP 0b01000000
309 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_1_8_CHIP 0b01100000
310 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_2_1_CHIP 0b10000000
311 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_4_1_CHIP 0b10100000
312 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_8_1_CHIP 0b11000000
313 #define RADIOLIB_SX127X_OOK_PEAK_THRESH_DEC_16_1_CHIP 0b11100000
314 #define RADIOLIB_SX127X_OOK_AVERAGE_OFFSET_0_DB 0b00000000
315 #define RADIOLIB_SX127X_OOK_AVERAGE_OFFSET_2_DB 0b00000100
316 #define RADIOLIB_SX127X_OOK_AVERAGE_OFFSET_4_DB 0b00001000
317 #define RADIOLIB_SX127X_OOK_AVERAGE_OFFSET_6_DB 0b00001100
318 #define RADIOLIB_SX127X_OOK_AVG_THRESH_FILT_32_PI 0b00000000
319 #define RADIOLIB_SX127X_OOK_AVG_THRESH_FILT_8_PI 0b00000001
320 #define RADIOLIB_SX127X_OOK_AVG_THRESH_FILT_4_PI 0b00000010
321 #define RADIOLIB_SX127X_OOK_AVG_THRESH_FILT_2_PI 0b00000011
324 #define RADIOLIB_SX127X_AGC_START 0b00010000
325 #define RADIOLIB_SX127X_AFC_CLEAR 0b00000010
326 #define RADIOLIB_SX127X_AFC_AUTO_CLEAR_OFF 0b00000000
327 #define RADIOLIB_SX127X_AFC_AUTO_CLEAR_ON 0b00000001
330 #define RADIOLIB_SX127X_PREAMBLE_DETECTOR_OFF 0b00000000
331 #define RADIOLIB_SX127X_PREAMBLE_DETECTOR_ON 0b10000000
332 #define RADIOLIB_SX127X_PREAMBLE_DETECTOR_1_BYTE 0b00000000
333 #define RADIOLIB_SX127X_PREAMBLE_DETECTOR_2_BYTE 0b00100000
334 #define RADIOLIB_SX127X_PREAMBLE_DETECTOR_3_BYTE 0b01000000
335 #define RADIOLIB_SX127X_PREAMBLE_DETECTOR_TOL 0x0A
338 #define RADIOLIB_SX127X_TIMEOUT_RX_RSSI_OFF 0x00
341 #define RADIOLIB_SX127X_TIMEOUT_RX_PREAMBLE_OFF 0x00
344 #define RADIOLIB_SX127X_TIMEOUT_SIGNAL_SYNC_OFF 0x00
347 #define RADIOLIB_SX127X_RC_CAL_START 0b00000000
348 #define RADIOLIB_SX127X_CLK_OUT_FXOSC 0b00000000
349 #define RADIOLIB_SX127X_CLK_OUT_FXOSC_2 0b00000001
350 #define RADIOLIB_SX127X_CLK_OUT_FXOSC_4 0b00000010
351 #define RADIOLIB_SX127X_CLK_OUT_FXOSC_8 0b00000011
352 #define RADIOLIB_SX127X_CLK_OUT_FXOSC_16 0b00000100
353 #define RADIOLIB_SX127X_CLK_OUT_FXOSC_32 0b00000101
354 #define RADIOLIB_SX127X_CLK_OUT_RC 0b00000110
355 #define RADIOLIB_SX127X_CLK_OUT_OFF 0b00000111
358 #define RADIOLIB_SX127X_PREAMBLE_SIZE_MSB 0x00
359 #define RADIOLIB_SX127X_PREAMBLE_SIZE_LSB 0x03
362 #define RADIOLIB_SX127X_AUTO_RESTART_RX_MODE_OFF 0b00000000
363 #define RADIOLIB_SX127X_AUTO_RESTART_RX_MODE_NO_PLL 0b01000000
364 #define RADIOLIB_SX127X_AUTO_RESTART_RX_MODE_PLL 0b10000000
365 #define RADIOLIB_SX127X_PREAMBLE_POLARITY_AA 0b00000000
366 #define RADIOLIB_SX127X_PREAMBLE_POLARITY_55 0b00100000
367 #define RADIOLIB_SX127X_SYNC_OFF 0b00000000
368 #define RADIOLIB_SX127X_SYNC_ON 0b00010000
369 #define RADIOLIB_SX127X_SYNC_SIZE 0x03
372 #define RADIOLIB_SX127X_SYNC_VALUE_1 0x01
373 #define RADIOLIB_SX127X_SYNC_VALUE_2 0x01
374 #define RADIOLIB_SX127X_SYNC_VALUE_3 0x01
375 #define RADIOLIB_SX127X_SYNC_VALUE_4 0x01
376 #define RADIOLIB_SX127X_SYNC_VALUE_5 0x01
377 #define RADIOLIB_SX127X_SYNC_VALUE_6 0x01
378 #define RADIOLIB_SX127X_SYNC_VALUE_7 0x01
379 #define RADIOLIB_SX127X_SYNC_VALUE_8 0x01
382 #define RADIOLIB_SX127X_PACKET_FIXED 0b00000000
383 #define RADIOLIB_SX127X_PACKET_VARIABLE 0b10000000
384 #define RADIOLIB_SX127X_DC_FREE_NONE 0b00000000
385 #define RADIOLIB_SX127X_DC_FREE_MANCHESTER 0b00100000
386 #define RADIOLIB_SX127X_DC_FREE_WHITENING 0b01000000
387 #define RADIOLIB_SX127X_CRC_OFF 0b00000000
388 #define RADIOLIB_SX127X_CRC_ON 0b00010000
389 #define RADIOLIB_SX127X_CRC_AUTOCLEAR_OFF 0b00001000
390 #define RADIOLIB_SX127X_CRC_AUTOCLEAR_ON 0b00000000
391 #define RADIOLIB_SX127X_ADDRESS_FILTERING_OFF 0b00000000
392 #define RADIOLIB_SX127X_ADDRESS_FILTERING_NODE 0b00000010
393 #define RADIOLIB_SX127X_ADDRESS_FILTERING_NODE_BROADCAST 0b00000100
394 #define RADIOLIB_SX127X_CRC_WHITENING_TYPE_CCITT 0b00000000
395 #define RADIOLIB_SX127X_CRC_WHITENING_TYPE_IBM 0b00000001
398 #define RADIOLIB_SX127X_DATA_MODE_PACKET 0b01000000
399 #define RADIOLIB_SX127X_DATA_MODE_CONTINUOUS 0b00000000
400 #define RADIOLIB_SX127X_IO_HOME_OFF 0b00000000
401 #define RADIOLIB_SX127X_IO_HOME_ON 0b00100000
404 #define RADIOLIB_SX127X_TX_START_FIFO_LEVEL 0b00000000
405 #define RADIOLIB_SX127X_TX_START_FIFO_NOT_EMPTY 0b10000000
406 #define RADIOLIB_SX127X_FIFO_THRESH 0x1F
409 #define RADIOLIB_SX127X_SEQUENCER_START 0b10000000
410 #define RADIOLIB_SX127X_SEQUENCER_STOP 0b01000000
411 #define RADIOLIB_SX127X_IDLE_MODE_STANDBY 0b00000000
412 #define RADIOLIB_SX127X_IDLE_MODE_SLEEP 0b00100000
413 #define RADIOLIB_SX127X_FROM_START_LP_SELECTION 0b00000000
414 #define RADIOLIB_SX127X_FROM_START_RECEIVE 0b00001000
415 #define RADIOLIB_SX127X_FROM_START_TRANSMIT 0b00010000
416 #define RADIOLIB_SX127X_FROM_START_TRANSMIT_FIFO_LEVEL 0b00011000
417 #define RADIOLIB_SX127X_LP_SELECTION_SEQ_OFF 0b00000000
418 #define RADIOLIB_SX127X_LP_SELECTION_IDLE 0b00000100
419 #define RADIOLIB_SX127X_FROM_IDLE_TRANSMIT 0b00000000
420 #define RADIOLIB_SX127X_FROM_IDLE_RECEIVE 0b00000010
421 #define RADIOLIB_SX127X_FROM_TRANSMIT_LP_SELECTION 0b00000000
422 #define RADIOLIB_SX127X_FROM_TRANSMIT_RECEIVE 0b00000001
425 #define RADIOLIB_SX127X_FROM_RECEIVE_PACKET_RECEIVED_PAYLOAD 0b00100000
426 #define RADIOLIB_SX127X_FROM_RECEIVE_LP_SELECTION 0b01000000
427 #define RADIOLIB_SX127X_FROM_RECEIVE_PACKET_RECEIVED_CRC_OK 0b01100000
428 #define RADIOLIB_SX127X_FROM_RECEIVE_SEQ_OFF_RSSI 0b10000000
429 #define RADIOLIB_SX127X_FROM_RECEIVE_SEQ_OFF_SYNC_ADDR 0b10100000
430 #define RADIOLIB_SX127X_FROM_RECEIVE_SEQ_OFF_PREAMBLE_DETECT 0b11000000
431 #define RADIOLIB_SX127X_FROM_RX_TIMEOUT_RECEIVE 0b00000000
432 #define RADIOLIB_SX127X_FROM_RX_TIMEOUT_TRANSMIT 0b00001000
433 #define RADIOLIB_SX127X_FROM_RX_TIMEOUT_LP_SELECTION 0b00010000
434 #define RADIOLIB_SX127X_FROM_RX_TIMEOUT_SEQ_OFF 0b00011000
435 #define RADIOLIB_SX127X_FROM_PACKET_RECEIVED_SEQ_OFF 0b00000000
436 #define RADIOLIB_SX127X_FROM_PACKET_RECEIVED_TRANSMIT 0b00000001
437 #define RADIOLIB_SX127X_FROM_PACKET_RECEIVED_LP_SELECTION 0b00000010
438 #define RADIOLIB_SX127X_FROM_PACKET_RECEIVED_RECEIVE_FS 0b00000011
439 #define RADIOLIB_SX127X_FROM_PACKET_RECEIVED_RECEIVE 0b00000100
442 #define RADIOLIB_SX127X_TIMER1_OFF 0b00000000
443 #define RADIOLIB_SX127X_TIMER1_RESOLUTION_64_US 0b00000100
444 #define RADIOLIB_SX127X_TIMER1_RESOLUTION_4_1_MS 0b00001000
445 #define RADIOLIB_SX127X_TIMER1_RESOLUTION_262_MS 0b00001100
446 #define RADIOLIB_SX127X_TIMER2_OFF 0b00000000
447 #define RADIOLIB_SX127X_TIMER2_RESOLUTION_64_US 0b00000001
448 #define RADIOLIB_SX127X_TIMER2_RESOLUTION_4_1_MS 0b00000010
449 #define RADIOLIB_SX127X_TIMER2_RESOLUTION_262_MS 0b00000011
452 #define RADIOLIB_SX127X_TIMER1_COEFFICIENT 0xF5
455 #define RADIOLIB_SX127X_TIMER2_COEFFICIENT 0x20
458 #define RADIOLIB_SX127X_AUTO_IMAGE_CAL_OFF 0b00000000
459 #define RADIOLIB_SX127X_AUTO_IMAGE_CAL_ON 0b10000000
460 #define RADIOLIB_SX127X_IMAGE_CAL_START 0b01000000
461 #define RADIOLIB_SX127X_IMAGE_CAL_RUNNING 0b00100000
462 #define RADIOLIB_SX127X_IMAGE_CAL_COMPLETE 0b00000000
463 #define RADIOLIB_SX127X_TEMP_CHANGED 0b00001000
464 #define RADIOLIB_SX127X_TEMP_THRESHOLD_5_DEG_C 0b00000000
465 #define RADIOLIB_SX127X_TEMP_THRESHOLD_10_DEG_C 0b00000010
466 #define RADIOLIB_SX127X_TEMP_THRESHOLD_15_DEG_C 0b00000100
467 #define RADIOLIB_SX127X_TEMP_THRESHOLD_20_DEG_C 0b00000110
468 #define RADIOLIB_SX127X_TEMP_MONITOR_ON 0b00000000
469 #define RADIOLIB_SX127X_TEMP_MONITOR_OFF 0b00000001
472 #define RADIOLIB_SX127X_LOW_BAT_OFF 0b00000000
473 #define RADIOLIB_SX127X_LOW_BAT_ON 0b00001000
474 #define RADIOLIB_SX127X_LOW_BAT_TRIM_1_695_V 0b00000000
475 #define RADIOLIB_SX127X_LOW_BAT_TRIM_1_764_V 0b00000001
476 #define RADIOLIB_SX127X_LOW_BAT_TRIM_1_835_V 0b00000010
477 #define RADIOLIB_SX127X_LOW_BAT_TRIM_1_905_V 0b00000011
478 #define RADIOLIB_SX127X_LOW_BAT_TRIM_1_976_V 0b00000100
479 #define RADIOLIB_SX127X_LOW_BAT_TRIM_2_045_V 0b00000101
480 #define RADIOLIB_SX127X_LOW_BAT_TRIM_2_116_V 0b00000110
481 #define RADIOLIB_SX127X_LOW_BAT_TRIM_2_185_V 0b00000111
484 #define RADIOLIB_SX127X_FLAG_MODE_READY 0b10000000
485 #define RADIOLIB_SX127X_FLAG_RX_READY 0b01000000
486 #define RADIOLIB_SX127X_FLAG_TX_READY 0b00100000
487 #define RADIOLIB_SX127X_FLAG_PLL_LOCK 0b00010000
488 #define RADIOLIB_SX127X_FLAG_RSSI 0b00001000
489 #define RADIOLIB_SX127X_FLAG_TIMEOUT 0b00000100
490 #define RADIOLIB_SX127X_FLAG_PREAMBLE_DETECT 0b00000010
491 #define RADIOLIB_SX127X_FLAG_SYNC_ADDRESS_MATCH 0b00000001
494 #define RADIOLIB_SX127X_FLAG_FIFO_FULL 0b10000000
495 #define RADIOLIB_SX127X_FLAG_FIFO_EMPTY 0b01000000
496 #define RADIOLIB_SX127X_FLAG_FIFO_LEVEL 0b00100000
497 #define RADIOLIB_SX127X_FLAG_FIFO_OVERRUN 0b00010000
498 #define RADIOLIB_SX127X_FLAG_PACKET_SENT 0b00001000
499 #define RADIOLIB_SX127X_FLAG_PAYLOAD_READY 0b00000100
500 #define RADIOLIB_SX127X_FLAG_CRC_OK 0b00000010
501 #define RADIOLIB_SX127X_FLAG_LOW_BAT 0b00000001
504 #define RADIOLIB_SX127X_DIO0_LORA_RX_DONE 0b00000000
505 #define RADIOLIB_SX127X_DIO0_LORA_TX_DONE 0b01000000
506 #define RADIOLIB_SX127X_DIO0_LORA_CAD_DONE 0b10000000
507 #define RADIOLIB_SX127X_DIO0_CONT_MODE_READY 0b11000000
508 #define RADIOLIB_SX127X_DIO0_CONT_SYNC_ADDRESS 0b00000000
509 #define RADIOLIB_SX127X_DIO0_CONT_RSSI_PREAMBLE_DETECT 0b01000000
510 #define RADIOLIB_SX127X_DIO0_CONT_RX_READY 0b10000000
511 #define RADIOLIB_SX127X_DIO0_CONT_TX_READY 0b00000000
512 #define RADIOLIB_SX127X_DIO0_PACK_PAYLOAD_READY 0b00000000
513 #define RADIOLIB_SX127X_DIO0_PACK_PACKET_SENT 0b00000000
514 #define RADIOLIB_SX127X_DIO0_PACK_CRC_OK 0b01000000
515 #define RADIOLIB_SX127X_DIO0_PACK_TEMP_CHANGE_LOW_BAT 0b11000000
516 #define RADIOLIB_SX127X_DIO1_LORA_RX_TIMEOUT 0b00000000
517 #define RADIOLIB_SX127X_DIO1_LORA_FHSS_CHANGE_CHANNEL 0b00010000
518 #define RADIOLIB_SX127X_DIO1_LORA_CAD_DETECTED 0b00100000
519 #define RADIOLIB_SX127X_DIO1_CONT_DCLK 0b00000000
520 #define RADIOLIB_SX127X_DIO1_CONT_RSSI_PREAMBLE_DETECT 0b00010000
521 #define RADIOLIB_SX127X_DIO1_PACK_FIFO_LEVEL 0b00000000
522 #define RADIOLIB_SX127X_DIO1_PACK_FIFO_EMPTY 0b00010000
523 #define RADIOLIB_SX127X_DIO1_PACK_FIFO_FULL 0b00100000
524 #define RADIOLIB_SX127X_DIO2_LORA_FHSS_CHANGE_CHANNEL 0b00000000
525 #define RADIOLIB_SX127X_DIO2_CONT_DATA 0b00000000
526 #define RADIOLIB_SX127X_DIO2_PACK_FIFO_FULL 0b00000000
527 #define RADIOLIB_SX127X_DIO2_PACK_RX_READY 0b00000100
528 #define RADIOLIB_SX127X_DIO2_PACK_TIMEOUT 0b00001000
529 #define RADIOLIB_SX127X_DIO2_PACK_SYNC_ADDRESS 0b00011000
530 #define RADIOLIB_SX127X_DIO3_LORA_CAD_DONE 0b00000000
531 #define RADIOLIB_SX127X_DIO3_LORA_VALID_HEADER 0b00000001
532 #define RADIOLIB_SX127X_DIO3_LORA_PAYLOAD_CRC_ERROR 0b00000010
533 #define RADIOLIB_SX127X_DIO3_CONT_TIMEOUT 0b00000000
534 #define RADIOLIB_SX127X_DIO3_CONT_RSSI_PREAMBLE_DETECT 0b00000001
535 #define RADIOLIB_SX127X_DIO3_CONT_TEMP_CHANGE_LOW_BAT 0b00000011
536 #define RADIOLIB_SX127X_DIO3_PACK_FIFO_EMPTY 0b00000000
537 #define RADIOLIB_SX127X_DIO3_PACK_TX_READY 0b00000001
540 #define RADIOLIB_SX127X_DIO4_LORA_CAD_DETECTED 0b10000000
541 #define RADIOLIB_SX127X_DIO4_LORA_PLL_LOCK 0b01000000
542 #define RADIOLIB_SX127X_DIO4_CONT_TEMP_CHANGE_LOW_BAT 0b00000000
543 #define RADIOLIB_SX127X_DIO4_CONT_PLL_LOCK 0b01000000
544 #define RADIOLIB_SX127X_DIO4_CONT_TIMEOUT 0b10000000
545 #define RADIOLIB_SX127X_DIO4_CONT_MODE_READY 0b11000000
546 #define RADIOLIB_SX127X_DIO4_PACK_TEMP_CHANGE_LOW_BAT 0b00000000
547 #define RADIOLIB_SX127X_DIO4_PACK_PLL_LOCK 0b01000000
548 #define RADIOLIB_SX127X_DIO4_PACK_TIMEOUT 0b10000000
549 #define RADIOLIB_SX127X_DIO4_PACK_RSSI_PREAMBLE_DETECT 0b11000000
550 #define RADIOLIB_SX127X_DIO5_LORA_MODE_READY 0b00000000
551 #define RADIOLIB_SX127X_DIO5_LORA_CLK_OUT 0b00010000
552 #define RADIOLIB_SX127X_DIO5_CONT_CLK_OUT 0b00000000
553 #define RADIOLIB_SX127X_DIO5_CONT_PLL_LOCK 0b00010000
554 #define RADIOLIB_SX127X_DIO5_CONT_RSSI_PREAMBLE_DETECT 0b00100000
555 #define RADIOLIB_SX127X_DIO5_CONT_MODE_READY 0b00110000
556 #define RADIOLIB_SX127X_DIO5_PACK_CLK_OUT 0b00000000
557 #define RADIOLIB_SX127X_DIO5_PACK_PLL_LOCK 0b00010000
558 #define RADIOLIB_SX127X_DIO5_PACK_DATA 0b00100000
559 #define RADIOLIB_SX127X_DIO5_PACK_MODE_READY 0b00110000
560 #define RADIOLIB_SX127X_DIO_MAP_PREAMBLE_DETECT 0b00000001
561 #define RADIOLIB_SX127X_DIO_MAP_RSSI 0b00000000
564 #define RADIOLIB_SX127X_FAST_HOP_OFF 0b00000000
565 #define RADIOLIB_SX127X_FAST_HOP_ON 0b10000000
568 #define RADIOLIB_SX127X_TCXO_INPUT_EXTERNAL 0b00000000
569 #define RADIOLIB_SX127X_TCXO_INPUT_EXTERNAL_CLIPPED 0b00010000
572 #define RADIOLIB_SX127X_PLL_BANDWIDTH_75_KHZ 0b00000000
573 #define RADIOLIB_SX127X_PLL_BANDWIDTH_150_KHZ 0b01000000
574 #define RADIOLIB_SX127X_PLL_BANDWIDTH_225_KHZ 0b10000000
575 #define RADIOLIB_SX127X_PLL_BANDWIDTH_300_KHZ 0b11000000
615 int16_t
begin(uint8_t chipVersion, uint8_t syncWord, uint16_t preambleLength);
639 int16_t
beginFSK(uint8_t chipVersion,
float br,
float freqDev,
float rxBw, uint16_t preambleLength,
bool enableOOK);
653 int16_t
transmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
665 int16_t
receive(uint8_t* data,
size_t len)
override;
723 void setDio0Action(
void (*func)(
void), RADIOLIB_INTERRUPT_STATUS dir = RISING);
737 void setDio1Action(
void (*func)(
void), RADIOLIB_INTERRUPT_STATUS dir = RISING);
779 bool fifoAdd(uint8_t* data,
int totalLen,
volatile int* remLen);
792 bool fifoGet(
volatile uint8_t* data,
int totalLen,
volatile int* rcvLen);
805 int16_t
startTransmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
823 int16_t
startReceive(uint8_t len = 0, uint8_t mode = RADIOLIB_SX127X_RXCONTINUOUS);
835 int16_t
readData(uint8_t* data,
size_t len)
override;
947 int16_t
setAFC(
bool isEnabled);
967 int16_t
setSyncWord(uint8_t* syncWord,
size_t len);
1001 int16_t
setOOK(
bool enableOOK);
1108 int16_t
setRSSIConfig(uint8_t smoothingSamples, int8_t offset = 0);
1177 #if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
1190 void readBit(RADIOLIB_PIN_TYPE pin);
1230 int16_t
setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value);
1250 #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
1255 #if !defined(RADIOLIB_GODMODE)
1265 bool _crcEnabled =
false;
1267 size_t _packetLength = 0;
1269 int16_t setFrequencyRaw(
float newFreq);
1271 int16_t configFSK();
1272 int16_t getActiveModem();
1273 int16_t directMode();
1274 int16_t setPacketMode(uint8_t mode, uint8_t len);
1276 #if !defined(RADIOLIB_GODMODE)
1279 float _dataRate = 0;
1280 bool _packetLengthQueried =
false;
1281 uint8_t _packetLengthConfig = RADIOLIB_SX127X_PACKET_VARIABLE;
1283 bool findChip(uint8_t ver);
1284 int16_t setMode(uint8_t mode);
1285 int16_t setActiveModem(uint8_t modem);
1286 void clearIRQFlags();
1287 void clearFIFO(
size_t count);
1295 static uint8_t calculateBWManExp(
float bandwidth);
1297 virtual void errataFix(
bool rx) = 0;
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:16
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:14
int16_t transmit(__FlashStringHelper *fstr, uint8_t addr=0)
Arduino Flash String transmit method.
Definition: PhysicalLayer.cpp:12
int16_t readData(String &str, size_t len=0)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:61
int16_t startTransmit(String &str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:53
int16_t receive(String &str, size_t len=0)
Arduino String receive method.
Definition: PhysicalLayer.cpp:104
Base class for SX127x series. All derived classes for SX127x (e.g. SX1278 or SX1272) inherit from thi...
Definition: SX127x.h:583
void readBit(RADIOLIB_PIN_TYPE pin)
Function to read and process data bit in direct reception mode.
Definition: SX127x.cpp:1523
int16_t packetMode()
Disables direct mode and enables packet mode, allowing the module to receive packets....
Definition: SX127x.cpp:358
void clearFifoFullAction()
Clears interrupt service routine to call when FIFO is full.
Definition: SX127x.cpp:460
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 Pe...
Definition: SX127x.cpp:1039
int16_t enableBitSync()
Enable Bit synchronizer.
Definition: SX127x.cpp:1063
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_SX127X_MAX_PACKET_LENGTH_FSK)
Set modem in variable packet length mode. Available in FSK mode only.
Definition: SX127x.cpp:1143
int16_t startChannelScan()
Interrupt-driven channel activity detection method. DIO0 will be activated when LoRa preamble is dete...
Definition: SX127x.cpp:663
int16_t invertIQ(bool invertIQ)
Enables/disables Invert the LoRa I and Q signals.
Definition: SX127x.cpp:1498
void setFifoFullAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is full.
Definition: SX127x.cpp:451
int16_t setOOK(bool enableOOK)
Enables/disables OOK modulation instead of FSK.
Definition: SX127x.cpp:1071
bool fifoGet(volatile uint8_t *data, int totalLen, volatile int *rcvLen)
Set interrupt service routine function to call when FIFO is sufficently full to read.
Definition: SX127x.cpp:495
int16_t setRxBandwidth(float rxBw)
Sets FSK receiver bandwidth. Allowed values range from 2.6 to 250 kHz. Only available in FSK mode.
Definition: SX127x.cpp:909
uint8_t getModemStatus()
Reads modem status. Only available in LoRa mode.
Definition: SX127x.cpp:1266
bool fifoAdd(uint8_t *data, int totalLen, volatile int *remLen)
Set interrupt service routine function to call when FIFO is empty.
Definition: SX127x.cpp:465
virtual void reset()=0
Reset method. Will reset the chip to the default state using RST pin. Declared pure virtual since SX1...
int16_t setCurrentLimit(uint8_t currentLimit)
Sets current limit for over current protection at transmitter amplifier. Allowed values range from 45...
Definition: SX127x.cpp:701
void clearFHSSInt(void)
Clear the FHSS interrupt.
Definition: SX127x.cpp:1540
int16_t setAFC(bool isEnabled)
Enables or disables FSK automatic frequency correction(AFC)
Definition: SX127x.cpp:941
int16_t sleep()
Sets the LoRa module to sleep to save power. Module will not be able to transmit or receive any data ...
Definition: SX127x.cpp:276
int16_t setFrequencyDeviation(float freqDev) override
Sets FSK frequency deviation from carrier frequency. Allowed values depend on bit rate setting and mu...
Definition: SX127x.cpp:867
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: SX127x.cpp:1111
int16_t setOokPeakThresholdStep(uint8_t value)
Size of each decrement of the RSSI threshold in the OOK demodulator.
Definition: SX127x.cpp:1055
float getAFCError()
Gets current AFC error.
Definition: SX127x.cpp:807
int16_t setRSSIThreshold(float dbm)
Sets the RSSI value above which the RSSI interrupt is signaled.
Definition: SX127x.cpp:1203
uint8_t getFHSSChannel(void)
Gets the FHSS channel in use.
Definition: SX127x.cpp:1536
int16_t begin(uint8_t chipVersion, uint8_t syncWord, uint16_t preambleLength)
Initialization method. Will be called with appropriate parameters when calling initialization method ...
Definition: SX127x.cpp:12
int16_t setBitRate(float br)
Sets FSK bit rate. Allowed values range from 1.2 to 300 kbps. Only available in FSK mode.
Definition: SX127x.cpp:838
int16_t setAFCBandwidth(float afcBw)
Sets FSK automatic frequency correction bandwidth. Allowed values range from 2.6 to 250 kHz....
Definition: SX127x.cpp:925
uint8_t randomByte()
Get one truly random byte from RSSI noise.
Definition: SX127x.cpp:1280
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_SX127X_MAX_PACKET_LENGTH_FSK)
Set modem in fixed packet length mode. Available in FSK mode only.
Definition: SX127x.cpp:1139
void setFifoEmptyAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is empty.
Definition: SX127x.cpp:442
void setDio0Action(void(*func)(void), RADIOLIB_INTERRUPT_STATUS dir=RISING)
Set interrupt service routine function to call when DIO0 activates.
Definition: SX127x.cpp:420
void clearDio0Action()
Clears interrupt service routine to call when DIO0 activates.
Definition: SX127x.cpp:424
int16_t standby() override
Sets the LoRa module to standby.
Definition: SX127x.cpp:284
int16_t setDIOPreambleDetect(bool usePreambleDetect)
Configure DIO mapping to use RSSI or Preamble Detect for pins that support it.
Definition: SX127x.cpp:1559
int16_t setFHSSHoppingPeriod(uint8_t freqHoppingPeriod)
Sets the hopping period and enables FHSS.
Definition: SX127x.cpp:1528
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: SX127x.cpp:601
int16_t disableBitSync()
Disable Bit synchronizer (not allowed in Packet mode).
Definition: SX127x.cpp:1067
int16_t setOokThresholdType(uint8_t type)
Selects the type of threshold in the OOK data slicer.
Definition: SX127x.cpp:1031
int8_t getTempRaw()
Reads uncalibrated temperature value. This function will change operating mode and should not be call...
Definition: SX127x.cpp:1309
int16_t setCrcFiltering(bool crcOn=true)
Enable CRC filtering and generation.
Definition: SX127x.cpp:1193
void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition: SX127x.cpp:435
void setDirectAction(void(*func)(void))
Set interrupt service routine function to call when data bit is receveid in direct mode.
Definition: SX127x.cpp:1519
int16_t receiveDirect() override
Enables direct reception mode on pins DIO1 (clock) and DIO2 (data). While in direct mode,...
Definition: SX127x.cpp:321
void clearFifoEmptyAction()
Clears interrupt service routine to call when FIFO is empty.
Definition: SX127x.cpp:447
int16_t setOokPeakThresholdDecrement(uint8_t value)
Period of decrement of the RSSI threshold in the OOK demodulator.
Definition: SX127x.cpp:1047
int16_t setAFCAGCTrigger(uint8_t trigger)
Controls trigger of AFC and AGC.
Definition: SX127x.cpp:951
int16_t transmit(__FlashStringHelper *fstr, uint8_t addr=0)
Arduino Flash String transmit method.
Definition: PhysicalLayer.cpp:12
int16_t setPreambleLength(uint16_t preambleLength)
Sets LoRa or FSK preamble length. Allowed values range from 6 to 65535 in LoRa mode or 0 to 65535 in ...
Definition: SX127x.cpp:725
int16_t setNodeAddress(uint8_t nodeAddr)
Sets FSK node address. Calling this method will enable address filtering. Only available in FSK mode.
Definition: SX127x.cpp:985
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Only available in FSK mode. Allowed values are RADIOLIB_ENCODING_NRZ,...
Definition: SX127x.cpp:1232
float getSNR()
Gets signal-to-noise ratio of the latest received packet. Only available in LoRa mode.
Definition: SX127x.cpp:823
int16_t setBroadcastAddress(uint8_t broadAddr)
Sets FSK broadcast address. Calling this method will enable address filtering. Only available in FSK ...
Definition: SX127x.cpp:999
int16_t setSyncWord(uint8_t syncWord)
Sets LoRa sync word. Only available in LoRa mode.
Definition: SX127x.cpp:688
uint16_t getIRQFlags()
Reads currently active IRQ flags, can be used to check which event caused an interrupt....
Definition: SX127x.cpp:1251
SX127x(Module *mod)
Default constructor. Called internally when creating new LoRa instance.
Definition: SX127x.cpp:4
int16_t setRSSIConfig(uint8_t smoothingSamples, int8_t offset=0)
Sets RSSI measurement configuration in FSK mode.
Definition: SX127x.cpp:1209
uint32_t getTimeOnAir(size_t len)
Get expected time-on-air for a given size of payload.
Definition: SX127x.cpp:1147
uint8_t getFHSSHoppingPeriod(void)
Gets FHSS hopping period.
Definition: SX127x.cpp:1532
int16_t scanChannel()
Performs scan for valid LoRa preamble in the current channel.
Definition: SX127x.cpp:260
int16_t setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value)
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition: SX127x.cpp:1549
float getDataRate() const
Get data rate of the latest transmitted packet.
Definition: SX127x.cpp:834
int16_t beginFSK(uint8_t chipVersion, float br, float freqDev, float rxBw, uint16_t preambleLength, bool enableOOK)
Initialization method for FSK modem. Will be called with appropriate parameters when calling FSK init...
Definition: SX127x.cpp:59
int16_t startReceive(uint8_t len=0, uint8_t mode=RADIOLIB_SX127X_RXCONTINUOUS)
Interrupt-driven receive method. DIO0 will be activated when full valid packet is received.
Definition: SX127x.cpp:367
void setDio1Action(void(*func)(void), RADIOLIB_INTERRUPT_STATUS dir=RISING)
Set interrupt service routine function to call when DIO1 activates.
Definition: SX127x.cpp:428
int16_t readData(String &str, size_t len=0)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:61
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn)
Some modules contain external RF switch controlled by two pins. This function gives RadioLib control ...
Definition: SX127x.cpp:1276
int16_t getChipVersion()
Read version SPI register. Should return SX1278_CHIP_VERSION (0x12) or SX1272_CHIP_VERSION (0x22) if ...
Definition: SX127x.cpp:1305
int16_t transmitDirect(uint32_t frf=0) override
Enables direct transmission mode on pins DIO1 (clock) and DIO2 (data). While in direct mode,...
Definition: SX127x.cpp:292
int16_t startTransmit(String &str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:53
float getFrequencyError(bool autoCorrect=false)
Gets frequency error of the latest received packet.
Definition: SX127x.cpp:754
int16_t receive(String &str, size_t len=0)
Arduino String receive method.
Definition: PhysicalLayer.cpp:104
int16_t disableAddressFiltering()
Disables FSK address filtering.
Definition: SX127x.cpp:1013