1 #if !defined(_RADIOLIB_RF69_H)
2 #define _RADIOLIB_RF69_H
4 #include "../../TypeDef.h"
6 #if !defined(RADIOLIB_EXCLUDE_RF69)
8 #include "../../Module.h"
10 #include "../../protocols/PhysicalLayer/PhysicalLayer.h"
13 #define RADIOLIB_RF69_FREQUENCY_STEP_SIZE 61.03515625
14 #define RADIOLIB_RF69_MAX_PACKET_LENGTH 64
15 #define RADIOLIB_RF69_CRYSTAL_FREQ 32.0
16 #define RADIOLIB_RF69_DIV_EXPONENT 19
19 #define RADIOLIB_RF69_REG_FIFO 0x00
20 #define RADIOLIB_RF69_REG_OP_MODE 0x01
21 #define RADIOLIB_RF69_REG_DATA_MODUL 0x02
22 #define RADIOLIB_RF69_REG_BITRATE_MSB 0x03
23 #define RADIOLIB_RF69_REG_BITRATE_LSB 0x04
24 #define RADIOLIB_RF69_REG_FDEV_MSB 0x05
25 #define RADIOLIB_RF69_REG_FDEV_LSB 0x06
26 #define RADIOLIB_RF69_REG_FRF_MSB 0x07
27 #define RADIOLIB_RF69_REG_FRF_MID 0x08
28 #define RADIOLIB_RF69_REG_FRF_LSB 0x09
29 #define RADIOLIB_RF69_REG_OSC_1 0x0A
30 #define RADIOLIB_RF69_REG_AFC_CTRL 0x0B
31 #define RADIOLIB_RF69_REG_LISTEN_1 0x0D
32 #define RADIOLIB_RF69_REG_LISTEN_2 0x0E
33 #define RADIOLIB_RF69_REG_LISTEN_3 0x0F
34 #define RADIOLIB_RF69_REG_VERSION 0x10
35 #define RADIOLIB_RF69_REG_PA_LEVEL 0x11
36 #define RADIOLIB_RF69_REG_PA_RAMP 0x12
37 #define RADIOLIB_RF69_REG_OCP 0x13
38 #define RADIOLIB_RF69_REG_LNA 0x18
39 #define RADIOLIB_RF69_REG_RX_BW 0x19
40 #define RADIOLIB_RF69_REG_AFC_BW 0x1A
41 #define RADIOLIB_RF69_REG_OOK_PEAK 0x1B
42 #define RADIOLIB_RF69_REG_OOK_AVG 0x1C
43 #define RADIOLIB_RF69_REG_OOK_FIX 0x1D
44 #define RADIOLIB_RF69_REG_AFC_FEI 0x1E
45 #define RADIOLIB_RF69_REG_AFC_MSB 0x1F
46 #define RADIOLIB_RF69_REG_AFC_LSB 0x20
47 #define RADIOLIB_RF69_REG_FEI_MSB 0x21
48 #define RADIOLIB_RF69_REG_FEI_LSB 0x22
49 #define RADIOLIB_RF69_REG_RSSI_CONFIG 0x23
50 #define RADIOLIB_RF69_REG_RSSI_VALUE 0x24
51 #define RADIOLIB_RF69_REG_DIO_MAPPING_1 0x25
52 #define RADIOLIB_RF69_REG_DIO_MAPPING_2 0x26
53 #define RADIOLIB_RF69_REG_IRQ_FLAGS_1 0x27
54 #define RADIOLIB_RF69_REG_IRQ_FLAGS_2 0x28
55 #define RADIOLIB_RF69_REG_RSSI_THRESH 0x29
56 #define RADIOLIB_RF69_REG_RX_TIMEOUT_1 0x2A
57 #define RADIOLIB_RF69_REG_RX_TIMEOUT_2 0x2B
58 #define RADIOLIB_RF69_REG_PREAMBLE_MSB 0x2C
59 #define RADIOLIB_RF69_REG_PREAMBLE_LSB 0x2D
60 #define RADIOLIB_RF69_REG_SYNC_CONFIG 0x2E
61 #define RADIOLIB_RF69_REG_SYNC_VALUE_1 0x2F
62 #define RADIOLIB_RF69_REG_SYNC_VALUE_2 0x30
63 #define RADIOLIB_RF69_REG_SYNC_VALUE_3 0x31
64 #define RADIOLIB_RF69_REG_SYNC_VALUE_4 0x32
65 #define RADIOLIB_RF69_REG_SYNC_VALUE_5 0x33
66 #define RADIOLIB_RF69_REG_SYNC_VALUE_6 0x34
67 #define RADIOLIB_RF69_REG_SYNC_VALUE_7 0x35
68 #define RADIOLIB_RF69_REG_SYNC_VALUE_8 0x36
69 #define RADIOLIB_RF69_REG_PACKET_CONFIG_1 0x37
70 #define RADIOLIB_RF69_REG_PAYLOAD_LENGTH 0x38
71 #define RADIOLIB_RF69_REG_NODE_ADRS 0x39
72 #define RADIOLIB_RF69_REG_BROADCAST_ADRS 0x3A
73 #define RADIOLIB_RF69_REG_AUTO_MODES 0x3B
74 #define RADIOLIB_RF69_REG_FIFO_THRESH 0x3C
75 #define RADIOLIB_RF69_REG_PACKET_CONFIG_2 0x3D
76 #define RADIOLIB_RF69_REG_AES_KEY_1 0x3E
77 #define RADIOLIB_RF69_REG_AES_KEY_2 0x3F
78 #define RADIOLIB_RF69_REG_AES_KEY_3 0x40
79 #define RADIOLIB_RF69_REG_AES_KEY_4 0x41
80 #define RADIOLIB_RF69_REG_AES_KEY_5 0x42
81 #define RADIOLIB_RF69_REG_AES_KEY_6 0x43
82 #define RADIOLIB_RF69_REG_AES_KEY_7 0x44
83 #define RADIOLIB_RF69_REG_AES_KEY_8 0x45
84 #define RADIOLIB_RF69_REG_AES_KEY_9 0x46
85 #define RADIOLIB_RF69_REG_AES_KEY_10 0x47
86 #define RADIOLIB_RF69_REG_AES_KEY_11 0x48
87 #define RADIOLIB_RF69_REG_AES_KEY_12 0x49
88 #define RADIOLIB_RF69_REG_AES_KEY_13 0x4A
89 #define RADIOLIB_RF69_REG_AES_KEY_14 0x4B
90 #define RADIOLIB_RF69_REG_AES_KEY_15 0x4C
91 #define RADIOLIB_RF69_REG_AES_KEY_16 0x4D
92 #define RADIOLIB_RF69_REG_TEMP_1 0x4E
93 #define RADIOLIB_RF69_REG_TEMP_2 0x4F
94 #define RADIOLIB_RF69_REG_TEST_LNA 0x58
95 #define RADIOLIB_RF69_REG_TEST_PA1 0x5A
96 #define RADIOLIB_RF69_REG_TEST_PA2 0x5C
97 #define RADIOLIB_RF69_REG_TEST_DAGC 0x6F
101 #define RADIOLIB_RF69_SEQUENCER_OFF 0b00000000
102 #define RADIOLIB_RF69_SEQUENCER_ON 0b10000000
103 #define RADIOLIB_RF69_LISTEN_OFF 0b00000000
104 #define RADIOLIB_RF69_LISTEN_ON 0b01000000
105 #define RADIOLIB_RF69_LISTEN_ABORT 0b00100000
106 #define RADIOLIB_RF69_SLEEP 0b00000000
107 #define RADIOLIB_RF69_STANDBY 0b00000100
108 #define RADIOLIB_RF69_FS 0b00001000
109 #define RADIOLIB_RF69_TX 0b00001100
110 #define RADIOLIB_RF69_RX 0b00010000
113 #define RADIOLIB_RF69_PACKET_MODE 0b00000000
114 #define RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC 0b01000000
115 #define RADIOLIB_RF69_CONTINUOUS_MODE 0b01100000
116 #define RADIOLIB_RF69_FSK 0b00000000
117 #define RADIOLIB_RF69_OOK 0b00001000
118 #define RADIOLIB_RF69_NO_SHAPING 0b00000000
119 #define RADIOLIB_RF69_FSK_GAUSSIAN_1_0 0b00000001
120 #define RADIOLIB_RF69_FSK_GAUSSIAN_0_5 0b00000010
121 #define RADIOLIB_RF69_FSK_GAUSSIAN_0_3 0b00000011
122 #define RADIOLIB_RF69_OOK_FILTER_BR 0b00000001
123 #define RADIOLIB_RF69_OOK_FILTER_2BR 0b00000010
126 #define RADIOLIB_RF69_BITRATE_MSB 0x1A
127 #define RADIOLIB_RF69_BITRATE_LSB 0x0B
130 #define RADIOLIB_RF69_FDEV_MSB 0x00
131 #define RADIOLIB_RF69_FDEV_LSB 0x52
134 #define RADIOLIB_RF69_FRF_MSB 0xE4
135 #define RADIOLIB_RF69_FRF_MID 0xC0
136 #define RADIOLIB_RF69_FRF_LSB 0x00
139 #define RADIOLIB_RF69_RC_CAL_START 0b10000000
140 #define RADIOLIB_RF69_RC_CAL_RUNNING 0b00000000
141 #define RADIOLIB_RF69_RC_CAL_DONE 0b00000000
144 #define RADIOLIB_RF69_AFC_LOW_BETA_OFF 0b00000000
145 #define RADIOLIB_RF69_AFC_LOW_BETA_ON 0b00100000
148 #define RADIOLIB_RF69_LISTEN_RES_IDLE_64_US 0b01000000
149 #define RADIOLIB_RF69_LISTEN_RES_IDLE_4_1_MS 0b10000000
150 #define RADIOLIB_RF69_LISTEN_RES_IDLE_262_MS 0b11000000
151 #define RADIOLIB_RF69_LISTEN_RES_RX_64_US 0b00010000
152 #define RADIOLIB_RF69_LISTEN_RES_RX_4_1_MS 0b00100000
153 #define RADIOLIB_RF69_LISTEN_RES_RX_262_MS 0b00110000
154 #define RADIOLIB_RF69_LISTEN_ACCEPT_ABOVE_RSSI_THRESH 0b00000000
155 #define RADIOLIB_RF69_LISTEN_ACCEPT_MATCH_SYNC_ADDRESS 0b00001000
156 #define RADIOLIB_RF69_LISTEN_END_KEEP_RX 0b00000000
157 #define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT 0b00000010
158 #define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT_RESUME 0b00000100
161 #define RADIOLIB_RF69_LISTEN_COEF_IDLE 0xF5
164 #define RADIOLIB_RF69_LISTEN_COEF_RX 0x20
167 #define RADIOLIB_RF69_CHIP_VERSION 0x24
170 #define RADIOLIB_RF69_PA0_OFF 0b00000000
171 #define RADIOLIB_RF69_PA0_ON 0b10000000
172 #define RADIOLIB_RF69_PA1_OFF 0b00000000
173 #define RADIOLIB_RF69_PA1_ON 0b01000000
174 #define RADIOLIB_RF69_PA2_OFF 0b00000000
175 #define RADIOLIB_RF69_PA2_ON 0b00100000
176 #define RADIOLIB_RF69_OUTPUT_POWER 0b00011111
179 #define RADIOLIB_RF69_PA_RAMP_3_4_MS 0b00000000
180 #define RADIOLIB_RF69_PA_RAMP_2_MS 0b00000001
181 #define RADIOLIB_RF69_PA_RAMP_1_MS 0b00000010
182 #define RADIOLIB_RF69_PA_RAMP_500_US 0b00000011
183 #define RADIOLIB_RF69_PA_RAMP_250_US 0b00000100
184 #define RADIOLIB_RF69_PA_RAMP_125_US 0b00000101
185 #define RADIOLIB_RF69_PA_RAMP_100_US 0b00000110
186 #define RADIOLIB_RF69_PA_RAMP_62_US 0b00000111
187 #define RADIOLIB_RF69_PA_RAMP_50_US 0b00001000
188 #define RADIOLIB_RF69_PA_RAMP_40_US 0b00001001
189 #define RADIOLIB_RF69_PA_RAMP_31_US 0b00001010
190 #define RADIOLIB_RF69_PA_RAMP_25_US 0b00001011
191 #define RADIOLIB_RF69_PA_RAMP_20_US 0b00001100
192 #define RADIOLIB_RF69_PA_RAMP_15_US 0b00001101
193 #define RADIOLIB_RF69_PA_RAMP_12_US 0b00001110
194 #define RADIOLIB_RF69_PA_RAMP_10_US 0b00001111
197 #define RADIOLIB_RF69_OCP_OFF 0b00000000
198 #define RADIOLIB_RF69_OCP_ON 0b00010000
199 #define RADIOLIB_RF69_OCP_TRIM 0b00001010
202 #define RADIOLIB_RF69_LNA_Z_IN_50_OHM 0b00000000
203 #define RADIOLIB_RF69_LNA_Z_IN_200_OHM 0b10000000
204 #define RADIOLIB_RF69_LNA_CURRENT_GAIN 0b00001000
205 #define RADIOLIB_RF69_LNA_GAIN_AUTO 0b00000000
206 #define RADIOLIB_RF69_LNA_GAIN_MAX 0b00000001
207 #define RADIOLIB_RF69_LNA_GAIN_MAX_6_DB 0b00000010
208 #define RADIOLIB_RF69_LNA_GAIN_MAX_12_DB 0b00000011
209 #define RADIOLIB_RF69_LNA_GAIN_MAX_24_DB 0b00000100
210 #define RADIOLIB_RF69_LNA_GAIN_MAX_36_DB 0b00000101
211 #define RADIOLIB_RF69_LNA_GAIN_MAX_48_DB 0b00000110
214 #define RADIOLIB_RF69_DCC_FREQ 0b01000000
215 #define RADIOLIB_RF69_RX_BW_MANT_16 0b00000000
216 #define RADIOLIB_RF69_RX_BW_MANT_20 0b00001000
217 #define RADIOLIB_RF69_RX_BW_MANT_24 0b00010000
218 #define RADIOLIB_RF69_RX_BW_EXP 0b00000101
221 #define RADIOLIB_RF69_DCC_FREQ_AFC 0b10000000
222 #define RADIOLIB_RF69_DCC_RX_BW_MANT_AFC 0b00001000
223 #define RADIOLIB_RF69_DCC_RX_BW_EXP_AFC 0b00000011
226 #define RADIOLIB_RF69_OOK_THRESH_FIXED 0b00000000
227 #define RADIOLIB_RF69_OOK_THRESH_PEAK 0b01000000
228 #define RADIOLIB_RF69_OOK_THRESH_AVERAGE 0b10000000
229 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_0_5_DB 0b00000000
230 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_1_0_DB 0b00001000
231 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_1_5_DB 0b00010000
232 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_2_0_DB 0b00011000
233 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_3_0_DB 0b00100000
234 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_4_0_DB 0b00101000
235 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_5_0_DB 0b00110000
236 #define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_6_0_DB 0b00111000
237 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_1_CHIP 0b00000000
238 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_2_CHIP 0b00000001
239 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_4_CHIP 0b00000010
240 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_8_CHIP 0b00000011
241 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_2_1_CHIP 0b00000100
242 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_4_1_CHIP 0b00000101
243 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_8_1_CHIP 0b00000110
244 #define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_16_1_CHIP 0b00000111
247 #define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_32_PI 0b00000000
248 #define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_8_PI 0b01000000
249 #define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_4_PI 0b10000000
250 #define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_2_PI 0b11000000
253 #define RADIOLIB_RF69_OOK_FIXED_THRESH 0b00000110
256 #define RADIOLIB_RF69_FEI_RUNNING 0b00000000
257 #define RADIOLIB_RF69_FEI_DONE 0b01000000
258 #define RADIOLIB_RF69_FEI_START 0b00100000
259 #define RADIOLIB_RF69_AFC_RUNNING 0b00000000
260 #define RADIOLIB_RF69_AFC_DONE 0b00010000
261 #define RADIOLIB_RF69_AFC_AUTOCLEAR_OFF 0b00000000
262 #define RADIOLIB_RF69_AFC_AUTOCLEAR_ON 0b00001000
263 #define RADIOLIB_RF69_AFC_AUTO_OFF 0b00000000
264 #define RADIOLIB_RF69_AFC_AUTO_ON 0b00000100
265 #define RADIOLIB_RF69_AFC_CLEAR 0b00000010
266 #define RADIOLIB_RF69_AFC_START 0b00000001
269 #define RADIOLIB_RF69_RSSI_RUNNING 0b00000000
270 #define RADIOLIB_RF69_RSSI_DONE 0b00000010
271 #define RADIOLIB_RF69_RSSI_START 0b00000001
274 #define RADIOLIB_RF69_DIO0_CONT_MODE_READY 0b11000000
275 #define RADIOLIB_RF69_DIO0_CONT_PLL_LOCK 0b00000000
276 #define RADIOLIB_RF69_DIO0_CONT_SYNC_ADDRESS 0b00000000
277 #define RADIOLIB_RF69_DIO0_CONT_TIMEOUT 0b01000000
278 #define RADIOLIB_RF69_DIO0_CONT_RSSI 0b10000000
279 #define RADIOLIB_RF69_DIO0_CONT_TX_READY 0b01000000
280 #define RADIOLIB_RF69_DIO0_PACK_PLL_LOCK 0b11000000
281 #define RADIOLIB_RF69_DIO0_PACK_CRC_OK 0b00000000
282 #define RADIOLIB_RF69_DIO0_PACK_PAYLOAD_READY 0b01000000
283 #define RADIOLIB_RF69_DIO0_PACK_SYNC_ADDRESS 0b10000000
284 #define RADIOLIB_RF69_DIO0_PACK_RSSI 0b11000000
285 #define RADIOLIB_RF69_DIO0_PACK_PACKET_SENT 0b00000000
286 #define RADIOLIB_RF69_DIO0_PACK_TX_READY 0b01000000
287 #define RADIOLIB_RF69_DIO1_CONT_PLL_LOCK 0b00110000
288 #define RADIOLIB_RF69_DIO1_CONT_DCLK 0b00000000
289 #define RADIOLIB_RF69_DIO1_CONT_RX_READY 0b00010000
290 #define RADIOLIB_RF69_DIO1_CONT_SYNC_ADDRESS 0b00110000
291 #define RADIOLIB_RF69_DIO1_CONT_TX_READY 0b00010000
292 #define RADIOLIB_RF69_DIO1_PACK_FIFO_LEVEL 0b00000000
293 #define RADIOLIB_RF69_DIO1_PACK_FIFO_FULL 0b00010000
294 #define RADIOLIB_RF69_DIO1_PACK_FIFO_NOT_EMPTY 0b00100000
295 #define RADIOLIB_RF69_DIO1_PACK_PLL_LOCK 0b00110000
296 #define RADIOLIB_RF69_DIO1_PACK_TIMEOUT 0b00110000
297 #define RADIOLIB_RF69_DIO2_CONT_DATA 0b00000000
298 #define RADIOLIB_RF69_DIO2_PACK_FIFO_NOT_EMPTY 0b00000000
299 #define RADIOLIB_RF69_DIO2_PACK_AUTO_MODE 0b00001100
300 #define RADIOLIB_RF69_DIO2_PACK_DATA 0b00000100
301 #define RADIOLIB_RF69_DIO3_CONT_AUTO_MODE 0b00000010
302 #define RADIOLIB_RF69_DIO3_CONT_RSSI 0b00000000
303 #define RADIOLIB_RF69_DIO3_CONT_RX_READY 0b00000001
304 #define RADIOLIB_RF69_DIO3_CONT_TIMEOUT 0b00000011
305 #define RADIOLIB_RF69_DIO3_CONT_TX_READY 0b00000001
306 #define RADIOLIB_RF69_DIO3_PACK_FIFO_FULL 0b00000000
307 #define RADIOLIB_RF69_DIO3_PACK_PLL_LOCK 0b00000011
308 #define RADIOLIB_RF69_DIO3_PACK_RSSI 0b00000001
309 #define RADIOLIB_RF69_DIO3_PACK_SYNC_ADDRESSS 0b00000010
310 #define RADIOLIB_RF69_DIO3_PACK_TX_READY 0b00000001
313 #define RADIOLIB_RF69_DIO4_CONT_PLL_LOCK 0b11000000
314 #define RADIOLIB_RF69_DIO4_CONT_TIMEOUT 0b00000000
315 #define RADIOLIB_RF69_DIO4_CONT_RX_READY 0b01000000
316 #define RADIOLIB_RF69_DIO4_CONT_SYNC_ADDRESS 0b10000000
317 #define RADIOLIB_RF69_DIO4_CONT_TX_READY 0b01000000
318 #define RADIOLIB_RF69_DIO4_PACK_PLL_LOCK 0b11000000
319 #define RADIOLIB_RF69_DIO4_PACK_TIMEOUT 0b00000000
320 #define RADIOLIB_RF69_DIO4_PACK_RSSI 0b01000000
321 #define RADIOLIB_RF69_DIO4_PACK_RX_READY 0b10000000
322 #define RADIOLIB_RF69_DIO4_PACK_MODE_READY 0b00000000
323 #define RADIOLIB_RF69_DIO4_PACK_TX_READY 0b01000000
324 #define RADIOLIB_RF69_DIO5_CONT_MODE_READY 0b00110000
325 #define RADIOLIB_RF69_DIO5_CONT_CLK_OUT 0b00000000
326 #define RADIOLIB_RF69_DIO5_CONT_RSSI 0b00010000
327 #define RADIOLIB_RF69_DIO5_PACK_MODE_READY 0b00110000
328 #define RADIOLIB_RF69_DIO5_PACK_CLK_OUT 0b00000000
329 #define RADIOLIB_RF69_DIO5_PACK_DATA 0b00010000
330 #define RADIOLIB_RF69_CLK_OUT_FXOSC 0b00000000
331 #define RADIOLIB_RF69_CLK_OUT_FXOSC_2 0b00000001
332 #define RADIOLIB_RF69_CLK_OUT_FXOSC_4 0b00000010
333 #define RADIOLIB_RF69_CLK_OUT_FXOSC_8 0b00000011
334 #define RADIOLIB_RF69_CLK_OUT_FXOSC_16 0b00000100
335 #define RADIOLIB_RF69_CLK_OUT_FXOSC_32 0b00000101
336 #define RADIOLIB_RF69_CLK_OUT_RC 0b00000110
337 #define RADIOLIB_RF69_CLK_OUT_OFF 0b00000111
340 #define RADIOLIB_RF69_IRQ_MODE_READY 0b10000000
341 #define RADIOLIB_RF69_IRQ_RX_READY 0b01000000
342 #define RADIOLIB_RF69_IRQ_TX_READY 0b00100000
343 #define RADIOLIB_RF69_IRQ_PLL_LOCK 0b00010000
344 #define RADIOLIB_RF69_IRQ_RSSI 0b00001000
345 #define RADIOLIB_RF69_IRQ_TIMEOUT 0b00000100
346 #define RADIOLIB_RF69_IRQ_AUTO_MODE 0b00000010
347 #define RADIOLIB_RF69_SYNC_ADDRESS_MATCH 0b00000001
350 #define RADIOLIB_RF69_IRQ_FIFO_FULL 0b10000000
351 #define RADIOLIB_RF69_IRQ_FIFO_NOT_EMPTY 0b01000000
352 #define RADIOLIB_RF69_IRQ_FIFO_LEVEL 0b00100000
353 #define RADIOLIB_RF69_IRQ_FIFO_OVERRUN 0b00010000
354 #define RADIOLIB_RF69_IRQ_PACKET_SENT 0b00001000
355 #define RADIOLIB_RF69_IRQ_PAYLOAD_READY 0b00000100
356 #define RADIOLIB_RF69_IRQ_CRC_OK 0b00000010
359 #define RADIOLIB_RF69_RSSI_THRESHOLD 0xE4
362 #define RADIOLIB_RF69_TIMEOUT_RX_START_OFF 0x00
363 #define RADIOLIB_RF69_TIMEOUT_RX_START 0xFF
366 #define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH_OFF 0x00
367 #define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH 0xFF
370 #define RADIOLIB_RF69_PREAMBLE_MSB 0x00
371 #define RADIOLIB_RF69_PREAMBLE_LSB 0x03
374 #define RADIOLIB_RF69_SYNC_OFF 0b00000000
375 #define RADIOLIB_RF69_SYNC_ON 0b10000000
376 #define RADIOLIB_RF69_FIFO_FILL_CONDITION_SYNC 0b00000000
377 #define RADIOLIB_RF69_FIFO_FILL_CONDITION 0b01000000
378 #define RADIOLIB_RF69_SYNC_SIZE 0b00001000
379 #define RADIOLIB_RF69_SYNC_TOL 0b00000000
382 #define RADIOLIB_RF69_SYNC_BYTE_1 0x01
383 #define RADIOLIB_RF69_SYNC_BYTE_2 0x01
384 #define RADIOLIB_RF69_SYNC_BYTE_3 0x01
385 #define RADIOLIB_RF69_SYNC_BYTE_4 0x01
386 #define RADIOLIB_RF69_SYNC_BYTE_5 0x01
387 #define RADIOLIB_RF69_SYNC_BYTE_6 0x01
388 #define RADIOLIB_RF69_SYNC_BYTE_7 0x01
389 #define RADIOLIB_RF69_SYNC_BYTE_8 0x01
392 #define RADIOLIB_RF69_PACKET_FORMAT_FIXED 0b00000000
393 #define RADIOLIB_RF69_PACKET_FORMAT_VARIABLE 0b10000000
394 #define RADIOLIB_RF69_DC_FREE_NONE 0b00000000
395 #define RADIOLIB_RF69_DC_FREE_MANCHESTER 0b00100000
396 #define RADIOLIB_RF69_DC_FREE_WHITENING 0b01000000
397 #define RADIOLIB_RF69_CRC_OFF 0b00000000
398 #define RADIOLIB_RF69_CRC_ON 0b00010000
399 #define RADIOLIB_RF69_CRC_AUTOCLEAR_ON 0b00000000
400 #define RADIOLIB_RF69_CRC_AUTOCLEAR_OFF 0b00001000
401 #define RADIOLIB_RF69_ADDRESS_FILTERING_OFF 0b00000000
402 #define RADIOLIB_RF69_ADDRESS_FILTERING_NODE 0b00000010
403 #define RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST 0b00000100
406 #define RADIOLIB_RF69_PAYLOAD_LENGTH 0xFF
409 #define RADIOLIB_RF69_ENTER_COND_NONE 0b00000000
410 #define RADIOLIB_RF69_ENTER_COND_FIFO_NOT_EMPTY 0b00100000
411 #define RADIOLIB_RF69_ENTER_COND_FIFO_LEVEL 0b01000000
412 #define RADIOLIB_RF69_ENTER_COND_CRC_OK 0b01100000
413 #define RADIOLIB_RF69_ENTER_COND_PAYLOAD_READY 0b10000000
414 #define RADIOLIB_RF69_ENTER_COND_SYNC_ADDRESS 0b10100000
415 #define RADIOLIB_RF69_ENTER_COND_PACKET_SENT 0b11000000
416 #define RADIOLIB_RF69_ENTER_COND_FIFO_EMPTY 0b11100000
417 #define RADIOLIB_RF69_EXIT_COND_NONE 0b00000000
418 #define RADIOLIB_RF69_EXIT_COND_FIFO_EMPTY 0b00100000
419 #define RADIOLIB_RF69_EXIT_COND_FIFO_LEVEL 0b01000000
420 #define RADIOLIB_RF69_EXIT_COND_CRC_OK 0b01100000
421 #define RADIOLIB_RF69_EXIT_COND_PAYLOAD_READY 0b10000000
422 #define RADIOLIB_RF69_EXIT_COND_SYNC_ADDRESS 0b10100000
423 #define RADIOLIB_RF69_EXIT_COND_PACKET_SENT 0b11000000
424 #define RADIOLIB_RF69_EXIT_COND_TIMEOUT 0b11100000
425 #define RADIOLIB_RF69_INTER_MODE_SLEEP 0b00000000
426 #define RADIOLIB_RF69_INTER_MODE_STANDBY 0b00000001
427 #define RADIOLIB_RF69_INTER_MODE_RX 0b00000010
428 #define RADIOLIB_RF69_INTER_MODE_TX 0b00000011
431 #define RADIOLIB_RF69_TX_START_CONDITION_FIFO_LEVEL 0b00000000
432 #define RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY 0b10000000
433 #define RADIOLIB_RF69_FIFO_THRESH 0x1F
436 #define RADIOLIB_RF69_INTER_PACKET_RX_DELAY 0b00000000
437 #define RADIOLIB_RF69_RESTART_RX 0b00000100
438 #define RADIOLIB_RF69_AUTO_RX_RESTART_OFF 0b00000000
439 #define RADIOLIB_RF69_AUTO_RX_RESTART_ON 0b00000010
440 #define RADIOLIB_RF69_AES_OFF 0b00000000
441 #define RADIOLIB_RF69_AES_ON 0b00000001
444 #define RADIOLIB_RF69_TEST_LNA_BOOST_NORMAL 0x1B
445 #define RADIOLIB_RF69_TEST_LNA_BOOST_HIGH 0x2D
448 #define RADIOLIB_RF69_TEMP_MEAS_START 0b00001000
449 #define RADIOLIB_RF69_TEMP_MEAS_RUNNING 0b00000100
450 #define RADIOLIB_RF69_TEMP_MEAS_DONE 0b00000000
453 #define RADIOLIB_RF69_CONTINUOUS_DAGC_NORMAL 0x00
454 #define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_ON 0x20
455 #define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_OFF 0x30
458 #define RADIOLIB_RF69_PA1_NORMAL 0x55
459 #define RADIOLIB_RF69_PA1_20_DBM 0x5D
462 #define RADIOLIB_RF69_PA2_NORMAL 0x70
463 #define RADIOLIB_RF69_PA2_20_DBM 0x7C
466 #define RADIOLIB_RF69_DEFAULT_FREQ 434.0
467 #define RADIOLIB_RF69_DEFAULT_BR 4.8
468 #define RADIOLIB_RF69_DEFAULT_FREQDEV 5.0
469 #define RADIOLIB_RF69_DEFAULT_RXBW 125.0
470 #define RADIOLIB_RF69_DEFAULT_POWER 10
471 #define RADIOLIB_RF69_DEFAULT_PREAMBLELEN 16
472 #define RADIOLIB_RF69_DEFAULT_SW {0x12, 0xAD}
473 #define RADIOLIB_RF69_DEFAULT_SW_LEN 2
516 float freq = RADIOLIB_RF69_DEFAULT_FREQ,
517 float br = RADIOLIB_RF69_DEFAULT_BR,
518 float freqDev = RADIOLIB_RF69_DEFAULT_FREQDEV,
519 float rxBw = RADIOLIB_RF69_DEFAULT_RXBW,
520 int8_t power = RADIOLIB_RF69_DEFAULT_POWER,
521 uint8_t preambleLen = RADIOLIB_RF69_DEFAULT_PREAMBLELEN);
540 int16_t
transmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
552 int16_t
receive(uint8_t* data,
size_t len)
override;
575 int16_t
standby(uint8_t mode)
override;
682 bool fifoAdd(uint8_t* data,
int totalLen,
int* remLen);
695 bool fifoGet(
volatile uint8_t* data,
int totalLen,
volatile int* rcvLen);
709 int16_t
startTransmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
738 int16_t
startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask,
size_t len);
750 int16_t
readData(uint8_t* data,
size_t len)
override;
828 int16_t
setSyncWord(uint8_t* syncWord,
size_t len, uint8_t maxErrBits = 0);
897 int16_t
setOOK(
bool enableOOK);
1057 #if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
1070 void readBit(RADIOLIB_PIN_TYPE pin);
1082 int16_t
setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value);
1084 #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
1089 #if !defined(RADIOLIB_GODMODE)
1093 float _freq = RADIOLIB_RF69_DEFAULT_FREQ;
1094 float _br = RADIOLIB_RF69_DEFAULT_BR;
1095 float _rxBw = RADIOLIB_RF69_DEFAULT_RXBW;
1097 int16_t _tempOffset = 0;
1098 int8_t _power = RADIOLIB_RF69_DEFAULT_POWER;
1100 size_t _packetLength = 0;
1101 bool _packetLengthQueried =
false;
1102 uint8_t _packetLengthConfig = RADIOLIB_RF69_PACKET_FORMAT_VARIABLE;
1104 bool _promiscuous =
false;
1106 uint8_t _syncWordLength = RADIOLIB_RF69_DEFAULT_SW_LEN;
1108 bool _bitSync =
true;
1111 int16_t directMode();
1112 int16_t setPacketMode(uint8_t mode, uint8_t len);
1114 #if !defined(RADIOLIB_GODMODE)
1117 int16_t setMode(uint8_t mode);
1118 void clearIRQFlags();
1119 void clearFIFO(
size_t count);
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:28
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code.
Definition: Module.h:39
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:14
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:204
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:51
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:144
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:111
Control class for RF69 module. Also serves as base class for SX1231.
Definition: RF69.h:479
int16_t getTemperature()
Measures temperature.
Definition: RF69.cpp:751
int16_t getChipVersion()
Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
Definition: RF69.cpp:968
void readBit(RADIOLIB_PIN_TYPE pin)
Function to read and process data bit in direct reception mode.
Definition: RF69.cpp:951
void clearFifoEmptyAction()
Clears interrupt service routine to call when FIFO is empty.
Definition: RF69.cpp:307
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_RF69_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition: RF69.cpp:781
int16_t disableAES()
Disables AES encryption.
Definition: RF69.cpp:233
void setFifoFullAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is full.
Definition: RF69.cpp:311
int16_t setBroadcastAddress(uint8_t broadAddr)
Sets broadcast address. Calling this method will also enable address filtering for node and broadcast...
Definition: RF69.cpp:725
int16_t enableAES()
Enables AES encryption.
Definition: RF69.cpp:229
uint8_t randomByte()
Get one truly random byte from RSSI noise.
Definition: RF69.cpp:927
int16_t standby() override
Sets the module to standby mode.
Definition: RF69.cpp:158
int16_t setOokThresholdType(uint8_t type)
Selects the type of threshold in the OOK data slicer.
Definition: RF69.cpp:492
int16_t transmitDirect(uint32_t frf=0) override
Starts direct mode transmission.
Definition: RF69.cpp:171
int16_t getFrequency(float *freq)
Gets carrier frequency.
Definition: RF69.cpp:528
int16_t setSyncWord(uint8_t *syncWord, size_t len, uint8_t maxErrBits=0)
Sets sync word. Up to 8 bytes can be set as sync word.
Definition: RF69.cpp:678
int16_t getFrequencyDeviation(float *freqDev)
Gets frequency deviation.
Definition: RF69.cpp:616
int16_t setOokFixedThreshold(uint8_t value)
Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer in OOK when Pe...
Definition: RF69.cpp:499
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:204
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: RF69.cpp:428
int16_t disableSyncWordFiltering()
Disable preamble and sync word filtering and generation.
Definition: RF69.cpp:794
int16_t setDataShaping(uint8_t sh) override
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Allowed values are RA...
Definition: RF69.cpp:863
int16_t setOokPeakThresholdDecrement(uint8_t value)
Period of decrement of the RSSI threshold in the OOK demodulator.
Definition: RF69.cpp:503
int16_t sleep()
Sets the module to sleep mode.
Definition: RF69.cpp:150
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:51
int16_t setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value)
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition: RF69.cpp:956
void setRfSwitchTable(const RADIOLIB_PIN_TYPE(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: RF69.cpp:923
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition: RF69.cpp:734
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0)
Enable sync word filtering and generation.
Definition: RF69.cpp:789
int16_t begin(float freq=RADIOLIB_RF69_DEFAULT_FREQ, float br=RADIOLIB_RF69_DEFAULT_BR, float freqDev=RADIOLIB_RF69_DEFAULT_FREQDEV, float rxBw=RADIOLIB_RF69_DEFAULT_RXBW, int8_t power=RADIOLIB_RF69_DEFAULT_POWER, uint8_t preambleLen=RADIOLIB_RF69_DEFAULT_PREAMBLELEN)
Initialization method.
Definition: RF69.cpp:12
int16_t packetMode()
Stops direct mode. It is required to call this method to switch from direct transmissions to packet-b...
Definition: RF69.cpp:221
int16_t setPromiscuousMode(bool promiscuous=true)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition: RF69.cpp:825
int16_t setRxBandwidth(float rxBw)
Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12....
Definition: RF69.cpp:565
void setFifoEmptyAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is empty.
Definition: RF69.cpp:296
int16_t setPreambleLength(uint8_t preambleLen)
Sets preamble length.
Definition: RF69.cpp:704
int16_t enableContinuousModeBitSync()
Enable Bit synchronization in continuous mode.
Definition: RF69.cpp:799
void setDirectAction(void(*func)(void))
Set interrupt service routine function to call when data bit is receveid in direct mode.
Definition: RF69.cpp:947
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: RF69.cpp:768
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:144
void clearDio0Action()
Clears interrupt service routine to call when DIO0 activates.
Definition: RF69.cpp:277
int16_t disableContinuousModeBitSync()
Disable Bit synchronization in continuous mode.
Definition: RF69.cpp:808
int16_t setOutputPower(int8_t power, bool highPower=false)
Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to ...
Definition: RF69.cpp:640
int16_t setOOK(bool enableOOK)
Enables/disables OOK modulation instead of FSK. Note: This function calls setRxBandwidth again,...
Definition: RF69.cpp:473
void setDio0Action(void(*func)(void))
Sets interrupt service routine to call when DIO0 activates.
Definition: RF69.cpp:273
int16_t setLnaTestBoost(bool value)
Enable/disable LNA Boost mode (disabled by default).
Definition: RF69.cpp:901
bool fifoGet(volatile uint8_t *data, int totalLen, volatile int *rcvLen)
Set interrupt service routine function to call when FIFO is sufficently full to read.
Definition: RF69.cpp:348
void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1 activates.
Definition: RF69.cpp:281
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: RF69.cpp:919
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER an...
Definition: RF69.cpp:883
int16_t setFrequency(float freq)
Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510....
Definition: RF69.cpp:507
bool fifoAdd(uint8_t *data, int totalLen, int *remLen)
Set interrupt service routine function to call when FIFO is empty.
Definition: RF69.cpp:325
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:111
int16_t setNodeAddress(uint8_t nodeAddr)
Sets node address. Calling this method will also enable address filtering for node address only.
Definition: RF69.cpp:716
int16_t receiveDirect() override
Starts direct mode reception.
Definition: RF69.cpp:192
void setAESKey(uint8_t *key)
Sets AES key.
Definition: RF69.cpp:225
int16_t setCrcFiltering(bool crcOn=true)
Enable CRC filtering and generation.
Definition: RF69.cpp:817
void setAmbientTemperature(int16_t tempAmbient)
Sets ambient temperature. Required to correct values from on-board temperature sensor.
Definition: RF69.cpp:747
float getRSSI()
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
Definition: RF69.cpp:909
int16_t setBitRate(float br)
Sets bit rate. Allowed values range from 0.5 to 300.0 kbps.
Definition: RF69.cpp:543
int16_t setFrequencyDeviation(float freqDev) override
Sets frequency deviation.
Definition: RF69.cpp:593
void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition: RF69.cpp:289
void clearFifoFullAction()
Clears interrupt service routine to call when FIFO is full.
Definition: RF69.cpp:320
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_RF69_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition: RF69.cpp:785
void reset()
Reset method. Will reset the chip to the default state using RST pin.
Definition: RF69.cpp:96
int16_t startReceive()
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Definition: RF69.cpp:237
RF69(Module *module)
Default constructor.
Definition: RF69.cpp:4
int16_t setRSSIThreshold(float dbm)
Sets the RSSI value above which the RSSI interrupt is signaled.
Definition: RF69.cpp:913