RadioLib
Universal wireless communication library for Arduino
LR11x0.h
1 #if !defined(_RADIOLIB_LR11X0_H)
2 #define _RADIOLIB_LR11X0_H
3 
4 #include "../../TypeDef.h"
5 
6 #if !RADIOLIB_EXCLUDE_LR11X0
7 
8 #include "../../Module.h"
9 
10 #include "../../protocols/PhysicalLayer/PhysicalLayer.h"
11 
12 // LR11X0 physical layer properties
13 #define RADIOLIB_LR11X0_FREQUENCY_STEP_SIZE 1.0
14 #define RADIOLIB_LR11X0_MAX_PACKET_LENGTH 255
15 #define RADIOLIB_LR11X0_CRYSTAL_FREQ 32.0
16 #define RADIOLIB_LR11X0_DIV_EXPONENT 25
17 
18 // LR11X0 SPI commands
19 #define RADIOLIB_LR11X0_CMD_NOP (0x0000)
20 #define RADIOLIB_LR11X0_CMD_WRITE_REG_MEM (0x0105)
21 #define RADIOLIB_LR11X0_CMD_READ_REG_MEM (0x0106)
22 #define RADIOLIB_LR11X0_CMD_WRITE_BUFFER (0x0109)
23 #define RADIOLIB_LR11X0_CMD_READ_BUFFER (0x010A)
24 #define RADIOLIB_LR11X0_CMD_CLEAR_RX_BUFFER (0x010B)
25 #define RADIOLIB_LR11X0_CMD_WRITE_REG_MEM_MASK (0x010C)
26 #define RADIOLIB_LR11X0_CMD_GET_STATUS (0x0100)
27 #define RADIOLIB_LR11X0_CMD_GET_VERSION (0x0101)
28 #define RADIOLIB_LR11X0_CMD_GET_ERRORS (0x010D)
29 #define RADIOLIB_LR11X0_CMD_CLEAR_ERRORS (0x010E)
30 #define RADIOLIB_LR11X0_CMD_CALIBRATE (0x010F)
31 #define RADIOLIB_LR11X0_CMD_SET_REG_MODE (0x0110)
32 #define RADIOLIB_LR11X0_CMD_CALIB_IMAGE (0x0111)
33 #define RADIOLIB_LR11X0_CMD_SET_DIO_AS_RF_SWITCH (0x0112)
34 #define RADIOLIB_LR11X0_CMD_SET_DIO_IRQ_PARAMS (0x0113)
35 #define RADIOLIB_LR11X0_CMD_CLEAR_IRQ (0x0114)
36 #define RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK (0x0116)
37 #define RADIOLIB_LR11X0_CMD_SET_TCXO_MODE (0x0117)
38 #define RADIOLIB_LR11X0_CMD_REBOOT (0x0118)
39 #define RADIOLIB_LR11X0_CMD_GET_VBAT (0x0119)
40 #define RADIOLIB_LR11X0_CMD_GET_TEMP (0x011A)
41 #define RADIOLIB_LR11X0_CMD_SET_SLEEP (0x011B)
42 #define RADIOLIB_LR11X0_CMD_SET_STANDBY (0x011C)
43 #define RADIOLIB_LR11X0_CMD_SET_FS (0x011D)
44 #define RADIOLIB_LR11X0_CMD_GET_RANDOM_NUMBER (0x0120)
45 #define RADIOLIB_LR11X0_CMD_ERASE_INFO_PAGE (0x0121)
46 #define RADIOLIB_LR11X0_CMD_WRITE_INFO_PAGE (0x0122)
47 #define RADIOLIB_LR11X0_CMD_READ_INFO_PAGE (0x0123)
48 #define RADIOLIB_LR11X0_CMD_GET_CHIP_EUI (0x0125)
49 #define RADIOLIB_LR11X0_CMD_GET_SEMTECH_JOIN_EUI (0x0126)
50 #define RADIOLIB_LR11X0_CMD_DERIVE_ROOT_KEYS_AND_GET_PIN (0x0127)
51 #define RADIOLIB_LR11X0_CMD_ENABLE_SPI_CRC (0x0128)
52 #define RADIOLIB_LR11X0_CMD_DRIVE_DIOS_IN_SLEEP_MODE (0x012A)
53 #define RADIOLIB_LR11X0_CMD_RESET_STATS (0x0200)
54 #define RADIOLIB_LR11X0_CMD_GET_STATS (0x0201)
55 #define RADIOLIB_LR11X0_CMD_GET_PACKET_TYPE (0x0202)
56 #define RADIOLIB_LR11X0_CMD_GET_RX_BUFFER_STATUS (0x0203)
57 #define RADIOLIB_LR11X0_CMD_GET_PACKET_STATUS (0x0204)
58 #define RADIOLIB_LR11X0_CMD_GET_RSSI_INST (0x0205)
59 #define RADIOLIB_LR11X0_CMD_SET_GFSK_SYNC_WORD (0x0206)
60 #define RADIOLIB_LR11X0_CMD_SET_LORA_PUBLIC_NETWORK (0x0208)
61 #define RADIOLIB_LR11X0_CMD_SET_RX (0x0209)
62 #define RADIOLIB_LR11X0_CMD_SET_TX (0x020A)
63 #define RADIOLIB_LR11X0_CMD_SET_RF_FREQUENCY (0x020B)
64 #define RADIOLIB_LR11X0_CMD_AUTO_TX_RX (0x020C)
65 #define RADIOLIB_LR11X0_CMD_SET_CAD_PARAMS (0x020D)
66 #define RADIOLIB_LR11X0_CMD_SET_PACKET_TYPE (0x020E)
67 #define RADIOLIB_LR11X0_CMD_SET_MODULATION_PARAMS (0x020F)
68 #define RADIOLIB_LR11X0_CMD_SET_PACKET_PARAMS (0x0210)
69 #define RADIOLIB_LR11X0_CMD_SET_TX_PARAMS (0x0211)
70 #define RADIOLIB_LR11X0_CMD_SET_PACKET_ADRS (0x0212)
71 #define RADIOLIB_LR11X0_CMD_SET_RX_TX_FALLBACK_MODE (0x0213)
72 #define RADIOLIB_LR11X0_CMD_SET_RX_DUTY_CYCLE (0x0214)
73 #define RADIOLIB_LR11X0_CMD_SET_PA_CONFIG (0x0215)
74 #define RADIOLIB_LR11X0_CMD_STOP_TIMEOUT_ON_PREAMBLE (0x0217)
75 #define RADIOLIB_LR11X0_CMD_SET_CAD (0x0218)
76 #define RADIOLIB_LR11X0_CMD_SET_TX_CW (0x0219)
77 #define RADIOLIB_LR11X0_CMD_SET_TX_INFINITE_PREAMBLE (0x021A)
78 #define RADIOLIB_LR11X0_CMD_SET_LORA_SYNCH_TIMEOUT (0x021B)
79 #define RADIOLIB_LR11X0_CMD_SET_RANGING_ADDR (0x021C)
80 #define RADIOLIB_LR11X0_CMD_SET_RANGING_REQ_ADDR (0x021D)
81 #define RADIOLIB_LR11X0_CMD_GET_RANGING_RESULT (0x021E)
82 #define RADIOLIB_LR11X0_CMD_SET_RANGING_TX_RX_DELAY (0x021F)
83 #define RADIOLIB_LR11X0_CMD_SET_GFSK_CRC_PARAMS (0x0224)
84 #define RADIOLIB_LR11X0_CMD_SET_GFSK_WHIT_PARAMS (0x0225)
85 #define RADIOLIB_LR11X0_CMD_SET_RX_BOOSTED (0x0227)
86 #define RADIOLIB_LR11X0_CMD_SET_RANGING_PARAMETER (0x0228)
87 #define RADIOLIB_LR11X0_CMD_SET_RSSI_CALIBRATION (0x0229)
88 #define RADIOLIB_LR11X0_CMD_SET_LORA_SYNC_WORD (0x022B)
89 #define RADIOLIB_LR11X0_CMD_LR_FHSS_BUILD_FRAME (0x022C)
90 #define RADIOLIB_LR11X0_CMD_LR_FHSS_SET_SYNC_WORD (0x022D)
91 #define RADIOLIB_LR11X0_CMD_CONFIG_BLE_BEACON (0x022E)
92 #define RADIOLIB_LR11X0_CMD_GET_LORA_RX_HEADER_INFOS (0x0230)
93 #define RADIOLIB_LR11X0_CMD_BLE_BEACON_SEND (0x0231)
94 #define RADIOLIB_LR11X0_CMD_WIFI_SCAN (0x0300)
95 #define RADIOLIB_LR11X0_CMD_WIFI_SCAN_TIME_LIMIT (0x0301)
96 #define RADIOLIB_LR11X0_CMD_WIFI_COUNTRY_CODE (0x0302)
97 #define RADIOLIB_LR11X0_CMD_WIFI_COUNTRY_CODE_TIME_LIMIT (0x0303)
98 #define RADIOLIB_LR11X0_CMD_WIFI_GET_NB_RESULTS (0x0305)
99 #define RADIOLIB_LR11X0_CMD_WIFI_READ_RESULTS (0x0306)
100 #define RADIOLIB_LR11X0_CMD_WIFI_RESET_CUMUL_TIMINGS (0x0307)
101 #define RADIOLIB_LR11X0_CMD_WIFI_READ_CUMUL_TIMINGS (0x0308)
102 #define RADIOLIB_LR11X0_CMD_WIFI_GET_NB_COUNTRY_CODE_RESULTS (0x0309)
103 #define RADIOLIB_LR11X0_CMD_WIFI_READ_COUNTRY_CODE_RESULTS (0x030A)
104 #define RADIOLIB_LR11X0_CMD_WIFI_CFG_TIMESTAMP_AP_PHONE (0x030B)
105 #define RADIOLIB_LR11X0_CMD_WIFI_READ_VERSION (0x0320)
106 #define RADIOLIB_LR11X0_CMD_GNSS_SET_CONSTELLATION_TO_USE (0x0400)
107 #define RADIOLIB_LR11X0_CMD_GNSS_READ_CONSTELLATION_TO_USE (0x0401)
108 #define RADIOLIB_LR11X0_CMD_GNSS_SET_ALMANAC_UPDATE (0x0402)
109 #define RADIOLIB_LR11X0_CMD_GNSS_READ_ALMANAC_UPDATE (0x0403)
110 #define RADIOLIB_LR11X0_CMD_GNSS_READ_VERSION (0x0406)
111 #define RADIOLIB_LR11X0_CMD_GNSS_READ_SUPPORTED_CONSTELLATIONS (0x0407)
112 #define RADIOLIB_LR11X0_CMD_GNSS_SET_MODE (0x0408)
113 #define RADIOLIB_LR11X0_CMD_GNSS_AUTONOMOUS (0x0409)
114 #define RADIOLIB_LR11X0_CMD_GNSS_ASSISTED (0x040A)
115 #define RADIOLIB_LR11X0_CMD_GNSS_SCAN (0x040B)
116 #define RADIOLIB_LR11X0_CMD_GNSS_GET_RESULT_SIZE (0x040C)
117 #define RADIOLIB_LR11X0_CMD_GNSS_READ_RESULTS (0x040D)
118 #define RADIOLIB_LR11X0_CMD_GNSS_ALMANAC_FULL_UPDATE (0x040E)
119 #define RADIOLIB_LR11X0_CMD_GNSS_SET_ASSISTANCE_POSITION (0x0410)
120 #define RADIOLIB_LR11X0_CMD_GNSS_READ_ASSISTANCE_POSITION (0x0411)
121 #define RADIOLIB_LR11X0_CMD_GNSS_PUSH_SOLVER_MSG (0x0414)
122 #define RADIOLIB_LR11X0_CMD_GNSS_PUSH_DM_MSG (0x0415)
123 #define RADIOLIB_LR11X0_CMD_GNSS_GET_CONTEXT_STATUS (0x0416)
124 #define RADIOLIB_LR11X0_CMD_GNSS_GET_NB_SV_DETECTED (0x0417)
125 #define RADIOLIB_LR11X0_CMD_GNSS_GET_SV_DETECTED (0x0418)
126 #define RADIOLIB_LR11X0_CMD_GNSS_GET_CONSUMPTION (0x0419)
127 #define RADIOLIB_LR11X0_CMD_GNSS_GET_SV_VISIBLE (0x041F)
128 #define RADIOLIB_LR11X0_CMD_GNSS_READ_LAST_SCAN_MODE_LAUNCHED (0x0426)
129 #define RADIOLIB_LR11X0_CMD_GNSS_FETCH_TIME (0x0432)
130 #define RADIOLIB_LR11X0_CMD_GNSS_READ_TIME (0x0434)
131 #define RADIOLIB_LR11X0_CMD_GNSS_RESET_TIME (0x0435)
132 #define RADIOLIB_LR11X0_CMD_GNSS_RESET_POSITION (0x0437)
133 #define RADIOLIB_LR11X0_CMD_GNSS_READ_DEMOD_STATUS (0x0439)
134 #define RADIOLIB_LR11X0_CMD_GNSS_READ_CUMUL_TIMING (0x044A)
135 #define RADIOLIB_LR11X0_CMD_GNSS_SET_TIME (0x044B)
136 #define RADIOLIB_LR11X0_CMD_GNSS_READ_DOPPLER_SOLVER_RES (0x044F)
137 #define RADIOLIB_LR11X0_CMD_GNSS_READ_DELAY_RESET_AP (0x0453)
138 #define RADIOLIB_LR11X0_CMD_GNSS_ALMANAC_UPDATE_FROM_SAT (0x0455)
139 #define RADIOLIB_LR11X0_CMD_GNSS_READ_ALMANAC_STATUS (0x0457)
140 #define RADIOLIB_LR11X0_CMD_GNSS_CONFIG_ALMANAC_UPDATE_PERIOD (0x0463)
141 #define RADIOLIB_LR11X0_CMD_GNSS_READ_ALMANAC_UPDATE_PERIOD (0x0464)
142 #define RADIOLIB_LR11X0_CMD_GNSS_CONFIG_DELAY_RESET_AP (0x0465)
143 #define RADIOLIB_LR11X0_CMD_GNSS_GET_SV_WARM_START (0x0466)
144 #define RADIOLIB_LR11X0_CMD_GNSS_READ_WN_ROLLOVER (0x0467)
145 #define RADIOLIB_LR11X0_CMD_GNSS_READ_WARM_START_STATUS (0x0469)
146 #define RADIOLIB_LR11X0_CMD_GNSS_WRITE_BIT_MASK_SAT_ACTIVATED (0x0472)
147 #define RADIOLIB_LR11X0_CMD_CRYPTO_SET_KEY (0x0502)
148 #define RADIOLIB_LR11X0_CMD_CRYPTO_DERIVE_KEY (0x0503)
149 #define RADIOLIB_LR11X0_CMD_CRYPTO_PROCESS_JOIN_ACCEPT (0x0504)
150 #define RADIOLIB_LR11X0_CMD_CRYPTO_COMPUTE_AES_CMAC (0x0505)
151 #define RADIOLIB_LR11X0_CMD_CRYPTO_VERIFY_AES_CMAC (0x0506)
152 #define RADIOLIB_LR11X0_CMD_CRYPTO_AES_ENCRYPT_01 (0x0507)
153 #define RADIOLIB_LR11X0_CMD_CRYPTO_AES_ENCRYPT (0x0508)
154 #define RADIOLIB_LR11X0_CMD_CRYPTO_AES_DECRYPT (0x0509)
155 #define RADIOLIB_LR11X0_CMD_CRYPTO_STORE_TO_FLASH (0x050A)
156 #define RADIOLIB_LR11X0_CMD_CRYPTO_RESTORE_FROM_FLASH (0x050B)
157 #define RADIOLIB_LR11X0_CMD_CRYPTO_SET_PARAM (0x050D)
158 #define RADIOLIB_LR11X0_CMD_CRYPTO_GET_PARAM (0x050E)
159 #define RADIOLIB_LR11X0_CMD_CRYPTO_CHECK_ENCRYPTED_FIRMWARE_IMAGE (0x050F)
160 #define RADIOLIB_LR11X0_CMD_CRYPTO_CHECK_ENCRYPTED_FIRMWARE_IMAGE_RESULT (0x0510)
161 #define RADIOLIB_LR11X0_CMD_BOOT_ERASE_FLASH (0x8000)
162 #define RADIOLIB_LR11X0_CMD_BOOT_WRITE_FLASH_ENCRYPTED (0x8003)
163 #define RADIOLIB_LR11X0_CMD_BOOT_REBOOT (0x8005)
164 #define RADIOLIB_LR11X0_CMD_BOOT_GET_PIN (0x800B)
165 #define RADIOLIB_LR11X0_CMD_BOOT_GET_CHIP_EUI (0x800C)
166 #define RADIOLIB_LR11X0_CMD_BOOT_GET_JOIN_EUI (0x800D)
167 
168 // LR11X0 register map
169 #define RADIOLIB_LR11X0_REG_SF6_SX127X_COMPAT (0x00F20414)
170 #define RADIOLIB_LR11X0_REG_LORA_HIGH_POWER_FIX (0x00F30054)
171 // TODO add fix for br 600/1200 bps
172 
173 // LR11X0 SPI command variables
174 
175 // RADIOLIB_LR11X0_CMD_GET_STATUS MSB LSB DESCRIPTION
176 #define RADIOLIB_LR11X0_STAT_1_CMD_FAIL (0x00UL << 1) // 3 1 command status: last command could not be executed
177 #define RADIOLIB_LR11X0_STAT_1_CMD_PERR (0x01UL << 1) // 3 1 processing error
178 #define RADIOLIB_LR11X0_STAT_1_CMD_OK (0x02UL << 1) // 3 1 successfully processed
179 #define RADIOLIB_LR11X0_STAT_1_CMD_DAT (0x03UL << 1) // 3 1 successfully processed, data is being transmitted
180 #define RADIOLIB_LR11X0_STAT_1_IRQ_INACTIVE (0x00UL << 0) // 0 0 interrupt status: inactive
181 #define RADIOLIB_LR11X0_STAT_1_IRQ_ACTIVE (0x01UL << 0) // 0 0 at least 1 interrupt active
182 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_CLEARED (0x00UL << 4) // 7 4 reset status: cleared
183 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_ANALOG (0x01UL << 4) // 7 4 analog (power on, brown-out)
184 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_EXTERNAL (0x02UL << 4) // 7 4 NRESET pin
185 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_SYSTEM (0x03UL << 4) // 7 4 system
186 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_WATCHDOG (0x04UL << 4) // 7 4 watchdog
187 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_WAKEUP (0x05UL << 4) // 7 4 NSS toggling wake-up
188 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_RTC (0x06UL << 4) // 7 4 realtime clock
189 #define RADIOLIB_LR11X0_STAT_2_MODE_SLEEP (0x00UL << 1) // 3 1 chip mode: sleep
190 #define RADIOLIB_LR11X0_STAT_2_MODE_STBY_RC (0x01UL << 1) // 3 1 standby with RC oscillator
191 #define RADIOLIB_LR11X0_STAT_2_MODE_STBY_OSC (0x02UL << 1) // 3 1 standby with external oscillator
192 #define RADIOLIB_LR11X0_STAT_2_MODE_FS (0x03UL << 1) // 3 1 frequency synthesis
193 #define RADIOLIB_LR11X0_STAT_2_MODE_RX (0x04UL << 1) // 3 1 receive
194 #define RADIOLIB_LR11X0_STAT_2_MODE_TX (0x05UL << 1) // 3 1 transmit
195 #define RADIOLIB_LR11X0_STAT_2_MODE_WIFI_GNSS (0x06UL << 1) // 3 1 WiFi or GNSS geolocation
196 #define RADIOLIB_LR11X0_STAT_2_BOOT (0x00UL << 0) // 0 0 code executed from: bootloader
197 #define RADIOLIB_LR11X0_STAT_2_FLASH (0x01UL << 0) // 0 0 flash
198 
199 // RADIOLIB_LR11X0_CMD_WRITE_REG_MEM
200 #define RADIOLIB_LR11X0_SPI_MAX_READ_WRITE_LEN (256) // 7 0 maximum length of read/write SPI payload in bytes
201 
202 // RADIOLIB_LR11X0_CMD_GET_VERSION
203 #define RADIOLIB_LR11X0_DEVICE_LR1110 (0x01UL << 0) // 7 0 HW device: LR1110
204 #define RADIOLIB_LR11X0_DEVICE_LR1120 (0x02UL << 0) // 7 0 LR1120
205 #define RADIOLIB_LR11X0_DEVICE_LR1121 (0x03UL << 0) // 7 0 LR1121
206 #define RADIOLIB_LR11X0_DEVICE_BOOT (0xDFUL << 0) // 7 0 bootloader mode
207 
208 // RADIOLIB_LR11X0_CMD_GET_ERRORS
209 #define RADIOLIB_LR11X0_ERROR_STAT_LF_RC_CALIB_ERR (0x01UL << 0) // 15 0 error: low frequency RC not calibrated
210 #define RADIOLIB_LR11X0_ERROR_STAT_HF_RC_CALIB_ERR (0x01UL << 1) // 15 0 high frequency RC not calibrated
211 #define RADIOLIB_LR11X0_ERROR_STAT_ADC_CALIB_ERR (0x01UL << 2) // 15 0 ADC not calibrated
212 #define RADIOLIB_LR11X0_ERROR_STAT_PLL_CALIB_ERR (0x01UL << 3) // 15 0 PLL not calibrated
213 #define RADIOLIB_LR11X0_ERROR_STAT_IMG_CALIB_ERR (0x01UL << 4) // 15 0 image rejection not calibrated
214 #define RADIOLIB_LR11X0_ERROR_STAT_HF_XOSC_START_ERR (0x01UL << 5) // 15 0 high frequency oscillator failed to start
215 #define RADIOLIB_LR11X0_ERROR_STAT_LF_XOSC_START_ERR (0x01UL << 6) // 15 0 low frequency oscillator failed to start
216 #define RADIOLIB_LR11X0_ERROR_STAT_PLL_LOCK_ERR (0x01UL << 7) // 15 0 PLL failed to lock
217 #define RADIOLIB_LR11X0_ERROR_STAT_RX_ADC_OFFSET_ERR (0x01UL << 8) // 15 0 ADC offset not calibrated
218 
219 // RADIOLIB_LR11X0_CMD_CALIBRATE
220 #define RADIOLIB_LR11X0_CALIBRATE_PLL_TX (0x01UL << 5) // 5 5 calibrate: Tx PLL
221 #define RADIOLIB_LR11X0_CALIBRATE_IMG (0x01UL << 4) // 4 4 image rejection
222 #define RADIOLIB_LR11X0_CALIBRATE_ADC (0x01UL << 3) // 3 3 A/D converter
223 #define RADIOLIB_LR11X0_CALIBRATE_PLL (0x01UL << 2) // 2 2 PLL
224 #define RADIOLIB_LR11X0_CALIBRATE_HF_RC (0x01UL << 1) // 1 1 high frequency RC
225 #define RADIOLIB_LR11X0_CALIBRATE_LF_RC (0x01UL << 0) // 0 0 low frequency RC
226 #define RADIOLIB_LR11X0_CALIBRATE_ALL (0x3FUL << 0) // 5 0 everything
227 
228 // RADIOLIB_LR11X0_CMD_SET_REG_MODE
229 #define RADIOLIB_LR11X0_REG_MODE_LDO (0x00UL << 0) // 0 0 regulator mode: LDO in all modes
230 #define RADIOLIB_LR11X0_REG_MODE_DC_DC (0x01UL << 0) // 0 0 DC-DC and LDO
231 
232 // RADIOLIB_LR11X0_CMD_SET_DIO_AS_RF_SWITCH
233 #define RADIOLIB_LR11X0_RFSW_DIO5_ENABLED (0x01UL << 0) // 4 0 RF switch: DIO5 enabled
234 #define RADIOLIB_LR11X0_RFSW_DIO5_DISABLED (0x00UL << 0) // 4 0 DIO5 disabled (default)
235 #define RADIOLIB_LR11X0_RFSW_DIO6_ENABLED (0x01UL << 1) // 4 0 RF switch: DIO6 enabled
236 #define RADIOLIB_LR11X0_RFSW_DIO6_DISABLED (0x00UL << 1) // 4 0 DIO6 disabled (default)
237 #define RADIOLIB_LR11X0_RFSW_DIO7_ENABLED (0x01UL << 2) // 4 0 RF switch: DIO7 enabled
238 #define RADIOLIB_LR11X0_RFSW_DIO7_DISABLED (0x00UL << 2) // 4 0 DIO7 disabled (default)
239 #define RADIOLIB_LR11X0_RFSW_DIO8_ENABLED (0x01UL << 3) // 4 0 RF switch: DIO8 enabled
240 #define RADIOLIB_LR11X0_RFSW_DIO8_DISABLED (0x00UL << 3) // 4 0 DIO8 disabled (default)
241 #define RADIOLIB_LR11X0_RFSW_DIO10_ENABLED (0x01UL << 4) // 4 0 RF switch: DIO10 enabled
242 #define RADIOLIB_LR11X0_RFSW_DIO10_DISABLED (0x00UL << 4) // 4 0 DIO10 disabled (default)
243 
244 // RADIOLIB_LR11X0_CMD_SET_DIO_IRQ_PARAMS
245 #define RADIOLIB_LR11X0_IRQ_TX_DONE (0x01UL << 2) // 31 0 interrupt: packet transmitted
246 #define RADIOLIB_LR11X0_IRQ_RX_DONE (0x01UL << 3) // 31 0 packet received
247 #define RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED (0x01UL << 4) // 31 0 preamble detected
248 #define RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID (0x01UL << 5) // 31 0 sync word or LoRa header valid
249 #define RADIOLIB_LR11X0_IRQ_HEADER_ERR (0x01UL << 6) // 31 0 LoRa header CRC error
250 #define RADIOLIB_LR11X0_IRQ_CRC_ERR (0x01UL << 7) // 31 0 packet CRC error
251 #define RADIOLIB_LR11X0_IRQ_CAD_DONE (0x01UL << 8) // 31 0 CAD completed
252 #define RADIOLIB_LR11X0_IRQ_CAD_DETECTED (0x01UL << 9) // 31 0 CAD detected
253 #define RADIOLIB_LR11X0_IRQ_TIMEOUT (0x01UL << 10) // 31 0 Rx or Tx timeout
254 #define RADIOLIB_LR11X0_IRQ_LR_FHSS_HOP (0x01UL << 11) // 31 0 FHSS hop
255 #define RADIOLIB_LR11X0_IRQ_GNSS_DONE (0x01UL << 19) // 31 0 GNSS scan finished
256 #define RADIOLIB_LR11X0_IRQ_WIFI_DONE (0x01UL << 20) // 31 0 WiFi scan finished
257 #define RADIOLIB_LR11X0_IRQ_LBD (0x01UL << 21) // 31 0 low battery detected
258 #define RADIOLIB_LR11X0_IRQ_CMD_ERROR (0x01UL << 22) // 31 0 command error
259 #define RADIOLIB_LR11X0_IRQ_ERROR (0x01UL << 23) // 31 0 some other error than CMD_ERR
260 #define RADIOLIB_LR11X0_IRQ_FSK_LEN_ERROR (0x01UL << 24) // 31 0 FSK packet received with length error
261 #define RADIOLIB_LR11X0_IRQ_FSK_ADDR_ERROR (0x01UL << 25) // 31 0 FSK packet received with address error
262 #define RADIOLIB_LR11X0_IRQ_LORA_RX_TIMESTAMP (0x01UL << 27) // 31 0 last LoRa symbol was received (timestamp source)
263 #define RADIOLIB_LR11X0_IRQ_ALL (0x0BF80FFCUL) // 31 0 all interrupts
264 #define RADIOLIB_LR11X0_IRQ_NONE (0x00UL << 0) // 31 0 no interrupts
265 
266 // RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK
267 #define RADIOLIB_LR11X0_LF_CLK_RC (0x00UL << 0) // 1 0 32.768 kHz source: RC oscillator
268 #define RADIOLIB_LR11X0_LF_CLK_XOSC (0x01UL << 0) // 1 0 crystal oscillator
269 #define RADIOLIB_LR11X0_LF_CLK_EXT (0x02UL << 0) // 1 0 external signal on DIO11
270 #define RADIOLIB_LR11X0_LF_BUSY_RELEASE_DISABLED (0x00UL << 2) // 2 2
271 #define RADIOLIB_LR11X0_LF_BUSY_RELEASE_ENABLED (0x01UL << 2) // 2 2
272 
273 // RADIOLIB_LR11X0_CMD_SET_TCXO_MODE
274 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_1_6 (0x00UL << 0) // 2 0 TCXO supply voltage: 1.6V
275 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_1_7 (0x01UL << 0) // 2 0 1.7V
276 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_1_8 (0x02UL << 0) // 2 0 1.8V
277 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_2_2 (0x03UL << 0) // 2 0 2.2V
278 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_2_4 (0x04UL << 0) // 2 0 2.4V
279 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_2_7 (0x05UL << 0) // 2 0 2.7V
280 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_3_0 (0x06UL << 0) // 2 0 3.0V
281 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_3_3 (0x07UL << 0) // 2 0 3.3V
282 
283 // RADIOLIB_LR11X0_CMD_SET_SLEEP
284 #define RADIOLIB_LR11X0_SLEEP_RETENTION_DISABLED (0x00UL << 0) // 0 0 configuration retention in sleep mode: disabled
285 #define RADIOLIB_LR11X0_SLEEP_RETENTION_ENABLED (0x01UL << 0) // 0 0 enabled
286 #define RADIOLIB_LR11X0_SLEEP_WAKEUP_DISABLED (0x00UL << 0) // 1 1 automated wakeup: disabled
287 #define RADIOLIB_LR11X0_SLEEP_WAKEUP_ENABLED (0x01UL << 0) // 1 1 enabled
288 
289 // RADIOLIB_LR11X0_CMD_SET_STANDBY
290 #define RADIOLIB_LR11X0_STANDBY_RC (0x00UL << 0) // 7 0 standby mode: RC oscillator
291 #define RADIOLIB_LR11X0_STANDBY_XOSC (0x00UL << 0) // 7 0 XTAL/TCXO oscillator
292 
293 // RADIOLIB_LR11X0_CMD_ERASE_INFO_PAGE
294 #define RADIOLIB_LR11X0_INFO_PAGE (1)
295 
296 // RADIOLIB_LR11X0_CMD_GET_CHIP_EUI
297 #define RADIOLIB_LR11X0_EUI_LEN (8)
298 
299 // RADIOLIB_LR11X0_CMD_DERIVE_ROOT_KEYS_AND_GET_PIN
300 #define RADIOLIB_LR11X0_PIN_LEN (4)
301 
302 // RADIOLIB_LR11X0_CMD_GET_PACKET_STATUS
303 #define RADIOLIB_LR11X0_RX_STATUS_ADDR_ERR (0x01UL << 5) // 7 0 Rx status: address filtering error
304 #define RADIOLIB_LR11X0_RX_STATUS_CRC_ERR (0x01UL << 4) // 7 0 CRC error
305 #define RADIOLIB_LR11X0_RX_STATUS_LEN_ERR (0x01UL << 3) // 7 0 length filtering error
306 #define RADIOLIB_LR11X0_RX_STATUS_ABORTED (0x01UL << 2) // 7 0 packet reception aborted
307 #define RADIOLIB_LR11X0_RX_STATUS_PACKET_RECEIVED (0x01UL << 1) // 7 0 packet received
308 #define RADIOLIB_LR11X0_RX_STATUS_PACKET_SENT (0x01UL << 0) // 7 0 packet sent
309 
310 // RADIOLIB_LR11X0_CMD_SET_GFSK_SYNC_WORD
311 #define RADIOLIB_LR11X0_GFSK_SYNC_WORD_LEN (8)
312 
313 // RADIOLIB_LR11X0_CMD_SET_LORA_PUBLIC_NETWORK
314 #define RADIOLIB_LR11X0_LORA_PRIVATE_NETWORK (0x00UL << 0) // 7 0 LoRa sync word: private network
315 #define RADIOLIB_LR11X0_LORA_PUBLIC_NETWORK (0x01UL << 0) // 7 0 public network
316 
317 // RADIOLIB_LR11X0_CMD_SET_RX
318 #define RADIOLIB_LR11X0_RX_TIMEOUT_NONE (0x000000UL) // 23 0 Rx timeout duration: no timeout (Rx single mode)
319 #define RADIOLIB_LR11X0_RX_TIMEOUT_INF (0xFFFFFFUL) // 23 0 infinite (Rx continuous mode)
320 
321 // RADIOLIB_LR11X0_CMD_SET_TX
322 #define RADIOLIB_LR11X0_TX_TIMEOUT_NONE (0x000000UL) // 23 0 disable Tx timeout
323 
324 // RADIOLIB_LR11X0_CMD_AUTO_TX_RX
325 #define RADIOLIB_LR11X0_AUTO_TX_RX_DISABLED (0xFFFFFFUL) // 23 0 disable auto Tx/Rx mode
326 #define RADIOLIB_LR11X0_AUTO_TX_RX_SKIP_INT (0x000000UL) // 23 0 skip intermediary mode
327 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_SLEEP (0x00UL << 0) // 1 0 intermediary mode: sleep
328 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_STBY_RC (0x01UL << 0) // 1 0 standby with RC
329 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_STBY_XOSC (0x02UL << 0) // 1 0 standby with XOSC
330 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_FS (0x03UL << 0) // 1 0 frequency synthesis
331 #define RADIOLIB_LR11X0_AUTO_TX_RX_TIMEOUT_DISABLED (0x000000UL) // 23 0 disable timeout of the second mode
332 
333 // RADIOLIB_LR11X0_CMD_SET_CAD_PARAMS
334 #define RADIOLIB_LR11X0_CAD_EXIT_MODE_STBY_RC (0x00UL << 0) // 7 0 mode to set after CAD: standby with RC
335 #define RADIOLIB_LR11X0_CAD_EXIT_MODE_RX (0x01UL << 0) // 7 0 receive if activity detected
336 #define RADIOLIB_LR11X0_CAD_EXIT_MODE_LBT (0x10UL << 0) // 7 0 transmit if no activity detected
337 #define RADIOLIB_LR11X0_CAD_PARAM_DEFAULT (0xFFUL << 0) // 7 0 used by the CAD methods to specify default parameter value
338 
339 // RADIOLIB_LR11X0_CMD_SET_PACKET_TYPE
340 #define RADIOLIB_LR11X0_PACKET_TYPE_NONE (0x00UL << 0) // 2 0 packet type: none
341 #define RADIOLIB_LR11X0_PACKET_TYPE_GFSK (0x01UL << 0) // 2 0 (G)FSK
342 #define RADIOLIB_LR11X0_PACKET_TYPE_LORA (0x02UL << 0) // 2 0 LoRa
343 #define RADIOLIB_LR11X0_PACKET_TYPE_SIGFOX (0x03UL << 0) // 2 0 Sigfox
344 #define RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS (0x04UL << 0) // 2 0 GMSK/LR-FHSS
345 #define RADIOLIB_LR11X0_PACKET_TYPE_RANGING (0x05UL << 0) // 2 0 ranging
346 #define RADIOLIB_LR11X0_PACKET_TYPE_BLE (0x06UL << 0) // 2 0 BLE beacon
347 
348 // RADIOLIB_LR11X0_CMD_SET_MODULATION_PARAMS
349 #define RADIOLIB_LR11X0_LORA_BW_62_5 (0x03UL << 0) // 7 0 LoRa bandwidth: 62.5 kHz
350 #define RADIOLIB_LR11X0_LORA_BW_125_0 (0x04UL << 0) // 7 0 125.0 kHz
351 #define RADIOLIB_LR11X0_LORA_BW_250_0 (0x05UL << 0) // 7 0 250.0 kHz
352 #define RADIOLIB_LR11X0_LORA_BW_500_0 (0x06UL << 0) // 7 0 500.0 kHz
353 #define RADIOLIB_LR11X0_LORA_CR_4_5_SHORT (0x01UL << 0) // 7 0 coding rate: 4/5 with short interleaver
354 #define RADIOLIB_LR11X0_LORA_CR_4_6_SHORT (0x02UL << 0) // 7 0 4/6 with short interleaver
355 #define RADIOLIB_LR11X0_LORA_CR_4_7_SHORT (0x03UL << 0) // 7 0 4/7 with short interleaver
356 #define RADIOLIB_LR11X0_LORA_CR_4_8_SHORT (0x04UL << 0) // 7 0 4/8 with short interleaver
357 #define RADIOLIB_LR11X0_LORA_CR_4_5_LONG (0x05UL << 0) // 7 0 4/5 with long interleaver
358 #define RADIOLIB_LR11X0_LORA_CR_4_6_LONG (0x06UL << 0) // 7 0 4/6 with long interleaver
359 #define RADIOLIB_LR11X0_LORA_CR_4_8_LONG (0x07UL << 0) // 7 0 4/8 with long interleaver
360 #define RADIOLIB_LR11X0_LORA_LDRO_DISABLED (0x00UL << 0) // 7 0 low data rate optimize: disabled
361 #define RADIOLIB_LR11X0_LORA_LDRO_ENABLED (0x01UL << 0) // 7 0 enabled
362 #define RADIOLIB_LR11X0_GFSK_BIT_RATE_DIV_DISABLED (0x00UL << 31) // 31 0 divide bit rate value by 256: disabled
363 #define RADIOLIB_LR11X0_GFSK_BIT_RATE_DIV_ENABLED (0x01UL << 31) // 31 0 enabled
364 #define RADIOLIB_LR11X0_GFSK_SHAPING_NONE (0x00UL << 0) // 7 0 shaping filter: none
365 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_0_3 (0x08UL << 0) // 7 0 Gaussian, BT = 0.3
366 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_0_5 (0x09UL << 0) // 7 0 Gaussian, BT = 0.5
367 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_0_7 (0x0AUL << 0) // 7 0 Gaussian, BT = 0.7
368 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_1_0 (0x0BUL << 0) // 7 0 Gaussian, BT = 1.0
369 #define RADIOLIB_LR11X0_GFSK_SHAPING_RAISED_COSINE_BT_0_7 (0x16UL << 0) // 7 0 raised cosine, BT = 0.7
370 #define RADIOLIB_LR11X0_GFSK_RX_BW_4_8 (0x1FUL << 0) // 7 0 GFSK Rx bandwidth: 4.8 kHz
371 #define RADIOLIB_LR11X0_GFSK_RX_BW_5_8 (0x17UL << 0) // 7 0 5.8 kHz
372 #define RADIOLIB_LR11X0_GFSK_RX_BW_7_3 (0x0FUL << 0) // 7 0 7.3 kHz
373 #define RADIOLIB_LR11X0_GFSK_RX_BW_9_7 (0x1EUL << 0) // 7 0 9.7 kHz
374 #define RADIOLIB_LR11X0_GFSK_RX_BW_11_7 (0x16UL << 0) // 7 0 11.7 kHz
375 #define RADIOLIB_LR11X0_GFSK_RX_BW_14_6 (0x0EUL << 0) // 7 0 14.6 kHz
376 #define RADIOLIB_LR11X0_GFSK_RX_BW_19_5 (0x1DUL << 0) // 7 0 19.5 kHz
377 #define RADIOLIB_LR11X0_GFSK_RX_BW_23_4 (0x15UL << 0) // 7 0 23.4 kHz
378 #define RADIOLIB_LR11X0_GFSK_RX_BW_29_3 (0x0DUL << 0) // 7 0 29.3 kHz
379 #define RADIOLIB_LR11X0_GFSK_RX_BW_39_0 (0x1CUL << 0) // 7 0 39.0 kHz
380 #define RADIOLIB_LR11X0_GFSK_RX_BW_46_9 (0x14UL << 0) // 7 0 46.9 kHz
381 #define RADIOLIB_LR11X0_GFSK_RX_BW_58_6 (0x0CUL << 0) // 7 0 58.6 kHz
382 #define RADIOLIB_LR11X0_GFSK_RX_BW_78_2 (0x1BUL << 0) // 7 0 78.2 kHz
383 #define RADIOLIB_LR11X0_GFSK_RX_BW_93_8 (0x13UL << 0) // 7 0 93.8 kHz
384 #define RADIOLIB_LR11X0_GFSK_RX_BW_117_3 (0x0BUL << 0) // 7 0 117.3 kHz
385 #define RADIOLIB_LR11X0_GFSK_RX_BW_156_2 (0x1AUL << 0) // 7 0 156.2 kHz
386 #define RADIOLIB_LR11X0_GFSK_RX_BW_187_2 (0x12UL << 0) // 7 0 187.2 kHz
387 #define RADIOLIB_LR11X0_GFSK_RX_BW_234_3 (0x0AUL << 0) // 7 0 234.3 kHz
388 #define RADIOLIB_LR11X0_GFSK_RX_BW_312_0 (0x19UL << 0) // 7 0 312.0 kHz
389 #define RADIOLIB_LR11X0_GFSK_RX_BW_373_6 (0x11UL << 0) // 7 0 373.6 kHz
390 #define RADIOLIB_LR11X0_GFSK_RX_BW_467_0 (0x09UL << 0) // 7 0 467.0 kHz
391 #define RADIOLIB_LR11X0_LR_FHSS_BIT_RATE (488.28215) // 31 0 LR FHSS bit rate: 488.28215 bps
392 #define RADIOLIB_LR11X0_LR_FHSS_BIT_RATE_RAW (0x8001E848UL) // 31 0 488.28215 bps in raw
393 #define RADIOLIB_LR11X0_LR_FHSS_SHAPING_GAUSSIAN_BT_1_0 (0x0BUL << 0) // 7 0 shaping filter: Gaussian, BT = 1.0
394 #define RADIOLIB_LR11X0_SIGFOX_SHAPING_GAUSSIAN_BT_0_7 (0x16UL << 0) // 7 0 shaping filter: Gaussian, BT = 0.7
395 
396 // RADIOLIB_LR11X0_CMD_SET_PACKET_PARAMS
397 #define RADIOLIB_LR11X0_LORA_HEADER_EXPLICIT (0x00UL << 0) // 7 0 LoRa header mode: explicit
398 #define RADIOLIB_LR11X0_LORA_HEADER_IMPLICIT (0x01UL << 0) // 7 0 implicit
399 #define RADIOLIB_LR11X0_LORA_PAYLOAD_LEN_ANY (0x00UL << 0) // 7 0 accept any payload length
400 #define RADIOLIB_LR11X0_LORA_CRC_ENABLED (0x01UL << 0) // 7 0 CRC: enabled
401 #define RADIOLIB_LR11X0_LORA_CRC_DISABLED (0x00UL << 0) // 7 0 disabled
402 #define RADIOLIB_LR11X0_LORA_IQ_STANDARD (0x00UL << 0) // 7 0 IQ setup: standard
403 #define RADIOLIB_LR11X0_LORA_IQ_INVERTED (0x01UL << 0) // 7 0 inverted
404 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_DISABLED (0x00UL << 0) // 7 0 preamble detector: disabled
405 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_8_BITS (0x04UL << 0) // 7 0 8 bits
406 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_16_BITS (0x05UL << 0) // 7 0 16 bits
407 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_24_BITS (0x06UL << 0) // 7 0 24 bits
408 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_32_BITS (0x07UL << 0) // 7 0 32 bits
409 #define RADIOLIB_LR11X0_GFSK_ADDR_FILTER_DISABLED (0x00UL << 0) // 7 0 address filtering: disabled
410 #define RADIOLIB_LR11X0_GFSK_ADDR_FILTER_NODE (0x01UL << 0) // 7 0 node address
411 #define RADIOLIB_LR11X0_GFSK_ADDR_FILTER_NODE_BROADCAST (0x02UL << 0) // 7 0 node and broadcast address
412 #define RADIOLIB_LR11X0_GFSK_PACKET_LENGTH_FIXED (0x00UL << 0) // 7 0 packet length: fixed
413 #define RADIOLIB_LR11X0_GFSK_PACKET_LENGTH_VARIABLE (0x01UL << 0) // 7 0 variable
414 #define RADIOLIB_LR11X0_GFSK_PACKET_LENGTH_VARIABLE_SX128X (0x02UL << 0) // 7 0 variable, SX128x 9-bit length encoding
415 #define RADIOLIB_LR11X0_GFSK_PAYLOAD_LEN_ANY (0x00UL << 0) // 7 0 accept any payload length
416 #define RADIOLIB_LR11X0_GFSK_CRC_DISABLED (0x01UL << 0) // 7 0 CRC: disabled
417 #define RADIOLIB_LR11X0_GFSK_CRC_1_BYTE (0x00UL << 0) // 7 0 1-byte
418 #define RADIOLIB_LR11X0_GFSK_CRC_2_BYTE (0x02UL << 0) // 7 0 2-byte
419 #define RADIOLIB_LR11X0_GFSK_CRC_1_BYTE_INV (0x04UL << 0) // 7 0 1-byte, inverted
420 #define RADIOLIB_LR11X0_GFSK_CRC_2_BYTE_INV (0x06UL << 0) // 7 0 2-byte, inverted
421 #define RADIOLIB_LR11X0_GFSK_WHITENING_DISABLED (0x00UL << 0) // 7 0 whitening: disabled
422 #define RADIOLIB_LR11X0_GFSK_WHITENING_ENABLED (0x01UL << 0) // 7 0 enabled
423 
424 // RADIOLIB_LR11X0_CMD_SET_TX_PARAMS
425 #define RADIOLIB_LR11X0_PA_RAMP_48U (0x02UL << 0) // 7 0 PA ramp time: 48 us
426 
427 // RADIOLIB_LR11X0_CMD_SET_RX_TX_FALLBACK_MODE
428 #define RADIOLIB_LR11X0_FALLBACK_MODE_STBY_RC (0x01UL << 0) // 1 0 fallback mode after Rx/Tx: standby with RC
429 #define RADIOLIB_LR11X0_FALLBACK_MODE_STBY_XOSC (0x02UL << 0) // 1 0 standby with XOSC
430 #define RADIOLIB_LR11X0_FALLBACK_MODE_FS (0x03UL << 0) // 1 0 frequency synthesis
431 
432 // RADIOLIB_LR11X0_CMD_SET_RX_DUTY_CYCLE
433 #define RADIOLIB_LR11X0_RX_DUTY_CYCLE_MODE_RX (0x00UL << 0) // 0 0 mode in Rx windows: Rx (default)
434 #define RADIOLIB_LR11X0_RX_DUTY_CYCLE_MODE_CAD (0x01UL << 0) // 0 0 CAD
435 #define RADIOLIB_LR11X0_TIMING_STEP (1.0f/32768.0f) // 23 0 timing step fo delays
436 
437 // RADIOLIB_LR11X0_CMD_SET_PA_CONFIG
438 #define RADIOLIB_LR11X0_PA_SEL_LP (0x00UL << 0) // 7 0 PA select: low power PA
439 #define RADIOLIB_LR11X0_PA_SEL_HP (0x01UL << 0) // 7 0 high power PA
440 #define RADIOLIB_LR11X0_PA_SEL_HF (0x02UL << 0) // 7 0 high frequency PA
441 #define RADIOLIB_LR11X0_PA_SUPPLY_INTERNAL (0x00UL << 0) // 7 0 PA power source: internal
442 #define RADIOLIB_LR11X0_PA_SUPPLY_VBAT (0x01UL << 0) // 7 0 VBAT (required for >= 14 dBm)
443 
444 // RADIOLIB_LR11X0_CMD_STOP_TIMEOUT_ON_PREAMBLE
445 #define RADIOLIB_LR11X0_STOP_ON_SYNC_HEADER (0x00UL << 0) // 0 0 stop timeout on: sync word or header (default)
446 #define RADIOLIB_LR11X0_STOP_ON_PREAMBLE (0x01UL << 0) // 0 0 preamble
447 
448 // RADIOLIB_LR11X0_CMD_GET_RANGING_RESULT
449 #define RADIOLIB_LR11X0_RANGING_RESULT_DISTANCE (0) // 7 0 ranging result type: distance
450 #define RADIOLIB_LR11X0_RANGING_RESULT_RSSI (1) // 7 0 RSSI
451 
452 // RADIOLIB_LR11X0_CMD_SET_RX_BOOSTED
453 #define RADIOLIB_LR11X0_RX_BOOSTED_ENABLED (0x01UL << 0) // 0 0 Rx boosted mode: enabled
454 #define RADIOLIB_LR11X0_RX_BOOSTED_DISABLED (0x00UL << 0) // 0 0 disabled
455 
456 // RADIOLIB_LR11X0_CMD_SET_LORA_SYNC_WORD
457 #define RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE (0x12)
458 #define RADIOLIB_LR11X0_LORA_SYNC_WORD_PUBLIC (0x34)
459 
460 // RADIOLIB_LR11X0_CMD_LR_FHSS_BUILD_FRAME
461 #define RADIOLIB_LR11X0_LR_FHSS_CR_5_6 (0x00UL << 0) // 7 0 LR FHSS coding rate: 5/6
462 #define RADIOLIB_LR11X0_LR_FHSS_CR_2_3 (0x01UL << 0) // 7 0 2/3
463 #define RADIOLIB_LR11X0_LR_FHSS_CR_1_2 (0x02UL << 0) // 7 0 1/2
464 #define RADIOLIB_LR11X0_LR_FHSS_CR_1_3 (0x03UL << 0) // 7 0 1/3
465 #define RADIOLIB_LR11X0_LR_FHSS_MOD_TYPE_GMSK (0x00UL << 0) // 7 0 LR FHSS modulation: GMSK
466 #define RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC (0x00UL << 0) // 7 0 LR FHSS step size: 25.390625 kHz (FCC)
467 #define RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_NON_FCC (0x01UL << 0) // 7 0 3.90625 kHz (non-FCC)
468 #define RADIOLIB_LR11X0_LR_FHSS_HOPPING_DISABLED (0x00UL << 0) // 7 0 LR FHSS hopping: disabled
469 #define RADIOLIB_LR11X0_LR_FHSS_HOPPING_ENABLED (0x01UL << 0) // 7 0 enabled
470 #define RADIOLIB_LR11X0_LR_FHSS_BW_39_06 (0x00UL << 0) // 7 0 LR FHSS bandwidth: 39.06 kHz
471 #define RADIOLIB_LR11X0_LR_FHSS_BW_85_94 (0x01UL << 0) // 7 0 85.94 kHz
472 #define RADIOLIB_LR11X0_LR_FHSS_BW_136_72 (0x02UL << 0) // 7 0 136.72 kHz
473 #define RADIOLIB_LR11X0_LR_FHSS_BW_183_59 (0x03UL << 0) // 7 0 183.59 kHz
474 #define RADIOLIB_LR11X0_LR_FHSS_BW_335_94 (0x04UL << 0) // 7 0 335.94 kHz
475 #define RADIOLIB_LR11X0_LR_FHSS_BW_386_72 (0x05UL << 0) // 7 0 386.72 kHz
476 #define RADIOLIB_LR11X0_LR_FHSS_BW_722_66 (0x06UL << 0) // 7 0 722.66 kHz
477 #define RADIOLIB_LR11X0_LR_FHSS_BW_773_44 (0x07UL << 0) // 7 0 773.44 kHz
478 #define RADIOLIB_LR11X0_LR_FHSS_BW_1523_4 (0x08UL << 0) // 7 0 1523.4 kHz
479 #define RADIOLIB_LR11X0_LR_FHSS_BW_1574_2 (0x09UL << 0) // 7 0 1574.2 kHz
480 
481 // RADIOLIB_LR11X0_CMD_GET_LORA_RX_HEADER_INFOS
482 #define RADIOLIB_LR11X0_LAST_HEADER_CRC_ENABLED (0x01UL << 4) // 4 4 last header CRC: enabled
483 #define RADIOLIB_LR11X0_LAST_HEADER_CRC_DISABLED (0x00UL << 4) // 4 4 disabled
484 
485 // RADIOLIB_LR11X0_CMD_WIFI_SCAN
486 #define RADIOLIB_LR11X0_WIFI_SCAN_802_11_B (0x01UL << 0) // 7 0 Wi-Fi type to scan: 802.11b
487 #define RADIOLIB_LR11X0_WIFI_SCAN_802_11_G (0x02UL << 0) // 7 0 802.11g
488 #define RADIOLIB_LR11X0_WIFI_SCAN_802_11_N (0x03UL << 0) // 7 0 802.11n
489 #define RADIOLIB_LR11X0_WIFI_SCAN_ALL (0x04UL << 0) // 7 0 all (802.11b first)
490 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_BEACON_ONLY (0x01UL << 0) // 7 0 Wi-Fi acquisition mode: beacon only
491 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_BEACON_PACKET (0x02UL << 0) // 7 0 beacon and packet
492 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_TRAFFIC (0x03UL << 0) // 7 0 full traffic
493 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_BEACON (0x04UL << 0) // 7 0 full beacon
494 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_SSID_BEACON (0x05UL << 0) // 7 0 SSID beacon
495 #define RADIOLIB_LR11X0_WIFI_ABORT_ON_TIMEOUT_ENABLED (0x01UL << 0) // 7 0 abort scanning on preamble timeout: enabled
496 #define RADIOLIB_LR11X0_WIFI_ABORT_ON_TIMEOUT_DISABLED (0x00UL << 0) // 7 0 disabled
497 #define RADIOLIB_LR11X0_WIFI_MAX_NUM_RESULTS (32) // 7 0 maximum possible number of Wi-Fi scan results
498 #define RADIOLIB_LR11X0_WIFI_ALL_CHANNELS (0x3FFFUL) // 16 0 scan all channels
499 
500 // RADIOLIB_LR11X0_CMD_WIFI_READ_RESULTS
501 #define RADIOLIB_LR11X0_WIFI_RESULT_TYPE_COMPLETE (0x01UL << 0) // 7 0 Wi-Fi scan result type: complete
502 #define RADIOLIB_LR11X0_WIFI_RESULT_TYPE_BASIC (0x04UL << 0) // 7 0 basic
503 #define RADIOLIB_LR11X0_WIFI_RESULT_MAX_LEN (79) // 7 0 maximum possible Wi-Fi scan size
504 #define RADIOLIB_LR11X0_WIFI_RESULT_MAC_LEN (6) // 7 0 MAC address length in bytes
505 #define RADIOLIB_LR11X0_WIFI_RESULT_SSID_LEN (32) // 7 0 SSID length in bytes
506 
507 // RADIOLIB_LR11X0_CMD_GNSS_SET_CONSTELLATION_TO_USE
508 #define RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS (0x01UL << 0) // 7 0 GNSS constellation to use: GPS
509 #define RADIOLIB_LR11X0_GNSS_CONSTELLATION_BEIDOU (0x01UL << 1) // 7 0 BeiDou
510 
511 // RADIOLIB_LR11X0_CMD_GNSS_SET_MODE
512 #define RADIOLIB_LR11X0_GNSS_MODE_SINGLE_SCAN (0x00UL << 0) // 7 0 GNSS scanning mode: single/legacy
513 #define RADIOLIB_LR11X0_GNSS_MODE_SINGLE_MULTIPLE (0x03UL << 1) // 7 0 multiple/advanced
514 
515 // RADIOLIB_LR11X0_CMD_GNSS_AUTONOMOUS
516 #define RADIOLIB_LR11X0_GNSS_RES_PSEUDO_DOPPLER_ENABLED (0x01UL << 0) // 0 0 GNSS results in NAV message: pseudo-range (in single scan mode) or Doppler information (in multiple scan mode)
517 #define RADIOLIB_LR11X0_GNSS_RES_PSEUDO_DOPPLER_DISABLED (0x00UL << 0) // 0 0 not included
518 #define RADIOLIB_LR11X0_GNSS_RES_DOPPLER_ENABLED (0x01UL << 1) // 1 1 Doppler information
519 #define RADIOLIB_LR11X0_GNSS_RES_DOPPLER_DISABLED (0x00UL << 1) // 1 1 not included
520 #define RADIOLIB_LR11X0_GNSS_NB_SV_ALL (0x00UL << 0) // 7 0 include all detected satellites
521 #define RADIOLIB_LR11X0_GNSS_AUTO_EFFORT_MODE (0x00UL << 0) // 7 0 reserved, always 0
522 
523 // RADIOLIB_LR11X0_CMD_GNSS_ASSISTED
524 #define RADIOLIB_LR11X0_GNSS_ASSIST_LOW_POWER (0x00UL << 0) // 7 0 effort mode: low power
525 #define RADIOLIB_LR11X0_GNSS_ASSIST_BEST_EFFORT (0x01UL << 0) // 7 0 best effort
526 
527 // RADIOLIB_LR11X0_CMD_GNSS_GET_CONTEXT_STATUS
528 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_NONE (0x00UL << 0) // 7 4 error code: none
529 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_ALMANAC_OLD (0x01UL << 0) // 7 4 almanac too old
530 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_ALMANAC_CRC (0x02UL << 0) // 7 4 almanac CRC mismatch
531 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_FLASH (0x03UL << 0) // 7 4 flash integrity error
532 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_ALMANAC_UPD (0x04UL << 0) // 7 4 almanac update not allowed
533 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_250_HZ (0x00UL << 0) // 8 7 frequency search space: 250 Hz
534 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_500_HZ (0x01UL << 0) // 8 7 500 H
535 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_1000_HZ (0x02UL << 0) // 8 7 1000 Hz
536 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_2000_HZ (0x03UL << 0) // 8 7 2000 Hz
537 
538 // RADIOLIB_LR11X0_CMD_GNSS_GET_SV_VISIBLE
539 #define RADIOLIB_LR11X0_SV_CONSTELLATION_GPS (0x00UL << 0) // 7 0 GNSS constellation: GPS
540 #define RADIOLIB_LR11X0_SV_CONSTELLATION_BEIDOU (0x01UL << 0) // 7 0 BeiDou
541 
542 // RADIOLIB_LR11X0_CMD_GNSS_ALMANAC_FULL_UPDATE
543 #define RADIOLIB_LR11X0_GNSS_ALMANAC_HEADER_ID (0x80UL << 0) // 7 0 starting byte of GNSS almanac header
544 #define RADIOLIB_LR11X0_GNSS_ALMANAC_BLOCK_SIZE (20)
545 
546 // RADIOLIB_LR11X0_CMD_CRYPTO_SET_KEY
547 #define RADIOLIB_LR11X0_CRYPTO_STATUS_SUCCESS (0x00UL << 0) // 7 0 crypto engine status: success
548 #define RADIOLIB_LR11X0_CRYPTO_STATUS_FAIL_CMAC (0x01UL << 0) // 7 0 MIC check failed
549 #define RADIOLIB_LR11X0_CRYPTO_STATUS_INV_KEY_ID (0x03UL << 0) // 7 0 key/parameter source or destination ID error
550 #define RADIOLIB_LR11X0_CRYPTO_STATUS_BUF_SIZE (0x05UL << 0) // 7 0 data buffer size invalid
551 #define RADIOLIB_LR11X0_CRYPTO_STATUS_ERROR (0x06UL << 0) // 7 0 generic error
552 
553 // RADIOLIB_LR11X0_CMD_CRYPTO_PROCESS_JOIN_ACCEPT
554 #define RADIOLIB_LR11X0_CRYPTO_LORAWAN_VERSION_1_0 (0x00UL << 0) // 7 0 LoRaWAN version: 1.0.x
555 #define RADIOLIB_LR11X0_CRYPTO_LORAWAN_VERSION_1_1 (0x01UL << 0) // 7 0 1.1
556 
557 // LR11X0 SPI register variables
558 
559 // RADIOLIB_LR11X0_REG_SF6_SX127X_COMPAT
560 #define RADIOLIB_LR11X0_SF6_SX126X (0x00UL << 18) // 18 18 SF6 mode: SX126x series
561 #define RADIOLIB_LR11X0_SF6_SX127X (0x01UL << 18) // 18 18 SX127x series
562 
563 // RADIOLIB_LR11X0_REG_LORA_HIGH_POWER_FIX
564 #define RADIOLIB_LR11X0_LORA_HIGH_POWER_FIX (0x00UL << 30) // 30 30 fix for errata
565 
573  char type;
574 
576  uint8_t dataRateId;
577 
579  uint16_t channelFreq;
580 
582  uint8_t origin;
583 
585  bool ap;
586 
588  float rssi;
589 
591  uint8_t mac[RADIOLIB_LR11X0_WIFI_RESULT_MAC_LEN];
592 };
593 
601  uint8_t frameType;
602 
604  uint8_t frameSubType;
605 
608 
611 
613  uint16_t phiOffset;
614 
616  uint64_t timestamp;
617 
619  uint32_t periodBeacon;
620 };
621 
631  uint8_t rate;
632 
634  uint16_t service;
635 
637  uint16_t length;
638 
640  uint8_t mac0[RADIOLIB_LR11X0_WIFI_RESULT_MAC_LEN];
641 
643  uint8_t mac2[RADIOLIB_LR11X0_WIFI_RESULT_MAC_LEN];
644 
646  uint16_t seqCtrl;
647 
649  uint8_t ssid[RADIOLIB_LR11X0_WIFI_RESULT_SSID_LEN];
650 
652  uint8_t currentChannel;
653 
655  char countryCode[3];
656 
658  uint8_t ioReg;
659 
662 };
663 
670  uint8_t hardware;
671 
673  uint8_t device;
674 
676  uint8_t fwMajor;
677 
679  uint8_t fwMinor;
680 
682  uint8_t fwMajorWiFi;
683 
685  uint8_t fwMinorWiFi;
686 
688  uint8_t fwGNSS;
689 
691  uint8_t almanacGNSS;
692 };
693 
699 class LR11x0: public PhysicalLayer {
700  public:
701  // introduce PhysicalLayer overloads
706 
711  explicit LR11x0(Module* mod);
712 
716  bool XTAL;
717 
729  int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage);
730 
741  int16_t beginGFSK(float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage);
742 
751  int16_t beginLRFHSS(uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage);
752 
757  int16_t reset();
758 
767  int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
768 
776  int16_t receive(uint8_t* data, size_t len) override;
777 
783  int16_t transmitDirect(uint32_t frf = 0) override;
784 
790  int16_t receiveDirect() override;
791 
796  int16_t scanChannel() override;
797 
805  int16_t scanChannel(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
806 
811  int16_t standby() override;
812 
820  int16_t standby(uint8_t mode, bool wakeup = true);
821 
827  int16_t sleep();
828 
836  int16_t sleep(bool retainConfig, uint32_t sleepTime);
837 
838  // interrupt methods
839 
844  void setIrqAction(void (*func)(void));
845 
849  void clearIrqAction();
850 
855  void setPacketReceivedAction(void (*func)(void)) override;
856 
860  void clearPacketReceivedAction() override;
861 
866  void setPacketSentAction(void (*func)(void)) override;
867 
871  void clearPacketSentAction() override;
872 
881  int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
882 
887  int16_t finishTransmit() override;
888 
895  int16_t startReceive() override;
896 
909  int16_t startReceive(uint32_t timeout, uint32_t irqFlags = RADIOLIB_LR11X0_IRQ_RX_DONE, uint32_t irqMask = 0, size_t len = 0);
910 
915  uint32_t getIrqStatus();
916 
925  int16_t readData(uint8_t* data, size_t len) override;
926 
932  int16_t startChannelScan() override;
933 
942  int16_t startChannelScan(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
943 
948  int16_t getChannelScanResult() override;
949 
950  // configuration methods
951 
957  int16_t setOutputPower(int8_t power) override;
958 
966  int16_t setOutputPower(int8_t power, bool forceHighPower);
967 
975  int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
976 
985  int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);
986 
992  int16_t setBandwidth(float bw);
993 
1000  int16_t setSpreadingFactor(uint8_t sf, bool legacy = false);
1001 
1009  int16_t setCodingRate(uint8_t cr, bool longInterleave = false);
1010 
1016  int16_t setSyncWord(uint32_t syncWord);
1017 
1023  int16_t setBitRate(float br) override;
1024 
1030  int16_t setFrequencyDeviation(float freqDev) override;
1031 
1038  int16_t setRxBandwidth(float rxBw);
1039 
1046  int16_t setSyncWord(uint8_t* syncWord, size_t len) override;
1047 
1055  int16_t setSyncBits(uint8_t *syncWord, uint8_t bitsLen);
1056 
1062  int16_t setNodeAddress(uint8_t nodeAddr);
1063 
1070  int16_t setBroadcastAddress(uint8_t broadAddr);
1071 
1076  int16_t disableAddressFiltering();
1077 
1085  int16_t setDataShaping(uint8_t sh) override;
1086 
1092  int16_t setEncoding(uint8_t encoding) override;
1093 
1099  int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_LR11X0_MAX_PACKET_LENGTH);
1100 
1106  int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_LR11X0_MAX_PACKET_LENGTH);
1107 
1115  int16_t setWhitening(bool enabled, uint16_t initial = 0x01FF);
1116 
1122  int16_t setDataRate(DataRate_t dr) override;
1123 
1129  int16_t checkDataRate(DataRate_t dr) override;
1130 
1136  int16_t setPreambleLength(size_t preambleLength) override;
1137 
1146  int16_t setTCXO(float voltage, uint32_t delay = 5000);
1147 
1156  int16_t setCRC(uint8_t len, uint32_t initial = 0x00001D0FUL, uint32_t polynomial = 0x00001021UL, bool inverted = true);
1157 
1163  int16_t invertIQ(bool enable) override;
1164 
1169  float getRSSI() override;
1170 
1175  float getSNR() override;
1176 
1181  float getFrequencyError();
1182 
1188  size_t getPacketLength(bool update = true) override;
1189 
1195  size_t getPacketLength(bool update, uint8_t* offset);
1196 
1202  RadioLibTime_t getTimeOnAir(size_t len) override;
1203 
1209  RadioLibTime_t calculateRxTimeout(RadioLibTime_t timeoutUs) override;
1210 
1217  int16_t irqRxDoneRxTimeout(uint32_t &irqFlags, uint32_t &irqMask) override;
1218 
1223  bool isRxTimeout() override;
1224 
1229  uint8_t randomByte() override;
1230 
1236  int16_t implicitHeader(size_t len);
1237 
1242  int16_t explicitHeader();
1243 
1248  float getDataRate() const;
1249 
1258  int16_t setLrFhssConfig(uint8_t bw, uint8_t cr, uint8_t hdrCount = 3, uint16_t hopSeed = 0x13A);
1259 
1274  int16_t startWifiScan(char wifiType, uint8_t mode = RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_BEACON, uint16_t chanMask = RADIOLIB_LR11X0_WIFI_ALL_CHANNELS, uint8_t numScans = 16, uint16_t timeout = 100);
1275 
1280  void setWiFiScanAction(void (*func)(void));
1281 
1285  void clearWiFiScanAction();
1286 
1292  int16_t getWifiScanResultsCount(uint8_t* count);
1293 
1303  int16_t getWifiScanResult(LR11x0WifiResult_t* result, uint8_t index, bool brief = false);
1304 
1321  int16_t wifiScan(uint8_t wifiType, uint8_t* count, uint8_t mode = RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_BEACON, uint16_t chanMask = RADIOLIB_LR11X0_WIFI_ALL_CHANNELS, uint8_t numScans = 16, uint16_t timeout = 100);
1322 
1328  int16_t getVersionInfo(LR11x0VersionInfo_t* info);
1329 
1340  int16_t updateFirmware(const uint32_t* image, size_t size, bool nonvolatile = true);
1341 
1342 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
1343  protected:
1344 #endif
1345  Module* getMod() override;
1346 
1347  // LR11x0 SPI command implementations
1348  int16_t writeRegMem32(uint32_t addr, uint32_t* data, size_t len);
1349  int16_t readRegMem32(uint32_t addr, uint32_t* data, size_t len);
1350  int16_t writeBuffer8(uint8_t* data, size_t len);
1351  int16_t readBuffer8(uint8_t* data, size_t len, size_t offset);
1352  int16_t clearRxBuffer(void);
1353  int16_t writeRegMemMask32(uint32_t addr, uint32_t mask, uint32_t data);
1354 
1355  int16_t getStatus(uint8_t* stat1, uint8_t* stat2, uint32_t* irq);
1356  int16_t getVersion(uint8_t* hw, uint8_t* device, uint8_t* major, uint8_t* minor);
1357  int16_t getErrors(uint16_t* err);
1358  int16_t clearErrors(void);
1359  int16_t calibrate(uint8_t params);
1360  int16_t setRegMode(uint8_t mode);
1361  int16_t calibImage(float freq1, float freq2);
1362  int16_t setDioAsRfSwitch(uint8_t en, uint8_t stbyCfg, uint8_t rxCfg, uint8_t txCfg, uint8_t txHpCfg, uint8_t txHfCfg, uint8_t gnssCfg, uint8_t wifiCfg);
1363  int16_t setDioIrqParams(uint32_t irq1, uint32_t irq2);
1364  int16_t clearIrq(uint32_t irq);
1365  int16_t configLfClock(uint8_t setup);
1366  int16_t setTcxoMode(uint8_t tune, uint32_t delay);
1367  int16_t reboot(bool stay);
1368  int16_t getVbat(float* vbat);
1369  int16_t getTemp(float* temp);
1370  int16_t setFs(void);
1371  int16_t getRandomNumber(uint32_t* rnd);
1372  int16_t eraseInfoPage(void);
1373  int16_t writeInfoPage(uint16_t addr, const uint32_t* data, size_t len);
1374  int16_t readInfoPage(uint16_t addr, uint32_t* data, size_t len);
1375  int16_t getChipEui(uint8_t* eui);
1376  int16_t getSemtechJoinEui(uint8_t* eui);
1377  int16_t deriveRootKeysAndGetPin(uint8_t* pin);
1378  int16_t enableSpiCrc(bool en);
1379  int16_t driveDiosInSleepMode(bool en);
1380 
1381  int16_t resetStats(void);
1382  int16_t getStats(uint16_t* nbPktReceived, uint16_t* nbPktCrcError, uint16_t* data1, uint16_t* data2);
1383  int16_t getPacketType(uint8_t* type);
1384  int16_t getRxBufferStatus(uint8_t* len, uint8_t* startOffset);
1385  int16_t getPacketStatusLoRa(float* rssiPkt, float* snrPkt, float* signalRssiPkt);
1386  int16_t getPacketStatusGFSK(float* rssiSync, float* rssiAvg, uint8_t* rxLen, uint8_t* stat);
1387  int16_t getRssiInst(float* rssi);
1388  int16_t setGfskSyncWord(uint8_t* sync);
1389  int16_t setLoRaPublicNetwork(bool pub);
1390  int16_t setRx(uint32_t timeout);
1391  int16_t setTx(uint32_t timeout);
1392  int16_t setRfFrequency(uint32_t rfFreq);
1393  int16_t autoTxRx(uint32_t delay, uint8_t intMode, uint32_t timeout);
1394  int16_t setCadParams(uint8_t symNum, uint8_t detPeak, uint8_t detMin, uint8_t cadExitMode, uint32_t timeout);
1395  int16_t setPacketType(uint8_t type);
1396  int16_t setModulationParamsLoRa(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro);
1397  int16_t setModulationParamsGFSK(uint32_t br, uint8_t sh, uint8_t rxBw, uint32_t freqDev);
1398  int16_t setModulationParamsLrFhss(uint32_t br, uint8_t sh);
1399  int16_t setModulationParamsSigfox(uint32_t br, uint8_t sh);
1400  int16_t setPacketParamsLoRa(uint16_t preambleLen, uint8_t hdrType, uint8_t payloadLen, uint8_t crcType, uint8_t invertIQ);
1401  int16_t setPacketParamsGFSK(uint16_t preambleLen, uint8_t preambleDetectorLen, uint8_t syncWordLen, uint8_t addrCmp, uint8_t packType, uint8_t payloadLen, uint8_t crcType, uint8_t whiten);
1402  int16_t setPacketParamsSigfox(uint8_t payloadLen, uint16_t rampUpDelay, uint16_t rampDownDelay, uint16_t bitNum);
1403  int16_t setTxParams(int8_t pwr, uint8_t ramp);
1404  int16_t setPacketAdrs(uint8_t node, uint8_t broadcast);
1405  int16_t setRxTxFallbackMode(uint8_t mode);
1406  int16_t setRxDutyCycle(uint32_t rxPeriod, uint32_t sleepPeriod, uint8_t mode);
1407  int16_t setPaConfig(uint8_t paSel, uint8_t regPaSupply, uint8_t paDutyCycle, uint8_t paHpSel);
1408  int16_t stopTimeoutOnPreamble(bool stop);
1409  int16_t setCad(void);
1410  int16_t setTxCw(void);
1411  int16_t setTxInfinitePreamble(void);
1412  int16_t setLoRaSynchTimeout(uint8_t symbolNum);
1413  int16_t setRangingAddr(uint32_t addr, uint8_t checkLen);
1414  int16_t setRangingReqAddr(uint32_t addr);
1415  int16_t getRangingResult(uint8_t type, float* res);
1416  int16_t setRangingTxRxDelay(uint32_t delay);
1417  int16_t setGfskCrcParams(uint32_t init, uint32_t poly);
1418  int16_t setGfskWhitParams(uint16_t seed);
1419  int16_t setRxBoosted(bool en);
1420  int16_t setRangingParameter(uint8_t symbolNum);
1421  int16_t setRssiCalibration(int8_t* tune, int16_t gainOffset);
1422  int16_t setLoRaSyncWord(uint8_t sync);
1423  int16_t lrFhssBuildFrame(uint8_t hdrCount, uint8_t cr, uint8_t grid, bool hop, uint8_t bw, uint16_t hopSeq, int8_t devOffset, uint8_t* payload, size_t len);
1424  int16_t lrFhssSetSyncWord(uint32_t sync);
1425  int16_t configBleBeacon(uint8_t chan, uint8_t* payload, size_t len);
1426  int16_t getLoRaRxHeaderInfos(uint8_t* info);
1427  int16_t bleBeaconSend(uint8_t chan, uint8_t* payload, size_t len);
1428 
1429  int16_t wifiScan(uint8_t type, uint16_t mask, uint8_t acqMode, uint8_t nbMaxRes, uint8_t nbScanPerChan, uint16_t timeout, uint8_t abortOnTimeout);
1430  int16_t wifiScanTimeLimit(uint8_t type, uint16_t mask, uint8_t acqMode, uint8_t nbMaxRes, uint16_t timePerChan, uint16_t timeout);
1431  int16_t wifiCountryCode(uint16_t mask, uint8_t nbMaxRes, uint8_t nbScanPerChan, uint16_t timeout, uint8_t abortOnTimeout);
1432  int16_t wifiCountryCodeTimeLimit(uint16_t mask, uint8_t nbMaxRes, uint16_t timePerChan, uint16_t timeout);
1433  int16_t wifiGetNbResults(uint8_t* nbResults);
1434  int16_t wifiReadResults(uint8_t index, uint8_t nbResults, uint8_t format, uint8_t* results);
1435  int16_t wifiResetCumulTimings(void);
1436  int16_t wifiReadCumulTimings(uint32_t* detection, uint32_t* capture, uint32_t* demodulation);
1437  int16_t wifiGetNbCountryCodeResults(uint8_t* nbResults);
1438  int16_t wifiReadCountryCodeResults(uint8_t index, uint8_t nbResults, uint8_t* results);
1439  int16_t wifiCfgTimestampAPphone(uint32_t timestamp);
1440  int16_t wifiReadVersion(uint8_t* major, uint8_t* minor);
1441 
1442  int16_t gnssSetConstellationToUse(uint8_t mask);
1443  int16_t gnssReadConstellationToUse(uint8_t* mask);
1444  int16_t gnssSetAlmanacUpdate(uint8_t mask);
1445  int16_t gnssReadAlmanacUpdate(uint8_t* mask);
1446  int16_t gnssReadVersion(uint8_t* fw, uint8_t* almanac);
1447  int16_t gnssReadSupportedConstellations(uint8_t* mask);
1448  int16_t gnssSetMode(uint8_t mode);
1449  int16_t gnssAutonomous(uint32_t gpsTime, uint8_t resMask, uint8_t nbSvMask);
1450  int16_t gnssAssisted(uint32_t gpsTime, uint8_t effort, uint8_t resMask, uint8_t nbSvMask);
1451  int16_t gnssSetAssistancePosition(float lat, float lon);
1452  int16_t gnssReadAssistancePosition(float* lat, float* lon);
1453  int16_t gnssPushSolverMsg(uint8_t* payload, size_t len);
1454  int16_t gnssPushDmMsg(uint8_t* payload, size_t len);
1455  int16_t gnssGetContextStatus(uint8_t* fwVersion, uint32_t* almanacCrc, uint8_t* errCode, uint8_t* almUpdMask, uint8_t* freqSpace);
1456  int16_t gnssGetNbSvDetected(uint8_t* nbSv);
1457  int16_t gnssGetSvDetected(uint8_t* svId, uint8_t* snr, uint16_t* doppler, size_t nbSv);
1458  int16_t gnssGetConsumption(uint32_t* cpu, uint32_t* radio);
1459  int16_t gnssGetResultSize(uint16_t* size);
1460  int16_t gnssReadResults(uint8_t* result, uint16_t size);
1461  int16_t gnssAlmanacFullUpdateHeader(uint16_t date, uint32_t globalCrc);
1462  int16_t gnssAlmanacFullUpdateSV(uint8_t svn, uint8_t* svnAlmanac);
1463  int16_t gnssGetSvVisible(uint32_t time, float lat, float lon, uint8_t constellation, uint8_t* nbSv);
1464  int16_t gnssScan(uint8_t effort, uint8_t resMask, uint8_t nbSvMax);
1465  int16_t gnssReadLastScanModeLaunched(uint8_t* lastScanMode);
1466  int16_t gnssFetchTime(uint8_t effort, uint8_t opt);
1467  int16_t gnssReadTime(uint8_t* err, uint32_t* time, uint32_t* nbUs, uint32_t* timeAccuracy);
1468  int16_t gnssResetTime(void);
1469  int16_t gnssResetPosition(void);
1470  int16_t gnssReadDemodStatus(int8_t* status, uint8_t* info);
1471  int16_t gnssReadCumulTiming(uint32_t* timing, uint8_t* constDemod);
1472  int16_t gnssSetTime(uint32_t time, uint16_t accuracy);
1473  int16_t gnssReadDopplerSolverRes(uint8_t* error, uint8_t* nbSvUsed, float* lat, float* lon, uint16_t* accuracy, uint16_t* xtal, float* latFilt, float* lonFilt, uint16_t* accuracyFilt, uint16_t* xtalFilt);
1474  int16_t gnssReadDelayResetAP(uint32_t* delay);
1475  int16_t gnssAlmanacUpdateFromSat(uint8_t effort, uint8_t bitMask);
1476  int16_t gnssReadAlmanacStatus(uint8_t* status);
1477  int16_t gnssConfigAlmanacUpdatePeriod(uint8_t bitMask, uint8_t svType, uint16_t period);
1478  int16_t gnssReadAlmanacUpdatePeriod(uint8_t bitMask, uint8_t svType, uint16_t* period);
1479  int16_t gnssConfigDelayResetAP(uint32_t delay);
1480  int16_t gnssGetSvWarmStart(uint8_t bitMask, uint8_t* sv, uint8_t nbVisSat);
1481  int16_t gnssReadWNRollover(uint8_t* status, uint8_t* rollover);
1482  int16_t gnssReadWarmStartStatus(uint8_t bitMask, uint8_t* nbVisSat, uint32_t* timeElapsed);
1483  int16_t gnssWriteBitMaskSatActivated(uint8_t bitMask, uint32_t* bitMaskActivated0, uint32_t* bitMaskActivated1);
1484 
1485  int16_t cryptoSetKey(uint8_t keyId, uint8_t* key);
1486  int16_t cryptoDeriveKey(uint8_t srcKeyId, uint8_t dstKeyId, uint8_t* key);
1487  int16_t cryptoProcessJoinAccept(uint8_t decKeyId, uint8_t verKeyId, uint8_t lwVer, uint8_t* header, uint8_t* dataIn, size_t len, uint8_t* dataOut);
1488  int16_t cryptoComputeAesCmac(uint8_t keyId, uint8_t* data, size_t len, uint32_t* mic);
1489  int16_t cryptoVerifyAesCmac(uint8_t keyId, uint32_t micExp, uint8_t* data, size_t len, bool* result);
1490  int16_t cryptoAesEncrypt01(uint8_t keyId, uint8_t* dataIn, size_t len, uint8_t* dataOut);
1491  int16_t cryptoAesEncrypt(uint8_t keyId, uint8_t* dataIn, size_t len, uint8_t* dataOut);
1492  int16_t cryptoAesDecrypt(uint8_t keyId, uint8_t* dataIn, size_t len, uint8_t* dataOut);
1493  int16_t cryptoStoreToFlash(void);
1494  int16_t cryptoRestoreFromFlash(void);
1495  int16_t cryptoSetParam(uint8_t id, uint32_t value);
1496  int16_t cryptoGetParam(uint8_t id, uint32_t* value);
1497  int16_t cryptoCheckEncryptedFirmwareImage(uint32_t offset, uint32_t* data, size_t len, bool nonvolatile);
1498  int16_t cryptoCheckEncryptedFirmwareImageResult(bool* result);
1499 
1500  int16_t bootEraseFlash(void);
1501  int16_t bootWriteFlashEncrypted(uint32_t offset, uint32_t* data, size_t len, bool nonvolatile);
1502  int16_t bootReboot(bool stay);
1503  int16_t bootGetPin(uint8_t* pin);
1504  int16_t bootGetChipEui(uint8_t* eui);
1505  int16_t bootGetJoinEui(uint8_t* eui);
1506 
1507  int16_t SPIcommand(uint16_t cmd, bool write, uint8_t* data, size_t len, uint8_t* out = NULL, size_t outLen = 0);
1508 
1509 #if !RADIOLIB_GODMODE
1510  protected:
1511 #endif
1512  uint8_t chipType = 0;
1513 
1514 #if !RADIOLIB_GODMODE
1515  private:
1516 #endif
1517  Module* mod;
1518 
1519  // cached LoRa parameters
1520  uint8_t bandwidth = 0, spreadingFactor = 0, codingRate = 0, ldrOptimize = 0, crcTypeLoRa = 0, headerType = 0;
1521  uint16_t preambleLengthLoRa = 0;
1522  float bandwidthKhz = 0;
1523  bool ldroAuto = true;
1524  size_t implicitLen = 0;
1525  bool invertIQEnabled = false;
1526 
1527  // cached GFSK parameters
1528  uint32_t bitRate = 0, frequencyDev = 0;
1529  uint8_t preambleDetLength = 0, rxBandwidth = 0, pulseShape = 0, crcTypeGFSK = 0, syncWordLength = 0, addrComp = 0, whitening = 0, packetType = 0, node = 0;
1530  uint16_t preambleLengthGFSK = 0;
1531 
1532  // cached LR-FHSS parameters
1533  uint8_t lrFhssCr = 0, lrFhssBw = 0, lrFhssHdrCount = 0;
1534  uint16_t lrFhssHopSeq = 0;
1535 
1536  float dataRateMeasured = 0;
1537 
1538  uint8_t wifiScanMode = 0;
1539 
1540  int16_t modSetup(float tcxoVoltage, uint8_t modem);
1541  static int16_t SPIparseStatus(uint8_t in);
1542  static int16_t SPIcheckStatus(Module* mod);
1543  bool findChip(uint8_t ver);
1544  int16_t config(uint8_t modem);
1545  int16_t setPacketMode(uint8_t mode, uint8_t len);
1546  int16_t startCad(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
1547  int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
1548 
1549  // common methods to avoid some copy-paste
1550  int16_t bleBeaconCommon(uint16_t cmd, uint8_t chan, uint8_t* payload, size_t len);
1551  int16_t writeCommon(uint16_t cmd, uint32_t addrOffset, const uint32_t* data, size_t len, bool nonvolatile);
1552  int16_t cryptoCommon(uint16_t cmd, uint8_t keyId, uint8_t* dataIn, size_t len, uint8_t* dataOut);
1553 };
1554 
1555 #endif
1556 
1557 #endif
Base class for LR11x0 series. All derived classes for LR11x0 (e.g. LR1110 or LR1120) inherit from thi...
Definition: LR11x0.h:699
float getSNR() override
Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem.
Definition: LR11x0.cpp:1224
uint32_t getIrqStatus()
Reads the current IRQ status.
Definition: LR11x0.cpp:488
int16_t setDataRate(DataRate_t dr) override
Set data.
Definition: LR11x0.cpp:1026
int16_t getChannelScanResult() override
Read the channel scan result.
Definition: LR11x0.cpp:576
float getDataRate() const
Gets effective data rate for the last transmitted packet. The value is calculated only for payload by...
Definition: LR11x0.cpp:1362
int16_t setRxBandwidth(float rxBw)
Sets GFSK receiver bandwidth. Allowed values are 4.8, 5.8, 7.3, 9.7, 11.7, 14.6, 19....
Definition: LR11x0.cpp:786
RadioLibTime_t calculateRxTimeout(RadioLibTime_t timeoutUs) override
Calculate the timeout value for this specific module / series (in number of symbols or units of time)
Definition: LR11x0.cpp:1329
int16_t reset()
Reset method. Will reset the chip to the default state using RST pin.
Definition: LR11x0.cpp:110
int16_t startWifiScan(char wifiType, uint8_t mode=RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_BEACON, uint16_t chanMask=RADIOLIB_LR11X0_WIFI_ALL_CHANNELS, uint8_t numScans=16, uint16_t timeout=100)
Start passive WiFi scan. BUSY pin will be de-activated when the scan is finished.
Definition: LR11x0.cpp:1387
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
int16_t explicitHeader()
Set explicit header mode for future reception/transmission.
Definition: LR11x0.cpp:1358
bool XTAL
Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
Definition: LR11x0.h:716
int16_t beginLRFHSS(uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage)
Initialization method for LR-FHSS modem.
Definition: LR11x0.cpp:91
int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage)
Initialization method for LoRa modem.
Definition: LR11x0.cpp:16
int16_t getWifiScanResult(LR11x0WifiResult_t *result, uint8_t index, bool brief=false)
Retrieve passive WiFi scan result.
Definition: LR11x0.cpp:1446
void setIrqAction(void(*func)(void))
Sets interrupt service routine to call when IRQ1 activates.
Definition: LR11x0.cpp:342
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
int16_t checkDataRate(DataRate_t dr) override
Check the data rate can be configured by this module.
Definition: LR11x0.cpp:1056
int16_t startChannelScan() override
Interrupt-driven channel activity detection method. IRQ1 will be activated when LoRa preamble is dete...
Definition: LR11x0.cpp:543
int16_t setCRC(uint8_t len, uint32_t initial=0x00001D0FUL, uint32_t polynomial=0x00001021UL, bool inverted=true)
Sets CRC configuration.
Definition: LR11x0.cpp:1150
LR11x0(Module *mod)
Default constructor.
Definition: LR11x0.cpp:11
int16_t setCodingRate(uint8_t cr, bool longInterleave=false)
Sets LoRa coding rate denominator. Allowed values range from 5 to 8.
Definition: LR11x0.cpp:700
int16_t setDataShaping(uint8_t sh) override
Sets time-bandwidth product of Gaussian filter applied for shaping. Allowed values are RADIOLIB_SHAPI...
Definition: LR11x0.cpp:955
int16_t setOutputPower(int8_t power) override
Sets output power. Allowed values are in range from -9 to 22 dBm (high-power PA) or -17 to 14 dBm (lo...
Definition: LR11x0.cpp:599
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_LR11X0_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode. Available in GFSK mode only.
Definition: LR11x0.cpp:993
int16_t getWifiScanResultsCount(uint8_t *count)
Get number of WiFi scan results after the scan is finished.
Definition: LR11x0.cpp:1432
int16_t setNodeAddress(uint8_t nodeAddr)
Sets node address. Calling this method will also enable address filtering for node address only.
Definition: LR11x0.cpp:904
int16_t setSyncBits(uint8_t *syncWord, uint8_t bitsLen)
Sets GFSK sync word in the form of array of up to 8 bytes.
Definition: LR11x0.cpp:883
int16_t checkOutputPower(int8_t power, int8_t *clipped) override
Check if output power is configurable. This method is needed for compatibility with PhysicalLayer::ch...
Definition: LR11x0.cpp:622
int16_t scanChannel() override
Performs scan for LoRa transmission in the current channel. Detects both preamble and payload.
Definition: LR11x0.cpp:280
float getRSSI() override
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. Only available for LoRa o...
Definition: LR11x0.cpp:1207
int16_t standby() override
Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator)...
Definition: LR11x0.cpp:298
int16_t setSyncWord(uint32_t syncWord)
Sets LoRa or LR-FHSS sync word.
Definition: LR11x0.cpp:733
uint8_t randomByte() override
Get one truly random byte from RSSI noise.
Definition: LR11x0.cpp:1348
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Available in GFSK mode only. Serves only as alias for PhysicalLayer compa...
Definition: LR11x0.cpp:989
int16_t setLrFhssConfig(uint8_t bw, uint8_t cr, uint8_t hdrCount=3, uint16_t hopSeed=0x13A)
Sets LR-FHSS configuration.
Definition: LR11x0.cpp:1366
bool isRxTimeout() override
Check whether the IRQ bit for RxTimeout is set.
Definition: LR11x0.cpp:1342
void setPacketSentAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is sent.
Definition: LR11x0.cpp:358
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
void clearPacketSentAction() override
Clears interrupt service routine to call when a packet is sent.
Definition: LR11x0.cpp:362
void clearPacketReceivedAction() override
Clears interrupt service routine to call when a packet is received.
Definition: LR11x0.cpp:354
int16_t setTCXO(float voltage, uint32_t delay=5000)
Sets TCXO (Temperature Compensated Crystal Oscillator) configuration.
Definition: LR11x0.cpp:1095
int16_t setPreambleLength(size_t preambleLength) override
Sets preamble length for LoRa or GFSK modem. Allowed values range from 1 to 65535.
Definition: LR11x0.cpp:1078
int16_t startReceive() override
Interrupt-driven receive method with default parameters. Implemented for compatibility with PhysicalL...
Definition: LR11x0.cpp:441
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: LR11x0.cpp:433
int16_t sleep()
Sets the module to sleep mode. To wake the device up, call standby(). Overload with warm start enable...
Definition: LR11x0.cpp:317
void clearIrqAction()
Clears interrupt service routine to call when IRQ1 activates.
Definition: LR11x0.cpp:346
int16_t setBitRate(float br) override
Sets GFSK bit rate. Allowed values range from 0.6 to 300.0 kbps.
Definition: LR11x0.cpp:749
int16_t beginGFSK(float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage)
Initialization method for FSK modem.
Definition: LR11x0.cpp:50
int16_t updateFirmware(const uint32_t *image, size_t size, bool nonvolatile=true)
Method to upload new firmware image to the device. The device will be automatically erased,...
Definition: LR11x0.cpp:1561
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
int16_t implicitHeader(size_t len)
Set implicit header mode for future reception/transmission.
Definition: LR11x0.cpp:1354
RadioLibTime_t getTimeOnAir(size_t len) override
Get expected time-on-air for a given size of payload.
Definition: LR11x0.cpp:1261
int16_t setBandwidth(float bw)
Sets LoRa bandwidth. Allowed values are 62.5, 125.0, 250.0 and 500.0 kHz.
Definition: LR11x0.cpp:643
int16_t setFrequencyDeviation(float freqDev) override
Sets GFSK frequency deviation. Allowed values range from 0.0 to 200.0 kHz.
Definition: LR11x0.cpp:766
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: LR11x0.cpp:1242
void setPacketReceivedAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is received.
Definition: LR11x0.cpp:350
int16_t getVersionInfo(LR11x0VersionInfo_t *info)
Retrieve LR11x0 hardware, device and firmware version information.
Definition: LR11x0.cpp:1549
void clearWiFiScanAction()
Clears interrupt service routine to call when a WiFi scan is completed.
Definition: LR11x0.cpp:1428
float getFrequencyError()
Gets frequency error of the latest received packet.
Definition: LR11x0.cpp:1237
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_LR11X0_MAX_PACKET_LENGTH)
Set modem in variable packet length mode. Available in GFSK mode only.
Definition: LR11x0.cpp:997
int16_t setWhitening(bool enabled, uint16_t initial=0x01FF)
Sets GFSK whitening parameters.
Definition: LR11x0.cpp:1001
int16_t wifiScan(uint8_t wifiType, uint8_t *count, uint8_t mode=RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_BEACON, uint16_t chanMask=RADIOLIB_LR11X0_WIFI_ALL_CHANNELS, uint8_t numScans=16, uint16_t timeout=100)
Blocking WiFi scan method. Performs a full passive WiFi scan. This method may block for several secon...
Definition: LR11x0.cpp:1522
int16_t setSpreadingFactor(uint8_t sf, bool legacy=false)
Sets LoRa spreading factor. Allowed values range from 5 to 12.
Definition: LR11x0.cpp:679
int16_t transmitDirect(uint32_t frf=0) override
Starts direct mode transmission.
Definition: LR11x0.cpp:257
int16_t receiveDirect() override
Starts direct mode reception. Only implemented for PhysicalLayer compatibility, as SX126x series does...
Definition: LR11x0.cpp:272
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition: LR11x0.cpp:941
int16_t setBroadcastAddress(uint8_t broadAddr)
Sets broadcast address. Calling this method will also enable address filtering for node and broadcast...
Definition: LR11x0.cpp:923
int16_t irqRxDoneRxTimeout(uint32_t &irqFlags, uint32_t &irqMask) override
Create the flags that make up RxDone and RxTimeout used for receiving downlinks.
Definition: LR11x0.cpp:1336
int16_t invertIQ(bool enable) override
Enable/disable inversion of the I and Q signals.
Definition: LR11x0.cpp:1194
void setWiFiScanAction(void(*func)(void))
Sets interrupt service routine to call when a WiFi scan is completed.
Definition: LR11x0.cpp:1424
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:65
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:54
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
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
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition: TypeDef.h:611
Structure to report information about versions of the LR11x0 hardware and firmware.
Definition: LR11x0.h:668
uint8_t fwMajor
Major revision of the base firmware.
Definition: LR11x0.h:676
uint8_t fwMinorWiFi
Minor revision of the WiFi firmware.
Definition: LR11x0.h:685
uint8_t device
Which device this is - one of RADIOLIB_LR11X0_DEVICE_* macros.
Definition: LR11x0.h:673
uint8_t hardware
Hardware revision.
Definition: LR11x0.h:670
uint8_t fwMinor
Minor revision of the base firmware.
Definition: LR11x0.h:679
uint8_t fwGNSS
Revision of the GNSS firmware.
Definition: LR11x0.h:688
uint8_t almanacGNSS
Almanac revision of the GNSS firmware.
Definition: LR11x0.h:691
uint8_t fwMajorWiFi
Major revision of the WiFi firmware.
Definition: LR11x0.h:682
Structure to save result of passive WiFi scan. This result only saves the basic information.
Definition: LR11x0.h:571
bool ap
Whether this signal was sent by an access point (true) or end device (false)
Definition: LR11x0.h:585
uint16_t channelFreq
Channel frequency in MHz.
Definition: LR11x0.h:579
char type
WiFi (802.11) signal type, 'b', 'n' or 'g'.
Definition: LR11x0.h:573
uint8_t mac[RADIOLIB_LR11X0_WIFI_RESULT_MAC_LEN]
MAC address.
Definition: LR11x0.h:591
uint8_t dataRateId
Data rate ID holding information about modulation and coding rate. See LR11x0 user manual for details...
Definition: LR11x0.h:576
float rssi
RSSI in dBm.
Definition: LR11x0.h:588
uint8_t origin
MAC address origin: from gateway (1), phone (2) or undetermined (3)
Definition: LR11x0.h:582
Structure to save result of passive WiFi scan. This result saves additional information alongside tha...
Definition: LR11x0.h:629
uint8_t rate
Data rate. See LR11x0 user manual for details.
Definition: LR11x0.h:631
uint16_t length
Refer to IEEE Std 802.11, 2016, Part 11: Wireless LAN MAC and PHY Spec.
Definition: LR11x0.h:637
bool fcsCheckOk
True if frame check sequences is valid, false otherwise.
Definition: LR11x0.h:661
uint16_t service
Refer to IEEE Std 802.11, 2016, Part 11: Wireless LAN MAC and PHY Spec.
Definition: LR11x0.h:634
uint8_t mac2[RADIOLIB_LR11X0_WIFI_RESULT_MAC_LEN]
MAC address 2.
Definition: LR11x0.h:643
uint8_t ssid[RADIOLIB_LR11X0_WIFI_RESULT_SSID_LEN]
SSID.
Definition: LR11x0.h:649
uint8_t currentChannel
WiFi channel number.
Definition: LR11x0.h:652
uint16_t seqCtrl
Refer to IEEE Std 802.11, 2016, Part 11: Wireless LAN MAC and PHY Spec.
Definition: LR11x0.h:646
uint8_t mac0[RADIOLIB_LR11X0_WIFI_RESULT_MAC_LEN]
MAC address 0.
Definition: LR11x0.h:640
char countryCode[3]
Two-letter country code (null-terminated string).
Definition: LR11x0.h:655
uint8_t ioReg
Refer to IEEE Std 802.11, 2016, Part 11: Wireless LAN MAC and PHY Spec.
Definition: LR11x0.h:658
Structure to save result of passive WiFi scan. This result saves additional information alongside tha...
Definition: LR11x0.h:599
uint32_t periodBeacon
Beacon period in microseconds.
Definition: LR11x0.h:619
uint16_t phiOffset
See LR11x0 user manual for details.
Definition: LR11x0.h:613
bool fromDistributionSystem
Frame sent from distribution system to client station.
Definition: LR11x0.h:610
uint64_t timestamp
Number of microseconds the AP has been active.
Definition: LR11x0.h:616
uint8_t frameType
Frame type. See LR11x0 user manual for details.
Definition: LR11x0.h:601
uint8_t frameSubType
Frame sub type. See LR11x0 user manual for details.
Definition: LR11x0.h:604
bool toDistributionSystem
Frame sent from client station to distribution system.
Definition: LR11x0.h:607
Common data rate structure.
Definition: PhysicalLayer.h:38