1#if !defined(_RADIOLIB_RF69_H)
2#define _RADIOLIB_RF69_H
4#include "../../TypeDef.h"
6#if !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.0f
16#define RADIOLIB_RF69_DIV_EXPONENT 19
17#define RADIOLIB_RF69_LP_POUT_MIN -18
18#define RADIOLIB_RF69_LP_POUT_MAX 13
19#define RADIOLIB_RF69_HP_POUT_MIN -2
20#define RADIOLIB_RF69_HP_POUT_MAX 20
23#define RADIOLIB_RF69_REG_FIFO 0x00
24#define RADIOLIB_RF69_REG_OP_MODE 0x01
25#define RADIOLIB_RF69_REG_DATA_MODUL 0x02
26#define RADIOLIB_RF69_REG_BITRATE_MSB 0x03
27#define RADIOLIB_RF69_REG_BITRATE_LSB 0x04
28#define RADIOLIB_RF69_REG_FDEV_MSB 0x05
29#define RADIOLIB_RF69_REG_FDEV_LSB 0x06
30#define RADIOLIB_RF69_REG_FRF_MSB 0x07
31#define RADIOLIB_RF69_REG_FRF_MID 0x08
32#define RADIOLIB_RF69_REG_FRF_LSB 0x09
33#define RADIOLIB_RF69_REG_OSC_1 0x0A
34#define RADIOLIB_RF69_REG_AFC_CTRL 0x0B
35#define RADIOLIB_RF69_REG_LISTEN_1 0x0D
36#define RADIOLIB_RF69_REG_LISTEN_2 0x0E
37#define RADIOLIB_RF69_REG_LISTEN_3 0x0F
38#define RADIOLIB_RF69_REG_VERSION 0x10
39#define RADIOLIB_RF69_REG_PA_LEVEL 0x11
40#define RADIOLIB_RF69_REG_PA_RAMP 0x12
41#define RADIOLIB_RF69_REG_OCP 0x13
42#define RADIOLIB_RF69_REG_LNA 0x18
43#define RADIOLIB_RF69_REG_RX_BW 0x19
44#define RADIOLIB_RF69_REG_AFC_BW 0x1A
45#define RADIOLIB_RF69_REG_OOK_PEAK 0x1B
46#define RADIOLIB_RF69_REG_OOK_AVG 0x1C
47#define RADIOLIB_RF69_REG_OOK_FIX 0x1D
48#define RADIOLIB_RF69_REG_AFC_FEI 0x1E
49#define RADIOLIB_RF69_REG_AFC_MSB 0x1F
50#define RADIOLIB_RF69_REG_AFC_LSB 0x20
51#define RADIOLIB_RF69_REG_FEI_MSB 0x21
52#define RADIOLIB_RF69_REG_FEI_LSB 0x22
53#define RADIOLIB_RF69_REG_RSSI_CONFIG 0x23
54#define RADIOLIB_RF69_REG_RSSI_VALUE 0x24
55#define RADIOLIB_RF69_REG_DIO_MAPPING_1 0x25
56#define RADIOLIB_RF69_REG_DIO_MAPPING_2 0x26
57#define RADIOLIB_RF69_REG_IRQ_FLAGS_1 0x27
58#define RADIOLIB_RF69_REG_IRQ_FLAGS_2 0x28
59#define RADIOLIB_RF69_REG_RSSI_THRESH 0x29
60#define RADIOLIB_RF69_REG_RX_TIMEOUT_1 0x2A
61#define RADIOLIB_RF69_REG_RX_TIMEOUT_2 0x2B
62#define RADIOLIB_RF69_REG_PREAMBLE_MSB 0x2C
63#define RADIOLIB_RF69_REG_PREAMBLE_LSB 0x2D
64#define RADIOLIB_RF69_REG_SYNC_CONFIG 0x2E
65#define RADIOLIB_RF69_REG_SYNC_VALUE_1 0x2F
66#define RADIOLIB_RF69_REG_SYNC_VALUE_2 0x30
67#define RADIOLIB_RF69_REG_SYNC_VALUE_3 0x31
68#define RADIOLIB_RF69_REG_SYNC_VALUE_4 0x32
69#define RADIOLIB_RF69_REG_SYNC_VALUE_5 0x33
70#define RADIOLIB_RF69_REG_SYNC_VALUE_6 0x34
71#define RADIOLIB_RF69_REG_SYNC_VALUE_7 0x35
72#define RADIOLIB_RF69_REG_SYNC_VALUE_8 0x36
73#define RADIOLIB_RF69_REG_PACKET_CONFIG_1 0x37
74#define RADIOLIB_RF69_REG_PAYLOAD_LENGTH 0x38
75#define RADIOLIB_RF69_REG_NODE_ADRS 0x39
76#define RADIOLIB_RF69_REG_BROADCAST_ADRS 0x3A
77#define RADIOLIB_RF69_REG_AUTO_MODES 0x3B
78#define RADIOLIB_RF69_REG_FIFO_THRESH 0x3C
79#define RADIOLIB_RF69_REG_PACKET_CONFIG_2 0x3D
80#define RADIOLIB_RF69_REG_AES_KEY_1 0x3E
81#define RADIOLIB_RF69_REG_AES_KEY_2 0x3F
82#define RADIOLIB_RF69_REG_AES_KEY_3 0x40
83#define RADIOLIB_RF69_REG_AES_KEY_4 0x41
84#define RADIOLIB_RF69_REG_AES_KEY_5 0x42
85#define RADIOLIB_RF69_REG_AES_KEY_6 0x43
86#define RADIOLIB_RF69_REG_AES_KEY_7 0x44
87#define RADIOLIB_RF69_REG_AES_KEY_8 0x45
88#define RADIOLIB_RF69_REG_AES_KEY_9 0x46
89#define RADIOLIB_RF69_REG_AES_KEY_10 0x47
90#define RADIOLIB_RF69_REG_AES_KEY_11 0x48
91#define RADIOLIB_RF69_REG_AES_KEY_12 0x49
92#define RADIOLIB_RF69_REG_AES_KEY_13 0x4A
93#define RADIOLIB_RF69_REG_AES_KEY_14 0x4B
94#define RADIOLIB_RF69_REG_AES_KEY_15 0x4C
95#define RADIOLIB_RF69_REG_AES_KEY_16 0x4D
96#define RADIOLIB_RF69_REG_TEMP_1 0x4E
97#define RADIOLIB_RF69_REG_TEMP_2 0x4F
98#define RADIOLIB_RF69_REG_TEST_LNA 0x58
99#define RADIOLIB_RF69_REG_TEST_PA1 0x5A
100#define RADIOLIB_RF69_REG_TEST_PA2 0x5C
101#define RADIOLIB_RF69_REG_TEST_DAGC 0x6F
105#define RADIOLIB_RF69_SEQUENCER_OFF 0b10000000
106#define RADIOLIB_RF69_SEQUENCER_ON 0b00000000
107#define RADIOLIB_RF69_LISTEN_OFF 0b00000000
108#define RADIOLIB_RF69_LISTEN_ON 0b01000000
109#define RADIOLIB_RF69_LISTEN_ABORT 0b00100000
110#define RADIOLIB_RF69_SLEEP 0b00000000
111#define RADIOLIB_RF69_STANDBY 0b00000100
112#define RADIOLIB_RF69_FS 0b00001000
113#define RADIOLIB_RF69_TX 0b00001100
114#define RADIOLIB_RF69_RX 0b00010000
117#define RADIOLIB_RF69_PACKET_MODE 0b00000000
118#define RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC 0b01000000
119#define RADIOLIB_RF69_CONTINUOUS_MODE 0b01100000
120#define RADIOLIB_RF69_FSK 0b00000000
121#define RADIOLIB_RF69_OOK 0b00001000
122#define RADIOLIB_RF69_NO_SHAPING 0b00000000
123#define RADIOLIB_RF69_FSK_GAUSSIAN_1_0 0b00000001
124#define RADIOLIB_RF69_FSK_GAUSSIAN_0_5 0b00000010
125#define RADIOLIB_RF69_FSK_GAUSSIAN_0_3 0b00000011
126#define RADIOLIB_RF69_OOK_FILTER_BR 0b00000001
127#define RADIOLIB_RF69_OOK_FILTER_2BR 0b00000010
130#define RADIOLIB_RF69_BITRATE_MSB 0x1A
131#define RADIOLIB_RF69_BITRATE_LSB 0x0B
134#define RADIOLIB_RF69_FDEV_MSB 0x00
135#define RADIOLIB_RF69_FDEV_LSB 0x52
138#define RADIOLIB_RF69_FRF_MSB 0xE4
139#define RADIOLIB_RF69_FRF_MID 0xC0
140#define RADIOLIB_RF69_FRF_LSB 0x00
143#define RADIOLIB_RF69_RC_CAL_START 0b10000000
144#define RADIOLIB_RF69_RC_CAL_RUNNING 0b00000000
145#define RADIOLIB_RF69_RC_CAL_DONE 0b00000000
148#define RADIOLIB_RF69_AFC_LOW_BETA_OFF 0b00000000
149#define RADIOLIB_RF69_AFC_LOW_BETA_ON 0b00100000
152#define RADIOLIB_RF69_LISTEN_RES_IDLE_64_US 0b01000000
153#define RADIOLIB_RF69_LISTEN_RES_IDLE_4_1_MS 0b10000000
154#define RADIOLIB_RF69_LISTEN_RES_IDLE_262_MS 0b11000000
155#define RADIOLIB_RF69_LISTEN_RES_RX_64_US 0b00010000
156#define RADIOLIB_RF69_LISTEN_RES_RX_4_1_MS 0b00100000
157#define RADIOLIB_RF69_LISTEN_RES_RX_262_MS 0b00110000
158#define RADIOLIB_RF69_LISTEN_ACCEPT_ABOVE_RSSI_THRESH 0b00000000
159#define RADIOLIB_RF69_LISTEN_ACCEPT_MATCH_SYNC_ADDRESS 0b00001000
160#define RADIOLIB_RF69_LISTEN_END_KEEP_RX 0b00000000
161#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT 0b00000010
162#define RADIOLIB_RF69_LISTEN_END_KEEP_RX_TIMEOUT_RESUME 0b00000100
165#define RADIOLIB_RF69_LISTEN_COEF_IDLE 0xF5
168#define RADIOLIB_RF69_LISTEN_COEF_RX 0x20
171#define RADIOLIB_RF69_CHIP_VERSION 0x24
174#define RADIOLIB_RF69_PA0_OFF 0b00000000
175#define RADIOLIB_RF69_PA0_ON 0b10000000
176#define RADIOLIB_RF69_PA1_OFF 0b00000000
177#define RADIOLIB_RF69_PA1_ON 0b01000000
178#define RADIOLIB_RF69_PA2_OFF 0b00000000
179#define RADIOLIB_RF69_PA2_ON 0b00100000
180#define RADIOLIB_RF69_OUTPUT_POWER 0b00011111
183#define RADIOLIB_RF69_PA_RAMP_3_4_MS 0b00000000
184#define RADIOLIB_RF69_PA_RAMP_2_MS 0b00000001
185#define RADIOLIB_RF69_PA_RAMP_1_MS 0b00000010
186#define RADIOLIB_RF69_PA_RAMP_500_US 0b00000011
187#define RADIOLIB_RF69_PA_RAMP_250_US 0b00000100
188#define RADIOLIB_RF69_PA_RAMP_125_US 0b00000101
189#define RADIOLIB_RF69_PA_RAMP_100_US 0b00000110
190#define RADIOLIB_RF69_PA_RAMP_62_US 0b00000111
191#define RADIOLIB_RF69_PA_RAMP_50_US 0b00001000
192#define RADIOLIB_RF69_PA_RAMP_40_US 0b00001001
193#define RADIOLIB_RF69_PA_RAMP_31_US 0b00001010
194#define RADIOLIB_RF69_PA_RAMP_25_US 0b00001011
195#define RADIOLIB_RF69_PA_RAMP_20_US 0b00001100
196#define RADIOLIB_RF69_PA_RAMP_15_US 0b00001101
197#define RADIOLIB_RF69_PA_RAMP_12_US 0b00001110
198#define RADIOLIB_RF69_PA_RAMP_10_US 0b00001111
201#define RADIOLIB_RF69_OCP_OFF 0b00000000
202#define RADIOLIB_RF69_OCP_ON 0b00010000
203#define RADIOLIB_RF69_OCP_TRIM 0b00001010
206#define RADIOLIB_RF69_LNA_Z_IN_50_OHM 0b00000000
207#define RADIOLIB_RF69_LNA_Z_IN_200_OHM 0b10000000
208#define RADIOLIB_RF69_LNA_CURRENT_GAIN 0b00001000
209#define RADIOLIB_RF69_LNA_GAIN_AUTO 0b00000000
210#define RADIOLIB_RF69_LNA_GAIN_MAX 0b00000001
211#define RADIOLIB_RF69_LNA_GAIN_MAX_6_DB 0b00000010
212#define RADIOLIB_RF69_LNA_GAIN_MAX_12_DB 0b00000011
213#define RADIOLIB_RF69_LNA_GAIN_MAX_24_DB 0b00000100
214#define RADIOLIB_RF69_LNA_GAIN_MAX_36_DB 0b00000101
215#define RADIOLIB_RF69_LNA_GAIN_MAX_48_DB 0b00000110
218#define RADIOLIB_RF69_DCC_FREQ 0b01000000
219#define RADIOLIB_RF69_RX_BW_MANT_16 0b00000000
220#define RADIOLIB_RF69_RX_BW_MANT_20 0b00001000
221#define RADIOLIB_RF69_RX_BW_MANT_24 0b00010000
222#define RADIOLIB_RF69_RX_BW_EXP 0b00000101
225#define RADIOLIB_RF69_DCC_FREQ_AFC 0b10000000
226#define RADIOLIB_RF69_DCC_RX_BW_MANT_AFC 0b00001000
227#define RADIOLIB_RF69_DCC_RX_BW_EXP_AFC 0b00000011
230#define RADIOLIB_RF69_OOK_THRESH_FIXED 0b00000000
231#define RADIOLIB_RF69_OOK_THRESH_PEAK 0b01000000
232#define RADIOLIB_RF69_OOK_THRESH_AVERAGE 0b10000000
233#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_0_5_DB 0b00000000
234#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_1_0_DB 0b00001000
235#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_1_5_DB 0b00010000
236#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_2_0_DB 0b00011000
237#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_3_0_DB 0b00100000
238#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_4_0_DB 0b00101000
239#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_5_0_DB 0b00110000
240#define RADIOLIB_RF69_OOK_PEAK_THRESH_STEP_6_0_DB 0b00111000
241#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_1_CHIP 0b00000000
242#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_2_CHIP 0b00000001
243#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_4_CHIP 0b00000010
244#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_1_8_CHIP 0b00000011
245#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_2_1_CHIP 0b00000100
246#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_4_1_CHIP 0b00000101
247#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_8_1_CHIP 0b00000110
248#define RADIOLIB_RF69_OOK_PEAK_THRESH_DEC_16_1_CHIP 0b00000111
251#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_32_PI 0b00000000
252#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_8_PI 0b01000000
253#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_4_PI 0b10000000
254#define RADIOLIB_RF69_OOK_AVG_THRESH_FILT_2_PI 0b11000000
257#define RADIOLIB_RF69_OOK_FIXED_THRESH 0b00000110
260#define RADIOLIB_RF69_FEI_RUNNING 0b00000000
261#define RADIOLIB_RF69_FEI_DONE 0b01000000
262#define RADIOLIB_RF69_FEI_START 0b00100000
263#define RADIOLIB_RF69_AFC_RUNNING 0b00000000
264#define RADIOLIB_RF69_AFC_DONE 0b00010000
265#define RADIOLIB_RF69_AFC_AUTOCLEAR_OFF 0b00000000
266#define RADIOLIB_RF69_AFC_AUTOCLEAR_ON 0b00001000
267#define RADIOLIB_RF69_AFC_AUTO_OFF 0b00000000
268#define RADIOLIB_RF69_AFC_AUTO_ON 0b00000100
269#define RADIOLIB_RF69_AFC_CLEAR 0b00000010
270#define RADIOLIB_RF69_AFC_START 0b00000001
273#define RADIOLIB_RF69_RSSI_RUNNING 0b00000000
274#define RADIOLIB_RF69_RSSI_DONE 0b00000010
275#define RADIOLIB_RF69_RSSI_START 0b00000001
278#define RADIOLIB_RF69_DIO0_CONT_MODE_READY 0b11000000
279#define RADIOLIB_RF69_DIO0_CONT_PLL_LOCK 0b00000000
280#define RADIOLIB_RF69_DIO0_CONT_SYNC_ADDRESS 0b00000000
281#define RADIOLIB_RF69_DIO0_CONT_TIMEOUT 0b01000000
282#define RADIOLIB_RF69_DIO0_CONT_RSSI 0b10000000
283#define RADIOLIB_RF69_DIO0_CONT_TX_READY 0b01000000
284#define RADIOLIB_RF69_DIO0_PACK_PLL_LOCK 0b11000000
285#define RADIOLIB_RF69_DIO0_PACK_CRC_OK 0b00000000
286#define RADIOLIB_RF69_DIO0_PACK_PAYLOAD_READY 0b01000000
287#define RADIOLIB_RF69_DIO0_PACK_SYNC_ADDRESS 0b10000000
288#define RADIOLIB_RF69_DIO0_PACK_RSSI 0b11000000
289#define RADIOLIB_RF69_DIO0_PACK_PACKET_SENT 0b00000000
290#define RADIOLIB_RF69_DIO0_PACK_TX_READY 0b01000000
291#define RADIOLIB_RF69_DIO1_CONT_PLL_LOCK 0b00110000
292#define RADIOLIB_RF69_DIO1_CONT_DCLK 0b00000000
293#define RADIOLIB_RF69_DIO1_CONT_RX_READY 0b00010000
294#define RADIOLIB_RF69_DIO1_CONT_SYNC_ADDRESS 0b00110000
295#define RADIOLIB_RF69_DIO1_CONT_TX_READY 0b00010000
296#define RADIOLIB_RF69_DIO1_PACK_FIFO_LEVEL 0b00000000
297#define RADIOLIB_RF69_DIO1_PACK_FIFO_FULL 0b00010000
298#define RADIOLIB_RF69_DIO1_PACK_FIFO_NOT_EMPTY 0b00100000
299#define RADIOLIB_RF69_DIO1_PACK_PLL_LOCK 0b00110000
300#define RADIOLIB_RF69_DIO1_PACK_TIMEOUT 0b00110000
301#define RADIOLIB_RF69_DIO2_CONT_DATA 0b00000000
302#define RADIOLIB_RF69_DIO2_PACK_FIFO_NOT_EMPTY 0b00000000
303#define RADIOLIB_RF69_DIO2_PACK_AUTO_MODE 0b00001100
304#define RADIOLIB_RF69_DIO2_PACK_DATA 0b00000100
305#define RADIOLIB_RF69_DIO3_CONT_AUTO_MODE 0b00000010
306#define RADIOLIB_RF69_DIO3_CONT_RSSI 0b00000000
307#define RADIOLIB_RF69_DIO3_CONT_RX_READY 0b00000001
308#define RADIOLIB_RF69_DIO3_CONT_TIMEOUT 0b00000011
309#define RADIOLIB_RF69_DIO3_CONT_TX_READY 0b00000001
310#define RADIOLIB_RF69_DIO3_PACK_FIFO_FULL 0b00000000
311#define RADIOLIB_RF69_DIO3_PACK_PLL_LOCK 0b00000011
312#define RADIOLIB_RF69_DIO3_PACK_RSSI 0b00000001
313#define RADIOLIB_RF69_DIO3_PACK_SYNC_ADDRESSS 0b00000010
314#define RADIOLIB_RF69_DIO3_PACK_TX_READY 0b00000001
317#define RADIOLIB_RF69_DIO4_CONT_PLL_LOCK 0b11000000
318#define RADIOLIB_RF69_DIO4_CONT_TIMEOUT 0b00000000
319#define RADIOLIB_RF69_DIO4_CONT_RX_READY 0b01000000
320#define RADIOLIB_RF69_DIO4_CONT_SYNC_ADDRESS 0b10000000
321#define RADIOLIB_RF69_DIO4_CONT_TX_READY 0b01000000
322#define RADIOLIB_RF69_DIO4_PACK_PLL_LOCK 0b11000000
323#define RADIOLIB_RF69_DIO4_PACK_TIMEOUT 0b00000000
324#define RADIOLIB_RF69_DIO4_PACK_RSSI 0b01000000
325#define RADIOLIB_RF69_DIO4_PACK_RX_READY 0b10000000
326#define RADIOLIB_RF69_DIO4_PACK_MODE_READY 0b00000000
327#define RADIOLIB_RF69_DIO4_PACK_TX_READY 0b01000000
328#define RADIOLIB_RF69_DIO5_CONT_MODE_READY 0b00110000
329#define RADIOLIB_RF69_DIO5_CONT_CLK_OUT 0b00000000
330#define RADIOLIB_RF69_DIO5_CONT_RSSI 0b00010000
331#define RADIOLIB_RF69_DIO5_PACK_MODE_READY 0b00110000
332#define RADIOLIB_RF69_DIO5_PACK_CLK_OUT 0b00000000
333#define RADIOLIB_RF69_DIO5_PACK_DATA 0b00010000
334#define RADIOLIB_RF69_CLK_OUT_FXOSC 0b00000000
335#define RADIOLIB_RF69_CLK_OUT_FXOSC_2 0b00000001
336#define RADIOLIB_RF69_CLK_OUT_FXOSC_4 0b00000010
337#define RADIOLIB_RF69_CLK_OUT_FXOSC_8 0b00000011
338#define RADIOLIB_RF69_CLK_OUT_FXOSC_16 0b00000100
339#define RADIOLIB_RF69_CLK_OUT_FXOSC_32 0b00000101
340#define RADIOLIB_RF69_CLK_OUT_RC 0b00000110
341#define RADIOLIB_RF69_CLK_OUT_OFF 0b00000111
344#define RADIOLIB_RF69_IRQ_MODE_READY 0b10000000
345#define RADIOLIB_RF69_IRQ_RX_READY 0b01000000
346#define RADIOLIB_RF69_IRQ_TX_READY 0b00100000
347#define RADIOLIB_RF69_IRQ_PLL_LOCK 0b00010000
348#define RADIOLIB_RF69_IRQ_RSSI 0b00001000
349#define RADIOLIB_RF69_IRQ_TIMEOUT 0b00000100
350#define RADIOLIB_RF69_IRQ_AUTO_MODE 0b00000010
351#define RADIOLIB_RF69_SYNC_ADDRESS_MATCH 0b00000001
354#define RADIOLIB_RF69_IRQ_FIFO_FULL 0b10000000
355#define RADIOLIB_RF69_IRQ_FIFO_NOT_EMPTY 0b01000000
356#define RADIOLIB_RF69_IRQ_FIFO_LEVEL 0b00100000
357#define RADIOLIB_RF69_IRQ_FIFO_OVERRUN 0b00010000
358#define RADIOLIB_RF69_IRQ_PACKET_SENT 0b00001000
359#define RADIOLIB_RF69_IRQ_PAYLOAD_READY 0b00000100
360#define RADIOLIB_RF69_IRQ_CRC_OK 0b00000010
363#define RADIOLIB_RF69_RSSI_THRESHOLD 0xE4
366#define RADIOLIB_RF69_TIMEOUT_RX_START_OFF 0x00
367#define RADIOLIB_RF69_TIMEOUT_RX_START 0xFF
370#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH_OFF 0x00
371#define RADIOLIB_RF69_TIMEOUT_RSSI_THRESH 0xFF
374#define RADIOLIB_RF69_PREAMBLE_MSB 0x00
375#define RADIOLIB_RF69_PREAMBLE_LSB 0x03
378#define RADIOLIB_RF69_SYNC_OFF 0b00000000
379#define RADIOLIB_RF69_SYNC_ON 0b10000000
380#define RADIOLIB_RF69_FIFO_FILL_CONDITION_SYNC 0b00000000
381#define RADIOLIB_RF69_FIFO_FILL_CONDITION 0b01000000
382#define RADIOLIB_RF69_SYNC_SIZE 0b00001000
383#define RADIOLIB_RF69_SYNC_TOL 0b00000000
386#define RADIOLIB_RF69_SYNC_BYTE_1 0x01
387#define RADIOLIB_RF69_SYNC_BYTE_2 0x01
388#define RADIOLIB_RF69_SYNC_BYTE_3 0x01
389#define RADIOLIB_RF69_SYNC_BYTE_4 0x01
390#define RADIOLIB_RF69_SYNC_BYTE_5 0x01
391#define RADIOLIB_RF69_SYNC_BYTE_6 0x01
392#define RADIOLIB_RF69_SYNC_BYTE_7 0x01
393#define RADIOLIB_RF69_SYNC_BYTE_8 0x01
396#define RADIOLIB_RF69_PACKET_FORMAT_FIXED 0b00000000
397#define RADIOLIB_RF69_PACKET_FORMAT_VARIABLE 0b10000000
398#define RADIOLIB_RF69_DC_FREE_NONE 0b00000000
399#define RADIOLIB_RF69_DC_FREE_MANCHESTER 0b00100000
400#define RADIOLIB_RF69_DC_FREE_WHITENING 0b01000000
401#define RADIOLIB_RF69_CRC_OFF 0b00000000
402#define RADIOLIB_RF69_CRC_ON 0b00010000
403#define RADIOLIB_RF69_CRC_AUTOCLEAR_ON 0b00000000
404#define RADIOLIB_RF69_CRC_AUTOCLEAR_OFF 0b00001000
405#define RADIOLIB_RF69_ADDRESS_FILTERING_OFF 0b00000000
406#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE 0b00000010
407#define RADIOLIB_RF69_ADDRESS_FILTERING_NODE_BROADCAST 0b00000100
410#define RADIOLIB_RF69_PAYLOAD_LENGTH 0xFF
413#define RADIOLIB_RF69_ENTER_COND_NONE 0b00000000
414#define RADIOLIB_RF69_ENTER_COND_FIFO_NOT_EMPTY 0b00100000
415#define RADIOLIB_RF69_ENTER_COND_FIFO_LEVEL 0b01000000
416#define RADIOLIB_RF69_ENTER_COND_CRC_OK 0b01100000
417#define RADIOLIB_RF69_ENTER_COND_PAYLOAD_READY 0b10000000
418#define RADIOLIB_RF69_ENTER_COND_SYNC_ADDRESS 0b10100000
419#define RADIOLIB_RF69_ENTER_COND_PACKET_SENT 0b11000000
420#define RADIOLIB_RF69_ENTER_COND_FIFO_EMPTY 0b11100000
421#define RADIOLIB_RF69_EXIT_COND_NONE 0b00000000
422#define RADIOLIB_RF69_EXIT_COND_FIFO_EMPTY 0b00100000
423#define RADIOLIB_RF69_EXIT_COND_FIFO_LEVEL 0b01000000
424#define RADIOLIB_RF69_EXIT_COND_CRC_OK 0b01100000
425#define RADIOLIB_RF69_EXIT_COND_PAYLOAD_READY 0b10000000
426#define RADIOLIB_RF69_EXIT_COND_SYNC_ADDRESS 0b10100000
427#define RADIOLIB_RF69_EXIT_COND_PACKET_SENT 0b11000000
428#define RADIOLIB_RF69_EXIT_COND_TIMEOUT 0b11100000
429#define RADIOLIB_RF69_INTER_MODE_SLEEP 0b00000000
430#define RADIOLIB_RF69_INTER_MODE_STANDBY 0b00000001
431#define RADIOLIB_RF69_INTER_MODE_RX 0b00000010
432#define RADIOLIB_RF69_INTER_MODE_TX 0b00000011
435#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_LEVEL 0b00000000
436#define RADIOLIB_RF69_TX_START_CONDITION_FIFO_NOT_EMPTY 0b10000000
437#define RADIOLIB_RF69_FIFO_THRESH 0x1F
440#define RADIOLIB_RF69_INTER_PACKET_RX_DELAY 0b00000000
441#define RADIOLIB_RF69_RESTART_RX 0b00000100
442#define RADIOLIB_RF69_AUTO_RX_RESTART_OFF 0b00000000
443#define RADIOLIB_RF69_AUTO_RX_RESTART_ON 0b00000010
444#define RADIOLIB_RF69_AES_OFF 0b00000000
445#define RADIOLIB_RF69_AES_ON 0b00000001
448#define RADIOLIB_RF69_TEST_LNA_BOOST_NORMAL 0x1B
449#define RADIOLIB_RF69_TEST_LNA_BOOST_HIGH 0x2D
452#define RADIOLIB_RF69_TEMP_MEAS_START 0b00001000
453#define RADIOLIB_RF69_TEMP_MEAS_RUNNING 0b00000100
454#define RADIOLIB_RF69_TEMP_MEAS_DONE 0b00000000
457#define RADIOLIB_RF69_CONTINUOUS_DAGC_NORMAL 0x00
458#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_ON 0x20
459#define RADIOLIB_RF69_CONTINUOUS_DAGC_LOW_BETA_OFF 0x30
462#define RADIOLIB_RF69_PA1_NORMAL 0x55
463#define RADIOLIB_RF69_PA1_20_DBM 0x5D
466#define RADIOLIB_RF69_PA2_NORMAL 0x70
467#define RADIOLIB_RF69_PA2_20_DBM 0x7C
470#define RADIOLIB_RF69_DEFAULT_FREQ RADIOLIB_UNIT_MEGA(434)
471#define RADIOLIB_RF69_DEFAULT_BR 4800
472#define RADIOLIB_RF69_DEFAULT_FREQDEV 5000
473#define RADIOLIB_RF69_DEFAULT_RXBW RADIOLIB_UNIT_KILO(125)
474#define RADIOLIB_RF69_DEFAULT_POWER 10
475#define RADIOLIB_RF69_DEFAULT_PREAMBLELEN 16
476#define RADIOLIB_RF69_DEFAULT_SW {0x12, 0xAD}
477#define RADIOLIB_RF69_DEFAULT_SW_LEN 2
522 int16_t
transmit(
const uint8_t* data,
size_t len, uint8_t addr = 0)
override;
539 int16_t
sleep()
override;
552 int16_t
standby(uint8_t mode)
override;
653 bool fifoAdd(uint8_t* data,
int totalLen,
int* remLen);
662 bool fifoGet(
volatile uint8_t* data,
int totalLen,
volatile int* rcvLen);
672 int16_t
startTransmit(
const uint8_t* data,
size_t len, uint8_t addr = 0)
override;
688 int16_t
startReceive(uint32_t timeout, uint32_t irqFlags, uint32_t irqMask,
size_t len)
override;
698 int16_t
readData(uint8_t* data,
size_t len)
override;
779 int16_t
setSyncWord(uint8_t* syncWord,
size_t len)
override;
787 int16_t
setSyncWord(uint8_t* syncWord,
size_t len, uint8_t maxErrBits);
844 int16_t
setOOK(
bool enable);
978 #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
989 void readBit(uint32_t pin)
override;
1000#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
1003 Module* getMod()
override;
1005#if !RADIOLIB_GODMODE
1008 uint32_t bitRate = RADIOLIB_RF69_DEFAULT_BR;
1009 uint32_t rxBandwidth = RADIOLIB_RF69_DEFAULT_RXBW;
1012 int16_t setMode(uint8_t mode);
1014#if !RADIOLIB_GODMODE
1019 bool ookEnabled =
false;
1020 int16_t tempOffset = 0;
1021 int8_t power = RADIOLIB_RF69_DEFAULT_POWER;
1023 size_t packetLength = 0;
1024 bool packetLengthQueried =
false;
1025 uint8_t packetLengthConfig = RADIOLIB_RF69_PACKET_FORMAT_VARIABLE;
1027 bool promiscuous =
false;
1029 bool bitSync =
true;
1031 uint16_t preambleLen = 0;
1032 uint8_t syncWordLen = 0;
1034 int16_t directMode();
1035 int16_t setPacketMode(uint8_t mode, uint8_t len);
1036 void clearIRQFlags();
1037 void clearFIFO(
size_t count);
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition Module.h:74
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code. Note: It is not recommended to use this c...
Definition Module.h:83
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition PhysicalLayer.cpp:235
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition PhysicalLayer.cpp:53
virtual int16_t setSyncWord(uint8_t *sync, size_t len)
Set sync word. Must be implemented in module class if the module supports it.
Definition PhysicalLayer.cpp:310
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition PhysicalLayer.cpp:157
virtual int16_t receive(uint8_t *data, size_t len, RadioLibTime_t timeout=0)
Binary receive method. Must be implemented in module class.
Definition PhysicalLayer.cpp:111
PhysicalLayer()
Default constructor.
Definition PhysicalLayer.cpp:5
int16_t getTemperature()
Measures temperature.
Definition RF69.cpp:788
int16_t setBitRate(uint32_t br) override
Sets bit rate. Allowed values range from 500 bps to 300 kbps.
Definition RF69.cpp:562
int16_t getChipVersion()
Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
Definition RF69.cpp:1013
int16_t setCrcFiltering(bool enable=true)
Enable CRC filtering and generation.
Definition RF69.cpp:858
int16_t setDIOMapping(uint32_t pin, uint32_t value)
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition RF69.cpp:997
void clearFifoEmptyAction()
Clears interrupt service routine to call when FIFO is empty.
Definition RF69.cpp:322
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_RF69_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition RF69.cpp:818
int16_t disableAES()
Disables AES encryption.
Definition RF69.cpp:248
void setFifoFullAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is full.
Definition RF69.cpp:330
int16_t setBroadcastAddress(uint8_t broadAddr)
Sets broadcast address. Calling this method will also enable address filtering for node and broadcast...
Definition RF69.cpp:762
int16_t enableAES()
Enables AES encryption.
Definition RF69.cpp:244
int16_t standby() override
Sets the module to standby mode.
Definition RF69.cpp:173
int16_t setOokThresholdType(uint8_t type)
Selects the type of threshold in the OOK data slicer.
Definition RF69.cpp:509
int16_t transmitDirect(uint32_t frf=0) override
Starts direct mode transmission.
Definition RF69.cpp:186
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:516
int16_t begin(const ConfigFSK_t &config)
Initialization method for FSK modem.
Definition RF69.cpp:14
int16_t finishReceive() override
Clean up after reception is done.
Definition RF69.cpp:481
int16_t readData(uint8_t *data, size_t len) override
Reads data received after calling startReceive method. When the packet length is not known in advance...
Definition RF69.cpp:445
int16_t startReceive() override
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Definition RF69.cpp:252
int16_t disableSyncWordFiltering()
Disable preamble and sync word filtering and generation.
Definition RF69.cpp:835
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:904
int16_t setOokPeakThresholdDecrement(uint8_t value)
Period of decrement of the RSSI threshold in the OOK demodulator.
Definition RF69.cpp:520
int16_t setOutputPower(int8_t power) override
Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to ...
Definition RF69.cpp:662
int16_t setOOK(bool enable)
Enables/disables OOK modulation instead of FSK. Note: This function calls setRxBandwidth again,...
Definition RF69.cpp:490
int16_t setFrequencyDeviation(uint32_t freqDev) override
Sets frequency deviation.
Definition RF69.cpp:629
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition RF69.cpp:771
void readBit(uint32_t pin) override
Function to read and process data bit in direct reception mode.
Definition RF69.cpp:992
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0)
Enable sync word filtering and generation.
Definition RF69.cpp:826
int16_t packetMode()
Stops direct mode. It is required to call this method to switch from direct transmissions to packet-b...
Definition RF69.cpp:236
int16_t getFrequencyDeviation(uint32_t *freqDev)
Gets frequency deviation.
Definition RF69.cpp:643
int16_t receive(uint8_t *data, size_t len, RadioLibTime_t timeout=0) override
Blocking binary receive method. Overloads for string-based transmissions are implemented in PhysicalL...
Definition RF69.cpp:139
void setFifoEmptyAction(void(*func)(void))
Set interrupt service routine function to call when FIFO is empty.
Definition RF69.cpp:311
int16_t enableContinuousModeBitSync()
Enable Bit synchronization in continuous mode.
Definition RF69.cpp:840
void setFifoThreshold(uint8_t threshold)
Set FIFO threshold level. Be aware that threshold is also set in setFifoFullAction method....
Definition RF69.cpp:326
int16_t setFrequency(uint32_t freq) override
Sets carrier frequency. Allowed values are in bands 290 to 340 MHz, 431 to 510 MHz and 862 to 1020 MH...
Definition RF69.cpp:524
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition RF69.cpp:805
int16_t transmit(const uint8_t *data, size_t len, uint8_t addr=0) override
Blocking binary transmit method. Overloads for string-based transmissions are implemented in Physical...
Definition RF69.cpp:108
void clearDio0Action()
Clears interrupt service routine to call when DIO0 activates.
Definition RF69.cpp:292
int16_t disableContinuousModeBitSync()
Disable Bit synchronization in continuous mode.
Definition RF69.cpp:849
void setDirectAction(void(*func)(void)) override
Set interrupt service routine function to call when data bit is received in direct mode.
Definition RF69.cpp:988
int16_t getFrequency(uint32_t *freq)
Gets carrier frequency.
Definition RF69.cpp:547
void setDio0Action(void(*func)(void))
Sets interrupt service routine to call when DIO0 activates.
Definition RF69.cpp:288
int16_t setLnaTestBoost(bool value)
Enable/disable LNA Boost mode (disabled by default).
Definition RF69.cpp:942
bool fifoGet(volatile uint8_t *data, int totalLen, volatile int *rcvLen)
Set interrupt service routine function to call when FIFO is sufficiently full to read.
Definition RF69.cpp:367
void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1 activates.
Definition RF69.cpp:296
void setAESKey(const uint8_t *key)
Sets AES key.
Definition RF69.cpp:240
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER an...
Definition RF69.cpp:924
int16_t setRxBandwidth(uint32_t rxBw)
Sets FSK receiver bandwidth. Allowed values range from 5200 Hz to 1000 kHz. Only available in FSK mod...
Definition RF69.cpp:584
bool fifoAdd(uint8_t *data, int totalLen, int *remLen)
Set interrupt service routine function to call when FIFO is empty.
Definition RF69.cpp:344
int16_t setNodeAddress(uint8_t nodeAddr)
Sets node address. Calling this method will also enable address filtering for node address only.
Definition RF69.cpp:753
int16_t setSyncWord(uint8_t *syncWord, size_t len) override
Sets sync word. Up to 8 bytes can be set as sync word. Override for PhysicalLayer compatibility,...
Definition RF69.cpp:708
int16_t receiveDirect() override
Starts direct mode reception.
Definition RF69.cpp:207
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition RF69.cpp:960
void setAmbientTemperature(int16_t tempAmbient)
Sets ambient temperature. Required to correct values from on-board temperature sensor.
Definition RF69.cpp:784
uint8_t randomByte() override
Get one truly random byte from RSSI noise.
Definition RF69.cpp:968
int16_t setPreambleLength(size_t len, size_t detLen=0xFFFFFFFF) override
Sets preamble length.
Definition RF69.cpp:738
void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition RF69.cpp:304
int16_t sleep() override
Sets the module to sleep mode.
Definition RF69.cpp:165
int16_t setPromiscuousMode(bool enable=true)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition RF69.cpp:866
void clearFifoFullAction()
Clears interrupt service routine to call when FIFO is full.
Definition RF69.cpp:339
float getRSSI() override
Gets RSSI (Received Signal Strength Indicator) of the last received packet.
Definition RF69.cpp:950
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_RF69_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition RF69.cpp:822
int16_t startTransmit(const uint8_t *data, size_t len, uint8_t addr=0) override
Interrupt-driven binary transmit method. Overloads for string-based transmissions are implemented in ...
Definition RF69.cpp:389
void reset()
Reset method. Will reset the chip to the default state using RST pin.
Definition RF69.cpp:100
RF69(Module *module)
Default constructor.
Definition RF69.cpp:5
int16_t setRSSIThreshold(float dbm)
Sets the RSSI value above which the RSSI interrupt is signaled.
Definition RF69.cpp:954
void setRfSwitchTable(const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition RF69.cpp:964
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition TypeDef.h:783
Definition PhysicalLayer.h:310
Description of RF switch pin states for a single mode. See setRfSwitchTable for details.
Definition Module.h:90