1 #if !defined(_RADIOLIB_LR11X0_H)
2 #define _RADIOLIB_LR11X0_H
4 #include "../../TypeDef.h"
6 #if !RADIOLIB_EXCLUDE_LR11X0
8 #include "../../Module.h"
10 #include "../../protocols/PhysicalLayer/PhysicalLayer.h"
13 #define RADIOLIB_LR11X0_FREQUENCY_STEP_SIZE 0.9536743164
14 #define RADIOLIB_LR11X0_MAX_PACKET_LENGTH 255
15 #define RADIOLIB_LR11X0_CRYSTAL_FREQ 32.0
16 #define RADIOLIB_LR11X0_DIV_EXPONENT 25
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_LORA_SYNC_WORD (0x022B)
88 #define RADIOLIB_LR11X0_CMD_LR_FHSS_BUILD_FRAME (0x022C)
89 #define RADIOLIB_LR11X0_CMD_LR_FHSS_SET_SYNC_WORD (0x022D)
90 #define RADIOLIB_LR11X0_CMD_CONFIG_BLE_BEACON (0x022E)
91 #define RADIOLIB_LR11X0_CMD_GET_LORA_RX_HEADER_INFOS (0x0230)
92 #define RADIOLIB_LR11X0_CMD_BLE_BEACON_SEND (0x0231)
93 #define RADIOLIB_LR11X0_CMD_WIFI_SCAN (0x0300)
94 #define RADIOLIB_LR11X0_CMD_WIFI_SCAN_TIME_LIMIT (0x0301)
95 #define RADIOLIB_LR11X0_CMD_WIFI_COUNTRY_CODE (0x0302)
96 #define RADIOLIB_LR11X0_CMD_WIFI_COUNTRY_CODE_TIME_LIMIT (0x0303)
97 #define RADIOLIB_LR11X0_CMD_WIFI_GET_NB_RESULTS (0x0305)
98 #define RADIOLIB_LR11X0_CMD_WIFI_READ_RESULTS (0x0306)
99 #define RADIOLIB_LR11X0_CMD_WIFI_RESET_CUMUL_TIMINGS (0x0307)
100 #define RADIOLIB_LR11X0_CMD_WIFI_READ_CUMUL_TIMINGS (0x0308)
101 #define RADIOLIB_LR11X0_CMD_WIFI_GET_NB_COUNTRY_CODE_RESULTS (0x0309)
102 #define RADIOLIB_LR11X0_CMD_WIFI_READ_COUNTRY_CODE_RESULTS (0x030A)
103 #define RADIOLIB_LR11X0_CMD_WIFI_CFG_TIMESTAMP_AP_PHONE (0x030B)
104 #define RADIOLIB_LR11X0_CMD_WIFI_READ_VERSION (0x0320)
105 #define RADIOLIB_LR11X0_CMD_GNSS_SET_CONSTELLATION_TO_USE (0x0400)
106 #define RADIOLIB_LR11X0_CMD_GNSS_READ_CONSTELLATION_TO_USE (0x0401)
107 #define RADIOLIB_LR11X0_CMD_GNSS_SET_ALMANAC_UPDATE (0x0402)
108 #define RADIOLIB_LR11X0_CMD_GNSS_READ_ALMANAC_UPDATE (0x0403)
109 #define RADIOLIB_LR11X0_CMD_GNSS_READ_VERSION (0x0406)
110 #define RADIOLIB_LR11X0_CMD_GNSS_READ_SUPPORTED_CONSTELLATIONS (0x0407)
111 #define RADIOLIB_LR11X0_CMD_GNSS_SET_MODE (0x0408)
112 #define RADIOLIB_LR11X0_CMD_GNSS_AUTONOMOUS (0x0409)
113 #define RADIOLIB_LR11X0_CMD_GNSS_ASSISTED (0x040A)
114 #define RADIOLIB_LR11X0_CMD_GNSS_SET_ASSISTANCE_POSITION (0x0410)
115 #define RADIOLIB_LR11X0_CMD_GNSS_READ_ASSISTANCE_POSITION (0x0411)
116 #define RADIOLIB_LR11X0_CMD_GNSS_PUSH_SOLVER_MSG (0x0414)
117 #define RADIOLIB_LR11X0_CMD_GNSS_PUSH_DM_MSG (0x0415)
118 #define RADIOLIB_LR11X0_CMD_GNSS_GET_CONTEXT_STATUS (0x0416)
119 #define RADIOLIB_LR11X0_CMD_GNSS_GET_NB_SV_DETECTED (0x0417)
120 #define RADIOLIB_LR11X0_CMD_GNSS_GET_SV_DETECTED (0x0418)
121 #define RADIOLIB_LR11X0_CMD_GNSS_GET_CONSUMPTION (0x0419)
122 #define RADIOLIB_LR11X0_CMD_GNSS_GET_RESULT_SIZE (0x040C)
123 #define RADIOLIB_LR11X0_CMD_GNSS_READ_RESULTS (0x040D)
124 #define RADIOLIB_LR11X0_CMD_GNSS_ALMANAC_FULL_UPDATE (0x040E)
125 #define RADIOLIB_LR11X0_CMD_GNSS_GET_SV_VISIBLE (0x041F)
126 #define RADIOLIB_LR11X0_CMD_CRYPTO_SET_KEY (0x0502)
127 #define RADIOLIB_LR11X0_CMD_CRYPTO_DERIVE_KEY (0x0503)
128 #define RADIOLIB_LR11X0_CMD_CRYPTO_PROCESS_JOIN_ACCEPT (0x0504)
129 #define RADIOLIB_LR11X0_CMD_CRYPTO_COMPUTE_AES_CMAC (0x0505)
130 #define RADIOLIB_LR11X0_CMD_CRYPTO_VERIFY_AES_CMAC (0x0506)
131 #define RADIOLIB_LR11X0_CMD_CRYPTO_AES_ENCRYPT_01 (0x0507)
132 #define RADIOLIB_LR11X0_CMD_CRYPTO_AES_ENCRYPT (0x0508)
133 #define RADIOLIB_LR11X0_CMD_CRYPTO_AES_DECRYPT (0x0509)
134 #define RADIOLIB_LR11X0_CMD_CRYPTO_STORE_TO_FLASH (0x050A)
135 #define RADIOLIB_LR11X0_CMD_CRYPTO_RESTORE_FROM_FLASH (0x050B)
136 #define RADIOLIB_LR11X0_CMD_CRYPTO_SET_PARAM (0x050D)
137 #define RADIOLIB_LR11X0_CMD_CRYPTO_GET_PARAM (0x050E)
138 #define RADIOLIB_LR11X0_CMD_CRYPTO_CHECK_ENCRYPTED_FIRMWARE_IMAGE (0x050F)
139 #define RADIOLIB_LR11X0_CMD_CRYPTO_CHECK_ENCRYPTED_FIRMWARE_IMAGE_RESULT (0x0510)
140 #define RADIOLIB_LR11X0_CMD_BOOT_ERASE_FLASH (0x8000)
141 #define RADIOLIB_LR11X0_CMD_BOOT_WRITE_FLASH_ENCRYPTED (0x8003)
142 #define RADIOLIB_LR11X0_CMD_BOOT_REBOOT (0x8005)
143 #define RADIOLIB_LR11X0_CMD_BOOT_GET_PIN (0x800B)
144 #define RADIOLIB_LR11X0_CMD_BOOT_GET_CHIP_EUI (0x800C)
145 #define RADIOLIB_LR11X0_CMD_BOOT_GET_JOIN_EUI (0x800D)
148 #define RADIOLIB_LR11X0_REG_SF6_SX127X_COMPAT (0x00F20414)
149 #define RADIOLIB_LR11X0_REG_LORA_HIGH_POWER_FIX (0x00F30054)
154 #define RADIOLIB_LR11X0_STAT_1_CMD_FAIL (0x00UL << 1)
155 #define RADIOLIB_LR11X0_STAT_1_CMD_PERR (0x01UL << 1)
156 #define RADIOLIB_LR11X0_STAT_1_CMD_OK (0x02UL << 1)
157 #define RADIOLIB_LR11X0_STAT_1_CMD_DAT (0x03UL << 1)
158 #define RADIOLIB_LR11X0_STAT_1_IRQ_INACTIVE (0x00UL << 0)
159 #define RADIOLIB_LR11X0_STAT_1_IRQ_ACTIVE (0x01UL << 0)
160 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_CLEARED (0x00UL << 4)
161 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_ANALOG (0x01UL << 4)
162 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_EXTERNAL (0x02UL << 4)
163 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_SYSTEM (0x03UL << 4)
164 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_WATCHDOG (0x04UL << 4)
165 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_WAKEUP (0x05UL << 4)
166 #define RADIOLIB_LR11X0_STAT_2_CMD_RST_RTC (0x06UL << 4)
167 #define RADIOLIB_LR11X0_STAT_2_MODE_SLEEP (0x00UL << 1)
168 #define RADIOLIB_LR11X0_STAT_2_MODE_STBY_RC (0x01UL << 1)
169 #define RADIOLIB_LR11X0_STAT_2_MODE_STBY_OSC (0x02UL << 1)
170 #define RADIOLIB_LR11X0_STAT_2_MODE_FS (0x03UL << 1)
171 #define RADIOLIB_LR11X0_STAT_2_MODE_RX (0x04UL << 1)
172 #define RADIOLIB_LR11X0_STAT_2_MODE_TX (0x05UL << 1)
173 #define RADIOLIB_LR11X0_STAT_2_MODE_WIFI_GNSS (0x06UL << 1)
174 #define RADIOLIB_LR11X0_STAT_2_BOOT (0x00UL << 0)
175 #define RADIOLIB_LR11X0_STAT_2_FLASH (0x01UL << 0)
178 #define RADIOLIB_LR11X0_SPI_MAX_READ_WRITE_LEN (256)
181 #define RADIOLIB_LR11X0_HW_LR1110 (0x01UL << 0)
182 #define RADIOLIB_LR11X0_HW_LR1120 (0x02UL << 0)
183 #define RADIOLIB_LR11X0_HW_LR1121 (0x03UL << 0)
184 #define RADIOLIB_LR11X0_HW_BOOT (0xDFUL << 0)
187 #define RADIOLIB_LR11X0_ERROR_STAT_LF_RC_CALIB_ERR (0x01UL << 0)
188 #define RADIOLIB_LR11X0_ERROR_STAT_HF_RC_CALIB_ERR (0x01UL << 1)
189 #define RADIOLIB_LR11X0_ERROR_STAT_ADC_CALIB_ERR (0x01UL << 2)
190 #define RADIOLIB_LR11X0_ERROR_STAT_PLL_CALIB_ERR (0x01UL << 3)
191 #define RADIOLIB_LR11X0_ERROR_STAT_IMG_CALIB_ERR (0x01UL << 4)
192 #define RADIOLIB_LR11X0_ERROR_STAT_HF_XOSC_START_ERR (0x01UL << 5)
193 #define RADIOLIB_LR11X0_ERROR_STAT_LF_XOSC_START_ERR (0x01UL << 6)
194 #define RADIOLIB_LR11X0_ERROR_STAT_PLL_LOCK_ERR (0x01UL << 7)
195 #define RADIOLIB_LR11X0_ERROR_STAT_RX_ADC_OFFSET_ERR (0x01UL << 8)
198 #define RADIOLIB_LR11X0_CALIBRATE_PLL_TX (0x01UL << 5)
199 #define RADIOLIB_LR11X0_CALIBRATE_IMG (0x01UL << 4)
200 #define RADIOLIB_LR11X0_CALIBRATE_ADC (0x01UL << 3)
201 #define RADIOLIB_LR11X0_CALIBRATE_PLL (0x01UL << 2)
202 #define RADIOLIB_LR11X0_CALIBRATE_HF_RC (0x01UL << 1)
203 #define RADIOLIB_LR11X0_CALIBRATE_LF_RC (0x01UL << 0)
204 #define RADIOLIB_LR11X0_CALIBRATE_ALL (0x3FUL << 0)
207 #define RADIOLIB_LR11X0_REG_MODE_LDO (0x00UL << 0)
208 #define RADIOLIB_LR11X0_REG_MODE_DC_DC (0x01UL << 0)
211 #define RADIOLIB_LR11X0_RFSW_DIO5_ENABLED (0x01UL << 0)
212 #define RADIOLIB_LR11X0_RFSW_DIO5_DISABLED (0x00UL << 0)
213 #define RADIOLIB_LR11X0_RFSW_DIO6_ENABLED (0x01UL << 1)
214 #define RADIOLIB_LR11X0_RFSW_DIO6_DISABLED (0x00UL << 1)
215 #define RADIOLIB_LR11X0_RFSW_DIO7_ENABLED (0x01UL << 2)
216 #define RADIOLIB_LR11X0_RFSW_DIO7_DISABLED (0x00UL << 2)
217 #define RADIOLIB_LR11X0_RFSW_DIO8_ENABLED (0x01UL << 3)
218 #define RADIOLIB_LR11X0_RFSW_DIO8_DISABLED (0x00UL << 3)
219 #define RADIOLIB_LR11X0_RFSW_DIO10_ENABLED (0x01UL << 4)
220 #define RADIOLIB_LR11X0_RFSW_DIO10_DISABLED (0x00UL << 4)
223 #define RADIOLIB_LR11X0_IRQ_TX_DONE (0x01UL << 2)
224 #define RADIOLIB_LR11X0_IRQ_RX_DONE (0x01UL << 3)
225 #define RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED (0x01UL << 4)
226 #define RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID (0x01UL << 5)
227 #define RADIOLIB_LR11X0_IRQ_HEADER_ERR (0x01UL << 6)
228 #define RADIOLIB_LR11X0_IRQ_CRC_ERR (0x01UL << 7)
229 #define RADIOLIB_LR11X0_IRQ_CAD_DONE (0x01UL << 8)
230 #define RADIOLIB_LR11X0_IRQ_CAD_DETECTED (0x01UL << 9)
231 #define RADIOLIB_LR11X0_IRQ_TIMEOUT (0x01UL << 10)
232 #define RADIOLIB_LR11X0_IRQ_LR_FHSS_HOP (0x01UL << 11)
233 #define RADIOLIB_LR11X0_IRQ_GNSS_DONE (0x01UL << 19)
234 #define RADIOLIB_LR11X0_IRQ_WIFI_DONE (0x01UL << 20)
235 #define RADIOLIB_LR11X0_IRQ_LBD (0x01UL << 21)
236 #define RADIOLIB_LR11X0_IRQ_CMD_ERROR (0x01UL << 22)
237 #define RADIOLIB_LR11X0_IRQ_ERROR (0x01UL << 23)
238 #define RADIOLIB_LR11X0_IRQ_FSK_LEN_ERROR (0x01UL << 24)
239 #define RADIOLIB_LR11X0_IRQ_FSK_ADDR_ERROR (0x01UL << 25)
240 #define RADIOLIB_LR11X0_IRQ_LORA_RX_TIMESTAMP (0x01UL << 27)
241 #define RADIOLIB_LR11X0_IRQ_ALL (0x0BF80FFCUL)
242 #define RADIOLIB_LR11X0_IRQ_NONE (0x00UL << 0)
245 #define RADIOLIB_LR11X0_LF_CLK_RC (0x00UL << 0)
246 #define RADIOLIB_LR11X0_LF_CLK_XOSC (0x01UL << 0)
247 #define RADIOLIB_LR11X0_LF_CLK_EXT (0x02UL << 0)
248 #define RADIOLIB_LR11X0_LF_BUSY_RELEASE_DISABLED (0x00UL << 2)
249 #define RADIOLIB_LR11X0_LF_BUSY_RELEASE_ENABLED (0x01UL << 2)
252 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_1_6 (0x00UL << 0)
253 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_1_7 (0x01UL << 0)
254 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_1_8 (0x02UL << 0)
255 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_2_2 (0x03UL << 0)
256 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_2_4 (0x04UL << 0)
257 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_2_7 (0x05UL << 0)
258 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_3_0 (0x06UL << 0)
259 #define RADIOLIB_LR11X0_TCXO_VOLTAGE_3_3 (0x07UL << 0)
262 #define RADIOLIB_LR11X0_SLEEP_RETENTION_DISABLED (0x00UL << 0)
263 #define RADIOLIB_LR11X0_SLEEP_RETENTION_ENABLED (0x01UL << 0)
264 #define RADIOLIB_LR11X0_SLEEP_WAKEUP_DISABLED (0x00UL << 0)
265 #define RADIOLIB_LR11X0_SLEEP_WAKEUP_ENABLED (0x01UL << 0)
268 #define RADIOLIB_LR11X0_STANDBY_RC (0x00UL << 0)
269 #define RADIOLIB_LR11X0_STANDBY_XOSC (0x00UL << 0)
272 #define RADIOLIB_LR11X0_INFO_PAGE (1)
275 #define RADIOLIB_LR11X0_EUI_LEN (8)
278 #define RADIOLIB_LR11X0_PIN_LEN (4)
281 #define RADIOLIB_LR11X0_RX_STATUS_ADDR_ERR (0x01UL << 5)
282 #define RADIOLIB_LR11X0_RX_STATUS_CRC_ERR (0x01UL << 4)
283 #define RADIOLIB_LR11X0_RX_STATUS_LEN_ERR (0x01UL << 3)
284 #define RADIOLIB_LR11X0_RX_STATUS_ABORTED (0x01UL << 2)
285 #define RADIOLIB_LR11X0_RX_STATUS_PACKET_RECEIVED (0x01UL << 1)
286 #define RADIOLIB_LR11X0_RX_STATUS_PACKET_SENT (0x01UL << 0)
289 #define RADIOLIB_LR11X0_GFSK_SYNC_WORD_LEN (8)
292 #define RADIOLIB_LR11X0_LORA_PRIVATE_NETWORK (0x00UL << 0)
293 #define RADIOLIB_LR11X0_LORA_PUBLIC_NETWORK (0x01UL << 0)
296 #define RADIOLIB_LR11X0_RX_TIMEOUT_NONE (0x000000UL)
297 #define RADIOLIB_LR11X0_RX_TIMEOUT_INF (0xFFFFFFUL)
300 #define RADIOLIB_LR11X0_TX_TIMEOUT_NONE (0x000000UL)
303 #define RADIOLIB_LR11X0_AUTO_TX_RX_DISABLED (0xFFFFFFUL)
304 #define RADIOLIB_LR11X0_AUTO_TX_RX_SKIP_INT (0x000000UL)
305 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_SLEEP (0x00UL << 0)
306 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_STBY_RC (0x01UL << 0)
307 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_STBY_XOSC (0x02UL << 0)
308 #define RADIOLIB_LR11X0_AUTO_INTERMEDIARY_MODE_FS (0x03UL << 0)
309 #define RADIOLIB_LR11X0_AUTO_TX_RX_TIMEOUT_DISABLED (0x000000UL)
312 #define RADIOLIB_LR11X0_CAD_EXIT_MODE_STBY_RC (0x00UL << 0)
313 #define RADIOLIB_LR11X0_CAD_EXIT_MODE_RX (0x01UL << 0)
314 #define RADIOLIB_LR11X0_CAD_EXIT_MODE_LBT (0x10UL << 0)
317 #define RADIOLIB_LR11X0_PACKET_TYPE_NONE (0x00UL << 0)
318 #define RADIOLIB_LR11X0_PACKET_TYPE_GFSK (0x01UL << 0)
319 #define RADIOLIB_LR11X0_PACKET_TYPE_LORA (0x02UL << 0)
320 #define RADIOLIB_LR11X0_PACKET_TYPE_SIGFOX (0x03UL << 0)
321 #define RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS (0x04UL << 0)
322 #define RADIOLIB_LR11X0_PACKET_TYPE_RANGING (0x05UL << 0)
323 #define RADIOLIB_LR11X0_PACKET_TYPE_BLE (0x06UL << 0)
326 #define RADIOLIB_LR11X0_LORA_BW_62_5 (0x03UL << 0)
327 #define RADIOLIB_LR11X0_LORA_BW_125_0 (0x04UL << 0)
328 #define RADIOLIB_LR11X0_LORA_BW_250_0 (0x05UL << 0)
329 #define RADIOLIB_LR11X0_LORA_BW_500_0 (0x06UL << 0)
330 #define RADIOLIB_LR11X0_LORA_CR_4_5_SHORT (0x01UL << 0)
331 #define RADIOLIB_LR11X0_LORA_CR_4_6_SHORT (0x02UL << 0)
332 #define RADIOLIB_LR11X0_LORA_CR_4_7_SHORT (0x03UL << 0)
333 #define RADIOLIB_LR11X0_LORA_CR_4_8_SHORT (0x04UL << 0)
334 #define RADIOLIB_LR11X0_LORA_CR_4_5_LONG (0x05UL << 0)
335 #define RADIOLIB_LR11X0_LORA_CR_4_6_LONG (0x06UL << 0)
336 #define RADIOLIB_LR11X0_LORA_CR_4_8_LONG (0x07UL << 0)
337 #define RADIOLIB_LR11X0_LORA_LDRO_DISABLED (0x00UL << 0)
338 #define RADIOLIB_LR11X0_LORA_LDRO_ENABLED (0x01UL << 0)
339 #define RADIOLIB_LR11X0_GFSK_BIT_RATE_DIV_DISABLED (0x00UL << 31)
340 #define RADIOLIB_LR11X0_GFSK_BIT_RATE_DIV_ENABLED (0x01UL << 31)
341 #define RADIOLIB_LR11X0_GFSK_SHAPING_NONE (0x00UL << 0)
342 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_0_3 (0x08UL << 0)
343 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_0_5 (0x09UL << 0)
344 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_0_7 (0x0AUL << 0)
345 #define RADIOLIB_LR11X0_GFSK_SHAPING_GAUSSIAN_BT_1_0 (0x0BUL << 0)
346 #define RADIOLIB_LR11X0_GFSK_SHAPING_RAISED_COSINE_BT_0_7 (0x16UL << 0)
347 #define RADIOLIB_LR11X0_GFSK_RX_BW_4_8 (0x1FUL << 0)
348 #define RADIOLIB_LR11X0_GFSK_RX_BW_5_8 (0x17UL << 0)
349 #define RADIOLIB_LR11X0_GFSK_RX_BW_7_3 (0x0FUL << 0)
350 #define RADIOLIB_LR11X0_GFSK_RX_BW_9_7 (0x1EUL << 0)
351 #define RADIOLIB_LR11X0_GFSK_RX_BW_11_7 (0x16UL << 0)
352 #define RADIOLIB_LR11X0_GFSK_RX_BW_14_6 (0x0EUL << 0)
353 #define RADIOLIB_LR11X0_GFSK_RX_BW_19_5 (0x1DUL << 0)
354 #define RADIOLIB_LR11X0_GFSK_RX_BW_23_4 (0x15UL << 0)
355 #define RADIOLIB_LR11X0_GFSK_RX_BW_29_3 (0x0DUL << 0)
356 #define RADIOLIB_LR11X0_GFSK_RX_BW_39_0 (0x1CUL << 0)
357 #define RADIOLIB_LR11X0_GFSK_RX_BW_46_9 (0x14UL << 0)
358 #define RADIOLIB_LR11X0_GFSK_RX_BW_58_6 (0x0CUL << 0)
359 #define RADIOLIB_LR11X0_GFSK_RX_BW_78_2 (0x1BUL << 0)
360 #define RADIOLIB_LR11X0_GFSK_RX_BW_93_8 (0x13UL << 0)
361 #define RADIOLIB_LR11X0_GFSK_RX_BW_117_3 (0x0BUL << 0)
362 #define RADIOLIB_LR11X0_GFSK_RX_BW_156_2 (0x1AUL << 0)
363 #define RADIOLIB_LR11X0_GFSK_RX_BW_187_2 (0x12UL << 0)
364 #define RADIOLIB_LR11X0_GFSK_RX_BW_234_3 (0x0AUL << 0)
365 #define RADIOLIB_LR11X0_GFSK_RX_BW_312_0 (0x19UL << 0)
366 #define RADIOLIB_LR11X0_GFSK_RX_BW_373_6 (0x11UL << 0)
367 #define RADIOLIB_LR11X0_GFSK_RX_BW_467_0 (0x09UL << 0)
368 #define RADIOLIB_LR11X0_LR_FHSS_BIT_RATE (0x8001E848UL)
369 #define RADIOLIB_LR11X0_LR_FHSS_SHAPING_GAUSSIAN_BT_1_0 (0x0BUL << 0)
370 #define RADIOLIB_LR11X0_SIGFOX_SHAPING_GAUSSIAN_BT_0_7 (0x16UL << 0)
373 #define RADIOLIB_LR11X0_LORA_HEADER_EXPLICIT (0x00UL << 0)
374 #define RADIOLIB_LR11X0_LORA_HEADER_IMPLICIT (0x01UL << 0)
375 #define RADIOLIB_LR11X0_LORA_PAYLOAD_LEN_ANY (0x00UL << 0)
376 #define RADIOLIB_LR11X0_LORA_CRC_ENABLED (0x01UL << 0)
377 #define RADIOLIB_LR11X0_LORA_CRC_DISABLED (0x00UL << 0)
378 #define RADIOLIB_LR11X0_LORA_IQ_STANDARD (0x00UL << 0)
379 #define RADIOLIB_LR11X0_LORA_IQ_INVERTED (0x01UL << 0)
380 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_DISABLED (0x00UL << 0)
381 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_8_BITS (0x04UL << 0)
382 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_16_BITS (0x05UL << 0)
383 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_24_BITS (0x06UL << 0)
384 #define RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_32_BITS (0x07UL << 0)
385 #define RADIOLIB_LR11X0_GFSK_ADDR_FILTER_DISABLED (0x00UL << 0)
386 #define RADIOLIB_LR11X0_GFSK_ADDR_FILTER_NODE (0x01UL << 0)
387 #define RADIOLIB_LR11X0_GFSK_ADDR_FILTER_NODE_BROADCAST (0x02UL << 0)
388 #define RADIOLIB_LR11X0_GFSK_PACKET_LENGTH_FIXED (0x00UL << 0)
389 #define RADIOLIB_LR11X0_GFSK_PACKET_LENGTH_VARIABLE (0x01UL << 0)
390 #define RADIOLIB_LR11X0_GFSK_PACKET_LENGTH_VARIABLE_SX128X (0x02UL << 0)
391 #define RADIOLIB_LR11X0_GFSK_PAYLOAD_LEN_ANY (0x00UL << 0)
392 #define RADIOLIB_LR11X0_GFSK_CRC_DISABLED (0x01UL << 0)
393 #define RADIOLIB_LR11X0_GFSK_CRC_1_BYTE (0x00UL << 0)
394 #define RADIOLIB_LR11X0_GFSK_CRC_2_BYTE (0x02UL << 0)
395 #define RADIOLIB_LR11X0_GFSK_CRC_1_BYTE_INV (0x04UL << 0)
396 #define RADIOLIB_LR11X0_GFSK_CRC_2_BYTE_INV (0x06UL << 0)
397 #define RADIOLIB_LR11X0_GFSK_WHITENING_DISABLED (0x00UL << 0)
398 #define RADIOLIB_LR11X0_GFSK_WHITENING_ENABLED (0x01UL << 0)
401 #define RADIOLIB_LR11X0_PA_RAMP_48U (0x02UL << 0)
404 #define RADIOLIB_LR11X0_FALLBACK_MODE_STBY_RC (0x01UL << 0)
405 #define RADIOLIB_LR11X0_FALLBACK_MODE_STBY_XOSC (0x02UL << 0)
406 #define RADIOLIB_LR11X0_FALLBACK_MODE_FS (0x03UL << 0)
409 #define RADIOLIB_LR11X0_RX_DUTY_CYCLE_MODE_RX (0x00UL << 0)
410 #define RADIOLIB_LR11X0_RX_DUTY_CYCLE_MODE_CAD (0x01UL << 0)
411 #define RADIOLIB_LR11X0_TIMING_STEP (1.0f/32768.0f)
414 #define RADIOLIB_LR11X0_PA_SEL_LP (0x00UL << 0)
415 #define RADIOLIB_LR11X0_PA_SEL_HP (0x01UL << 0)
416 #define RADIOLIB_LR11X0_PA_SEL_HF (0x02UL << 0)
417 #define RADIOLIB_LR11X0_PA_SUPPLY_INTERNAL (0x00UL << 0)
418 #define RADIOLIB_LR11X0_PA_SUPPLY_VBAT (0x01UL << 0)
421 #define RADIOLIB_LR11X0_STOP_ON_SYNC_HEADER (0x00UL << 0)
422 #define RADIOLIB_LR11X0_STOP_ON_PREAMBLE (0x01UL << 0)
425 #define RADIOLIB_LR11X0_RANGING_RESULT_DISTANCE (0)
426 #define RADIOLIB_LR11X0_RANGING_RESULT_RSSI (1)
429 #define RADIOLIB_LR11X0_RX_BOOSTED_ENABLED (0x01UL << 0)
430 #define RADIOLIB_LR11X0_RX_BOOSTED_DISABLED (0x00UL << 0)
433 #define RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE (0x12)
434 #define RADIOLIB_LR11X0_LORA_SYNC_WORD_PUBLIC (0x34)
437 #define RADIOLIB_LR11X0_LR_FHSS_CR_5_6 (0x00UL << 0)
438 #define RADIOLIB_LR11X0_LR_FHSS_CR_2_3 (0x01UL << 0)
439 #define RADIOLIB_LR11X0_LR_FHSS_CR_1_2 (0x02UL << 0)
440 #define RADIOLIB_LR11X0_LR_FHSS_CR_1_3 (0x03UL << 0)
441 #define RADIOLIB_LR11X0_LR_FHSS_MOD_TYPE_GMSK (0x00UL << 0)
442 #define RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC (0x00UL << 0)
443 #define RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_NON_FCC (0x01UL << 0)
444 #define RADIOLIB_LR11X0_LR_FHSS_HOPPING_DISABLED (0x00UL << 0)
445 #define RADIOLIB_LR11X0_LR_FHSS_HOPPING_ENABLED (0x01UL << 0)
446 #define RADIOLIB_LR11X0_LR_FHSS_BW_39_06 (0x00UL << 0)
447 #define RADIOLIB_LR11X0_LR_FHSS_BW_85_94 (0x01UL << 0)
448 #define RADIOLIB_LR11X0_LR_FHSS_BW_136_72 (0x02UL << 0)
449 #define RADIOLIB_LR11X0_LR_FHSS_BW_183_59 (0x03UL << 0)
450 #define RADIOLIB_LR11X0_LR_FHSS_BW_335_94 (0x04UL << 0)
451 #define RADIOLIB_LR11X0_LR_FHSS_BW_386_72 (0x05UL << 0)
452 #define RADIOLIB_LR11X0_LR_FHSS_BW_722_66 (0x06UL << 0)
453 #define RADIOLIB_LR11X0_LR_FHSS_BW_773_44 (0x07UL << 0)
454 #define RADIOLIB_LR11X0_LR_FHSS_BW_1523_4 (0x08UL << 0)
455 #define RADIOLIB_LR11X0_LR_FHSS_BW_1574_2 (0x09UL << 0)
458 #define RADIOLIB_LR11X0_LAST_HEADER_CRC_ENABLED (0x01UL << 4)
459 #define RADIOLIB_LR11X0_LAST_HEADER_CRC_DISABLED (0x00UL << 4)
462 #define RADIOLIB_LR11X0_WIFI_SCAN_802_11_B (0x01UL << 0)
463 #define RADIOLIB_LR11X0_WIFI_SCAN_802_11_G (0x02UL << 0)
464 #define RADIOLIB_LR11X0_WIFI_SCAN_802_11_N (0x03UL << 0)
465 #define RADIOLIB_LR11X0_WIFI_SCAN_ALL (0x04UL << 0)
466 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_BEACON_ONLY (0x01UL << 0)
467 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_BEACON_PACKET (0x02UL << 0)
468 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_TRAFFIC (0x03UL << 0)
469 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_BEACON (0x04UL << 0)
470 #define RADIOLIB_LR11X0_WIFI_ACQ_MODE_SSID_BEACON (0x05UL << 0)
471 #define RADIOLIB_LR11X0_WIFI_ABORT_ON_TIMEOUT_ENABLED (0x01UL << 0)
472 #define RADIOLIB_LR11X0_WIFI_ABORT_ON_TIMEOUT_DISABLED (0x00UL << 0)
475 #define RADIOLIB_LR11X0_WIFI_RESULT_TYPE_COMPLETE (0x01UL << 0)
476 #define RADIOLIB_LR11X0_WIFI_RESULT_TYPE_BASIC (0x04UL << 0)
479 #define RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS (0x01UL << 0)
480 #define RADIOLIB_LR11X0_GNSS_CONSTELLATION_BEIDOU (0x01UL << 1)
483 #define RADIOLIB_LR11X0_GNSS_MODE_SINGLE_SCAN (0x00UL << 0)
484 #define RADIOLIB_LR11X0_GNSS_MODE_SINGLE_MULTIPLE (0x03UL << 1)
487 #define RADIOLIB_LR11X0_GNSS_RES_PSEUDO_DOPPLER_ENABLED (0x01UL << 0)
488 #define RADIOLIB_LR11X0_GNSS_RES_PSEUDO_DOPPLER_DISABLED (0x00UL << 0)
489 #define RADIOLIB_LR11X0_GNSS_RES_DOPPLER_ENABLED (0x01UL << 1)
490 #define RADIOLIB_LR11X0_GNSS_RES_DOPPLER_DISABLED (0x00UL << 1)
491 #define RADIOLIB_LR11X0_GNSS_NB_SV_ALL (0x00UL << 0)
492 #define RADIOLIB_LR11X0_GNSS_AUTO_EFFORT_MODE (0x00UL << 0)
495 #define RADIOLIB_LR11X0_GNSS_ASSIST_LOW_POWER (0x00UL << 0)
496 #define RADIOLIB_LR11X0_GNSS_ASSIST_BEST_EFFORT (0x01UL << 0)
499 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_NONE (0x00UL << 0)
500 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_ALMANAC_OLD (0x01UL << 0)
501 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_ALMANAC_CRC (0x02UL << 0)
502 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_FLASH (0x03UL << 0)
503 #define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_ALMANAC_UPD (0x04UL << 0)
504 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_250_HZ (0x00UL << 0)
505 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_500_HZ (0x01UL << 0)
506 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_1000_HZ (0x02UL << 0)
507 #define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_2000_HZ (0x03UL << 0)
510 #define RADIOLIB_LR11X0_SV_CONSTELLATION_GPS (0x00UL << 0)
511 #define RADIOLIB_LR11X0_SV_CONSTELLATION_BEIDOU (0x01UL << 0)
514 #define RADIOLIB_LR11X0_GNSS_ALMANAC_HEADER_ID (0x80UL << 0)
515 #define RADIOLIB_LR11X0_GNSS_ALMANAC_BLOCK_SIZE (20)
518 #define RADIOLIB_LR11X0_CRYPTO_STATUS_SUCCESS (0x00UL << 0)
519 #define RADIOLIB_LR11X0_CRYPTO_STATUS_FAIL_CMAC (0x01UL << 0)
520 #define RADIOLIB_LR11X0_CRYPTO_STATUS_INV_KEY_ID (0x03UL << 0)
521 #define RADIOLIB_LR11X0_CRYPTO_STATUS_BUF_SIZE (0x05UL << 0)
522 #define RADIOLIB_LR11X0_CRYPTO_STATUS_ERROR (0x06UL << 0)
525 #define RADIOLIB_LR11X0_CRYPTO_LORAWAN_VERSION_1_0 (0x00UL << 0)
526 #define RADIOLIB_LR11X0_CRYPTO_LORAWAN_VERSION_1_1 (0x01UL << 0)
531 #define RADIOLIB_LR11X0_SF6_SX126X (0x00UL << 18)
532 #define RADIOLIB_LR11X0_SF6_SX127X (0x01UL << 18)
535 #define RADIOLIB_LR11X0_LORA_HIGH_POWER_FIX (0x00UL << 30)
571 int16_t
begin(
float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength,
float tcxoVoltage);
582 int16_t
beginGFSK(
float br,
float freqDev,
float rxBw, uint16_t preambleLength,
float tcxoVoltage);
598 int16_t
transmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
607 int16_t
receive(uint8_t* data,
size_t len)
override;
622 int16_t
standby(uint8_t mode,
bool wakeup =
true);
631 int16_t
sleep(
bool retainConfig =
true, uint32_t sleepTime = 0);
676 int16_t
startTransmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
703 int16_t
startReceive(uint32_t timeout, uint32_t irqFlags = RADIOLIB_LR11X0_IRQ_RX_DONE,
size_t len = 0);
719 int16_t
readData(uint8_t* data,
size_t len)
override;
745 int16_t
setCodingRate(uint8_t cr,
bool longInterleave =
false);
782 int16_t
setSyncWord(uint8_t* syncWord,
size_t len)
override;
791 int16_t
setSyncBits(uint8_t *syncWord, uint8_t bitsLen);
851 int16_t
setWhitening(
bool enabled, uint16_t initial = 0x01FF);
882 int16_t
setTCXO(
float voltage, uint32_t delay = 5000);
892 int16_t
setCRC(uint8_t len, uint32_t initial = 0x00001D0FUL, uint32_t polynomial = 0x00001021UL,
bool inverted =
true);
899 int16_t
invertIQ(
bool enable)
override;
946 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
952 int16_t writeRegMem32(uint32_t addr, uint32_t* data,
size_t len);
953 int16_t readRegMem32(uint32_t addr, uint32_t* data,
size_t len);
954 int16_t writeBuffer8(uint8_t* data,
size_t len);
955 int16_t readBuffer8(uint8_t* data,
size_t len,
size_t offset);
956 int16_t clearRxBuffer(
void);
957 int16_t writeRegMemMask32(uint32_t addr, uint32_t mask, uint32_t data);
959 int16_t getStatus(uint8_t* stat1, uint8_t* stat2, uint32_t* irq);
960 int16_t getVersion(uint8_t* hw, uint8_t* device, uint8_t* major, uint8_t* minor);
961 int16_t getErrors(uint16_t* err);
962 int16_t clearErrors(
void);
963 int16_t calibrate(uint8_t params);
964 int16_t setRegMode(uint8_t mode);
965 int16_t calibImage(
float freq1,
float freq2);
966 int16_t setDioAsRfSwitch(uint8_t en, uint8_t stbyCfg, uint8_t rxCfg, uint8_t txCfg, uint8_t txHpCfg, uint8_t gnssCfg, uint8_t wifiCfg);
967 int16_t setDioIrqParams(uint32_t irq1, uint32_t irq2);
968 int16_t clearIrq(uint32_t irq);
969 int16_t configLfClock(uint8_t setup);
970 int16_t setTcxoMode(uint8_t tune, uint32_t delay);
971 int16_t reboot(
bool stay);
972 int16_t getVbat(
float* vbat);
973 int16_t getTemp(
float* temp);
975 int16_t getRandomNumber(uint32_t* rnd);
976 int16_t eraseInfoPage(
void);
977 int16_t writeInfoPage(uint16_t addr, uint32_t* data,
size_t len);
978 int16_t readInfoPage(uint16_t addr, uint32_t* data,
size_t len);
979 int16_t getChipEui(uint8_t* eui);
980 int16_t getSemtechJoinEui(uint8_t* eui);
981 int16_t deriveRootKeysAndGetPin(uint8_t* pin);
982 int16_t enableSpiCrc(
bool en);
983 int16_t driveDiosInSleepMode(
bool en);
985 int16_t resetStats(
void);
986 int16_t getStats(uint16_t* nbPktReceived, uint16_t* nbPktCrcError, uint16_t* data1, uint16_t* data2);
987 int16_t getPacketType(uint8_t* type);
988 int16_t getRxBufferStatus(uint8_t* len, uint8_t* startOffset);
989 int16_t getPacketStatusLoRa(
float* rssiPkt,
float* snrPkt,
float* signalRssiPkt);
990 int16_t getPacketStatusGFSK(
float* rssiSync,
float* rssiAvg, uint8_t* rxLen, uint8_t* stat);
991 int16_t getRssiInst(
float* rssi);
992 int16_t setGfskSyncWord(uint8_t* sync);
993 int16_t setLoRaPublicNetwork(
bool pub);
994 int16_t setRx(uint32_t timeout);
995 int16_t setTx(uint32_t timeout);
996 int16_t setRfFrequency(uint32_t rfFreq);
997 int16_t autoTxRx(uint32_t delay, uint8_t intMode, uint32_t timeout);
998 int16_t setCadParams(uint8_t symNum, uint8_t detPeak, uint8_t detMin, uint8_t cadExitMode, uint32_t timeout);
999 int16_t setPacketType(uint8_t type);
1000 int16_t setModulationParamsLoRa(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro);
1001 int16_t setModulationParamsGFSK(uint32_t br, uint8_t sh, uint8_t rxBw, uint32_t freqDev);
1002 int16_t setModulationParamsLrFhss(uint32_t br, uint8_t sh);
1003 int16_t setModulationParamsSigfox(uint32_t br, uint8_t sh);
1004 int16_t setPacketParamsLoRa(uint16_t preambleLen, uint8_t hdrType, uint8_t payloadLen, uint8_t crcType, uint8_t
invertIQ);
1005 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);
1006 int16_t setPacketParamsSigfox(uint8_t payloadLen, uint16_t rampUpDelay, uint16_t rampDownDelay, uint16_t bitNum);
1007 int16_t setTxParams(int8_t pwr, uint8_t ramp);
1008 int16_t setPacketAdrs(uint8_t node, uint8_t broadcast);
1009 int16_t setRxTxFallbackMode(uint8_t mode);
1010 int16_t setRxDutyCycle(uint32_t rxPeriod, uint32_t sleepPeriod, uint8_t mode);
1011 int16_t setPaConfig(uint8_t paSel, uint8_t regPaSupply, uint8_t paDutyCycle, uint8_t paHpSel);
1012 int16_t stopTimeoutOnPreamble(
bool stop);
1013 int16_t setCad(
void);
1014 int16_t setTxCw(
void);
1015 int16_t setTxInfinitePreamble(
void);
1016 int16_t setLoRaSynchTimeout(uint8_t symbolNum);
1017 int16_t setRangingAddr(uint32_t addr, uint8_t checkLen);
1018 int16_t setRangingReqAddr(uint32_t addr);
1019 int16_t getRangingResult(uint8_t type,
float* res);
1020 int16_t setRangingTxRxDelay(uint32_t delay);
1021 int16_t setGfskCrcParams(uint32_t init, uint32_t poly);
1022 int16_t setGfskWhitParams(uint16_t seed);
1023 int16_t setRxBoosted(
bool en);
1024 int16_t setRangingParameter(uint8_t symbolNum);
1025 int16_t setLoRaSyncWord(uint8_t sync);
1026 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);
1027 int16_t lrFhssSetSyncWord(uint32_t sync);
1028 int16_t configBleBeacon(uint8_t chan, uint8_t* payload,
size_t len);
1029 int16_t getLoRaRxHeaderInfos(uint8_t* info);
1030 int16_t bleBeaconSend(uint8_t chan, uint8_t* payload,
size_t len);
1032 int16_t wifiScan(uint8_t type, uint16_t mask, uint8_t acqMode, uint8_t nbMaxRes, uint8_t nbScanPerChan, uint16_t timeout, uint8_t abortOnTimeout);
1033 int16_t wifiScanTimeLimit(uint8_t type, uint16_t mask, uint8_t acqMode, uint8_t nbMaxRes, uint16_t timePerChan, uint16_t timeout);
1034 int16_t wifiCountryCode(uint16_t mask, uint8_t nbMaxRes, uint8_t nbScanPerChan, uint16_t timeout, uint8_t abortOnTimeout);
1035 int16_t wifiCountryCodeTimeLimit(uint16_t mask, uint8_t nbMaxRes, uint16_t timePerChan, uint16_t timeout);
1036 int16_t wifiGetNbResults(uint8_t* nbResults);
1037 int16_t wifiReadResults(uint8_t index, uint8_t nbResults, uint8_t format, uint8_t* results);
1038 int16_t wifiResetCumulTimings(
void);
1039 int16_t wifiReadCumulTimings(uint32_t* detection, uint32_t* capture, uint32_t* demodulation);
1040 int16_t wifiGetNbCountryCodeResults(uint8_t* nbResults);
1041 int16_t wifiReadCountryCodeResults(uint8_t index, uint8_t nbResults, uint8_t* results);
1042 int16_t wifiCfgTimestampAPphone(uint32_t timestamp);
1043 int16_t wifiReadVersion(uint8_t* major, uint8_t* minor);
1045 int16_t gnssSetConstellationToUse(uint8_t mask);
1046 int16_t gnssReadConstellationToUse(uint8_t* mask);
1047 int16_t gnssSetAlmanacUpdate(uint8_t mask);
1048 int16_t gnssReadAlmanacUpdate(uint8_t* mask);
1049 int16_t gnssReadVersion(uint8_t* fw, uint8_t* almanac);
1050 int16_t gnssReadSupportedConstellations(uint8_t* mask);
1051 int16_t gnssSetMode(uint8_t mode);
1052 int16_t gnssAutonomous(uint32_t gpsTime, uint8_t resMask, uint8_t nbSvMask);
1053 int16_t gnssAssisted(uint32_t gpsTime, uint8_t effort, uint8_t resMask, uint8_t nbSvMask);
1054 int16_t gnssSetAssistancePosition(
float lat,
float lon);
1055 int16_t gnssReadAssistancePosition(
float* lat,
float* lon);
1056 int16_t gnssPushSolverMsg(uint8_t* payload,
size_t len);
1057 int16_t gnssPushDmMsg(uint8_t* payload,
size_t len);
1058 int16_t gnssGetContextStatus(uint8_t* fwVersion, uint32_t* almanacCrc, uint8_t* errCode, uint8_t* almUpdMask, uint8_t* freqSpace);
1059 int16_t gnssGetNbSvDetected(uint8_t* nbSv);
1060 int16_t gnssGetSvDetected(uint8_t* svId, uint8_t* snr, uint16_t* doppler,
size_t nbSv);
1061 int16_t gnssGetConsumption(uint32_t* cpu, uint32_t* radio);
1062 int16_t gnssGetResultSize(uint16_t* size);
1063 int16_t gnssReadResults(uint8_t* result, uint16_t size);
1064 int16_t gnssAlmanacFullUpdateHeader(uint16_t date, uint32_t globalCrc);
1065 int16_t gnssAlmanacFullUpdateSV(uint8_t svn, uint8_t* svnAlmanac);
1066 int16_t gnssGetSvVisible(uint32_t time,
float lat,
float lon, uint8_t constellation, uint8_t* nbSv);
1068 int16_t cryptoSetKey(uint8_t keyId, uint8_t* key);
1069 int16_t cryptoDeriveKey(uint8_t srcKeyId, uint8_t dstKeyId, uint8_t* key);
1070 int16_t cryptoProcessJoinAccept(uint8_t decKeyId, uint8_t verKeyId, uint8_t lwVer, uint8_t* header, uint8_t* dataIn,
size_t len, uint8_t* dataOut);
1071 int16_t cryptoComputeAesCmac(uint8_t keyId, uint8_t* data,
size_t len, uint32_t* mic);
1072 int16_t cryptoVerifyAesCmac(uint8_t keyId, uint32_t micExp, uint8_t* data,
size_t len,
bool* result);
1073 int16_t cryptoAesEncrypt01(uint8_t keyId, uint8_t* dataIn,
size_t len, uint8_t* dataOut);
1074 int16_t cryptoAesEncrypt(uint8_t keyId, uint8_t* dataIn,
size_t len, uint8_t* dataOut);
1075 int16_t cryptoAesDecrypt(uint8_t keyId, uint8_t* dataIn,
size_t len, uint8_t* dataOut);
1076 int16_t cryptoStoreToFlash(
void);
1077 int16_t cryptoRestoreFromFlash(
void);
1078 int16_t cryptoSetParam(uint8_t
id, uint32_t value);
1079 int16_t cryptoGetParam(uint8_t
id, uint32_t* value);
1080 int16_t cryptoCheckEncryptedFirmwareImage(uint32_t offset, uint32_t* data,
size_t len);
1081 int16_t cryptoCheckEncryptedFirmwareImageResult(
bool* result);
1083 int16_t bootEraseFlash(
void);
1084 int16_t bootWriteFlashEncrypted(uint32_t offset, uint32_t* data,
size_t len);
1085 int16_t bootReboot(
bool stay);
1086 int16_t bootGetPin(uint8_t* pin);
1087 int16_t bootGetChipEui(uint8_t* eui);
1088 int16_t bootGetJoinEui(uint8_t* eui);
1090 int16_t SPIcommand(uint16_t cmd,
bool write, uint8_t* data,
size_t len, uint8_t* out = NULL,
size_t outLen = 0);
1092 #if !RADIOLIB_GODMODE
1097 #if !RADIOLIB_GODMODE
1103 uint8_t bandwidth = 0, spreadingFactor = 0, codingRate = 0, ldrOptimize = 0, crcTypeLoRa = 0, headerType = 0;
1104 uint16_t preambleLengthLoRa = 0;
1105 float bandwidthKhz = 0;
1106 bool ldroAuto =
true;
1107 size_t implicitLen = 0;
1108 bool invertIQEnabled =
false;
1111 uint32_t bitRate = 0, frequencyDev = 0;
1112 uint8_t preambleDetLength = 0, rxBandwidth = 0, pulseShape = 0, crcTypeGFSK = 0, syncWordLength = 0, addrComp = 0, whitening = 0, packetType = 0, node = 0;
1113 uint16_t preambleLengthGFSK = 0;
1115 float dataRateMeasured = 0;
1117 static int16_t SPIparseStatus(uint8_t in);
1118 static int16_t SPIcheckStatus(
Module* mod);
1119 bool findChip(uint8_t ver);
1120 int16_t config(uint8_t modem);
1121 int16_t setPacketMode(uint8_t mode, uint8_t len);
1124 int16_t bleBeaconCommon(uint16_t cmd, uint8_t chan, uint8_t* payload,
size_t len);
1125 int16_t writeCommon(uint16_t cmd, uint32_t addrOffset, uint32_t* data,
size_t len);
1126 int16_t cryptoCommon(uint16_t cmd, uint8_t keyId, uint8_t* dataIn,
size_t len, uint8_t* dataOut);
uint32_t getIrqStatus()
Reads the current IRQ status.
Definition: LR11x0.cpp:466
int16_t setBitRate(float br)
Sets GFSK bit rate. Allowed values range from 0.6 to 300.0 kbps.
Definition: LR11x0.cpp:613
int16_t setDataRate(DataRate_t dr) override
Set data.
Definition: LR11x0.cpp:882
void setPacketReceivedAction(void(*func)(void))
Sets interrupt service routine to call when a packet is received.
Definition: LR11x0.cpp:343
float getDataRate() const
Gets effective data rate for the last transmitted packet. The value is calculated only for payload by...
Definition: LR11x0.cpp:1183
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:650
int16_t reset()
Reset method. Will reset the chip to the default state using RST pin.
Definition: LR11x0.cpp:156
void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition: LR11x0.cpp:339
uint32_t getTimeOnAir(size_t len) override
Get expected time-on-air for a given size of payload.
Definition: LR11x0.cpp:1117
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
bool XTAL
Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
Definition: LR11x0.h:559
float getRSSI()
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. Only available for LoRa o...
Definition: LR11x0.cpp:1063
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:912
int16_t setCRC(uint8_t len, uint32_t initial=0x00001D0FUL, uint32_t polynomial=0x00001021UL, bool inverted=true)
Sets CRC configuration.
Definition: LR11x0.cpp:1006
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:576
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:811
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:849
int16_t setNodeAddress(uint8_t nodeAddr)
Sets node address. Calling this method will also enable address filtering for node address only.
Definition: LR11x0.cpp:760
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:739
void clearPacketReceivedAction()
Clears interrupt service routine to call when a packet is received.
Definition: LR11x0.cpp:347
int16_t standby() override
Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator)...
Definition: LR11x0.cpp:295
void setPacketSentAction(void(*func)(void))
Sets interrupt service routine to call when a packet is sent.
Definition: LR11x0.cpp:351
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:845
int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage)
Initialization method for LoRa modem.
Definition: LR11x0.cpp:16
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
int16_t setTCXO(float voltage, uint32_t delay=5000)
Sets TCXO (Temperature Compensated Crystal Oscillator) configuration.
Definition: LR11x0.cpp:951
void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1 activates.
Definition: LR11x0.cpp:335
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:934
int16_t startReceive()
Interrupt-driven receive method with default parameters. Implemented for compatibility with PhysicalL...
Definition: LR11x0.cpp:422
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: LR11x0.cpp:414
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 beginGFSK(float br, float freqDev, float rxBw, uint16_t preambleLength, float tcxoVoltage)
Initialization method for FSK modem.
Definition: LR11x0.cpp:84
int16_t setBandwidth(float bw)
Sets LoRa bandwidth. Allowed values are 62.5, 125.0, 250.0 and 500.0 kHz.
Definition: LR11x0.cpp:519
int16_t setFrequencyDeviation(float freqDev) override
Sets GFSK frequency deviation. Allowed values range from 0.0 to 200.0 kHz.
Definition: LR11x0.cpp:630
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: LR11x0.cpp:1098
void clearPacketSentAction()
Clears interrupt service routine to call when a packet is sent.
Definition: LR11x0.cpp:355
float getSNR()
Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem.
Definition: LR11x0.cpp:1080
float getFrequencyError()
Gets frequency error of the latest received packet.
Definition: LR11x0.cpp:1093
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:853
int16_t setWhitening(bool enabled, uint16_t initial=0x01FF)
Sets GFSK whitening parameters.
Definition: LR11x0.cpp:857
int16_t setSpreadingFactor(uint8_t sf, bool legacy=false)
Sets LoRa spreading factor. Allowed values range from 5 to 12.
Definition: LR11x0.cpp:555
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition: LR11x0.cpp:797
int16_t setSyncWord(uint8_t syncWord)
Sets LoRa sync word.
Definition: LR11x0.cpp:609
int16_t setBroadcastAddress(uint8_t broadAddr)
Sets broadcast address. Calling this method will also enable address filtering for node and broadcast...
Definition: LR11x0.cpp:779
int16_t invertIQ(bool enable) override
Enable/disable inversion of the I and Q signals.
Definition: LR11x0.cpp:1050
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:68
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
virtual int16_t sleep()
Sets module to sleep.
Definition: PhysicalLayer.cpp:118
Common data rate structure.
Definition: PhysicalLayer.h:38