diff --git a/_s_x1281_8h_source.html b/_s_x1281_8h_source.html index 4d03b86c..de41ea7e 100644 --- a/_s_x1281_8h_source.html +++ b/_s_x1281_8h_source.html @@ -112,7 +112,7 @@ $(document).ready(function(){initNavTree('_s_x1281_8h_source.html',''); initResi
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:65
SX1281
Derived class for SX1281 modules.
Definition: SX1281.h:15
SX1281::SX1281
SX1281(Module *mod)
Default constructor.
Definition: SX1281.cpp:4
-
SX128x
Base class for SX128x series. All derived classes for SX128x (e.g. SX1280 or SX1281) inherit from thi...
Definition: SX128x.h:350
+
SX128x
Base class for SX128x series. All derived classes for SX128x (e.g. SX1280 or SX1281) inherit from thi...
Definition: SX128x.h:351
diff --git a/_s_x128x_8h_source.html b/_s_x128x_8h_source.html index ed8f0370..c29b1ea8 100644 --- a/_s_x128x_8h_source.html +++ b/_s_x128x_8h_source.html @@ -110,541 +110,542 @@ $(document).ready(function(){initNavTree('_s_x128x_8h_source.html',''); initResi
22 #define RADIOLIB_SX128X_CMD_READ_REGISTER 0x19
23 #define RADIOLIB_SX128X_CMD_WRITE_BUFFER 0x1A
24 #define RADIOLIB_SX128X_CMD_READ_BUFFER 0x1B
-
25 #define RADIOLIB_SX128X_CMD_SET_SLEEP 0x84
-
26 #define RADIOLIB_SX128X_CMD_SET_STANDBY 0x80
-
27 #define RADIOLIB_SX128X_CMD_SET_FS 0xC1
-
28 #define RADIOLIB_SX128X_CMD_SET_TX 0x83
-
29 #define RADIOLIB_SX128X_CMD_SET_RX 0x82
-
30 #define RADIOLIB_SX128X_CMD_SET_RX_DUTY_CYCLE 0x94
-
31 #define RADIOLIB_SX128X_CMD_SET_CAD 0xC5
-
32 #define RADIOLIB_SX128X_CMD_SET_TX_CONTINUOUS_WAVE 0xD1
-
33 #define RADIOLIB_SX128X_CMD_SET_TX_CONTINUOUS_PREAMBLE 0xD2
-
34 #define RADIOLIB_SX128X_CMD_SET_PACKET_TYPE 0x8A
-
35 #define RADIOLIB_SX128X_CMD_GET_PACKET_TYPE 0x03
-
36 #define RADIOLIB_SX128X_CMD_SET_RF_FREQUENCY 0x86
-
37 #define RADIOLIB_SX128X_CMD_SET_TX_PARAMS 0x8E
-
38 #define RADIOLIB_SX128X_CMD_SET_CAD_PARAMS 0x88
-
39 #define RADIOLIB_SX128X_CMD_SET_BUFFER_BASE_ADDRESS 0x8F
-
40 #define RADIOLIB_SX128X_CMD_SET_MODULATION_PARAMS 0x8B
-
41 #define RADIOLIB_SX128X_CMD_SET_PACKET_PARAMS 0x8C
-
42 #define RADIOLIB_SX128X_CMD_GET_RX_BUFFER_STATUS 0x17
-
43 #define RADIOLIB_SX128X_CMD_GET_PACKET_STATUS 0x1D
-
44 #define RADIOLIB_SX128X_CMD_GET_RSSI_INST 0x1F
-
45 #define RADIOLIB_SX128X_CMD_SET_DIO_IRQ_PARAMS 0x8D
-
46 #define RADIOLIB_SX128X_CMD_GET_IRQ_STATUS 0x15
-
47 #define RADIOLIB_SX128X_CMD_CLEAR_IRQ_STATUS 0x97
-
48 #define RADIOLIB_SX128X_CMD_SET_REGULATOR_MODE 0x96
-
49 #define RADIOLIB_SX128X_CMD_SET_SAVE_CONTEXT 0xD5
-
50 #define RADIOLIB_SX128X_CMD_SET_AUTO_TX 0x98
-
51 #define RADIOLIB_SX128X_CMD_SET_AUTO_FS 0x9E
-
52 #define RADIOLIB_SX128X_CMD_SET_PERF_COUNTER_MODE 0x9C
-
53 #define RADIOLIB_SX128X_CMD_SET_LONG_PREAMBLE 0x9B
-
54 #define RADIOLIB_SX128X_CMD_SET_UART_SPEED 0x9D
-
55 #define RADIOLIB_SX128X_CMD_SET_RANGING_ROLE 0xA3
-
56 #define RADIOLIB_SX128X_CMD_SET_ADVANCED_RANGING 0x9A
-
57 
-
58 // SX128X register map
-
59 #define RADIOLIB_SX128X_REG_GAIN_MODE 0x0891
-
60 #define RADIOLIB_SX128X_REG_MANUAL_GAIN_CONTROL_ENABLE_2 0x0895
-
61 #define RADIOLIB_SX128X_REG_MANUAL_GAIN_SETTING 0x089E
-
62 #define RADIOLIB_SX128X_REG_MANUAL_GAIN_CONTROL_ENABLE_1 0x089F
-
63 #define RADIOLIB_SX128X_REG_SYNCH_PEAK_ATTENUATION 0x08C2
-
64 #define RADIOLIB_SX128X_REG_LORA_FIXED_PAYLOAD_LENGTH 0x0901
-
65 #define RADIOLIB_SX128X_REG_LORA_HEADER_MODE 0x0903
-
66 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_3 0x0912
-
67 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_2 0x0913
-
68 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_1 0x0914
-
69 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_0 0x0915
-
70 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_3 0x0916
-
71 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_2 0x0917
-
72 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_1 0x0918
-
73 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_0 0x0919
-
74 #define RADIOLIB_SX128X_REG_RANGING_FILTER_WINDOW_SIZE 0x091E
-
75 #define RADIOLIB_SX128X_REG_RANGING_FILTER_RESET 0x0923
-
76 #define RADIOLIB_SX128X_REG_RANGING_TYPE 0x0924
-
77 #define RADIOLIB_SX128X_REG_LORA_SF_CONFIG 0x0925
-
78 #define RADIOLIB_SX128X_REG_RANGING_ADDRESS_SWITCH 0x0927
-
79 #define RADIOLIB_SX128X_REG_RANGING_CALIBRATION_BYTE_2 0x092B
-
80 #define RADIOLIB_SX128X_REG_RANGING_CALIBRATION_MSB 0x092C
-
81 #define RADIOLIB_SX128X_REG_RANGING_CALIBRATION_LSB 0x092D
-
82 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_WIDTH 0x0931
-
83 #define RADIOLIB_SX128X_REG_FREQ_ERROR_CORRECTION 0x093C
-
84 #define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_MSB 0x0944
-
85 #define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_LSB 0x0945
-
86 #define RADIOLIB_SX128X_REG_RANGING_FILTER_RSSI_OFFSET 0x0953
-
87 #define RADIOLIB_SX128X_REG_FEI_MSB 0x0954
-
88 #define RADIOLIB_SX128X_REG_FEI_MID 0x0955
-
89 #define RADIOLIB_SX128X_REG_FEI_LSB 0x0956
-
90 #define RADIOLIB_SX128X_REG_RANGING_ADDRESS_MSB 0x095F
-
91 #define RADIOLIB_SX128X_REG_RANGING_ADDRESS_LSB 0x0960
-
92 #define RADIOLIB_SX128X_REG_RANGING_RESULT_MSB 0x0961
-
93 #define RADIOLIB_SX128X_REG_RANGING_RESULT_MID 0x0962
-
94 #define RADIOLIB_SX128X_REG_RANGING_RESULT_LSB 0x0963
-
95 #define RADIOLIB_SX128X_REG_RANGING_RSSI 0x0964
-
96 #define RADIOLIB_SX128X_REG_RANGING_LORA_CLOCK_ENABLE 0x097F
-
97 #define RADIOLIB_SX128X_REG_PACKET_PREAMBLE_SETTINGS 0x09C1
-
98 #define RADIOLIB_SX128X_REG_WHITENING_INITIAL_VALUE 0x09C5
-
99 #define RADIOLIB_SX128X_REG_CRC_POLYNOMIAL_MSB 0x09C6
-
100 #define RADIOLIB_SX128X_REG_CRC_POLYNOMIAL_LSB 0x09C7
-
101 #define RADIOLIB_SX128X_REG_CRC_INITIAL_MSB 0x09C8
-
102 #define RADIOLIB_SX128X_REG_CRC_INITIAL_LSB 0x09C9
-
103 #define RADIOLIB_SX128X_REG_BLE_CRC_INITIAL_MSB 0x09C7
-
104 #define RADIOLIB_SX128X_REG_BLE_CRC_INITIAL_MID (RADIOLIB_SX128X_REG_CRC_INITIAL_MSB)
-
105 #define RADIOLIB_SX128X_REG_BLE_CRC_INITIAL_LSB (RADIOLIB_SX128X_REG_CRC_INITIAL_LSB)
-
106 #define RADIOLIB_SX128X_REG_SYNCH_ADDRESS_CONTROL 0x09CD
-
107 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_4 0x09CE
-
108 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_3 0x09CF
-
109 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_2 0x09D0
-
110 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_1 0x09D1
-
111 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_0 0x09D2
-
112 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_4 0x09D3
-
113 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_3 0x09D4
-
114 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_2 0x09D5
-
115 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_1 0x09D6
-
116 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_0 0x09D7
-
117 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_4 0x09D8
-
118 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_3 0x09D9
-
119 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_2 0x09DA
-
120 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_1 0x09DB
-
121 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_0 0x09DC
-
122 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_3 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_3)
-
123 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_2 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_2)
-
124 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_1 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_1)
-
125 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_0 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_0)
-
126 
-
127 // SX128X SPI command variables
-
128 //RADIOLIB_SX128X_CMD_GET_STATUS MSB LSB DESCRIPTION
-
129 #define RADIOLIB_SX128X_STATUS_MODE_STDBY_RC 0b01000000 // 7 5 current chip mode: STDBY_RC
-
130 #define RADIOLIB_SX128X_STATUS_MODE_STDBY_XOSC 0b01100000 // 7 5 STDBY_XOSC
-
131 #define RADIOLIB_SX128X_STATUS_MODE_FS 0b10000000 // 7 5 FS
-
132 #define RADIOLIB_SX128X_STATUS_MODE_RX 0b10100000 // 7 5 Rx
-
133 #define RADIOLIB_SX128X_STATUS_MODE_TX 0b11000000 // 7 5 Tx
-
134 #define RADIOLIB_SX128X_STATUS_CMD_PROCESSED 0b00000100 // 4 2 command status: processing OK
-
135 #define RADIOLIB_SX128X_STATUS_DATA_AVAILABLE 0b00001000 // 4 2 data available
-
136 #define RADIOLIB_SX128X_STATUS_CMD_TIMEOUT 0b00001100 // 4 2 timeout
-
137 #define RADIOLIB_SX128X_STATUS_CMD_ERROR 0b00010000 // 4 2 processing error
-
138 #define RADIOLIB_SX128X_STATUS_CMD_FAILED 0b00010100 // 4 2 failed to execute
-
139 #define RADIOLIB_SX128X_STATUS_TX_DONE 0b00011000 // 4 2 transmission finished
-
140 #define RADIOLIB_SX128X_STATUS_BUSY 0b00000001 // 0 0 chip busy
-
141 #define RADIOLIB_SX128X_STATUS_SPI_FAILED 0b11111111 // 7 0 SPI transaction failed
-
142 
-
143 //RADIOLIB_SX128X_CMD_SET_SLEEP
-
144 #define RADIOLIB_SX128X_SLEEP_DATA_BUFFER_FLUSH 0b00000000 // 1 1 data buffer behavior in sleep mode: flush
-
145 #define RADIOLIB_SX128X_SLEEP_DATA_BUFFER_RETAIN 0b00000010 // 1 1 retain
-
146 #define RADIOLIB_SX128X_SLEEP_DATA_RAM_FLUSH 0b00000000 // 0 0 data RAM (configuration) behavior in sleep mode: flush
-
147 #define RADIOLIB_SX128X_SLEEP_DATA_RAM_RETAIN 0b00000001 // 0 0 retain
-
148 
-
149 //RADIOLIB_SX128X_CMD_SET_STANDBY
-
150 #define RADIOLIB_SX128X_STANDBY_RC 0x00 // 7 0 standby mode: 13 MHz RC oscillator
-
151 #define RADIOLIB_SX128X_STANDBY_XOSC 0x01 // 7 0 52 MHz crystal oscillator
-
152 
-
153 //RADIOLIB_SX128X_CMD_SET_TX + RADIOLIB_SX128X_CMD_SET_RX + RADIOLIB_SX128X_CMD_SET_RX_DUTY_CYCLE
-
154 #define RADIOLIB_SX128X_PERIOD_BASE_15_625_US 0x00 // 7 0 time period step: 15.625 us
-
155 #define RADIOLIB_SX128X_PERIOD_BASE_62_5_US 0x01 // 7 0 62.5 us
-
156 #define RADIOLIB_SX128X_PERIOD_BASE_1_MS 0x02 // 7 0 1 ms
-
157 #define RADIOLIB_SX128X_PERIOD_BASE_4_MS 0x03 // 7 0 4 ms
-
158 
-
159 //RADIOLIB_SX128X_CMD_SET_TX
-
160 #define RADIOLIB_SX128X_TX_TIMEOUT_NONE 0x0000 // 15 0 Tx timeout duration: no timeout (Tx single mode)
-
161 
-
162 //RADIOLIB_SX128X_CMD_SET_RX
-
163 #define RADIOLIB_SX128X_RX_TIMEOUT_NONE 0x0000 // 15 0 Rx timeout duration: no timeout (Rx single mode)
-
164 #define RADIOLIB_SX128X_RX_TIMEOUT_INF 0xFFFF // 15 0 infinite (Rx continuous mode)
-
165 
-
166 //RADIOLIB_SX128X_CMD_SET_PACKET_TYPE
-
167 #define RADIOLIB_SX128X_PACKET_TYPE_GFSK 0x00 // 7 0 packet type: (G)FSK
-
168 #define RADIOLIB_SX128X_PACKET_TYPE_LORA 0x01 // 7 0 LoRa
-
169 #define RADIOLIB_SX128X_PACKET_TYPE_RANGING 0x02 // 7 0 ranging engine
-
170 #define RADIOLIB_SX128X_PACKET_TYPE_FLRC 0x03 // 7 0 FLRC
-
171 #define RADIOLIB_SX128X_PACKET_TYPE_BLE 0x04 // 7 0 BLE
-
172 
-
173 //RADIOLIB_SX128X_CMD_SET_TX_PARAMS
-
174 #define RADIOLIB_SX128X_PA_RAMP_02_US 0x00 // 7 0 PA ramp time: 2 us
-
175 #define RADIOLIB_SX128X_PA_RAMP_04_US 0x20 // 7 0 4 us
-
176 #define RADIOLIB_SX128X_PA_RAMP_06_US 0x40 // 7 0 6 us
-
177 #define RADIOLIB_SX128X_PA_RAMP_08_US 0x60 // 7 0 8 us
-
178 #define RADIOLIB_SX128X_PA_RAMP_10_US 0x80 // 7 0 10 us
-
179 #define RADIOLIB_SX128X_PA_RAMP_12_US 0xA0 // 7 0 12 us
-
180 #define RADIOLIB_SX128X_PA_RAMP_16_US 0xC0 // 7 0 16 us
-
181 #define RADIOLIB_SX128X_PA_RAMP_20_US 0xE0 // 7 0 20 us
-
182 
-
183 //RADIOLIB_SX128X_CMD_SET_CAD_PARAMS
-
184 #define RADIOLIB_SX128X_CAD_ON_1_SYMB 0x00 // 7 0 number of symbols used for CAD: 1
-
185 #define RADIOLIB_SX128X_CAD_ON_2_SYMB 0x20 // 7 0 2
-
186 #define RADIOLIB_SX128X_CAD_ON_4_SYMB 0x40 // 7 0 4
-
187 #define RADIOLIB_SX128X_CAD_ON_8_SYMB 0x60 // 7 0 8
-
188 #define RADIOLIB_SX128X_CAD_ON_16_SYMB 0x80 // 7 0 16
-
189 #define RADIOLIB_SX128X_CAD_PARAM_DEFAULT RADIOLIB_SX128X_CAD_ON_8_SYMB
-
190 
-
191 //RADIOLIB_SX128X_CMD_SET_MODULATION_PARAMS
-
192 #define RADIOLIB_SX128X_BLE_GFSK_BR_2_000_BW_2_4 0x04 // 7 0 GFSK/BLE bit rate and bandwidth setting: 2.0 Mbps 2.4 MHz
-
193 #define RADIOLIB_SX128X_BLE_GFSK_BR_1_600_BW_2_4 0x28 // 7 0 1.6 Mbps 2.4 MHz
-
194 #define RADIOLIB_SX128X_BLE_GFSK_BR_1_000_BW_2_4 0x4C // 7 0 1.0 Mbps 2.4 MHz
-
195 #define RADIOLIB_SX128X_BLE_GFSK_BR_1_000_BW_1_2 0x45 // 7 0 1.0 Mbps 1.2 MHz
-
196 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_800_BW_2_4 0x70 // 7 0 0.8 Mbps 2.4 MHz
-
197 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_800_BW_1_2 0x69 // 7 0 0.8 Mbps 1.2 MHz
-
198 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_500_BW_1_2 0x8D // 7 0 0.5 Mbps 1.2 MHz
-
199 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_500_BW_0_6 0x86 // 7 0 0.5 Mbps 0.6 MHz
-
200 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_400_BW_1_2 0xB1 // 7 0 0.4 Mbps 1.2 MHz
-
201 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_400_BW_0_6 0xAA // 7 0 0.4 Mbps 0.6 MHz
-
202 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_250_BW_0_6 0xCE // 7 0 0.25 Mbps 0.6 MHz
-
203 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_250_BW_0_3 0xC7 // 7 0 0.25 Mbps 0.3 MHz
-
204 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_125_BW_0_3 0xEF // 7 0 0.125 Mbps 0.3 MHz
-
205 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_0_35 0x00 // 7 0 GFSK/BLE modulation index: 0.35
-
206 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_0_50 0x01 // 7 0 0.50
-
207 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_0_75 0x02 // 7 0 0.75
-
208 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_00 0x03 // 7 0 1.00
-
209 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_25 0x04 // 7 0 1.25
-
210 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_50 0x05 // 7 0 1.50
-
211 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_75 0x06 // 7 0 1.75
-
212 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_00 0x07 // 7 0 2.00
-
213 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_25 0x08 // 7 0 2.25
-
214 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_50 0x09 // 7 0 2.50
-
215 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_75 0x0A // 7 0 2.75
-
216 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_00 0x0B // 7 0 3.00
-
217 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_25 0x0C // 7 0 3.25
-
218 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_50 0x0D // 7 0 3.50
-
219 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_75 0x0E // 7 0 3.75
-
220 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_4_00 0x0F // 7 0 4.00
-
221 #define RADIOLIB_SX128X_BLE_GFSK_BT_OFF 0x00 // 7 0 GFSK Gaussian filter BT product: filter disabled
-
222 #define RADIOLIB_SX128X_BLE_GFSK_BT_1_0 0x10 // 7 0 1.0
-
223 #define RADIOLIB_SX128X_BLE_GFSK_BT_0_5 0x20 // 7 0 0.5
-
224 #define RADIOLIB_SX128X_FLRC_BR_1_300_BW_1_2 0x45 // 7 0 FLRC bit rate and bandwidth setting: 1.3 Mbps 1.2 MHz
-
225 #define RADIOLIB_SX128X_FLRC_BR_1_000_BW_1_2 0x69 // 7 0 1.04 Mbps 1.2 MHz
-
226 #define RADIOLIB_SX128X_FLRC_BR_0_650_BW_0_6 0x86 // 7 0 0.65 Mbps 0.6 MHz
-
227 #define RADIOLIB_SX128X_FLRC_BR_0_520_BW_0_6 0xAA // 7 0 0.52 Mbps 0.6 MHz
-
228 #define RADIOLIB_SX128X_FLRC_BR_0_325_BW_0_3 0xC7 // 7 0 0.325 Mbps 0.3 MHz
-
229 #define RADIOLIB_SX128X_FLRC_BR_0_260_BW_0_3 0xEB // 7 0 0.260 Mbps 0.3 MHz
-
230 #define RADIOLIB_SX128X_FLRC_CR_1_2 0x00 // 7 0 FLRC coding rate: 1/2
-
231 #define RADIOLIB_SX128X_FLRC_CR_3_4 0x02 // 7 0 3/4
-
232 #define RADIOLIB_SX128X_FLRC_CR_1_0 0x04 // 7 0 1/1
-
233 #define RADIOLIB_SX128X_FLRC_BT_OFF 0x00 // 7 0 FLRC Gaussian filter BT product: filter disabled
-
234 #define RADIOLIB_SX128X_FLRC_BT_1_0 0x10 // 7 0 1.0
-
235 #define RADIOLIB_SX128X_FLRC_BT_0_5 0x20 // 7 0 0.5
-
236 #define RADIOLIB_SX128X_LORA_SF_5 0x50 // 7 0 LoRa spreading factor: 5
-
237 #define RADIOLIB_SX128X_LORA_SF_6 0x60 // 7 0 6
-
238 #define RADIOLIB_SX128X_LORA_SF_7 0x70 // 7 0 7
-
239 #define RADIOLIB_SX128X_LORA_SF_8 0x80 // 7 0 8
-
240 #define RADIOLIB_SX128X_LORA_SF_9 0x90 // 7 0 9
-
241 #define RADIOLIB_SX128X_LORA_SF_10 0xA0 // 7 0 10
-
242 #define RADIOLIB_SX128X_LORA_SF_11 0xB0 // 7 0 11
-
243 #define RADIOLIB_SX128X_LORA_SF_12 0xC0 // 7 0 12
-
244 #define RADIOLIB_SX128X_LORA_BW_1625_00 0x0A // 7 0 LoRa bandwidth: 1625.0 kHz
-
245 #define RADIOLIB_SX128X_LORA_BW_812_50 0x18 // 7 0 812.5 kHz
-
246 #define RADIOLIB_SX128X_LORA_BW_406_25 0x26 // 7 0 406.25 kHz
-
247 #define RADIOLIB_SX128X_LORA_BW_203_125 0x34 // 7 0 203.125 kHz
-
248 #define RADIOLIB_SX128X_LORA_CR_4_5 0x01 // 7 0 LoRa coding rate: 4/5
-
249 #define RADIOLIB_SX128X_LORA_CR_4_6 0x02 // 7 0 4/6
-
250 #define RADIOLIB_SX128X_LORA_CR_4_7 0x03 // 7 0 4/7
-
251 #define RADIOLIB_SX128X_LORA_CR_4_8 0x04 // 7 0 4/8
-
252 #define RADIOLIB_SX128X_LORA_CR_4_5_LI 0x05 // 7 0 4/5, long interleaving
-
253 #define RADIOLIB_SX128X_LORA_CR_4_6_LI 0x06 // 7 0 4/6, long interleaving
-
254 #define RADIOLIB_SX128X_LORA_CR_4_7_LI 0x07 // 7 0 4/7, long interleaving
-
255 
-
256 //RADIOLIB_SX128X_CMD_SET_PACKET_PARAMS
-
257 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_OFF 0x00 // 7 0 GFSK/FLRC sync word used: none
-
258 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1 0x10 // 7 0 sync word 1
-
259 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_2 0x20 // 7 0 sync word 2
-
260 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1_2 0x30 // 7 0 sync words 1 and 2
-
261 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_3 0x40 // 7 0 sync word 3
-
262 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1_3 0x50 // 7 0 sync words 1 and 3
-
263 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_2_3 0x60 // 7 0 sync words 2 and 3
-
264 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1_2_3 0x70 // 7 0 sync words 1, 2 and 3
-
265 #define RADIOLIB_SX128X_GFSK_FLRC_PACKET_FIXED 0x00 // 7 0 GFSK/FLRC packet length mode: fixed
-
266 #define RADIOLIB_SX128X_GFSK_FLRC_PACKET_VARIABLE 0x20 // 7 0 variable
-
267 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_OFF 0x00 // 7 0 GFSK/FLRC packet CRC: none
-
268 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_1_BYTE 0x10 // 7 0 1 byte
-
269 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_2_BYTE 0x20 // 7 0 2 bytes
-
270 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_3_BYTE 0x30 // 7 0 3 bytes (FLRC only)
-
271 #define RADIOLIB_SX128X_GFSK_BLE_WHITENING_ON 0x00 // 7 0 GFSK/BLE whitening: enabled
-
272 #define RADIOLIB_SX128X_GFSK_BLE_WHITENING_OFF 0x08 // 7 0 disabled
-
273 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_MAX_31 0x00 // 7 0 BLE maximum payload length: 31 bytes
-
274 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_MAX_37 0x20 // 7 0 37 bytes
-
275 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_TEST 0x40 // 7 0 63 bytes (test mode)
-
276 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_MAX_255 0x80 // 7 0 255 bytes (Bluetooth 4.2 and above)
-
277 #define RADIOLIB_SX128X_BLE_CRC_OFF 0x00 // 7 0 BLE packet CRC: none
-
278 #define RADIOLIB_SX128X_BLE_CRC_3_BYTE 0x10 // 7 0 3 byte
-
279 #define RADIOLIB_SX128X_BLE_PRBS_9 0x00 // 7 0 BLE test payload contents: PRNG sequence using x^9 + x^5 + x
-
280 #define RADIOLIB_SX128X_BLE_EYELONG 0x04 // 7 0 repeated 0xF0
-
281 #define RADIOLIB_SX128X_BLE_EYESHORT 0x08 // 7 0 repeated 0xAA
-
282 #define RADIOLIB_SX128X_BLE_PRBS_15 0x0C // 7 0 PRNG sequence using x^15 + x^14 + x^13 + x^12 + x^2 + x + 1
-
283 #define RADIOLIB_SX128X_BLE_ALL_1 0x10 // 7 0 repeated 0xFF
-
284 #define RADIOLIB_SX128X_BLE_ALL_0 0x14 // 7 0 repeated 0x00
-
285 #define RADIOLIB_SX128X_BLE_EYELONG_INV 0x18 // 7 0 repeated 0x0F
-
286 #define RADIOLIB_SX128X_BLE_EYESHORT_INV 0x1C // 7 0 repeated 0x55
-
287 #define RADIOLIB_SX128X_FLRC_SYNC_WORD_OFF 0x00 // 7 0 FLRC sync word: disabled
-
288 #define RADIOLIB_SX128X_FLRC_SYNC_WORD_ON 0x04 // 7 0 enabled
-
289 #define RADIOLIB_SX128X_LORA_HEADER_EXPLICIT 0x00 // 7 0 LoRa header mode: explicit
-
290 #define RADIOLIB_SX128X_LORA_HEADER_IMPLICIT 0x80 // 7 0 implicit
-
291 #define RADIOLIB_SX128X_LORA_CRC_OFF 0x00 // 7 0 LoRa packet CRC: disabled
-
292 #define RADIOLIB_SX128X_LORA_CRC_ON 0x20 // 7 0 enabled
-
293 #define RADIOLIB_SX128X_LORA_IQ_STANDARD 0x40 // 7 0 LoRa IQ: standard
-
294 #define RADIOLIB_SX128X_LORA_IQ_INVERTED 0x00 // 7 0 inverted
-
295 
-
296 //RADIOLIB_SX128X_CMD_GET_PACKET_STATUS
-
297 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_ERROR 0b01000000 // 6 6 packet status errors byte: sync word error
-
298 #define RADIOLIB_SX128X_PACKET_STATUS_LENGTH_ERROR 0b00100000 // 5 5 packet length error
-
299 #define RADIOLIB_SX128X_PACKET_STATUS_CRC_ERROR 0b00010000 // 4 4 CRC error
-
300 #define RADIOLIB_SX128X_PACKET_STATUS_ABORT_ERROR 0b00001000 // 3 3 packet reception aborted
-
301 #define RADIOLIB_SX128X_PACKET_STATUS_HEADER_RECEIVED 0b00000100 // 2 2 header received
-
302 #define RADIOLIB_SX128X_PACKET_STATUS_PACKET_RECEIVED 0b00000010 // 1 1 packet received
-
303 #define RADIOLIB_SX128X_PACKET_STATUS_PACKET_CTRL_BUSY 0b00000001 // 0 0 packet controller is busy
-
304 #define RADIOLIB_SX128X_PACKET_STATUS_RX_PID 0b11000000 // 7 6 packet status status byte: PID field of the received packet
-
305 #define RADIOLIB_SX128X_PACKET_STATUS_NO_ACK 0b00100000 // 5 5 NO_ACK field of the received packet
-
306 #define RADIOLIB_SX128X_PACKET_STATUS_RX_PID_ERROR 0b00010000 // 4 4 PID field error
-
307 #define RADIOLIB_SX128X_PACKET_STATUS_PACKET_SENT 0b00000001 // 0 0 packet sent
-
308 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_ERROR 0b00000000 // 2 0 packet status sync byte: sync word detection error
-
309 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_1 0b00000001 // 2 0 detected sync word 1
-
310 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_2 0b00000010 // 2 0 detected sync word 2
-
311 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_3 0b00000100 // 2 0 detected sync word 3
-
312 
-
313 //RADIOLIB_SX128X_CMD_SET_DIO_IRQ_PARAMS
-
314 #define RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED 0x8000 // 15 15 interrupt source: preamble detected
-
315 #define RADIOLIB_SX128X_IRQ_ADVANCED_RANGING_DONE 0x8000 // 15 15 advanced ranging done
-
316 #define RADIOLIB_SX128X_IRQ_RX_TX_TIMEOUT 0x4000 // 14 14 Rx or Tx timeout
-
317 #define RADIOLIB_SX128X_IRQ_CAD_DETECTED 0x2000 // 13 13 channel activity detected
-
318 #define RADIOLIB_SX128X_IRQ_CAD_DONE 0x1000 // 12 12 CAD finished
-
319 #define RADIOLIB_SX128X_IRQ_RANGING_SLAVE_REQ_VALID 0x0800 // 11 11 ranging request valid (slave)
-
320 #define RADIOLIB_SX128X_IRQ_RANGING_MASTER_TIMEOUT 0x0400 // 10 10 ranging timeout (master)
-
321 #define RADIOLIB_SX128X_IRQ_RANGING_MASTER_RES_VALID 0x0200 // 9 9 ranging result valid (master)
-
322 #define RADIOLIB_SX128X_IRQ_RANGING_SLAVE_REQ_DISCARD 0x0100 // 8 8 ranging result valid (master)
-
323 #define RADIOLIB_SX128X_IRQ_RANGING_SLAVE_RESP_DONE 0x0080 // 7 7 ranging response complete (slave)
-
324 #define RADIOLIB_SX128X_IRQ_CRC_ERROR 0x0040 // 6 6 CRC error
-
325 #define RADIOLIB_SX128X_IRQ_HEADER_ERROR 0x0020 // 5 5 header error
-
326 #define RADIOLIB_SX128X_IRQ_HEADER_VALID 0x0010 // 4 4 header valid
-
327 #define RADIOLIB_SX128X_IRQ_SYNC_WORD_ERROR 0x0008 // 3 3 sync word error
-
328 #define RADIOLIB_SX128X_IRQ_SYNC_WORD_VALID 0x0004 // 2 2 sync word valid
-
329 #define RADIOLIB_SX128X_IRQ_RX_DONE 0x0002 // 1 1 Rx done
-
330 #define RADIOLIB_SX128X_IRQ_TX_DONE 0x0001 // 0 0 Tx done
-
331 #define RADIOLIB_SX128X_IRQ_NONE 0x0000 // 15 0 none
-
332 #define RADIOLIB_SX128X_IRQ_ALL 0xFFFF // 15 0 all
-
333 
-
334 //RADIOLIB_SX128X_CMD_SET_REGULATOR_MODE
-
335 #define RADIOLIB_SX128X_REGULATOR_LDO 0x00 // 7 0 set regulator mode: LDO (default)
-
336 #define RADIOLIB_SX128X_REGULATOR_DC_DC 0x01 // 7 0 DC-DC
-
337 
-
338 //RADIOLIB_SX128X_CMD_SET_RANGING_ROLE
-
339 #define RADIOLIB_SX128X_RANGING_ROLE_MASTER 0x01 // 7 0 ranging role: master
-
340 #define RADIOLIB_SX128X_RANGING_ROLE_SLAVE 0x00 // 7 0 slave
-
341 
-
342 //RADIOLIB_SX128X_REG_LORA_SYNC_WORD_1 - RADIOLIB_SX128X_REG_LORA_SYNC_WORD_2
-
343 #define RADIOLIB_SX128X_SYNC_WORD_PRIVATE 0x12
-
344 
-
350 class SX128x: public PhysicalLayer {
-
351  public:
-
352  // introduce PhysicalLayer overloads
-
353  using PhysicalLayer::transmit;
-
354  using PhysicalLayer::receive;
-
355  using PhysicalLayer::startTransmit;
-
356  using PhysicalLayer::readData;
-
357 
-
362  explicit SX128x(Module* mod);
-
363 
-
364  // basic methods
-
365 
-
377  int16_t begin(float freq = 2400.0, float bw = 812.5, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX128X_SYNC_WORD_PRIVATE, int8_t pwr = 10, uint16_t preambleLength = 12);
-
378 
-
388  int16_t beginGFSK(float freq = 2400.0, uint16_t br = 800, float freqDev = 400.0, int8_t pwr = 10, uint16_t preambleLength = 16);
-
389 
-
399  int16_t beginBLE(float freq = 2400.0, uint16_t br = 800, float freqDev = 400.0, int8_t pwr = 10, uint8_t dataShaping = RADIOLIB_SHAPING_0_5);
-
400 
-
411  int16_t beginFLRC(float freq = 2400.0, uint16_t br = 650, uint8_t cr = 3, int8_t pwr = 10, uint16_t preambleLength = 16, uint8_t dataShaping = RADIOLIB_SHAPING_0_5);
-
412 
-
419  int16_t reset(bool verify = true);
-
420 
-
429  int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
-
430 
-
438  int16_t receive(uint8_t* data, size_t len) override;
-
439 
-
445  int16_t transmitDirect(uint32_t frf = 0) override;
-
446 
-
452  int16_t receiveDirect() override;
-
453 
-
458  int16_t scanChannel() override;
-
459 
-
465  int16_t scanChannel(const ChannelScanConfig_t &config) override;
-
466 
-
472  int16_t sleep() override;
-
473 
-
480  int16_t sleep(bool retainConfig);
-
481 
-
486  int16_t standby() override;
-
487 
-
495  int16_t standby(uint8_t mode, bool wakeup = false);
-
496 
-
497  // interrupt methods
-
498 
-
503  void setDio1Action(void (*func)(void));
-
504 
-
508  void clearDio1Action();
-
509 
-
514  void setPacketReceivedAction(void (*func)(void)) override;
-
515 
-
519  void clearPacketReceivedAction() override;
-
520 
-
525  void setPacketSentAction(void (*func)(void)) override;
-
526 
-
530  void clearPacketSentAction() override;
-
531 
-
540  int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
-
541 
-
546  int16_t finishTransmit() override;
-
547 
-
554  int16_t startReceive() override;
-
555 
-
568  int16_t startReceive(uint16_t timeout, RadioLibIrqFlags_t irqFlags = RADIOLIB_IRQ_RX_DEFAULT_FLAGS, RadioLibIrqFlags_t irqMask = RADIOLIB_IRQ_RX_DEFAULT_MASK, size_t len = 0);
-
569 
-
574  uint16_t getIrqStatus();
-
575 
-
584  int16_t readData(uint8_t* data, size_t len) override;
-
585 
-
590  uint32_t getIrqFlags() override;
-
591 
-
597  int16_t setIrqFlags(uint32_t irq) override;
-
598 
-
604  int16_t clearIrqFlags(uint32_t irq) override;
-
605 
-
611  int16_t startChannelScan() override;
-
612 
-
619  int16_t startChannelScan(const ChannelScanConfig_t &config) override;
-
620 
-
625  int16_t getChannelScanResult() override;
-
626 
-
627  // configuration methods
-
628 
-
634  int16_t setFrequency(float freq) override;
-
635 
-
641  int16_t setBandwidth(float bw);
-
642 
-
648  int16_t setSpreadingFactor(uint8_t sf);
-
649 
-
657  int16_t setCodingRate(uint8_t cr, bool longInterleaving = false);
-
658 
-
664  int16_t setOutputPower(int8_t pwr) override;
-
665 
-
672  int16_t checkOutputPower(int8_t pwr, int8_t* clipped) override;
-
673 
-
679  int16_t setPreambleLength(uint32_t preambleLength);
-
680 
-
687  int16_t setBitRate(float br) override;
-
688 
-
694  int16_t setFrequencyDeviation(float freqDev) override;
-
695 
-
702  int16_t setDataShaping(uint8_t sh) override;
-
703 
-
711  int16_t setSyncWord(const uint8_t* syncWord, uint8_t len);
-
712 
-
719  int16_t setSyncWord(uint8_t syncWord, uint8_t controlBits = 0x44);
-
720 
-
728  int16_t setCRC(uint8_t len, uint32_t initial = 0x1D0F, uint16_t polynomial = 0x1021);
-
729 
-
735  int16_t setWhitening(bool enabled);
-
736 
-
742  int16_t setAccessAddress(uint32_t addr);
-
743 
-
749  int16_t setHighSensitivityMode(bool enable);
-
750 
-
756  int16_t setGainControl(uint8_t gain = 0);
-
757 
-
762  float getRSSI() override;
-
763 
-
769  float getRSSI(bool packet);
-
770 
-
775  float getSNR() override;
-
776 
-
781  float getFrequencyError();
-
782 
-
788  size_t getPacketLength(bool update = true) override;
-
789 
-
796  size_t getPacketLength(bool update, uint8_t* offset);
-
797 
-
803  RadioLibTime_t getTimeOnAir(size_t len) override;
-
804 
-
809  int16_t implicitHeader(size_t len);
-
810 
-
816  int16_t explicitHeader();
-
817 
-
823  int16_t setEncoding(uint8_t encoding) override;
-
824 
-
826  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
-
827 
-
829  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
-
830 
-
835  uint8_t randomByte() override;
-
836 
-
842  int16_t invertIQ(bool enable) override;
-
843 
-
844  #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
-
849  void setDirectAction(void (*func)(void)) override;
-
850 
-
855  void readBit(uint32_t pin) override;
-
856  #endif
-
857 
-
858 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
-
859  protected:
-
860 #endif
-
861  Module* getMod() override;
-
862 
-
863  // cached LoRa parameters
-
864  float bandwidthKhz = 0;
-
865  uint8_t bandwidth = 0, spreadingFactor = 0, codingRateLoRa = 0;
-
866  uint8_t preambleLengthLoRa = 0, headerType = 0, payloadLen = 0, crcLoRa = 0;
-
867 
-
868  // SX128x SPI command implementations
-
869  uint8_t getStatus();
-
870  int16_t writeRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
-
871  int16_t readRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
-
872  int16_t writeBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
-
873  int16_t readBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
-
874  int16_t setTx(uint16_t periodBaseCount = RADIOLIB_SX128X_TX_TIMEOUT_NONE, uint8_t periodBase = RADIOLIB_SX128X_PERIOD_BASE_15_625_US);
-
875  int16_t setRx(uint16_t periodBaseCount, uint8_t periodBase = RADIOLIB_SX128X_PERIOD_BASE_15_625_US);
-
876  int16_t setCad(uint8_t symbolNum);
-
877  uint8_t getPacketType();
-
878  int16_t setRfFrequency(uint32_t frf);
-
879  int16_t setTxParams(uint8_t pwr, uint8_t rampTime = RADIOLIB_SX128X_PA_RAMP_10_US);
-
880  int16_t setBufferBaseAddress(uint8_t txBaseAddress = 0x00, uint8_t rxBaseAddress = 0x00);
-
881  int16_t setModulationParams(uint8_t modParam1, uint8_t modParam2, uint8_t modParam3);
-
882  int16_t setPacketParamsGFSK(uint8_t preambleLen, uint8_t syncLen, uint8_t syncMatch, uint8_t crcLen, uint8_t whiten, uint8_t payLen = 0xFF, uint8_t hdrType = RADIOLIB_SX128X_GFSK_FLRC_PACKET_VARIABLE);
-
883  int16_t setPacketParamsBLE(uint8_t connState, uint8_t crcLen, uint8_t bleTest, uint8_t whiten);
-
884  int16_t setPacketParamsLoRa(uint8_t preambleLen, uint8_t hdrType, uint8_t payLen, uint8_t crc, uint8_t invIQ = RADIOLIB_SX128X_LORA_IQ_STANDARD);
-
885  int16_t setDioIrqParams(uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask = RADIOLIB_SX128X_IRQ_NONE, uint16_t dio3Mask = RADIOLIB_SX128X_IRQ_NONE);
-
886  int16_t clearIrqStatus(uint16_t clearIrqParams = RADIOLIB_SX128X_IRQ_ALL);
-
887  int16_t setRangingRole(uint8_t role);
-
888  int16_t setPacketType(uint8_t type);
-
889 
-
890 #if !RADIOLIB_GODMODE
-
891  private:
-
892 #endif
-
893  Module* mod;
-
894 
-
895  // common low-level SPI interface
-
896  static int16_t SPIparseStatus(uint8_t in);
-
897 
-
898  // common parameters
-
899  uint8_t power = 0;
-
900 
-
901  // cached LoRa parameters
-
902  uint8_t invertIQEnabled = RADIOLIB_SX128X_LORA_IQ_STANDARD;
-
903 
-
904  // cached GFSK parameters
-
905  float modIndexReal = 0;
-
906  uint16_t bitRateKbps = 0;
-
907  uint8_t bitRate = 0, modIndex = 0, shaping = 0;
-
908  uint8_t preambleLengthGFSK = 0, syncWordLen = 0, syncWordMatch = 0, crcGFSK = 0, whitening = 0;
-
909 
-
910  // cached FLRC parameters
-
911  uint8_t codingRateFLRC = 0;
-
912 
-
913  // cached BLE parameters
-
914  uint8_t connectionState = 0, crcBLE = 0, bleTestPayload = 0;
-
915 
-
916  int16_t config(uint8_t modem);
-
917  int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
-
918 };
-
919 
-
920 #endif
-
921 
-
922 #endif
+
25 #define RADIOLIB_SX128X_CMD_SAVE_CONTEXT 0xD5
+
26 #define RADIOLIB_SX128X_CMD_SET_SLEEP 0x84
+
27 #define RADIOLIB_SX128X_CMD_SET_STANDBY 0x80
+
28 #define RADIOLIB_SX128X_CMD_SET_FS 0xC1
+
29 #define RADIOLIB_SX128X_CMD_SET_TX 0x83
+
30 #define RADIOLIB_SX128X_CMD_SET_RX 0x82
+
31 #define RADIOLIB_SX128X_CMD_SET_RX_DUTY_CYCLE 0x94
+
32 #define RADIOLIB_SX128X_CMD_SET_CAD 0xC5
+
33 #define RADIOLIB_SX128X_CMD_SET_TX_CONTINUOUS_WAVE 0xD1
+
34 #define RADIOLIB_SX128X_CMD_SET_TX_CONTINUOUS_PREAMBLE 0xD2
+
35 #define RADIOLIB_SX128X_CMD_SET_PACKET_TYPE 0x8A
+
36 #define RADIOLIB_SX128X_CMD_GET_PACKET_TYPE 0x03
+
37 #define RADIOLIB_SX128X_CMD_SET_RF_FREQUENCY 0x86
+
38 #define RADIOLIB_SX128X_CMD_SET_TX_PARAMS 0x8E
+
39 #define RADIOLIB_SX128X_CMD_SET_CAD_PARAMS 0x88
+
40 #define RADIOLIB_SX128X_CMD_SET_BUFFER_BASE_ADDRESS 0x8F
+
41 #define RADIOLIB_SX128X_CMD_SET_MODULATION_PARAMS 0x8B
+
42 #define RADIOLIB_SX128X_CMD_SET_PACKET_PARAMS 0x8C
+
43 #define RADIOLIB_SX128X_CMD_GET_RX_BUFFER_STATUS 0x17
+
44 #define RADIOLIB_SX128X_CMD_GET_PACKET_STATUS 0x1D
+
45 #define RADIOLIB_SX128X_CMD_GET_RSSI_INST 0x1F
+
46 #define RADIOLIB_SX128X_CMD_SET_DIO_IRQ_PARAMS 0x8D
+
47 #define RADIOLIB_SX128X_CMD_GET_IRQ_STATUS 0x15
+
48 #define RADIOLIB_SX128X_CMD_CLEAR_IRQ_STATUS 0x97
+
49 #define RADIOLIB_SX128X_CMD_SET_REGULATOR_MODE 0x96
+
50 #define RADIOLIB_SX128X_CMD_SET_SAVE_CONTEXT 0xD5
+
51 #define RADIOLIB_SX128X_CMD_SET_AUTO_TX 0x98
+
52 #define RADIOLIB_SX128X_CMD_SET_AUTO_FS 0x9E
+
53 #define RADIOLIB_SX128X_CMD_SET_PERF_COUNTER_MODE 0x9C
+
54 #define RADIOLIB_SX128X_CMD_SET_LONG_PREAMBLE 0x9B
+
55 #define RADIOLIB_SX128X_CMD_SET_UART_SPEED 0x9D
+
56 #define RADIOLIB_SX128X_CMD_SET_RANGING_ROLE 0xA3
+
57 #define RADIOLIB_SX128X_CMD_SET_ADVANCED_RANGING 0x9A
+
58 
+
59 // SX128X register map
+
60 #define RADIOLIB_SX128X_REG_GAIN_MODE 0x0891
+
61 #define RADIOLIB_SX128X_REG_MANUAL_GAIN_CONTROL_ENABLE_2 0x0895
+
62 #define RADIOLIB_SX128X_REG_MANUAL_GAIN_SETTING 0x089E
+
63 #define RADIOLIB_SX128X_REG_MANUAL_GAIN_CONTROL_ENABLE_1 0x089F
+
64 #define RADIOLIB_SX128X_REG_SYNCH_PEAK_ATTENUATION 0x08C2
+
65 #define RADIOLIB_SX128X_REG_LORA_FIXED_PAYLOAD_LENGTH 0x0901
+
66 #define RADIOLIB_SX128X_REG_LORA_HEADER_MODE 0x0903
+
67 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_3 0x0912
+
68 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_2 0x0913
+
69 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_1 0x0914
+
70 #define RADIOLIB_SX128X_REG_MASTER_RANGING_ADDRESS_BYTE_0 0x0915
+
71 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_3 0x0916
+
72 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_2 0x0917
+
73 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_1 0x0918
+
74 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_BYTE_0 0x0919
+
75 #define RADIOLIB_SX128X_REG_RANGING_FILTER_WINDOW_SIZE 0x091E
+
76 #define RADIOLIB_SX128X_REG_RANGING_FILTER_RESET 0x0923
+
77 #define RADIOLIB_SX128X_REG_RANGING_TYPE 0x0924
+
78 #define RADIOLIB_SX128X_REG_LORA_SF_CONFIG 0x0925
+
79 #define RADIOLIB_SX128X_REG_RANGING_ADDRESS_SWITCH 0x0927
+
80 #define RADIOLIB_SX128X_REG_RANGING_CALIBRATION_BYTE_2 0x092B
+
81 #define RADIOLIB_SX128X_REG_RANGING_CALIBRATION_MSB 0x092C
+
82 #define RADIOLIB_SX128X_REG_RANGING_CALIBRATION_LSB 0x092D
+
83 #define RADIOLIB_SX128X_REG_SLAVE_RANGING_ADDRESS_WIDTH 0x0931
+
84 #define RADIOLIB_SX128X_REG_FREQ_ERROR_CORRECTION 0x093C
+
85 #define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_MSB 0x0944
+
86 #define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_LSB 0x0945
+
87 #define RADIOLIB_SX128X_REG_RANGING_FILTER_RSSI_OFFSET 0x0953
+
88 #define RADIOLIB_SX128X_REG_FEI_MSB 0x0954
+
89 #define RADIOLIB_SX128X_REG_FEI_MID 0x0955
+
90 #define RADIOLIB_SX128X_REG_FEI_LSB 0x0956
+
91 #define RADIOLIB_SX128X_REG_RANGING_ADDRESS_MSB 0x095F
+
92 #define RADIOLIB_SX128X_REG_RANGING_ADDRESS_LSB 0x0960
+
93 #define RADIOLIB_SX128X_REG_RANGING_RESULT_MSB 0x0961
+
94 #define RADIOLIB_SX128X_REG_RANGING_RESULT_MID 0x0962
+
95 #define RADIOLIB_SX128X_REG_RANGING_RESULT_LSB 0x0963
+
96 #define RADIOLIB_SX128X_REG_RANGING_RSSI 0x0964
+
97 #define RADIOLIB_SX128X_REG_RANGING_LORA_CLOCK_ENABLE 0x097F
+
98 #define RADIOLIB_SX128X_REG_PACKET_PREAMBLE_SETTINGS 0x09C1
+
99 #define RADIOLIB_SX128X_REG_WHITENING_INITIAL_VALUE 0x09C5
+
100 #define RADIOLIB_SX128X_REG_CRC_POLYNOMIAL_MSB 0x09C6
+
101 #define RADIOLIB_SX128X_REG_CRC_POLYNOMIAL_LSB 0x09C7
+
102 #define RADIOLIB_SX128X_REG_CRC_INITIAL_MSB 0x09C8
+
103 #define RADIOLIB_SX128X_REG_CRC_INITIAL_LSB 0x09C9
+
104 #define RADIOLIB_SX128X_REG_BLE_CRC_INITIAL_MSB 0x09C7
+
105 #define RADIOLIB_SX128X_REG_BLE_CRC_INITIAL_MID (RADIOLIB_SX128X_REG_CRC_INITIAL_MSB)
+
106 #define RADIOLIB_SX128X_REG_BLE_CRC_INITIAL_LSB (RADIOLIB_SX128X_REG_CRC_INITIAL_LSB)
+
107 #define RADIOLIB_SX128X_REG_SYNCH_ADDRESS_CONTROL 0x09CD
+
108 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_4 0x09CE
+
109 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_3 0x09CF
+
110 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_2 0x09D0
+
111 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_1 0x09D1
+
112 #define RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_0 0x09D2
+
113 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_4 0x09D3
+
114 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_3 0x09D4
+
115 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_2 0x09D5
+
116 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_1 0x09D6
+
117 #define RADIOLIB_SX128X_REG_SYNC_WORD_2_BYTE_0 0x09D7
+
118 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_4 0x09D8
+
119 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_3 0x09D9
+
120 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_2 0x09DA
+
121 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_1 0x09DB
+
122 #define RADIOLIB_SX128X_REG_SYNC_WORD_3_BYTE_0 0x09DC
+
123 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_3 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_3)
+
124 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_2 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_2)
+
125 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_1 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_1)
+
126 #define RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_0 (RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_0)
+
127 
+
128 // SX128X SPI command variables
+
129 //RADIOLIB_SX128X_CMD_GET_STATUS MSB LSB DESCRIPTION
+
130 #define RADIOLIB_SX128X_STATUS_MODE_STDBY_RC 0b01000000 // 7 5 current chip mode: STDBY_RC
+
131 #define RADIOLIB_SX128X_STATUS_MODE_STDBY_XOSC 0b01100000 // 7 5 STDBY_XOSC
+
132 #define RADIOLIB_SX128X_STATUS_MODE_FS 0b10000000 // 7 5 FS
+
133 #define RADIOLIB_SX128X_STATUS_MODE_RX 0b10100000 // 7 5 Rx
+
134 #define RADIOLIB_SX128X_STATUS_MODE_TX 0b11000000 // 7 5 Tx
+
135 #define RADIOLIB_SX128X_STATUS_CMD_PROCESSED 0b00000100 // 4 2 command status: processing OK
+
136 #define RADIOLIB_SX128X_STATUS_DATA_AVAILABLE 0b00001000 // 4 2 data available
+
137 #define RADIOLIB_SX128X_STATUS_CMD_TIMEOUT 0b00001100 // 4 2 timeout
+
138 #define RADIOLIB_SX128X_STATUS_CMD_ERROR 0b00010000 // 4 2 processing error
+
139 #define RADIOLIB_SX128X_STATUS_CMD_FAILED 0b00010100 // 4 2 failed to execute
+
140 #define RADIOLIB_SX128X_STATUS_TX_DONE 0b00011000 // 4 2 transmission finished
+
141 #define RADIOLIB_SX128X_STATUS_BUSY 0b00000001 // 0 0 chip busy
+
142 #define RADIOLIB_SX128X_STATUS_SPI_FAILED 0b11111111 // 7 0 SPI transaction failed
+
143 
+
144 //RADIOLIB_SX128X_CMD_SET_SLEEP
+
145 #define RADIOLIB_SX128X_SLEEP_DATA_BUFFER_FLUSH 0b00000000 // 1 1 data buffer behavior in sleep mode: flush
+
146 #define RADIOLIB_SX128X_SLEEP_DATA_BUFFER_RETAIN 0b00000010 // 1 1 retain
+
147 #define RADIOLIB_SX128X_SLEEP_DATA_RAM_FLUSH 0b00000000 // 0 0 data RAM (configuration) behavior in sleep mode: flush
+
148 #define RADIOLIB_SX128X_SLEEP_DATA_RAM_RETAIN 0b00000001 // 0 0 retain
+
149 
+
150 //RADIOLIB_SX128X_CMD_SET_STANDBY
+
151 #define RADIOLIB_SX128X_STANDBY_RC 0x00 // 7 0 standby mode: 13 MHz RC oscillator
+
152 #define RADIOLIB_SX128X_STANDBY_XOSC 0x01 // 7 0 52 MHz crystal oscillator
+
153 
+
154 //RADIOLIB_SX128X_CMD_SET_TX + RADIOLIB_SX128X_CMD_SET_RX + RADIOLIB_SX128X_CMD_SET_RX_DUTY_CYCLE
+
155 #define RADIOLIB_SX128X_PERIOD_BASE_15_625_US 0x00 // 7 0 time period step: 15.625 us
+
156 #define RADIOLIB_SX128X_PERIOD_BASE_62_5_US 0x01 // 7 0 62.5 us
+
157 #define RADIOLIB_SX128X_PERIOD_BASE_1_MS 0x02 // 7 0 1 ms
+
158 #define RADIOLIB_SX128X_PERIOD_BASE_4_MS 0x03 // 7 0 4 ms
+
159 
+
160 //RADIOLIB_SX128X_CMD_SET_TX
+
161 #define RADIOLIB_SX128X_TX_TIMEOUT_NONE 0x0000 // 15 0 Tx timeout duration: no timeout (Tx single mode)
+
162 
+
163 //RADIOLIB_SX128X_CMD_SET_RX
+
164 #define RADIOLIB_SX128X_RX_TIMEOUT_NONE 0x0000 // 15 0 Rx timeout duration: no timeout (Rx single mode)
+
165 #define RADIOLIB_SX128X_RX_TIMEOUT_INF 0xFFFF // 15 0 infinite (Rx continuous mode)
+
166 
+
167 //RADIOLIB_SX128X_CMD_SET_PACKET_TYPE
+
168 #define RADIOLIB_SX128X_PACKET_TYPE_GFSK 0x00 // 7 0 packet type: (G)FSK
+
169 #define RADIOLIB_SX128X_PACKET_TYPE_LORA 0x01 // 7 0 LoRa
+
170 #define RADIOLIB_SX128X_PACKET_TYPE_RANGING 0x02 // 7 0 ranging engine
+
171 #define RADIOLIB_SX128X_PACKET_TYPE_FLRC 0x03 // 7 0 FLRC
+
172 #define RADIOLIB_SX128X_PACKET_TYPE_BLE 0x04 // 7 0 BLE
+
173 
+
174 //RADIOLIB_SX128X_CMD_SET_TX_PARAMS
+
175 #define RADIOLIB_SX128X_PA_RAMP_02_US 0x00 // 7 0 PA ramp time: 2 us
+
176 #define RADIOLIB_SX128X_PA_RAMP_04_US 0x20 // 7 0 4 us
+
177 #define RADIOLIB_SX128X_PA_RAMP_06_US 0x40 // 7 0 6 us
+
178 #define RADIOLIB_SX128X_PA_RAMP_08_US 0x60 // 7 0 8 us
+
179 #define RADIOLIB_SX128X_PA_RAMP_10_US 0x80 // 7 0 10 us
+
180 #define RADIOLIB_SX128X_PA_RAMP_12_US 0xA0 // 7 0 12 us
+
181 #define RADIOLIB_SX128X_PA_RAMP_16_US 0xC0 // 7 0 16 us
+
182 #define RADIOLIB_SX128X_PA_RAMP_20_US 0xE0 // 7 0 20 us
+
183 
+
184 //RADIOLIB_SX128X_CMD_SET_CAD_PARAMS
+
185 #define RADIOLIB_SX128X_CAD_ON_1_SYMB 0x00 // 7 0 number of symbols used for CAD: 1
+
186 #define RADIOLIB_SX128X_CAD_ON_2_SYMB 0x20 // 7 0 2
+
187 #define RADIOLIB_SX128X_CAD_ON_4_SYMB 0x40 // 7 0 4
+
188 #define RADIOLIB_SX128X_CAD_ON_8_SYMB 0x60 // 7 0 8
+
189 #define RADIOLIB_SX128X_CAD_ON_16_SYMB 0x80 // 7 0 16
+
190 #define RADIOLIB_SX128X_CAD_PARAM_DEFAULT RADIOLIB_SX128X_CAD_ON_8_SYMB
+
191 
+
192 //RADIOLIB_SX128X_CMD_SET_MODULATION_PARAMS
+
193 #define RADIOLIB_SX128X_BLE_GFSK_BR_2_000_BW_2_4 0x04 // 7 0 GFSK/BLE bit rate and bandwidth setting: 2.0 Mbps 2.4 MHz
+
194 #define RADIOLIB_SX128X_BLE_GFSK_BR_1_600_BW_2_4 0x28 // 7 0 1.6 Mbps 2.4 MHz
+
195 #define RADIOLIB_SX128X_BLE_GFSK_BR_1_000_BW_2_4 0x4C // 7 0 1.0 Mbps 2.4 MHz
+
196 #define RADIOLIB_SX128X_BLE_GFSK_BR_1_000_BW_1_2 0x45 // 7 0 1.0 Mbps 1.2 MHz
+
197 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_800_BW_2_4 0x70 // 7 0 0.8 Mbps 2.4 MHz
+
198 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_800_BW_1_2 0x69 // 7 0 0.8 Mbps 1.2 MHz
+
199 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_500_BW_1_2 0x8D // 7 0 0.5 Mbps 1.2 MHz
+
200 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_500_BW_0_6 0x86 // 7 0 0.5 Mbps 0.6 MHz
+
201 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_400_BW_1_2 0xB1 // 7 0 0.4 Mbps 1.2 MHz
+
202 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_400_BW_0_6 0xAA // 7 0 0.4 Mbps 0.6 MHz
+
203 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_250_BW_0_6 0xCE // 7 0 0.25 Mbps 0.6 MHz
+
204 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_250_BW_0_3 0xC7 // 7 0 0.25 Mbps 0.3 MHz
+
205 #define RADIOLIB_SX128X_BLE_GFSK_BR_0_125_BW_0_3 0xEF // 7 0 0.125 Mbps 0.3 MHz
+
206 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_0_35 0x00 // 7 0 GFSK/BLE modulation index: 0.35
+
207 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_0_50 0x01 // 7 0 0.50
+
208 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_0_75 0x02 // 7 0 0.75
+
209 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_00 0x03 // 7 0 1.00
+
210 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_25 0x04 // 7 0 1.25
+
211 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_50 0x05 // 7 0 1.50
+
212 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_1_75 0x06 // 7 0 1.75
+
213 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_00 0x07 // 7 0 2.00
+
214 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_25 0x08 // 7 0 2.25
+
215 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_50 0x09 // 7 0 2.50
+
216 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_2_75 0x0A // 7 0 2.75
+
217 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_00 0x0B // 7 0 3.00
+
218 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_25 0x0C // 7 0 3.25
+
219 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_50 0x0D // 7 0 3.50
+
220 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_3_75 0x0E // 7 0 3.75
+
221 #define RADIOLIB_SX128X_BLE_GFSK_MOD_IND_4_00 0x0F // 7 0 4.00
+
222 #define RADIOLIB_SX128X_BLE_GFSK_BT_OFF 0x00 // 7 0 GFSK Gaussian filter BT product: filter disabled
+
223 #define RADIOLIB_SX128X_BLE_GFSK_BT_1_0 0x10 // 7 0 1.0
+
224 #define RADIOLIB_SX128X_BLE_GFSK_BT_0_5 0x20 // 7 0 0.5
+
225 #define RADIOLIB_SX128X_FLRC_BR_1_300_BW_1_2 0x45 // 7 0 FLRC bit rate and bandwidth setting: 1.3 Mbps 1.2 MHz
+
226 #define RADIOLIB_SX128X_FLRC_BR_1_000_BW_1_2 0x69 // 7 0 1.04 Mbps 1.2 MHz
+
227 #define RADIOLIB_SX128X_FLRC_BR_0_650_BW_0_6 0x86 // 7 0 0.65 Mbps 0.6 MHz
+
228 #define RADIOLIB_SX128X_FLRC_BR_0_520_BW_0_6 0xAA // 7 0 0.52 Mbps 0.6 MHz
+
229 #define RADIOLIB_SX128X_FLRC_BR_0_325_BW_0_3 0xC7 // 7 0 0.325 Mbps 0.3 MHz
+
230 #define RADIOLIB_SX128X_FLRC_BR_0_260_BW_0_3 0xEB // 7 0 0.260 Mbps 0.3 MHz
+
231 #define RADIOLIB_SX128X_FLRC_CR_1_2 0x00 // 7 0 FLRC coding rate: 1/2
+
232 #define RADIOLIB_SX128X_FLRC_CR_3_4 0x02 // 7 0 3/4
+
233 #define RADIOLIB_SX128X_FLRC_CR_1_0 0x04 // 7 0 1/1
+
234 #define RADIOLIB_SX128X_FLRC_BT_OFF 0x00 // 7 0 FLRC Gaussian filter BT product: filter disabled
+
235 #define RADIOLIB_SX128X_FLRC_BT_1_0 0x10 // 7 0 1.0
+
236 #define RADIOLIB_SX128X_FLRC_BT_0_5 0x20 // 7 0 0.5
+
237 #define RADIOLIB_SX128X_LORA_SF_5 0x50 // 7 0 LoRa spreading factor: 5
+
238 #define RADIOLIB_SX128X_LORA_SF_6 0x60 // 7 0 6
+
239 #define RADIOLIB_SX128X_LORA_SF_7 0x70 // 7 0 7
+
240 #define RADIOLIB_SX128X_LORA_SF_8 0x80 // 7 0 8
+
241 #define RADIOLIB_SX128X_LORA_SF_9 0x90 // 7 0 9
+
242 #define RADIOLIB_SX128X_LORA_SF_10 0xA0 // 7 0 10
+
243 #define RADIOLIB_SX128X_LORA_SF_11 0xB0 // 7 0 11
+
244 #define RADIOLIB_SX128X_LORA_SF_12 0xC0 // 7 0 12
+
245 #define RADIOLIB_SX128X_LORA_BW_1625_00 0x0A // 7 0 LoRa bandwidth: 1625.0 kHz
+
246 #define RADIOLIB_SX128X_LORA_BW_812_50 0x18 // 7 0 812.5 kHz
+
247 #define RADIOLIB_SX128X_LORA_BW_406_25 0x26 // 7 0 406.25 kHz
+
248 #define RADIOLIB_SX128X_LORA_BW_203_125 0x34 // 7 0 203.125 kHz
+
249 #define RADIOLIB_SX128X_LORA_CR_4_5 0x01 // 7 0 LoRa coding rate: 4/5
+
250 #define RADIOLIB_SX128X_LORA_CR_4_6 0x02 // 7 0 4/6
+
251 #define RADIOLIB_SX128X_LORA_CR_4_7 0x03 // 7 0 4/7
+
252 #define RADIOLIB_SX128X_LORA_CR_4_8 0x04 // 7 0 4/8
+
253 #define RADIOLIB_SX128X_LORA_CR_4_5_LI 0x05 // 7 0 4/5, long interleaving
+
254 #define RADIOLIB_SX128X_LORA_CR_4_6_LI 0x06 // 7 0 4/6, long interleaving
+
255 #define RADIOLIB_SX128X_LORA_CR_4_7_LI 0x07 // 7 0 4/7, long interleaving
+
256 
+
257 //RADIOLIB_SX128X_CMD_SET_PACKET_PARAMS
+
258 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_OFF 0x00 // 7 0 GFSK/FLRC sync word used: none
+
259 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1 0x10 // 7 0 sync word 1
+
260 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_2 0x20 // 7 0 sync word 2
+
261 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1_2 0x30 // 7 0 sync words 1 and 2
+
262 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_3 0x40 // 7 0 sync word 3
+
263 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1_3 0x50 // 7 0 sync words 1 and 3
+
264 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_2_3 0x60 // 7 0 sync words 2 and 3
+
265 #define RADIOLIB_SX128X_GFSK_FLRC_SYNC_WORD_1_2_3 0x70 // 7 0 sync words 1, 2 and 3
+
266 #define RADIOLIB_SX128X_GFSK_FLRC_PACKET_FIXED 0x00 // 7 0 GFSK/FLRC packet length mode: fixed
+
267 #define RADIOLIB_SX128X_GFSK_FLRC_PACKET_VARIABLE 0x20 // 7 0 variable
+
268 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_OFF 0x00 // 7 0 GFSK/FLRC packet CRC: none
+
269 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_1_BYTE 0x10 // 7 0 1 byte
+
270 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_2_BYTE 0x20 // 7 0 2 bytes
+
271 #define RADIOLIB_SX128X_GFSK_FLRC_CRC_3_BYTE 0x30 // 7 0 3 bytes (FLRC only)
+
272 #define RADIOLIB_SX128X_GFSK_BLE_WHITENING_ON 0x00 // 7 0 GFSK/BLE whitening: enabled
+
273 #define RADIOLIB_SX128X_GFSK_BLE_WHITENING_OFF 0x08 // 7 0 disabled
+
274 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_MAX_31 0x00 // 7 0 BLE maximum payload length: 31 bytes
+
275 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_MAX_37 0x20 // 7 0 37 bytes
+
276 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_TEST 0x40 // 7 0 63 bytes (test mode)
+
277 #define RADIOLIB_SX128X_BLE_PAYLOAD_LENGTH_MAX_255 0x80 // 7 0 255 bytes (Bluetooth 4.2 and above)
+
278 #define RADIOLIB_SX128X_BLE_CRC_OFF 0x00 // 7 0 BLE packet CRC: none
+
279 #define RADIOLIB_SX128X_BLE_CRC_3_BYTE 0x10 // 7 0 3 byte
+
280 #define RADIOLIB_SX128X_BLE_PRBS_9 0x00 // 7 0 BLE test payload contents: PRNG sequence using x^9 + x^5 + x
+
281 #define RADIOLIB_SX128X_BLE_EYELONG 0x04 // 7 0 repeated 0xF0
+
282 #define RADIOLIB_SX128X_BLE_EYESHORT 0x08 // 7 0 repeated 0xAA
+
283 #define RADIOLIB_SX128X_BLE_PRBS_15 0x0C // 7 0 PRNG sequence using x^15 + x^14 + x^13 + x^12 + x^2 + x + 1
+
284 #define RADIOLIB_SX128X_BLE_ALL_1 0x10 // 7 0 repeated 0xFF
+
285 #define RADIOLIB_SX128X_BLE_ALL_0 0x14 // 7 0 repeated 0x00
+
286 #define RADIOLIB_SX128X_BLE_EYELONG_INV 0x18 // 7 0 repeated 0x0F
+
287 #define RADIOLIB_SX128X_BLE_EYESHORT_INV 0x1C // 7 0 repeated 0x55
+
288 #define RADIOLIB_SX128X_FLRC_SYNC_WORD_OFF 0x00 // 7 0 FLRC sync word: disabled
+
289 #define RADIOLIB_SX128X_FLRC_SYNC_WORD_ON 0x04 // 7 0 enabled
+
290 #define RADIOLIB_SX128X_LORA_HEADER_EXPLICIT 0x00 // 7 0 LoRa header mode: explicit
+
291 #define RADIOLIB_SX128X_LORA_HEADER_IMPLICIT 0x80 // 7 0 implicit
+
292 #define RADIOLIB_SX128X_LORA_CRC_OFF 0x00 // 7 0 LoRa packet CRC: disabled
+
293 #define RADIOLIB_SX128X_LORA_CRC_ON 0x20 // 7 0 enabled
+
294 #define RADIOLIB_SX128X_LORA_IQ_STANDARD 0x40 // 7 0 LoRa IQ: standard
+
295 #define RADIOLIB_SX128X_LORA_IQ_INVERTED 0x00 // 7 0 inverted
+
296 
+
297 //RADIOLIB_SX128X_CMD_GET_PACKET_STATUS
+
298 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_ERROR 0b01000000 // 6 6 packet status errors byte: sync word error
+
299 #define RADIOLIB_SX128X_PACKET_STATUS_LENGTH_ERROR 0b00100000 // 5 5 packet length error
+
300 #define RADIOLIB_SX128X_PACKET_STATUS_CRC_ERROR 0b00010000 // 4 4 CRC error
+
301 #define RADIOLIB_SX128X_PACKET_STATUS_ABORT_ERROR 0b00001000 // 3 3 packet reception aborted
+
302 #define RADIOLIB_SX128X_PACKET_STATUS_HEADER_RECEIVED 0b00000100 // 2 2 header received
+
303 #define RADIOLIB_SX128X_PACKET_STATUS_PACKET_RECEIVED 0b00000010 // 1 1 packet received
+
304 #define RADIOLIB_SX128X_PACKET_STATUS_PACKET_CTRL_BUSY 0b00000001 // 0 0 packet controller is busy
+
305 #define RADIOLIB_SX128X_PACKET_STATUS_RX_PID 0b11000000 // 7 6 packet status status byte: PID field of the received packet
+
306 #define RADIOLIB_SX128X_PACKET_STATUS_NO_ACK 0b00100000 // 5 5 NO_ACK field of the received packet
+
307 #define RADIOLIB_SX128X_PACKET_STATUS_RX_PID_ERROR 0b00010000 // 4 4 PID field error
+
308 #define RADIOLIB_SX128X_PACKET_STATUS_PACKET_SENT 0b00000001 // 0 0 packet sent
+
309 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_ERROR 0b00000000 // 2 0 packet status sync byte: sync word detection error
+
310 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_1 0b00000001 // 2 0 detected sync word 1
+
311 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_2 0b00000010 // 2 0 detected sync word 2
+
312 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_3 0b00000100 // 2 0 detected sync word 3
+
313 
+
314 //RADIOLIB_SX128X_CMD_SET_DIO_IRQ_PARAMS
+
315 #define RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED 0x8000 // 15 15 interrupt source: preamble detected
+
316 #define RADIOLIB_SX128X_IRQ_ADVANCED_RANGING_DONE 0x8000 // 15 15 advanced ranging done
+
317 #define RADIOLIB_SX128X_IRQ_RX_TX_TIMEOUT 0x4000 // 14 14 Rx or Tx timeout
+
318 #define RADIOLIB_SX128X_IRQ_CAD_DETECTED 0x2000 // 13 13 channel activity detected
+
319 #define RADIOLIB_SX128X_IRQ_CAD_DONE 0x1000 // 12 12 CAD finished
+
320 #define RADIOLIB_SX128X_IRQ_RANGING_SLAVE_REQ_VALID 0x0800 // 11 11 ranging request valid (slave)
+
321 #define RADIOLIB_SX128X_IRQ_RANGING_MASTER_TIMEOUT 0x0400 // 10 10 ranging timeout (master)
+
322 #define RADIOLIB_SX128X_IRQ_RANGING_MASTER_RES_VALID 0x0200 // 9 9 ranging result valid (master)
+
323 #define RADIOLIB_SX128X_IRQ_RANGING_SLAVE_REQ_DISCARD 0x0100 // 8 8 ranging result valid (master)
+
324 #define RADIOLIB_SX128X_IRQ_RANGING_SLAVE_RESP_DONE 0x0080 // 7 7 ranging response complete (slave)
+
325 #define RADIOLIB_SX128X_IRQ_CRC_ERROR 0x0040 // 6 6 CRC error
+
326 #define RADIOLIB_SX128X_IRQ_HEADER_ERROR 0x0020 // 5 5 header error
+
327 #define RADIOLIB_SX128X_IRQ_HEADER_VALID 0x0010 // 4 4 header valid
+
328 #define RADIOLIB_SX128X_IRQ_SYNC_WORD_ERROR 0x0008 // 3 3 sync word error
+
329 #define RADIOLIB_SX128X_IRQ_SYNC_WORD_VALID 0x0004 // 2 2 sync word valid
+
330 #define RADIOLIB_SX128X_IRQ_RX_DONE 0x0002 // 1 1 Rx done
+
331 #define RADIOLIB_SX128X_IRQ_TX_DONE 0x0001 // 0 0 Tx done
+
332 #define RADIOLIB_SX128X_IRQ_NONE 0x0000 // 15 0 none
+
333 #define RADIOLIB_SX128X_IRQ_ALL 0xFFFF // 15 0 all
+
334 
+
335 //RADIOLIB_SX128X_CMD_SET_REGULATOR_MODE
+
336 #define RADIOLIB_SX128X_REGULATOR_LDO 0x00 // 7 0 set regulator mode: LDO (default)
+
337 #define RADIOLIB_SX128X_REGULATOR_DC_DC 0x01 // 7 0 DC-DC
+
338 
+
339 //RADIOLIB_SX128X_CMD_SET_RANGING_ROLE
+
340 #define RADIOLIB_SX128X_RANGING_ROLE_MASTER 0x01 // 7 0 ranging role: master
+
341 #define RADIOLIB_SX128X_RANGING_ROLE_SLAVE 0x00 // 7 0 slave
+
342 
+
343 //RADIOLIB_SX128X_REG_LORA_SYNC_WORD_1 - RADIOLIB_SX128X_REG_LORA_SYNC_WORD_2
+
344 #define RADIOLIB_SX128X_SYNC_WORD_PRIVATE 0x12
+
345 
+
351 class SX128x: public PhysicalLayer {
+
352  public:
+
353  // introduce PhysicalLayer overloads
+
354  using PhysicalLayer::transmit;
+
355  using PhysicalLayer::receive;
+
356  using PhysicalLayer::startTransmit;
+
357  using PhysicalLayer::readData;
+
358 
+
363  explicit SX128x(Module* mod);
+
364 
+
365  // basic methods
+
366 
+
378  int16_t begin(float freq = 2400.0, float bw = 812.5, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX128X_SYNC_WORD_PRIVATE, int8_t pwr = 10, uint16_t preambleLength = 12);
+
379 
+
389  int16_t beginGFSK(float freq = 2400.0, uint16_t br = 800, float freqDev = 400.0, int8_t pwr = 10, uint16_t preambleLength = 16);
+
390 
+
400  int16_t beginBLE(float freq = 2400.0, uint16_t br = 800, float freqDev = 400.0, int8_t pwr = 10, uint8_t dataShaping = RADIOLIB_SHAPING_0_5);
+
401 
+
412  int16_t beginFLRC(float freq = 2400.0, uint16_t br = 650, uint8_t cr = 3, int8_t pwr = 10, uint16_t preambleLength = 16, uint8_t dataShaping = RADIOLIB_SHAPING_0_5);
+
413 
+
420  int16_t reset(bool verify = true);
+
421 
+
430  int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
+
431 
+
439  int16_t receive(uint8_t* data, size_t len) override;
+
440 
+
446  int16_t transmitDirect(uint32_t frf = 0) override;
+
447 
+
453  int16_t receiveDirect() override;
+
454 
+
459  int16_t scanChannel() override;
+
460 
+
466  int16_t scanChannel(const ChannelScanConfig_t &config) override;
+
467 
+
473  int16_t sleep() override;
+
474 
+
481  int16_t sleep(bool retainConfig);
+
482 
+
487  int16_t standby() override;
+
488 
+
496  int16_t standby(uint8_t mode, bool wakeup = false);
+
497 
+
498  // interrupt methods
+
499 
+
504  void setDio1Action(void (*func)(void));
+
505 
+
509  void clearDio1Action();
+
510 
+
515  void setPacketReceivedAction(void (*func)(void)) override;
+
516 
+
520  void clearPacketReceivedAction() override;
+
521 
+
526  void setPacketSentAction(void (*func)(void)) override;
+
527 
+
531  void clearPacketSentAction() override;
+
532 
+
541  int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
+
542 
+
547  int16_t finishTransmit() override;
+
548 
+
555  int16_t startReceive() override;
+
556 
+
569  int16_t startReceive(uint16_t timeout, RadioLibIrqFlags_t irqFlags = RADIOLIB_IRQ_RX_DEFAULT_FLAGS, RadioLibIrqFlags_t irqMask = RADIOLIB_IRQ_RX_DEFAULT_MASK, size_t len = 0);
+
570 
+
575  uint16_t getIrqStatus();
+
576 
+
585  int16_t readData(uint8_t* data, size_t len) override;
+
586 
+
591  uint32_t getIrqFlags() override;
+
592 
+
598  int16_t setIrqFlags(uint32_t irq) override;
+
599 
+
605  int16_t clearIrqFlags(uint32_t irq) override;
+
606 
+
612  int16_t startChannelScan() override;
+
613 
+
620  int16_t startChannelScan(const ChannelScanConfig_t &config) override;
+
621 
+
626  int16_t getChannelScanResult() override;
+
627 
+
628  // configuration methods
+
629 
+
635  int16_t setFrequency(float freq) override;
+
636 
+
642  int16_t setBandwidth(float bw);
+
643 
+
649  int16_t setSpreadingFactor(uint8_t sf);
+
650 
+
658  int16_t setCodingRate(uint8_t cr, bool longInterleaving = false);
+
659 
+
665  int16_t setOutputPower(int8_t pwr) override;
+
666 
+
673  int16_t checkOutputPower(int8_t pwr, int8_t* clipped) override;
+
674 
+
680  int16_t setPreambleLength(uint32_t preambleLength);
+
681 
+
688  int16_t setBitRate(float br) override;
+
689 
+
695  int16_t setFrequencyDeviation(float freqDev) override;
+
696 
+
703  int16_t setDataShaping(uint8_t sh) override;
+
704 
+
712  int16_t setSyncWord(const uint8_t* syncWord, uint8_t len);
+
713 
+
720  int16_t setSyncWord(uint8_t syncWord, uint8_t controlBits = 0x44);
+
721 
+
729  int16_t setCRC(uint8_t len, uint32_t initial = 0x1D0F, uint16_t polynomial = 0x1021);
+
730 
+
736  int16_t setWhitening(bool enabled);
+
737 
+
743  int16_t setAccessAddress(uint32_t addr);
+
744 
+
750  int16_t setHighSensitivityMode(bool enable);
+
751 
+
757  int16_t setGainControl(uint8_t gain = 0);
+
758 
+
763  float getRSSI() override;
+
764 
+
770  float getRSSI(bool packet);
+
771 
+
776  float getSNR() override;
+
777 
+
782  float getFrequencyError();
+
783 
+
789  size_t getPacketLength(bool update = true) override;
+
790 
+
797  size_t getPacketLength(bool update, uint8_t* offset);
+
798 
+
804  RadioLibTime_t getTimeOnAir(size_t len) override;
+
805 
+
810  int16_t implicitHeader(size_t len);
+
811 
+
817  int16_t explicitHeader();
+
818 
+
824  int16_t setEncoding(uint8_t encoding) override;
+
825 
+
827  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
+
828 
+
830  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
+
831 
+
836  uint8_t randomByte() override;
+
837 
+
843  int16_t invertIQ(bool enable) override;
+
844 
+
845  #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
+
850  void setDirectAction(void (*func)(void)) override;
+
851 
+
856  void readBit(uint32_t pin) override;
+
857  #endif
+
858 
+
859 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
+
860  protected:
+
861 #endif
+
862  Module* getMod() override;
+
863 
+
864  // cached LoRa parameters
+
865  float bandwidthKhz = 0;
+
866  uint8_t bandwidth = 0, spreadingFactor = 0, codingRateLoRa = 0;
+
867  uint8_t preambleLengthLoRa = 0, headerType = 0, payloadLen = 0, crcLoRa = 0;
+
868 
+
869  // SX128x SPI command implementations
+
870  uint8_t getStatus();
+
871  int16_t writeRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
+
872  int16_t readRegister(uint16_t addr, uint8_t* data, uint8_t numBytes);
+
873  int16_t writeBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
+
874  int16_t readBuffer(uint8_t* data, uint8_t numBytes, uint8_t offset = 0x00);
+
875  int16_t setTx(uint16_t periodBaseCount = RADIOLIB_SX128X_TX_TIMEOUT_NONE, uint8_t periodBase = RADIOLIB_SX128X_PERIOD_BASE_15_625_US);
+
876  int16_t setRx(uint16_t periodBaseCount, uint8_t periodBase = RADIOLIB_SX128X_PERIOD_BASE_15_625_US);
+
877  int16_t setCad(uint8_t symbolNum);
+
878  uint8_t getPacketType();
+
879  int16_t setRfFrequency(uint32_t frf);
+
880  int16_t setTxParams(uint8_t pwr, uint8_t rampTime = RADIOLIB_SX128X_PA_RAMP_10_US);
+
881  int16_t setBufferBaseAddress(uint8_t txBaseAddress = 0x00, uint8_t rxBaseAddress = 0x00);
+
882  int16_t setModulationParams(uint8_t modParam1, uint8_t modParam2, uint8_t modParam3);
+
883  int16_t setPacketParamsGFSK(uint8_t preambleLen, uint8_t syncLen, uint8_t syncMatch, uint8_t crcLen, uint8_t whiten, uint8_t payLen = 0xFF, uint8_t hdrType = RADIOLIB_SX128X_GFSK_FLRC_PACKET_VARIABLE);
+
884  int16_t setPacketParamsBLE(uint8_t connState, uint8_t crcLen, uint8_t bleTest, uint8_t whiten);
+
885  int16_t setPacketParamsLoRa(uint8_t preambleLen, uint8_t hdrType, uint8_t payLen, uint8_t crc, uint8_t invIQ = RADIOLIB_SX128X_LORA_IQ_STANDARD);
+
886  int16_t setDioIrqParams(uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask = RADIOLIB_SX128X_IRQ_NONE, uint16_t dio3Mask = RADIOLIB_SX128X_IRQ_NONE);
+
887  int16_t clearIrqStatus(uint16_t clearIrqParams = RADIOLIB_SX128X_IRQ_ALL);
+
888  int16_t setRangingRole(uint8_t role);
+
889  int16_t setPacketType(uint8_t type);
+
890 
+
891 #if !RADIOLIB_GODMODE
+
892  private:
+
893 #endif
+
894  Module* mod;
+
895 
+
896  // common low-level SPI interface
+
897  static int16_t SPIparseStatus(uint8_t in);
+
898 
+
899  // common parameters
+
900  uint8_t power = 0;
+
901 
+
902  // cached LoRa parameters
+
903  uint8_t invertIQEnabled = RADIOLIB_SX128X_LORA_IQ_STANDARD;
+
904 
+
905  // cached GFSK parameters
+
906  float modIndexReal = 0;
+
907  uint16_t bitRateKbps = 0;
+
908  uint8_t bitRate = 0, modIndex = 0, shaping = 0;
+
909  uint8_t preambleLengthGFSK = 0, syncWordLen = 0, syncWordMatch = 0, crcGFSK = 0, whitening = 0;
+
910 
+
911  // cached FLRC parameters
+
912  uint8_t codingRateFLRC = 0;
+
913 
+
914  // cached BLE parameters
+
915  uint8_t connectionState = 0, crcBLE = 0, bleTestPayload = 0;
+
916 
+
917  int16_t config(uint8_t modem);
+
918  int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
+
919 };
+
920 
+
921 #endif
+
922 
+
923 #endif
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:65
Module::RFSWITCH_MAX_PINS
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code. Note: It is not recommended to use this c...
Definition: Module.h:74
PhysicalLayer
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:135
@@ -652,65 +653,65 @@ $(document).ready(function(){initNavTree('_s_x128x_8h_source.html',''); initResi
PhysicalLayer::transmit
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
PhysicalLayer::startTransmit
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:149
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
-
SX128x
Base class for SX128x series. All derived classes for SX128x (e.g. SX1280 or SX1281) inherit from thi...
Definition: SX128x.h:350
-
SX128x::setDio1Action
void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1 activates.
Definition: SX128x.cpp:489
-
SX128x::setPreambleLength
int16_t setPreambleLength(uint32_t preambleLength)
Sets preamble length for currently active modem. Allowed values range from 1 to 65535.
Definition: SX128x.cpp:857
-
SX128x::setOutputPower
int16_t setOutputPower(int8_t pwr) override
Sets output power. Allowed values are in range from -18 to 13 dBm.
Definition: SX128x.cpp:840
-
SX128x::setPacketSentAction
void setPacketSentAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is sent.
Definition: SX128x.cpp:505
-
SX128x::setDirectAction
void setDirectAction(void(*func)(void)) override
Dummy method, to ensure PhysicalLayer compatibility.
Definition: SX128x.cpp:1445
-
SX128x::getRSSI
float getRSSI() override
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
Definition: SX128x.cpp:1232
+
SX128x
Base class for SX128x series. All derived classes for SX128x (e.g. SX1280 or SX1281) inherit from thi...
Definition: SX128x.h:351
+
SX128x::setDio1Action
void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1 activates.
Definition: SX128x.cpp:491
+
SX128x::setPreambleLength
int16_t setPreambleLength(uint32_t preambleLength)
Sets preamble length for currently active modem. Allowed values range from 1 to 65535.
Definition: SX128x.cpp:859
+
SX128x::setOutputPower
int16_t setOutputPower(int8_t pwr) override
Sets output power. Allowed values are in range from -18 to 13 dBm.
Definition: SX128x.cpp:842
+
SX128x::setPacketSentAction
void setPacketSentAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is sent.
Definition: SX128x.cpp:507
+
SX128x::setDirectAction
void setDirectAction(void(*func)(void)) override
Dummy method, to ensure PhysicalLayer compatibility.
Definition: SX128x.cpp:1447
+
SX128x::getRSSI
float getRSSI() override
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
Definition: SX128x.cpp:1234
SX128x::reset
int16_t reset(bool verify=true)
Reset method. Will reset the chip to the default state using RST pin.
Definition: SX128x.cpp:281
-
SX128x::setFrequencyDeviation
int16_t setFrequencyDeviation(float freqDev) override
Sets FSK frequency deviation. Allowed values range from 0.0 to 3200.0 kHz.
Definition: SX128x.cpp:962
+
SX128x::setFrequencyDeviation
int16_t setFrequencyDeviation(float freqDev) override
Sets FSK frequency deviation. Allowed values range from 0.0 to 3200.0 kHz.
Definition: SX128x.cpp:964
SX128x::begin
int16_t begin(float freq=2400.0, float bw=812.5, uint8_t sf=9, uint8_t cr=7, uint8_t syncWord=RADIOLIB_SX128X_SYNC_WORD_PRIVATE, int8_t pwr=10, uint16_t preambleLength=12)
Initialization method for LoRa modem.
Definition: SX128x.cpp:19
-
SX128x::getFrequencyError
float getFrequencyError()
Gets frequency error of the latest received packet.
Definition: SX128x.cpp:1287
-
SX128x::standby
int16_t standby() override
Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator)...
Definition: SX128x.cpp:472
+
SX128x::getFrequencyError
float getFrequencyError()
Gets frequency error of the latest received packet.
Definition: SX128x.cpp:1289
+
SX128x::standby
int16_t standby() override
Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator)...
Definition: SX128x.cpp:474
SX128x::beginFLRC
int16_t beginFLRC(float freq=2400.0, uint16_t br=650, uint8_t cr=3, int8_t pwr=10, uint16_t preambleLength=16, uint8_t dataShaping=RADIOLIB_SHAPING_0_5)
Initialization method for FLRC modem.
Definition: SX128x.cpp:213
SX128x::scanChannel
int16_t scanChannel() override
Performs scan for LoRa transmission in the current channel. Detects both preamble and payload.
Definition: SX128x.cpp:423
SX128x::readData
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
-
SX128x::setGainControl
int16_t setGainControl(uint8_t gain=0)
Enables or disables receiver manual gain control.
Definition: SX128x.cpp:1196
-
SX128x::getPacketLength
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: SX128x.cpp:1320
-
SX128x::finishTransmit
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: SX128x.cpp:577
-
SX128x::invertIQ
int16_t invertIQ(bool enable) override
Enable/disable inversion of the I and Q signals.
Definition: SX128x.cpp:1430
+
SX128x::setGainControl
int16_t setGainControl(uint8_t gain=0)
Enables or disables receiver manual gain control.
Definition: SX128x.cpp:1198
+
SX128x::getPacketLength
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: SX128x.cpp:1322
+
SX128x::finishTransmit
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: SX128x.cpp:579
+
SX128x::invertIQ
int16_t invertIQ(bool enable) override
Enable/disable inversion of the I and Q signals.
Definition: SX128x.cpp:1432
SX128x::transmit
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
SX128x::transmitDirect
int16_t transmitDirect(uint32_t frf=0) override
Starts direct mode transmission.
Definition: SX128x.cpp:400
-
SX128x::setRfSwitchPins
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: SX128x.cpp:1416
-
SX128x::checkOutputPower
int16_t checkOutputPower(int8_t pwr, int8_t *clipped) override
Check if output power is configurable.
Definition: SX128x.cpp:849
-
SX128x::setIrqFlags
int16_t setIrqFlags(uint32_t irq) override
Set interrupt on DIO1 to be sent on a specific IRQ bit (e.g. RxTimeout, CadDone).
Definition: SX128x.cpp:671
-
SX128x::setHighSensitivityMode
int16_t setHighSensitivityMode(bool enable)
Enables or disables receiver high sensitivity mode.
Definition: SX128x.cpp:1179
+
SX128x::setRfSwitchPins
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: SX128x.cpp:1418
+
SX128x::checkOutputPower
int16_t checkOutputPower(int8_t pwr, int8_t *clipped) override
Check if output power is configurable.
Definition: SX128x.cpp:851
+
SX128x::setIrqFlags
int16_t setIrqFlags(uint32_t irq) override
Set interrupt on DIO1 to be sent on a specific IRQ bit (e.g. RxTimeout, CadDone).
Definition: SX128x.cpp:673
+
SX128x::setHighSensitivityMode
int16_t setHighSensitivityMode(bool enable)
Enables or disables receiver high sensitivity mode.
Definition: SX128x.cpp:1181
SX128x::beginGFSK
int16_t beginGFSK(float freq=2400.0, uint16_t br=800, float freqDev=400.0, int8_t pwr=10, uint16_t preambleLength=16)
Initialization method for GFSK modem.
Definition: SX128x.cpp:83
-
SX128x::startReceive
int16_t startReceive() override
Interrupt-driven receive method with default parameters. Implemented for compatibility with PhysicalL...
Definition: SX128x.cpp:585
-
SX128x::setEncoding
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Serves only as alias for PhysicalLayer compatibility.
Definition: SX128x.cpp:1412
-
SX128x::setWhitening
int16_t setWhitening(bool enabled)
Sets whitening parameters, not available for LoRa or FLRC modem.
Definition: SX128x.cpp:1148
-
SX128x::randomByte
uint8_t randomByte() override
Dummy random method, to ensure PhysicalLayer compatibility.
Definition: SX128x.cpp:1424
+
SX128x::startReceive
int16_t startReceive() override
Interrupt-driven receive method with default parameters. Implemented for compatibility with PhysicalL...
Definition: SX128x.cpp:587
+
SX128x::setEncoding
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Serves only as alias for PhysicalLayer compatibility.
Definition: SX128x.cpp:1414
+
SX128x::setWhitening
int16_t setWhitening(bool enabled)
Sets whitening parameters, not available for LoRa or FLRC modem.
Definition: SX128x.cpp:1150
+
SX128x::randomByte
uint8_t randomByte() override
Dummy random method, to ensure PhysicalLayer compatibility.
Definition: SX128x.cpp:1426
SX128x::startTransmit
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:149
-
SX128x::setAccessAddress
int16_t setAccessAddress(uint32_t addr)
Sets BLE access address.
Definition: SX128x.cpp:1168
-
SX128x::startChannelScan
int16_t startChannelScan() override
Interrupt-driven channel activity detection method. DIO1 will be activated when LoRa preamble is dete...
Definition: SX128x.cpp:679
-
SX128x::explicitHeader
int16_t explicitHeader()
Set explicit header mode for future reception/transmission.
Definition: SX128x.cpp:1408
-
SX128x::setDataShaping
int16_t setDataShaping(uint8_t sh) override
Sets time-bandwidth product of Gaussian filter applied for shaping. Allowed values are RADIOLIB_SHAPI...
Definition: SX128x.cpp:995
+
SX128x::setAccessAddress
int16_t setAccessAddress(uint32_t addr)
Sets BLE access address.
Definition: SX128x.cpp:1170
+
SX128x::startChannelScan
int16_t startChannelScan() override
Interrupt-driven channel activity detection method. DIO1 will be activated when LoRa preamble is dete...
Definition: SX128x.cpp:681
+
SX128x::explicitHeader
int16_t explicitHeader()
Set explicit header mode for future reception/transmission.
Definition: SX128x.cpp:1410
+
SX128x::setDataShaping
int16_t setDataShaping(uint8_t sh) override
Sets time-bandwidth product of Gaussian filter applied for shaping. Allowed values are RADIOLIB_SHAPI...
Definition: SX128x.cpp:997
SX128x::SX128x
SX128x(Module *mod)
Default constructor.
Definition: SX128x.cpp:5
-
SX128x::setCodingRate
int16_t setCodingRate(uint8_t cr, bool longInterleaving=false)
Sets LoRa coding rate denominator. Allowed values range from 5 to 8.
Definition: SX128x.cpp:812
-
SX128x::getIrqFlags
uint32_t getIrqFlags() override
Read currently active IRQ flags.
Definition: SX128x.cpp:667
-
SX128x::setCRC
int16_t setCRC(uint8_t len, uint32_t initial=0x1D0F, uint16_t polynomial=0x1021)
Sets CRC configuration.
Definition: SX128x.cpp:1084
+
SX128x::setCodingRate
int16_t setCodingRate(uint8_t cr, bool longInterleaving=false)
Sets LoRa coding rate denominator. Allowed values range from 5 to 8.
Definition: SX128x.cpp:814
+
SX128x::getIrqFlags
uint32_t getIrqFlags() override
Read currently active IRQ flags.
Definition: SX128x.cpp:669
+
SX128x::setCRC
int16_t setCRC(uint8_t len, uint32_t initial=0x1D0F, uint16_t polynomial=0x1021)
Sets CRC configuration.
Definition: SX128x.cpp:1086
SX128x::sleep
int16_t sleep() override
Sets the module to sleep mode. To wake the device up, call standby(). Overload for PhysicalLayer comp...
Definition: SX128x.cpp:452
-
SX128x::clearPacketSentAction
void clearPacketSentAction() override
Clears interrupt service routine to call when a packet is sent.
Definition: SX128x.cpp:509
+
SX128x::clearPacketSentAction
void clearPacketSentAction() override
Clears interrupt service routine to call when a packet is sent.
Definition: SX128x.cpp:511
SX128x::receive
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
-
SX128x::clearDio1Action
void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition: SX128x.cpp:493
-
SX128x::setFrequency
int16_t setFrequency(float freq) override
Sets carrier frequency. Allowed values are in range from 2400.0 to 2500.0 MHz.
Definition: SX128x.cpp:740
-
SX128x::getChannelScanResult
int16_t getChannelScanResult() override
Read the channel scan result.
Definition: SX128x.cpp:719
-
SX128x::implicitHeader
int16_t implicitHeader(size_t len)
Set implicit header mode for future reception/transmission.
Definition: SX128x.cpp:1404
-
SX128x::clearPacketReceivedAction
void clearPacketReceivedAction() override
Clears interrupt service routine to call when a packet is received.
Definition: SX128x.cpp:501
+
SX128x::clearDio1Action
void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition: SX128x.cpp:495
+
SX128x::setFrequency
int16_t setFrequency(float freq) override
Sets carrier frequency. Allowed values are in range from 2400.0 to 2500.0 MHz.
Definition: SX128x.cpp:742
+
SX128x::getChannelScanResult
int16_t getChannelScanResult() override
Read the channel scan result.
Definition: SX128x.cpp:721
+
SX128x::implicitHeader
int16_t implicitHeader(size_t len)
Set implicit header mode for future reception/transmission.
Definition: SX128x.cpp:1406
+
SX128x::clearPacketReceivedAction
void clearPacketReceivedAction() override
Clears interrupt service routine to call when a packet is received.
Definition: SX128x.cpp:503
SX128x::beginBLE
int16_t beginBLE(float freq=2400.0, uint16_t br=800, float freqDev=400.0, int8_t pwr=10, uint8_t dataShaping=RADIOLIB_SHAPING_0_5)
Initialization method for BLE modem.
Definition: SX128x.cpp:155
-
SX128x::setRfSwitchTable
void setRfSwitchTable(const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: SX128x.cpp:1420
-
SX128x::setBitRate
int16_t setBitRate(float br) override
Sets FSK or FLRC bit rate. Allowed values are 125, 250, 400, 500, 800, 1000, 1600 and 2000 kbps (for ...
Definition: SX128x.cpp:905
-
SX128x::setSyncWord
int16_t setSyncWord(const uint8_t *syncWord, uint8_t len)
Sets FSK/FLRC sync word in the form of array of up to 5 bytes (FSK). For FLRC modem,...
Definition: SX128x.cpp:1025
-
SX128x::setPacketReceivedAction
void setPacketReceivedAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is received.
Definition: SX128x.cpp:497
-
SX128x::getSNR
float getSNR() override
Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa or ranging mode...
Definition: SX128x.cpp:1267
-
SX128x::getIrqStatus
uint16_t getIrqStatus()
Reads the current IRQ status.
Definition: SX128x.cpp:1560
-
SX128x::setSpreadingFactor
int16_t setSpreadingFactor(uint8_t sf)
Sets LoRa spreading factor. Allowed values range from 5 to 12.
Definition: SX128x.cpp:778
-
SX128x::getTimeOnAir
RadioLibTime_t getTimeOnAir(size_t len) override
Get expected time-on-air for a given size of payload.
Definition: SX128x.cpp:1340
-
SX128x::setBandwidth
int16_t setBandwidth(float bw)
Sets LoRa bandwidth. Allowed values are 203.125, 406.25, 812.5 and 1625.0 kHz.
Definition: SX128x.cpp:748
-
SX128x::readBit
void readBit(uint32_t pin) override
Dummy method, to ensure PhysicalLayer compatibility.
Definition: SX128x.cpp:1451
-
SX128x::clearIrqFlags
int16_t clearIrqFlags(uint32_t irq) override
Clear interrupt on a specific IRQ bit (e.g. RxTimeout, CadDone).
Definition: SX128x.cpp:675
+
SX128x::setRfSwitchTable
void setRfSwitchTable(const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: SX128x.cpp:1422
+
SX128x::setBitRate
int16_t setBitRate(float br) override
Sets FSK or FLRC bit rate. Allowed values are 125, 250, 400, 500, 800, 1000, 1600 and 2000 kbps (for ...
Definition: SX128x.cpp:907
+
SX128x::setSyncWord
int16_t setSyncWord(const uint8_t *syncWord, uint8_t len)
Sets FSK/FLRC sync word in the form of array of up to 5 bytes (FSK). For FLRC modem,...
Definition: SX128x.cpp:1027
+
SX128x::setPacketReceivedAction
void setPacketReceivedAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is received.
Definition: SX128x.cpp:499
+
SX128x::getSNR
float getSNR() override
Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa or ranging mode...
Definition: SX128x.cpp:1269
+
SX128x::getIrqStatus
uint16_t getIrqStatus()
Reads the current IRQ status.
Definition: SX128x.cpp:1562
+
SX128x::setSpreadingFactor
int16_t setSpreadingFactor(uint8_t sf)
Sets LoRa spreading factor. Allowed values range from 5 to 12.
Definition: SX128x.cpp:780
+
SX128x::getTimeOnAir
RadioLibTime_t getTimeOnAir(size_t len) override
Get expected time-on-air for a given size of payload.
Definition: SX128x.cpp:1342
+
SX128x::setBandwidth
int16_t setBandwidth(float bw)
Sets LoRa bandwidth. Allowed values are 203.125, 406.25, 812.5 and 1625.0 kHz.
Definition: SX128x.cpp:750
+
SX128x::readBit
void readBit(uint32_t pin) override
Dummy method, to ensure PhysicalLayer compatibility.
Definition: SX128x.cpp:1453
+
SX128x::clearIrqFlags
int16_t clearIrqFlags(uint32_t irq) override
Clear interrupt on a specific IRQ bit (e.g. RxTimeout, CadDone).
Definition: SX128x.cpp:677
SX128x::receiveDirect
int16_t receiveDirect() override
Starts direct mode reception. Only implemented for PhysicalLayer compatibility, as SX128x series does...
Definition: SX128x.cpp:415
RADIOLIB_SHAPING_0_5
#define RADIOLIB_SHAPING_0_5
Gaussian shaping filter, BT = 0.5.
Definition: TypeDef.h:27
RadioLibTime_t
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition: TypeDef.h:621