RadioHead
RH_RF24.h
1 // RH_RF24.h
2 // Author: Mike McCauley (mikem@airspayce.com)
3 // Copyright (C) 2014 Mike McCauley
4 // $Id: RH_RF24.h,v 1.18 2017/07/25 05:26:50 mikem Exp $
5 //
6 // Supports RF24/RF26 and RFM24/RFM26 modules in FIFO mode
7 // also Si4464/63/62/61/60-A1
8 // Si4063 is the same but Tx only
9 //
10 // Per http://www.hoperf.cn/upload/rf/RFM24.pdf
11 // and http://www.hoperf.cn/upload/rf/RFM26.pdf
12 // Sigh: the HopeRF documentation is utter rubbish: full of errors and incomplete. The Si446x docs are better:
13 // http://www.silabs.com/Support%20Documents/TechnicalDocs/Si4464-63-61-60.pdf
14 // http://www.silabs.com/Support%20Documents/TechnicalDocs/AN626.pdf
15 // http://www.silabs.com/Support%20Documents/TechnicalDocs/AN627.pdf
16 // http://www.silabs.com/Support%20Documents/TechnicalDocs/AN647.pdf
17 // http://www.silabs.com/Support%20Documents/TechnicalDocs/AN633.pdf
18 // http://www.silabs.com/Support%20Documents/TechnicalDocs/AN736.pdf
19 // http://nicerf.com/manage/upfile/indexbanner/635231050196868750.pdf (API description)
20 // http://www.silabs.com/Support%20Documents/Software/Si446x%20RX_HOP%20PLL%20Calculator.xlsx
21 #ifndef RH_RF24_h
22 #define RH_RF24_h
23 
24 #include <RHGenericSPI.h>
25 #include <RHSPIDriver.h>
26 
27 // This is the maximum number of interrupts the driver can support
28 // Most Arduinos can handle 2, Megas can handle more
29 #define RH_RF24_NUM_INTERRUPTS 3
30 
31 // Maximum payload length the RF24 can support, limited by our 1 octet message length
32 #define RH_RF24_MAX_PAYLOAD_LEN 255
33 
34 // The length of the headers we add.
35 // The headers are inside the RF24's payload
36 #define RH_RF24_HEADER_LEN 4
37 
38 // This is the maximum message length that can be supported by this driver.
39 // Can be pre-defined to a smaller size (to save SRAM) prior to including this header
40 // Here we allow for message length 4 bytes of address and header and payload to be included in payload size limit.
41 #ifndef RH_RF24_MAX_MESSAGE_LEN
42 #define RH_RF24_MAX_MESSAGE_LEN (RH_RF24_MAX_PAYLOAD_LEN - RH_RF24_HEADER_LEN - 1)
43 #endif
44 
45 // Max number of times we will try to read CTS from the radio
46 #define RH_RF24_CTS_RETRIES 2500
47 
48 // RF24/RF26 API commands from table 10
49 // also Si446X API DESCRIPTIONS table 1
50 #define RH_RF24_CMD_NOP 0x00
51 #define RH_RF24_CMD_PART_INFO 0x01
52 #define RH_RF24_CMD_POWER_UP 0x02
53 #define RH_RF24_CMD_PATCH_IMAGE 0x04
54 #define RH_RF24_CMD_FUNC_INFO 0x10
55 #define RH_RF24_CMD_SET_PROPERTY 0x11
56 #define RH_RF24_CMD_GET_PROPERTY 0x12
57 #define RH_RF24_CMD_GPIO_PIN_CFG 0x13
58 #define RH_RF24_CMD_GET_ADC_READING 0x14
59 #define RH_RF24_CMD_FIFO_INFO 0x15
60 #define RH_RF24_CMD_PACKET_INFO 0x16
61 #define RH_RF24_CMD_IRCAL 0x17
62 #define RH_RF24_CMD_PROTOCOL_CFG 0x18
63 #define RH_RF24_CMD_GET_INT_STATUS 0x20
64 #define RH_RF24_CMD_GET_PH_STATUS 0x21
65 #define RH_RF24_CMD_GET_MODEM_STATUS 0x22
66 #define RH_RF24_CMD_GET_CHIP_STATUS 0x23
67 #define RH_RF24_CMD_START_TX 0x31
68 #define RH_RF24_CMD_START_RX 0x32
69 #define RH_RF24_CMD_REQUEST_DEVICE_STATE 0x33
70 #define RH_RF24_CMD_CHANGE_STATE 0x34
71 #define RH_RF24_CMD_RX_HOP 0x36
72 #define RH_RF24_CMD_READ_BUF 0x44
73 #define RH_RF24_CMD_FAST_RESPONSE_A 0x50
74 #define RH_RF24_CMD_FAST_RESPONSE_B 0x51
75 #define RH_RF24_CMD_FAST_RESPONSE_C 0x53
76 #define RH_RF24_CMD_FAST_RESPONSE_D 0x57
77 #define RH_RF24_CMD_TX_FIFO_WRITE 0x66
78 #define RH_RF24_CMD_RX_FIFO_READ 0x77
79 
80 // The Clear To Send signal from the radio
81 #define RH_RF24_REPLY_CTS 0xff
82 
83 //#define RH_RF24_CMD_START_TX 0x31
84 #define RH_RF24_CONDITION_TX_COMPLETE_STATE 0xf0
85 #define RH_RF24_CONDITION_RETRANSMIT_NO 0x00
86 #define RH_RF24_CONDITION_RETRANSMIT_YES 0x04
87 #define RH_RF24_CONDITION_START_IMMEDIATE 0x00
88 #define RH_RF24_CONDITION_START_AFTER_WUT 0x01
89 
90 //#define RH_RF24_CMD_START_RX 0x32
91 #define RH_RF24_CONDITION_RX_START_IMMEDIATE 0x00
92 
93 //#define RH_RF24_CMD_REQUEST_DEVICE_STATE 0x33
94 #define RH_RF24_DEVICE_STATE_NO_CHANGE 0x00
95 #define RH_RF24_DEVICE_STATE_SLEEP 0x01
96 #define RH_RF24_DEVICE_STATE_SPI_ACTIVE 0x02
97 #define RH_RF24_DEVICE_STATE_READY 0x03
98 #define RH_RF24_DEVICE_STATE_ALSO_READY 0x04
99 #define RH_RF24_DEVICE_STATE_TUNE_TX 0x05
100 #define RH_RF24_DEVICE_STATE_TUNE_RX 0x06
101 #define RH_RF24_DEVICE_STATE_TX 0x07
102 #define RH_RF24_DEVICE_STATE_RX 0x08
103 
104 // Properties for API Description AN625 Section 2.2
105 #define RH_RF24_PROPERTY_GLOBAL_XO_TUNE 0x0000
106 #define RH_RF24_PROPERTY_GLOBAL_CLK_CFG 0x0001
107 #define RH_RF24_PROPERTY_GLOBAL_LOW_BATT_THRESH 0x0002
108 #define RH_RF24_PROPERTY_GLOBAL_CONFIG 0x0003
109 #define RH_RF24_PROPERTY_GLOBAL_WUT_CONFIG 0x0004
110 #define RH_RF24_PROPERTY_GLOBAL_WUT_M_15_8 0x0005
111 #define RH_RF24_PROPERTY_GLOBAL_WUT_M_7_0 0x0006
112 #define RH_RF24_PROPERTY_GLOBAL_WUT_R 0x0007
113 #define RH_RF24_PROPERTY_GLOBAL_WUT_LDC 0x0008
114 #define RH_RF24_PROPERTY_INT_CTL_ENABLE 0x0100
115 #define RH_RF24_PROPERTY_INT_CTL_PH_ENABLE 0x0101
116 #define RH_RF24_PROPERTY_INT_CTL_MODEM_ENABLE 0x0102
117 #define RH_RF24_PROPERTY_INT_CTL_CHIP_ENABLE 0x0103
118 #define RH_RF24_PROPERTY_FRR_CTL_A_MODE 0x0200
119 #define RH_RF24_PROPERTY_FRR_CTL_B_MODE 0x0201
120 #define RH_RF24_PROPERTY_FRR_CTL_C_MODE 0x0202
121 #define RH_RF24_PROPERTY_FRR_CTL_D_MODE 0x0203
122 #define RH_RF24_PROPERTY_PREAMBLE_TX_LENGTH 0x1000
123 #define RH_RF24_PROPERTY_PREAMBLE_CONFIG_STD_1 0x1001
124 #define RH_RF24_PROPERTY_PREAMBLE_CONFIG_NSTD 0x1002
125 #define RH_RF24_PROPERTY_PREAMBLE_CONFIG_STD_2 0x1003
126 #define RH_RF24_PROPERTY_PREAMBLE_CONFIG 0x1004
127 #define RH_RF24_PROPERTY_PREAMBLE_PATTERN_31_24 0x1005
128 #define RH_RF24_PROPERTY_PREAMBLE_PATTERN_23_16 0x1006
129 #define RH_RF24_PROPERTY_PREAMBLE_PATTERN_15_8 0x1007
130 #define RH_RF24_PROPERTY_PREAMBLE_PATTERN_7_0 0x1008
131 #define RH_RF24_PROPERTY_SYNC_CONFIG 0x1100
132 #define RH_RF24_PROPERTY_SYNC_BITS_31_24 0x1101
133 #define RH_RF24_PROPERTY_SYNC_BITS_23_16 0x1102
134 #define RH_RF24_PROPERTY_SYNC_BITS_15_8 0x1103
135 #define RH_RF24_PROPERTY_SYNC_BITS_7_0 0x1104
136 #define RH_RF24_PROPERTY_PKT_CRC_CONFIG 0x1200
137 #define RH_RF24_PROPERTY_PKT_CONFIG1 0x1206
138 #define RH_RF24_PROPERTY_PKT_LEN 0x1208
139 #define RH_RF24_PROPERTY_PKT_LEN_FIELD_SOURCE 0x1209
140 #define RH_RF24_PROPERTY_PKT_LEN_ADJUST 0x120a
141 #define RH_RF24_PROPERTY_PKT_TX_THRESHOLD 0x120b
142 #define RH_RF24_PROPERTY_PKT_RX_THRESHOLD 0x120c
143 #define RH_RF24_PROPERTY_PKT_FIELD_1_LENGTH_12_8 0x120d
144 #define RH_RF24_PROPERTY_PKT_FIELD_1_LENGTH_7_0 0x120e
145 #define RH_RF24_PROPERTY_PKT_FIELD_1_CONFIG 0x120f
146 #define RH_RF24_PROPERTY_PKT_FIELD_1_CRC_CONFIG 0x1210
147 #define RH_RF24_PROPERTY_PKT_FIELD_2_LENGTH_12_8 0x1211
148 #define RH_RF24_PROPERTY_PKT_FIELD_2_LENGTH_7_0 0x1212
149 #define RH_RF24_PROPERTY_PKT_FIELD_2_CONFIG 0x1213
150 #define RH_RF24_PROPERTY_PKT_FIELD_2_CRC_CONFIG 0x1214
151 #define RH_RF24_PROPERTY_PKT_FIELD_3_LENGTH_12_8 0x1215
152 #define RH_RF24_PROPERTY_PKT_FIELD_3_LENGTH_7_0 0x1216
153 #define RH_RF24_PROPERTY_PKT_FIELD_3_CONFIG 0x1217
154 #define RH_RF24_PROPERTY_PKT_FIELD_3_CRC_CONFIG 0x1218
155 #define RH_RF24_PROPERTY_PKT_FIELD_4_LENGTH_12_8 0x1219
156 #define RH_RF24_PROPERTY_PKT_FIELD_4_LENGTH_7_0 0x121a
157 #define RH_RF24_PROPERTY_PKT_FIELD_4_CONFIG 0x121b
158 #define RH_RF24_PROPERTY_PKT_FIELD_4_CRC_CONFIG 0x121c
159 #define RH_RF24_PROPERTY_PKT_FIELD_5_LENGTH_12_8 0x121d
160 #define RH_RF24_PROPERTY_PKT_FIELD_5_LENGTH_7_0 0x121e
161 #define RH_RF24_PROPERTY_PKT_FIELD_5_CONFIG 0x121f
162 #define RH_RF24_PROPERTY_PKT_FIELD_5_CRC_CONFIG 0x1220
163 #define RH_RF24_PROPERTY_PKT_RX_FIELD_1_LENGTH_12_8 0x1221
164 #define RH_RF24_PROPERTY_PKT_RX_FIELD_1_LENGTH_7_0 0x1222
165 #define RH_RF24_PROPERTY_PKT_RX_FIELD_1_CONFIG 0x1223
166 #define RH_RF24_PROPERTY_PKT_RX_FIELD_1_CRC_CONFIG 0x1224
167 #define RH_RF24_PROPERTY_PKT_RX_FIELD_2_LENGTH_12_8 0x1225
168 #define RH_RF24_PROPERTY_PKT_RX_FIELD_2_LENGTH_7_0 0x1226
169 #define RH_RF24_PROPERTY_PKT_RX_FIELD_2_CONFIG 0x1227
170 #define RH_RF24_PROPERTY_PKT_RX_FIELD_2_CRC_CONFIG 0x1228
171 #define RH_RF24_PROPERTY_PKT_RX_FIELD_3_LENGTH_12_8 0x1229
172 #define RH_RF24_PROPERTY_PKT_RX_FIELD_3_LENGTH_7_0 0x122a
173 #define RH_RF24_PROPERTY_PKT_RX_FIELD_3_CONFIG 0x122b
174 #define RH_RF24_PROPERTY_PKT_RX_FIELD_3_CRC_CONFIG 0x122c
175 #define RH_RF24_PROPERTY_PKT_RX_FIELD_4_LENGTH_12_8 0x122d
176 #define RH_RF24_PROPERTY_PKT_RX_FIELD_4_LENGTH_7_0 0x122e
177 #define RH_RF24_PROPERTY_PKT_RX_FIELD_4_CONFIG 0x122f
178 #define RH_RF24_PROPERTY_PKT_RX_FIELD_4_CRC_CONFIG 0x1230
179 #define RH_RF24_PROPERTY_PKT_RX_FIELD_5_LENGTH_12_8 0x1231
180 #define RH_RF24_PROPERTY_PKT_RX_FIELD_5_LENGTH_7_0 0x1232
181 #define RH_RF24_PROPERTY_PKT_RX_FIELD_5_CONFIG 0x1233
182 #define RH_RF24_PROPERTY_PKT_RX_FIELD_5_CRC_CONFIG 0x1234
183 #define RH_RF24_PROPERTY_MODEM_MOD_TYPE 0x2000
184 #define RH_RF24_PROPERTY_MODEM_MAP_CONTROL 0x2001
185 #define RH_RF24_PROPERTY_MODEM_DSM_CTRL 0x2002
186 #define RH_RF24_PROPERTY_MODEM_DATA_RATE_2 0x2003
187 #define RH_RF24_PROPERTY_MODEM_DATA_RATE_1 0x2004
188 #define RH_RF24_PROPERTY_MODEM_DATA_RATE_0 0x2005
189 #define RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_3 0x2006
190 #define RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_2 0x2007
191 #define RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_1 0x2008
192 #define RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_0 0x2009
193 #define RH_RF24_PROPERTY_MODEM_FREQ_DEV_2 0x200a
194 #define RH_RF24_PROPERTY_MODEM_FREQ_DEV_1 0x200b
195 #define RH_RF24_PROPERTY_MODEM_FREQ_DEV_0 0x200c
196 #define RH_RF24_PROPERTY_MODEM_TX_RAMP_DELAY 0x2018
197 #define RH_RF24_PROPERTY_MODEM_MDM_CTRL 0x2019
198 #define RH_RF24_PROPERTY_MODEM_IF_CONTROL 0x201a
199 #define RH_RF24_PROPERTY_MODEM_IF_FREQ_2 0x201b
200 #define RH_RF24_PROPERTY_MODEM_IF_FREQ_1 0x201c
201 #define RH_RF24_PROPERTY_MODEM_IF_FREQ_0 0x201d
202 #define RH_RF24_PROPERTY_MODEM_DECIMATION_CFG1 0x201e
203 #define RH_RF24_PROPERTY_MODEM_DECIMATION_CFG0 0x201f
204 #define RH_RF24_PROPERTY_MODEM_BCR_OSR_1 0x2022
205 #define RH_RF24_PROPERTY_MODEM_BCR_OSR_0 0x2023
206 #define RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_2 0x2024
207 #define RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_1 0x2025
208 #define RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_0 0x2026
209 #define RH_RF24_PROPERTY_MODEM_BCR_GAIN_1 0x2027
210 #define RH_RF24_PROPERTY_MODEM_BCR_GAIN_0 0x2028
211 #define RH_RF24_PROPERTY_MODEM_BCR_GEAR 0x2029
212 #define RH_RF24_PROPERTY_MODEM_BCR_MISC1 0x202a
213 #define RH_RF24_PROPERTY_MODEM_AFC_GEAR 0x202c
214 #define RH_RF24_PROPERTY_MODEM_AFC_WAIT 0x202d
215 #define RH_RF24_PROPERTY_MODEM_AFC_GAIN_1 0x202e
216 #define RH_RF24_PROPERTY_MODEM_AFC_GAIN_0 0x202f
217 #define RH_RF24_PROPERTY_MODEM_AFC_LIMITER_1 0x2030
218 #define RH_RF24_PROPERTY_MODEM_AFC_LIMITER_0 0x2031
219 #define RH_RF24_PROPERTY_MODEM_AFC_MISC 0x2032
220 #define RH_RF24_PROPERTY_MODEM_AGC_CONTROL 0x2035
221 #define RH_RF24_PROPERTY_MODEM_AGC_WINDOW_SIZE 0x2038
222 #define RH_RF24_PROPERTY_MODEM_AGC_RFPD_DECAY 0x2039
223 #define RH_RF24_PROPERTY_MODEM_AGC_IFPD_DECAY 0x203a
224 #define RH_RF24_PROPERTY_MODEM_FSK4_GAIN1 0x203b
225 #define RH_RF24_PROPERTY_MODEM_FSK4_GAIN0 0x203c
226 #define RH_RF24_PROPERTY_MODEM_FSK4_TH1 0x203d
227 #define RH_RF24_PROPERTY_MODEM_FSK4_TH0 0x203e
228 #define RH_RF24_PROPERTY_MODEM_FSK4_MAP 0x203f
229 #define RH_RF24_PROPERTY_MODEM_OOK_PDTC 0x2040
230 #define RH_RF24_PROPERTY_MODEM_OOK_CNT1 0x2042
231 #define RH_RF24_PROPERTY_MODEM_OOK_MISC 0x2043
232 #define RH_RF24_PROPERTY_MODEM_RAW_SEARCH 0x2044
233 #define RH_RF24_PROPERTY_MODEM_RAW_CONTROL 0x2045
234 #define RH_RF24_PROPERTY_MODEM_RAW_EYE_1 0x2046
235 #define RH_RF24_PROPERTY_MODEM_RAW_EYE_0 0x2047
236 #define RH_RF24_PROPERTY_MODEM_ANT_DIV_MODE 0x2048
237 #define RH_RF24_PROPERTY_MODEM_ANT_DIV_CONTROL 0x2049
238 #define RH_RF24_PROPERTY_MODEM_RSSI_THRESH 0x204a
239 #define RH_RF24_PROPERTY_MODEM_RSSI_JUMP_THRESH 0x204b
240 #define RH_RF24_PROPERTY_MODEM_RSSI_CONTROL 0x204c
241 #define RH_RF24_PROPERTY_MODEM_RSSI_CONTROL2 0x204d
242 #define RH_RF24_PROPERTY_MODEM_RSSI_COMP 0x204e
243 #define RH_RF24_PROPERTY_MODEM_ANT_DIV_CONT 0x2049
244 #define RH_RF24_PROPERTY_MODEM_CLKGEN_BAND 0x2051
245 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE13_7_0 0x2100
246 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE12_7_0 0x2101
247 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE11_7_0 0x2102
248 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE10_7_0 0x2103
249 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE9_7_0 0x2104
250 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE8_7_0 0x2105
251 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE7_7_0 0x2106
252 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE6_7_0 0x2107
253 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE5_7_0 0x2108
254 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE4_7_0 0x2109
255 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE3_7_0 0x210a
256 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE2_7_0 0x210b
257 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE1_7_0 0x210c
258 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE0_7_0 0x210d
259 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM0 0x210e
260 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM1 0x210f
261 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM2 0x2110
262 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM3 0x2111
263 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE13_7_0 0x2112
264 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE12_7_0 0x2113
265 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE11_7_0 0x2114
266 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE10_7_0 0x2115
267 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE9_7_0 0x2116
268 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE8_7_0 0x2117
269 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE7_7_0 0x2118
270 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE6_7_0 0x2119
271 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE5_7_0 0x211a
272 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE4_7_0 0x211b
273 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE3_7_0 0x211c
274 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE2_7_0 0x211d
275 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE1_7_0 0x211e
276 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE0_7_0 0x211f
277 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM0 0x2120
278 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM1 0x2121
279 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM2 0x2122
280 #define RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM3 0x2123
281 #define RH_RF24_PROPERTY_PA_MODE 0x2200
282 #define RH_RF24_PROPERTY_PA_PWR_LVL 0x2201
283 #define RH_RF24_PROPERTY_PA_BIAS_CLKDUTY 0x2202
284 #define RH_RF24_PROPERTY_PA_TC 0x2203
285 #define RH_RF24_PROPERTY_SYNTH_PFDCP_CPFF 0x2300
286 #define RH_RF24_PROPERTY_SYNTH_PFDCP_CPINT 0x2301
287 #define RH_RF24_PROPERTY_SYNTH_VCO_KV 0x2302
288 #define RH_RF24_PROPERTY_SYNTH_LPFILT3 0x2303
289 #define RH_RF24_PROPERTY_SYNTH_LPFILT2 0x2304
290 #define RH_RF24_PROPERTY_SYNTH_LPFILT1 0x2305
291 #define RH_RF24_PROPERTY_SYNTH_LPFILT0 0x2306
292 #define RH_RF24_PROPERTY_MATCH_VALUE_1 0x3000
293 #define RH_RF24_PROPERTY_MATCH_MASK_1 0x3001
294 #define RH_RF24_PROPERTY_MATCH_CTRL_1 0x3002
295 #define RH_RF24_PROPERTY_MATCH_VALUE_2 0x3003
296 #define RH_RF24_PROPERTY_MATCH_MASK_2 0x3004
297 #define RH_RF24_PROPERTY_MATCH_CTRL_2 0x3005
298 #define RH_RF24_PROPERTY_MATCH_VALUE_3 0x3006
299 #define RH_RF24_PROPERTY_MATCH_MASK_3 0x3007
300 #define RH_RF24_PROPERTY_MATCH_CTRL_3 0x3008
301 #define RH_RF24_PROPERTY_MATCH_VALUE_4 0x3009
302 #define RH_RF24_PROPERTY_MATCH_MASK_4 0x300a
303 #define RH_RF24_PROPERTY_MATCH_CTRL_4 0x300b
304 #define RH_RF24_PROPERTY_FREQ_CONTROL_INTE 0x4000
305 #define RH_RF24_PROPERTY_FREQ_CONTROL_FRAC_2 0x4001
306 #define RH_RF24_PROPERTY_FREQ_CONTROL_FRAC_1 0x4002
307 #define RH_RF24_PROPERTY_FREQ_CONTROL_FRAC_0 0x4003
308 #define RH_RF24_PROPERTY_FREQ_CONTROL_CHANNEL_STEP_SIZE_1 0x4004
309 #define RH_RF24_PROPERTY_FREQ_CONTROL_CHANNEL_STEP_SIZE_0 0x4005
310 #define RH_RF24_PROPERTY_FREQ_CONTROL_VCOCNT_RX_ADJ 0x4007
311 #define RH_RF24_PROPERTY_RX_HOP_CONTROL 0x5000
312 #define RH_RF24_PROPERTY_RX_HOP_TABLE_SIZE 0x5001
313 #define RH_RF24_PROPERTY_RX_HOP_TABLE_ENTRY_0 0x5002
314 
315 //#define RH_RF24_CMD_GPIO_PIN_CFG 0x13
316 #define RH_RF24_GPIO_NO_CHANGE 0
317 #define RH_RF24_GPIO_DISABLED 1
318 #define RH_RF24_GPIO_LOW 2
319 #define RH_RF24_GPIO_HIGH 3
320 #define RH_RF24_GPIO_INPUT 4
321 #define RH_RF24_GPIO_32_KHZ_CLOCK 5
322 #define RH_RF24_GPIO_BOOT_CLOCK 6
323 #define RH_RF24_GPIO_DIVIDED_MCU_CLOCK 7
324 #define RH_RF24_GPIO_CTS 8
325 #define RH_RF24_GPIO_INV_CTS 9
326 #define RH_RF24_GPIO_HIGH_ON_CMD_OVERLAP 10
327 #define RH_RF24_GPIO_SPI_DATA_OUT 11
328 #define RH_RF24_GPIO_HIGH_AFTER_RESET 12
329 #define RH_RF24_GPIO_HIGH_AFTER_CALIBRATION 13
330 #define RH_RF24_GPIO_HIGH_AFTER_WUT 14
331 #define RH_RF24_GPIO_UNUSED_0 15
332 #define RH_RF24_GPIO_TX_DATA_CLOCK 16
333 #define RH_RF24_GPIO_RX_DATA_CLOCK 17
334 #define RH_RF24_GPIO_UNUSED_1 18
335 #define RH_RF24_GPIO_TX_DATA 19
336 #define RH_RF24_GPIO_RX_DATA 20
337 #define RH_RF24_GPIO_RX_RAW_DATA 21
338 #define RH_RF24_GPIO_ANTENNA_1_SWITCH 22
339 #define RH_RF24_GPIO_ANTENNA_2_SWITCH 23
340 #define RH_RF24_GPIO_VALID_PREAMBLE 24
341 #define RH_RF24_GPIO_INVALID_PREAMBLE 25
342 #define RH_RF24_GPIO_SYNC_DETECTED 26
343 #define RH_RF24_GPIO_RSSI_ABOVE_CAT 27
344 #define RH_RF24_GPIO_TX_STATE 32
345 #define RH_RF24_GPIO_RX_STATE 33
346 #define RH_RF24_GPIO_RX_FIFO_ALMOST_FULL 34
347 #define RH_RF24_GPIO_TX_FIFO_ALMOST_EMPTY 35
348 #define RH_RF24_GPIO_BATT_LOW 36
349 #define RH_RF24_GPIO_RSSI_ABOVE_CAT_LOW 37
350 #define RH_RF24_GPIO_HOP 38
351 #define RH_RF24_GPIO_HOP_TABLE_WRAPPED 39
352 
353 // #define RH_RF24_CMD_GET_INT_STATUS 0x20
354 #define RH_RF24_INT_STATUS_CHIP_INT_STATUS 0x04
355 #define RH_RF24_INT_STATUS_MODEM_INT_STATUS 0x02
356 #define RH_RF24_INT_STATUS_PH_INT_STATUS 0x01
357 #define RH_RF24_INT_STATUS_FILTER_MATCH 0x80
358 #define RH_RF24_INT_STATUS_FILTER_MISS 0x40
359 #define RH_RF24_INT_STATUS_PACKET_SENT 0x20
360 #define RH_RF24_INT_STATUS_PACKET_RX 0x10
361 #define RH_RF24_INT_STATUS_CRC_ERROR 0x08
362 #define RH_RF24_INT_STATUS_TX_FIFO_ALMOST_EMPTY 0x02
363 #define RH_RF24_INT_STATUS_RX_FIFO_ALMOST_FULL 0x01
364 #define RH_RF24_INT_STATUS_INVALID_SYNC 0x20
365 #define RH_RF24_INT_STATUS_RSSI_JUMP 0x10
366 #define RH_RF24_INT_STATUS_RSSI 0x08
367 #define RH_RF24_INT_STATUS_INVALID_PREAMBLE 0x04
368 #define RH_RF24_INT_STATUS_PREAMBLE_DETECT 0x02
369 #define RH_RF24_INT_STATUS_SYNC_DETECT 0x01
370 #define RH_RF24_INT_STATUS_CAL 0x40
371 #define RH_RF24_INT_STATUS_FIFO_UNDERFLOW_OVERFLOW_ERROR 0x20
372 #define RH_RF24_INT_STATUS_STATE_CHANGE 0x10
373 #define RH_RF24_INT_STATUS_CMD_ERROR 0x08
374 #define RH_RF24_INT_STATUS_CHIP_READY 0x04
375 #define RH_RF24_INT_STATUS_LOW_BATT 0x02
376 #define RH_RF24_INT_STATUS_WUT 0x01
377 
378 //#define RH_RF24_PROPERTY_GLOBAL_CLK_CFG 0x0001
379 #define RH_RF24_CLK_CFG_DIVIDED_CLK_EN 0x40
380 #define RH_RF24_CLK_CFG_DIVIDED_CLK_SEL_30 0x30
381 #define RH_RF24_CLK_CFG_DIVIDED_CLK_SEL_15 0x28
382 #define RH_RF24_CLK_CFG_DIVIDED_CLK_SEL_10 0x20
383 #define RH_RF24_CLK_CFG_DIVIDED_CLK_SEL_7_5 0x18
384 #define RH_RF24_CLK_CFG_DIVIDED_CLK_SEL_3 0x10
385 #define RH_RF24_CLK_CFG_DIVIDED_CLK_SEL_2 0x08
386 #define RH_RF24_CLK_CFG_DIVIDED_CLK_SEL_1 0x00
387 #define RH_RF24_CLK_CFG_CLK_32K_SEL_EXTERNAL 0x02
388 #define RH_RF24_CLK_CFG_CLK_32K_SEL_RC 0x01
389 #define RH_RF24_CLK_CFG_CLK_32K_SEL_DISABLED 0x00
390 
391 //#define RH_RF24_PROPERTY_FRR_CTL_A_MODE 0x0200
392 //#define RH_RF24_PROPERTY_FRR_CTL_B_MODE 0x0201
393 //#define RH_RF24_PROPERTY_FRR_CTL_C_MODE 0x0202
394 //#define RH_RF24_PROPERTY_FRR_CTL_D_MODE 0x0203
395 #define RH_RF24_FRR_MODE_DISABLED 0
396 #define RH_RF24_FRR_MODE_GLOBAL_STATUS 1
397 #define RH_RF24_FRR_MODE_GLOBAL_INTERRUPT_PENDING 2
398 #define RH_RF24_FRR_MODE_PACKET_HANDLER_STATUS 3
399 #define RH_RF24_FRR_MODE_PACKET_HANDLER_INTERRUPT_PENDING 4
400 #define RH_RF24_FRR_MODE_MODEM_STATUS 5
401 #define RH_RF24_FRR_MODE_MODEM_INTERRUPT_PENDING 6
402 #define RH_RF24_FRR_MODE_CHIP_STATUS 7
403 #define RH_RF24_FRR_MODE_CHIP_INTERRUPT_PENDING 8
404 #define RH_RF24_FRR_MODE_CURRENT_STATE 9
405 #define RH_RF24_FRR_MODE_LATCHED_RSSI 10
406 
407 //#define RH_RF24_PROPERTY_INT_CTL_ENABLE 0x0100
408 #define RH_RF24_CHIP_INT_STATUS_EN 0x04
409 #define RH_RF24_MODEM_INT_STATUS_EN 0x02
410 #define RH_RF24_PH_INT_STATUS_EN 0x01
411 
412 //#define RH_RF24_PROPERTY_PREAMBLE_CONFIG 0x1004
413 #define RH_RF24_PREAMBLE_FIRST_1 0x20
414 #define RH_RF24_PREAMBLE_FIRST_0 0x00
415 #define RH_RF24_PREAMBLE_LENGTH_NIBBLES 0x00
416 #define RH_RF24_PREAMBLE_LENGTH_BYTES 0x10
417 #define RH_RF24_PREAMBLE_MAN_CONST 0x08
418 #define RH_RF24_PREAMBLE_MAN_ENABLE 0x02
419 #define RH_RF24_PREAMBLE_NON_STANDARD 0x00
420 #define RH_RF24_PREAMBLE_STANDARD_1010 0x01
421 #define RH_RF24_PREAMBLE_STANDARD_0101 0x02
422 
423 //#define RH_RF24_PROPERTY_SYNC_CONFIG 0x1100
424 #define RH_RF24_SYNC_CONFIG_SKIP_TX 0x80
425 #define RH_RF24_SYNC_CONFIG_RX_ERRORS_MASK 0x70
426 #define RH_RF24_SYNC_CONFIG_4FSK 0x08
427 #define RH_RF24_SYNC_CONFIG_MANCH 0x04
428 #define RH_RF24_SYNC_CONFIG_LENGTH_MASK 0x03
429 
430 //#define RH_RF24_PROPERTY_PKT_CRC_CONFIG 0x1200
431 #define RH_RF24_CRC_SEED_ALL_0S 0x00
432 #define RH_RF24_CRC_SEED_ALL_1S 0x80
433 #define RH_RF24_CRC_MASK 0x0f
434 #define RH_RF24_CRC_NONE 0x00
435 #define RH_RF24_CRC_ITU_T 0x01
436 #define RH_RF24_CRC_IEC_16 0x02
437 #define RH_RF24_CRC_BIACHEVA 0x03
438 #define RH_RF24_CRC_16_IBM 0x04
439 #define RH_RF24_CRC_CCITT 0x05
440 #define RH_RF24_CRC_KOOPMAN 0x06
441 #define RH_RF24_CRC_IEEE_802_3 0x07
442 #define RH_RF24_CRC_CASTAGNOLI 0x08
443 
444 //#define RH_RF24_PROPERTY_PKT_CONFIG1 0x1206
445 #define RH_RF24_PH_FIELD_SPLIT 0x80
446 #define RH_RF24_PH_RX_DISABLE 0x40
447 #define RH_RF24_4FSK_EN 0x20
448 #define RH_RF24_RX_MULTI_PKT 0x10
449 #define RH_RF24_MANCH_POL 0x08
450 #define RH_RF24_CRC_INVERT 0x04
451 #define RH_RF24_CRC_ENDIAN 0x02
452 #define RH_RF24_BIT_ORDER 0x01
453 
454 //#define RH_RF24_PROPERTY_PKT_FIELD_1_CONFIG 0x120f
455 //#define RH_RF24_PROPERTY_PKT_FIELD_2_CONFIG 0x1213
456 //#define RH_RF24_PROPERTY_PKT_FIELD_3_CONFIG 0x1217
457 //#define RH_RF24_PROPERTY_PKT_FIELD_4_CONFIG 0x121b
458 //#define RH_RF24_PROPERTY_PKT_FIELD_5_CONFIG 0x121f
459 #define RH_RF24_FIELD_CONFIG_4FSK 0x10
460 #define RH_RF24_FIELD_CONFIG_WHITEN 0x02
461 #define RH_RF24_FIELD_CONFIG_MANCH 0x01
462 
463 //#define RH_RF24_PROPERTY_PKT_RX_FIELD_1_CRC_CONFIG 0x1224
464 //#define RH_RF24_PROPERTY_PKT_RX_FIELD_2_CRC_CONFIG 0x1228
465 //#define RH_RF24_PROPERTY_PKT_RX_FIELD_3_CRC_CONFIG 0x122c
466 //#define RH_RF24_PROPERTY_PKT_RX_FIELD_4_CRC_CONFIG 0x1230
467 //#define RH_RF24_PROPERTY_PKT_RX_FIELD_5_CRC_CONFIG 0x1234
468 #define RH_RF24_FIELD_CONFIG_CRC_START 0x80
469 #define RH_RF24_FIELD_CONFIG_SEND_CRC 0x20
470 #define RH_RF24_FIELD_CONFIG_CHECK_CRC 0x08
471 #define RH_RF24_FIELD_CONFIG_CRC_ENABLE 0x02
472 
473 
474 
475 
476 //#define RH_RF24_PROPERTY_MODEM_MOD_TYPE 0x2000
477 #define RH_RF24_TX_DIRECT_MODE_TYPE_SYNCHRONOUS 0x00
478 #define RH_RF24_TX_DIRECT_MODE_TYPE_ASYNCHRONOUS 0x80
479 #define RH_RF24_TX_DIRECT_MODE_GPIO0 0x00
480 #define RH_RF24_TX_DIRECT_MODE_GPIO1 0x20
481 #define RH_RF24_TX_DIRECT_MODE_GPIO2 0x40
482 #define RH_RF24_TX_DIRECT_MODE_GPIO3 0x60
483 #define RH_RF24_MOD_SOURCE_PACKET_HANDLER 0x00
484 #define RH_RF24_MOD_SOURCE_DIRECT_MODE 0x08
485 #define RH_RF24_MOD_SOURCE_RANDOM_GENERATOR 0x10
486 #define RH_RF24_MOD_TYPE_CW 0x00
487 #define RH_RF24_MOD_TYPE_OOK 0x01
488 #define RH_RF24_MOD_TYPE_2FSK 0x02
489 #define RH_RF24_MOD_TYPE_2GFSK 0x03
490 #define RH_RF24_MOD_TYPE_4FSK 0x04
491 #define RH_RF24_MOD_TYPE_4GFSK 0x05
492 
493 // RH_RF24_PROPERTY_PA_MODE 0x2200
494 #define RH_RF24_PA_MODE_1_GROUP 0x04
495 #define RH_RF24_PA_MODE_2_GROUPS 0x08
496 #define RH_RF24_PA_MODE_CLASS_E 0x00
497 #define RH_RF24_PA_MODE_SWITCH_CURRENT 0x01
498 
499 
500 /////////////////////////////////////////////////////////////////////
501 /// \class RH_RF24 RH_RF24.h <RH_RF24.h>
502 /// \brief Driver to send and receive unaddressed, unreliable datagrams via an RF24 and compatible radio transceiver.
503 ///
504 /// Works with
505 /// - Silicon Labs Si4460/1/2/3/4 transceiver chips
506 /// - The equivalent HopeRF RF24/25/26/27 transceiver chips
507 /// - HopeRF Complete modules: RFM24W/26W/27W
508 ///
509 /// \par Overview
510 ///
511 /// This class provides basic functions for sending and receiving unaddressed,
512 /// unreliable datagrams of arbitrary length to 250 octets per packet.
513 ///
514 /// Manager classes may use this class to implement reliable, addressed datagrams and streams,
515 /// mesh routers, repeaters, translators etc.
516 ///
517 /// Naturally, for any 2 radios to communicate that must be configured to use the same frequency and
518 /// modulation scheme.
519 ///
520 /// This Driver provides an object-oriented interface for sending and receiving data messages with Hope-RF
521 /// RF24 and compatible radio modules, such as the RFM24W module.
522 ///
523 /// The Hope-RF (http://www.hoperf.com) RF24 family is a low-cost ISM transceiver
524 /// chip. It supports FSK, GFSK, OOK over a wide range of frequencies and
525 /// programmable data rates. HopeRF also sell these chips on modules which includes
526 /// a crystal and antenna coupling circuits: RFM24W, RFM26W and RFM27W
527 ///
528 /// This Driver provides functions for sending and receiving messages of up
529 /// to 250 octets on any frequency supported by the RF24, in a range of
530 /// predefined data rates and frequency deviations. Frequency can be set
531 /// to any frequency from 142.0MHz to 1050.0MHz. Caution: most modules only support a more limited
532 /// range of frequencies due to antenna tuning.
533 ///
534 /// Up to 2 RFM24 modules can be connected to an Arduino (3 on a Mega),
535 /// permitting the construction of translators and frequency changers, etc.
536 ///
537 /// The following modulation types are suppported with a range of modem configurations for
538 /// common data rates and frequency deviations:
539 /// - OOK On-Off Keying
540 /// - GFSK Gaussian Frequency Shift Keying
541 /// - FSK Frequency Shift Keying
542 ///
543 /// Support for other RF24 features such as on-chip temperature measurement,
544 /// transmitter power control etc is also provided.
545 ///
546 /// RH_RF24 uses interrupts to detect and handle events in the radio chip. The RF24 family has
547 /// TX and RX FIFOs of 64 bytes, but through the use of interrupt, the RH_RF24 driver can send longer
548 /// messages by filling or emptying the FIFOs on-the-fly.
549 ///
550 /// Tested on Anarduino Mini http://www.anarduino.com/mini/ with arduino-1.0.5
551 /// on OpenSuSE 13.1. Also on Anarduino Mini with arduino-1.8.1 on Kubuntu 16.04
552 ///
553 /// \par Packet Format
554 ///
555 /// All messages sent and received by this RH_RF24 Driver conform to this packet format:
556 ///
557 /// - 4 octets PREAMBLE (configurable)
558 /// - 2 octets SYNC 0x2d, 0xd4 (configurable, so you can use this as a network filter)
559 /// - Field containing 1 octet of message length and 2 octet CRC protecting this field
560 /// - Field 2 containing at least 4 octets, and 2 octet CRC protecting this field:
561 /// + 4 octets HEADER: (TO, FROM, ID, FLAGS)
562 /// + 0 to 250 octets DATA
563 /// + 2 octets CRC, computed on HEADER and DATA
564 ///
565 /// \par Connecting RFM-24 to Arduino
566 ///
567 /// For RFM24/RFM26 and Teensy 3.1 or Anarduino Mini
568 /// \code
569 /// Teensy RFM-24/RFM26
570 /// GND----------GND (ground in)
571 /// 3V3----------VCC (3.3V in)
572 /// interrupt 2 pin D2-----------NIRQ (interrupt request out)
573 /// SS pin D10----------NSEL (chip select in)
574 /// SCK pin D13----------SCK (SPI clock in)
575 /// MOSI pin D11----------SDI (SPI Data in)
576 /// MISO pin D12----------SDO (SPI data out)
577 /// D9-----------SDN (shutdown in)
578 /// /--GPIO0 (GPIO0 out to control transmitter antenna TX_ANT)
579 /// \--TX_ANT (TX antenna control in) RFM22B only
580 /// /--GPIO1 (GPIO1 out to control receiver antenna RX_ANT)
581 /// \--RX_ANT (RX antenna control in) RFM22B only
582 /// \endcode
583 /// Caution: tying the radio SDN pin to ground (though it might appear from the data sheets to make sense)
584 /// does not always produce a reliable radio startup. So this driver controls the SDN pin directly.
585 /// Note: the GPIO0-TX_ANT and GPIO1-RX_ANT connections are not required for the 11dBm RFM24W,
586 /// which has no antenna switch.
587 ///
588 /// If you have an Arduino Zero, you should note that you cannot use Pin 2 for the interrupt line
589 /// (Pin 2 is for the NMI only), instead you can use any other pin (we use Pin 3) and initialise RH_RF69 like this:
590 /// \code
591 /// // Slave Select is pin 10, interrupt is Pin 3
592 /// RH_RF24 driver(10, 3);
593 /// \endcode
594 ///
595 /// \par Customising and configuring
596 ///
597 /// The RH_RF24 module uses a radio configuration header file to configure the basic radio operation
598 /// frequency and modulation scheme. The radio configuration header file must be generated with the
599 /// Silicon Labs Wireless Development Suite (WDS) program and \#included by RH_RF24.cpp
600 ///
601 /// The library will work out of the box and without further configuring with these parameters:
602 /// - Si4464 or equvalent
603 /// - 30MHz Crytstal
604 /// - 434MHz base frequncy band
605 /// - 2GFSK modulation
606 /// - 5kbps data rate
607 /// - 10kHz deviation
608 /// using the radio configuration header file
609 /// RF24configs/radio_config_Si4464_30_434_2GFSK_5_10.h
610 /// which is included in RadioHead.
611 ///
612 /// In order to use different frequency bands or modulation schemes, you must generate a new
613 /// radio configuration header file
614 /// with WDS, or select one of a small set of prebuilt headers from the RF24configs folder (see README in that
615 /// folder for details of the filename format).
616 ///
617 /// To generate a new header file:
618 ///
619 /// - Install Silicon Labs Wireless Development Suite (WDS) 3.2.11.0 or later
620 /// (Windows only, we were not able to get it to run under Wine on Linux)
621 /// - Run WDS
622 /// - Menu->Start Simulation
623 /// - Select radio chip type Si4464, press Select Radio
624 /// - Select Radio Configuration Application, press Select Application
625 /// - Click on Standard Packet Tx
626 /// - On the Frequency and Power tab, Select the Frequency, crystal frequency etc. The PA power level is irrelevant,
627 /// since power is set programatically
628 /// - On the RF parameters tab, select the modulation type and rates
629 /// - Press Generate Source, Save custom radio configuration header file
630 /// - Enter a new unique file name in the RF24configs folder in RadioHead
631 /// - Edit RH_RF24.cpp to use this new header file
632 /// - Recompile RH_RF24
633 ///
634 /// \par RSSI
635 ///
636 /// The RSSI (Received Signal Strength Indicator) is measured and latched after the message sync bytes are received.
637 /// The latched RSSI is available from the lastRssi() member functionafter the complete message is received.
638 /// Although lastRssi()
639 /// supposedly returns a signed integer, in the case of this radio it actually returns an unsigned 8 bit integer (uint8_t)
640 /// and you will have to cast the return value to use it:
641 /// \code
642 /// uint8_t lastRssi = (uint8_t)rf24.lastRssi();
643 /// \endcode
644 /// The units of RSSI are arbitrary and relative, with larger unsigned numbers indicating a stronger signal. Values up to 255
645 /// are seen with radios in close proximity to each other. Lower limit of receivable strength is about 70.
646 ///
647 /// \par Transmitter Power
648 ///
649 /// You can control the transmitter power on the RF24/25/26/27 transceiver
650 /// with the RH_RF24::setTxPower() function. The argument can be any of
651 /// 0x00 to 0x4f (for RFM24/Si4460) or
652 /// 0x00 to 0x7f (for others)
653 /// 0x00 will yield no measurable power. For other settings there is a non-linear correlation with actual
654 /// RF power output (see below)
655 /// The default is 0x10. Eg:
656 /// \code
657 /// driver.setTxPower(0x10);
658 /// \endcode
659 ///
660 /// We have made some actual power measurements against
661 /// programmed power
662 /// - Anarduino Mini with RFM24-433 and RFM26-433 at Vcc = 3.3V, in CW mode, 434MHz
663 /// - 10cm RG58C/U soldered direct to RFM69 module ANT and GND
664 /// - bnc connecteor
665 /// - 12dB attenuator
666 /// - BNC-SMA adapter
667 /// - MiniKits AD8307 HF/VHF Power Head (calibrated against Rohde&Schwartz 806.2020 test set)
668 /// - Digitech QM-1460 digital multimeter
669 /// \code
670 /// Program power Measured Power dBm
671 /// HEX RFM24 RFM26
672 /// 0x00 not measurable not measurable
673 /// 0x01 -20.4 -20.6
674 /// 0x0f 2.4 4.8
675 /// 0x1f 9.4 11.0
676 /// 0x2f 11.2 14.2
677 /// 0x3f 11.6 16.4
678 /// 0x4f 11.6 18.0
679 /// 0x5f 18.6
680 /// 0x6f 19.0
681 /// 0x7f 19.2
682 /// \endcode
683 /// Caution: the actual radiated power output will depend heavily on the power supply voltage and the antenna.
684 
685 class RH_RF24 : public RHSPIDriver
686 {
687 public:
688  /// \brief Defines property values for a set of modem configuration registers
689  ///
690  /// Defines property values for a set of modem configuration registers
691  /// that can be passed to setModemRegisters() if none of the choices in
692  /// ModemConfigChoice suit your need setModemRegisters() writes the
693  /// property values from this structure to the appropriate RF24 properties
694  /// to set the desired modulation type, data rate and deviation/bandwidth.
695  /// OBSOLETE: no need ever to use this now
696  typedef struct
697  {
698  uint8_t prop_2000; ///< Value for property RH_RF24_PROPERTY_MODEM_MOD_TYPE
699  uint8_t prop_2003; ///< Value for property RH_RF24_PROPERTY_MODEM_DATA_RATE_2
700  uint8_t prop_2004; ///< Value for property RH_RF24_PROPERTY_MODEM_DATA_RATE_1
701  uint8_t prop_2005; ///< Value for property RH_RF24_PROPERTY_MODEM_DATA_RATE_0
702  uint8_t prop_2006; ///< Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_3
703  uint8_t prop_2007; ///< Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_2
704  uint8_t prop_2008; ///< Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_1
705  uint8_t prop_2009; ///< Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_0
706  uint8_t prop_200a; ///< Value for property RH_RF24_PROPERTY_MODEM_FREQ_DEV_2
707  uint8_t prop_200b; ///< Value for property RH_RF24_PROPERTY_MODEM_FREQ_DEV_1
708  uint8_t prop_200c; ///< Value for property RH_RF24_PROPERTY_MODEM_FREQ_DEV_0
709  uint8_t prop_2018; ///< Value for property RH_RF24_PROPERTY_MODEM_TX_RAMP_DELAY
710  uint8_t prop_201e; ///< Value for property RH_RF24_PROPERTY_MODEM_DECIMATION_CFG1
711  uint8_t prop_201f; ///< Value for property RH_RF24_PROPERTY_MODEM_DECIMATION_CFG0
712  uint8_t prop_2022; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_OSR_1
713  uint8_t prop_2023; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_OSR_0
714  uint8_t prop_2024; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_2
715  uint8_t prop_2025; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_1
716  uint8_t prop_2026; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_0
717  uint8_t prop_2027; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_GAIN_1
718  uint8_t prop_2028; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_GAIN_0
719  uint8_t prop_2029; ///< Value for property RH_RF24_PROPERTY_MODEM_BCR_GEAR
720  uint8_t prop_202d; ///< Value for property RH_RF24_PROPERTY_MODEM_AFC_WAIT
721  uint8_t prop_202e; ///< Value for property RH_RF24_PROPERTY_MODEM_AFC_GAIN_1
722  uint8_t prop_202f; ///< Value for property RH_RF24_PROPERTY_MODEM_AFC_GAIN_0
723  uint8_t prop_2030; ///< Value for property RH_RF24_PROPERTY_MODEM_AFC_LIMITER_1
724  uint8_t prop_2031; ///< Value for property RH_RF24_PROPERTY_MODEM_AFC_LIMITER_0
725  uint8_t prop_2035; ///< Value for property RH_RF24_PROPERTY_MODEM_AGC_CONTROL
726  uint8_t prop_2038; ///< Value for property RH_RF24_PROPERTY_MODEM_AGC_WINDOW_SIZE
727  uint8_t prop_2039; ///< Value for property RH_RF24_PROPERTY_MODEM_AGC_RFPD_DECAY
728  uint8_t prop_203a; ///< Value for property RH_RF24_PROPERTY_MODEM_AGC_IFPD_DECAY
729  uint8_t prop_203b; ///< Value for property RH_RF24_PROPERTY_MODEM_FSK4_GAIN1
730  uint8_t prop_203c; ///< Value for property RH_RF24_PROPERTY_MODEM_FSK4_GAIN0
731  uint8_t prop_203d; ///< Value for property RH_RF24_PROPERTY_MODEM_FSK4_TH1
732  uint8_t prop_203e; ///< Value for property RH_RF24_PROPERTY_MODEM_FSK4_TH0
733  uint8_t prop_203f; ///< Value for property RH_RF24_PROPERTY_MODEM_FSK4_MAP
734  uint8_t prop_2040; ///< Value for property RH_RF24_PROPERTY_MODEM_OOK_PDTC
735  uint8_t prop_2043; ///< Value for property RH_RF24_PROPERTY_MODEM_OOK_MISC
736  uint8_t prop_2045; ///< Value for property RH_RF24_PROPERTY_MODEM_RAW_CONTROL
737  uint8_t prop_2046; ///< Value for property RH_RF24_PROPERTY_MODEM_RAW_EYE_1
738  uint8_t prop_2047; ///< Value for property RH_RF24_PROPERTY_MODEM_RAW_EYE_0
739  uint8_t prop_204e; ///< Value for property RH_RF24_PROPERTY_MODEM_RSSI_COMP
740  uint8_t prop_2100; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE13_7_0
741  uint8_t prop_2101; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE12_7_0
742  uint8_t prop_2102; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE11_7_0
743  uint8_t prop_2103; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE10_7_0
744  uint8_t prop_2104; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE9_7_0
745  uint8_t prop_2105; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE8_7_0
746  uint8_t prop_2106; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE7_7_0
747  uint8_t prop_2107; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE6_7_0
748  uint8_t prop_2108; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE5_7_0
749  uint8_t prop_2109; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE4_7_0
750  uint8_t prop_210a; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE3_7_0
751  uint8_t prop_210b; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE2_7_0
752  uint8_t prop_210c; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE1_7_0
753  uint8_t prop_210d; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE0_7_0
754  uint8_t prop_210e; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM0
755  uint8_t prop_210f; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM1
756  uint8_t prop_2110; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM2
757  uint8_t prop_2111; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM3
758  uint8_t prop_2112; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE13_7_0
759  uint8_t prop_2113; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE12_7_0
760  uint8_t prop_2114; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE11_7_0
761  uint8_t prop_2115; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE10_7_0
762  uint8_t prop_2116; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE9_7_0
763  uint8_t prop_2117; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE8_7_0
764  uint8_t prop_2118; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE7_7_0
765  uint8_t prop_2119; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE6_7_0
766  uint8_t prop_211a; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE5_7_0
767  uint8_t prop_211b; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE4_7_0
768  uint8_t prop_211c; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE3_7_0
769  uint8_t prop_211d; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE2_7_0
770  uint8_t prop_211e; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE1_7_0
771  uint8_t prop_211f; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE0_7_0
772  uint8_t prop_2120; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM0
773  uint8_t prop_2121; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM1
774  uint8_t prop_2122; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM2
775  uint8_t prop_2123; ///< Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM3
776  uint8_t prop_2203; ///< Value for property RH_RF24_PROPERTY_PA_TC
777  uint8_t prop_2300; ///< Value for property RH_RF24_PROPERTY_SYNTH_PFDCP_CPFF
778  uint8_t prop_2301; ///< Value for property RH_RF24_PROPERTY_SYNTH_PFDCP_CPINT
779  uint8_t prop_2303; ///< Value for property RH_RF24_PROPERTY_SYNTH_LPFILT3
780  uint8_t prop_2304; ///< Value for property RH_RF24_PROPERTY_SYNTH_LPFILT2
781  uint8_t prop_2305; ///< Value for property RH_RF24_PROPERTY_SYNTH_LPFILT1
782  } ModemConfig;
783 
784  /// Choices for setModemConfig() for a selected subset of common
785  /// modulation types, and data rates. If you need another configuration,
786  /// use the register calculator. and call setModemRegisters() with your
787  /// desired settings.
788  /// These are indexes into MODEM_CONFIG_TABLE. We strongly recommend you use these symbolic
789  /// definitions and not their integer equivalents: its possible that values will be
790  /// changed in later versions (though we will try to avoid it).
791  /// Contributions of new complete and tested ModemConfigs ready to add to this list will be readily accepted.
792  /// OBSOLETE: no need ever to use this now
793  typedef enum
794  {
795  FSK_Rb0_5Fd1 = 0, ///< FSK Rb = 0.5kbs, Fd = 1kHz
796  FSK_Rb5Fd10, ///< FSK Rb = 5kbs, Fd = 10kHz
797  FSK_Rb50Fd100, ///< FSK Rb = 50kbs, Fd = 100kHz
798  FSK_Rb150Fd300, ///< FSK Rb = 50kbs, Fd = 100kHz
799 
800  GFSK_Rb0_5Fd1, ///< GFSK Rb = 0.5kbs, Fd = 1kHz
801  GFSK_Rb5Fd10, ///< GFSK Rb = 5kbs, Fd = 10kHz
802  GFSK_Rb50Fd100, ///< GFSK Rb = 50kbs, Fd = 100kHz
803  GFSK_Rb150Fd300, ///< GFSK Rb = 150kbs, Fd = 300kHz
804 
805  // We were unable to get any other OOKs to work
806  OOK_Rb5Bw30, ///< OOK Rb = 5kbs, Bw = 30kHz
807  OOK_Rb10Bw40, ///< OOK Rb = 10kbs, Bw = 40kHz
808 
809  // We were unable to get any 4FSK or 4GFSK schemes to work
810 
812 
813  /// \brief Defines the available choices for CRC
814  /// Types of permitted CRC polynomials, to be passed to setCRCPolynomial()
815  /// They deliberately have the same numeric values as the CRC_POLYNOMIAL field of PKT_CRC_CONFIG
816  typedef enum
817  {
818  CRC_NONE = 0,
819  CRC_ITU_T,
820  CRC_IEC_16,
821  CRC_Biacheva,
822  CRC_16_IBM,
823  CRC_CCITT,
824  CRC_Koopman,
825  CRC_IEEE_802_3,
826  CRC_Castagnoli,
827  } CRCPolynomial;
828 
829  /// \brief Defines the commands we can interrogate in printRegisters
830  typedef struct
831  {
832  uint8_t cmd; ///< The command number
833  uint8_t replyLen; ///< Number of bytes in the reply stream (after the CTS)
834  } CommandInfo;
835 
836  /// Constructor. You can have multiple instances, but each instance must have its own
837  /// interrupt and slave select pin. After constructing, you must call init() to initialise the interface
838  /// and the radio module. A maximum of 3 instances can co-exist on one processor, provided there are sufficient
839  /// distinct interrupt lines, one for each instance.
840  /// \param[in] slaveSelectPin the Arduino pin number of the output to use to select the RF24 before
841  /// accessing it. Defaults to the normal SS pin for your Arduino (D10 for Diecimila, Uno etc, D53 for Mega, D10 for Maple)
842  /// \param[in] interruptPin The interrupt Pin number that is connected to the RF24 DIO0 interrupt line.
843  /// Defaults to pin 2.
844  /// Caution: You must specify an interrupt capable pin.
845  /// On many Arduino boards, there are limitations as to which pins may be used as interrupts.
846  /// On Leonardo pins 0, 1, 2 or 3. On Mega2560 pins 2, 3, 18, 19, 20, 21. On Due and Teensy, any digital pin.
847  /// On other Arduinos pins 2 or 3.
848  /// See http://arduino.cc/en/Reference/attachInterrupt for more details.
849  /// On Chipkit Uno32, pins 38, 2, 7, 8, 35.
850  /// On other boards, any digital pin may be used.
851  /// \param [in] sdnPin The pin number connected to SDN on the radio. Defaults to pin 9.
852  /// Connecting SDN directly to ground does not aloways provide reliable radio startup.
853  /// \param[in] spi Pointer to the SPI interface object to use.
854  /// Defaults to the standard Arduino hardware SPI interface
855  RH_RF24(uint8_t slaveSelectPin = SS, uint8_t interruptPin = 2, uint8_t sdnPin = 9, RHGenericSPI& spi = hardware_spi);
856 
857  /// Initialises this instance and the radio module connected to it.
858  /// The following steps are taken:
859  /// - Initialise the slave select and shutdown pins and the SPI interface library
860  /// - Checks the connected RF24 module can be communicated
861  /// - Attaches an interrupt handler
862  /// - Configures the RF24 module
863  /// - Sets the frequency to 434.0 MHz
864  /// - Sets the modem data rate to GFSK_Rb5Fd10
865  /// - Sets the tranmitter power level to 16 (about 2.4dBm on RFM4)
866  /// \return true if everything was successful
867  bool init();
868 
869  /// Sets the chip mode that will be used when the RH_RF24 driver is idle (ie not transmitting or receiving)
870  /// You can use this to control the power level consumed while idle, at the cost of slower
871  /// transition to tranmit or receive states
872  /// \param[in] idleMode The chip state to use when idle. Sensible choices might be RH_RF24_DEVICE_STATE_SLEEP or RH_RF24_DEVICE_STATE_READY
873  void setIdleMode(uint8_t idleMode);
874 
875  /// Sets the transmitter and receiver
876  /// centre frequency.
877  /// Valid frequency ranges for RFM24/Si4460, Si4461, RFM25/Si4463 are:
878  /// 142MHz to 175Mhz, 284MHz to 350MHz, 425MHz to 525MHz, 850MHz to 1050MHz.
879  /// Valid frequency ranges for RFM26/Si4464 are:
880  /// 119MHz to 960MHz.
881  /// Caution: RFM modules are designed with antenna coupling components to suit a limited band
882  /// of frequencies (marked underneath the module). It is possible to set frequencies in other bands,
883  /// but you may only get little or no power radiated.
884  /// Caution, you can only use this function to change frequency within the frequency band configured by
885  /// the radio configuration header file. To use a frequency in a different band, you must recompile with
886  /// the appropriate radio configuration header file. Setting a frequency in anotehr band will
887  /// have unpredicatble results.
888  /// \param[in] centre Frequency in MHz.
889  /// \param[in] afcPullInRange Not used
890  /// \return true if the selected frequency is within a valid range for the connected radio and if
891  /// setting the new frequency succeeded.
892  bool setFrequency(float centre, float afcPullInRange = 0.05);
893 
894  /// OBSOLETE, do not use.
895  /// To get different modulation schemes, you must generate a new radio config file
896  /// as described in this documentation.
897  /// Sets all the properties required to configure the data modem in the RF24, including the data rate,
898  /// bandwidths etc. You can use this to configure the modem with custom configurations if none of the
899  /// canned configurations in ModemConfigChoice suit you.
900  /// \param[in] config A ModemConfig structure containing values for the modem configuration registers.
901  void setModemRegisters(const ModemConfig* config);
902 
903  /// OBSOLETE, do not use.
904  /// To get different modulation schemes, you must generate a new radio config file
905  /// as described in this documentation.
906  /// Select one of the predefined modem configurations. If you need a modem configuration not provided
907  /// here, use setModemRegisters() with your own ModemConfig. The default after init() is RH_RF24::GFSK_Rb5Fd10.
908  /// \param[in] index The configuration choice.
909  /// \return true if index is a valid choice.
910  bool setModemConfig(ModemConfigChoice index);
911 
912  /// Starts the receiver and checks whether a received message is available.
913  /// This can be called multiple times in a timeout loop
914  /// \return true if a complete, valid message has been received and is able to be retrieved by
915  /// recv()
916  bool available();
917 
918  /// Turns the receiver on if it not already on.
919  /// If there is a valid message available, copy it to buf and return true
920  /// else return false.
921  /// If a message is copied, *len is set to the length (Caution, 0 length messages are permitted).
922  /// You should be sure to call this function frequently enough to not miss any messages
923  /// It is recommended that you call it in your main loop.
924  /// \param[in] buf Location to copy the received message
925  /// \param[in,out] len Pointer to available space in buf. Set to the actual number of octets copied.
926  /// \return true if a valid message was copied to buf
927  bool recv(uint8_t* buf, uint8_t* len);
928 
929  /// Waits until any previous transmit packet is finished being transmitted with waitPacketSent().
930  /// Then loads a message into the transmitter and starts the transmitter. Note that a message length
931  /// of 0 is NOT permitted.
932  /// \param[in] data Array of data to be sent
933  /// \param[in] len Number of bytes of data to send (> 0)
934  /// \return true if the message length was valid and it was correctly queued for transmit
935  bool send(const uint8_t* data, uint8_t len);
936 
937  /// The maximum message length supported by this driver
938  /// \return The maximum message length supported by this driver
939  uint8_t maxMessageLength();
940 
941  /// Sets the length of the preamble
942  /// in bytes.
943  /// Caution: this should be set to the same
944  /// value on all nodes in your network. Default is 4.
945  /// \param[in] bytes Preamble length in bytes.
946  void setPreambleLength(uint16_t bytes);
947 
948  /// Sets the sync words for transmit and receive
949  /// Caution: SyncWords should be set to the same
950  /// value on all nodes in your network. Nodes with different SyncWords set will never receive
951  /// each others messages, so different SyncWords can be used to isolate different
952  /// networks from each other. Default is { 0x2d, 0xd4 }.
953  /// \param[in] syncWords Array of sync words, 1 to 4 octets long. NULL if no sync words to be used.
954  /// \param[in] len Number of sync words to set, 1 to 4. 0 if no sync words to be used.
955  void setSyncWords(const uint8_t* syncWords = NULL, uint8_t len = 0);
956 
957  /// Sets the CRC polynomial to be used to generate the CRC for both receive and transmit
958  /// otherwise the default of CRC_16_IBM will be used.
959  /// \param[in] polynomial One of RH_RF24::CRCPolynomial choices CRC_*
960  /// \return true if polynomial is a valid option for this radio.
961  bool setCRCPolynomial(CRCPolynomial polynomial);
962 
963  /// If current mode is Rx or Tx changes it to Idle. If the transmitter or receiver is running,
964  /// disables them.
965  void setModeIdle();
966 
967  /// If current mode is Tx or Idle, changes it to Rx.
968  /// Starts the receiver in the RF24.
969  void setModeRx();
970 
971  /// If current mode is Rx or Idle, changes it to Rx. F
972  /// Starts the transmitter in the RF24.
973  void setModeTx();
974 
975  /// Sets the transmitter power output level register PA_PWR_LVL
976  /// The power argument to this function has a non-linear correlation with the actual RF power output.
977  /// See the transmitter power table above for some examples.
978  /// Also the Si446x Data Sheet section 5.4.2 may be helpful.
979  /// Be a good neighbour and set the lowest power level you need.
980  /// Caution: legal power limits may apply in certain countries.
981  /// After init(), the power will be set to 0x10.
982  /// \param[in] power Transmitter power level. For RFM24/Si4460, valid values are 0x00 to 0x4f. For others, 0x00 to 0x7f
983  void setTxPower(uint8_t power);
984 
985  /// Dump the values of available command replies and properties
986  /// to the Serial device if RH_HAVE_SERIAL is defined for the current platform
987  /// Not all commands have valid replies, therefore they are not all printed.
988  /// Caution: the list is very long
989  bool printRegisters();
990 
991  /// Send a string of command bytes to the chip and get a string of reply bytes
992  /// Different RFM24 commands take different numbers of command bytes and send back different numbers
993  /// of reply bytes. See the Si446x documentaiton for more details.
994  /// Both command bytes and reply bytes are optional
995  /// \param[in] cmd The command number. One of RH_RF24_CMD_*
996  /// \param[in] write_buf Pointer to write_len bytes of command input bytes to send. If there are none, set to NULL.
997  /// \param[in] write_len The number of bytes to send from write_buf. If there are none, set to 0
998  /// \param[out] read_buf Pointer to read_len bytes of storage where the reply stream from the comand will be written.
999  /// If none are required, set to NULL
1000  /// \param[in] read_len The number of bytes to read from the reply stream. If none required, set to 0.
1001  /// \return true if the command succeeeded.
1002  bool command(uint8_t cmd, const uint8_t* write_buf = 0, uint8_t write_len = 0, uint8_t* read_buf = 0, uint8_t read_len = 0);
1003 
1004  /// Set one or more chip properties using the RH_RF24_CMD_SET_PROPERTY
1005  /// command. See the Si446x API Description AN625 for details on what properties are available.
1006  /// param[in] firstProperty The property number of the first property to set. The first value in the values array
1007  /// will be used to set this property, and any subsequent values will be used to set the following properties.
1008  /// One of RH_RF24_PROPERTY_*
1009  /// param[in] values Array of 0 or more values to write the firstProperty and subsequent proerties
1010  /// param[in] count The number of values in the values array
1011  /// \return true if the command succeeeded.
1012  bool set_properties(uint16_t firstProperty, const uint8_t* values, uint8_t count);
1013 
1014  /// Get one or more chip properties using the RH_RF24_CMD_GET_PROPERTY
1015  /// command. See the Si446x API Description AN625 for details on what properties are available.
1016  /// param[in] firstProperty The property number of the first property to get. The first value in the values array
1017  /// will be set with this property, and any subsequent values will be set from the following properties.
1018  /// One of RH_RF24_PROPERTY_*
1019  /// param[out] values Array of 0 or more values to receive the firstProperty and subsequent proerties
1020  /// param[in] count The number of values in the values array
1021  /// \return true if the command succeeeded.
1022  bool get_properties(uint16_t firstProperty, uint8_t* values, uint8_t count);
1023 
1024  /// Measures and returns the current
1025  /// Chip temperature.
1026  /// \return The current chip temperature in degrees Centigrade
1027  float get_temperature();
1028 
1029  /// Measures and returns the current
1030  /// Chip Vcc supply voltage.
1031  /// \return The current chip Vcc supply voltage in Volts.
1032  float get_battery_voltage();
1033 
1034  /// Measures and returns the current
1035  /// voltage applied to a GPIO pin (which has previously been configured as a voltage input)
1036  /// \param[in] gpio The GPIO pin to read. 0 to 3.
1037  /// \return The current pin voltage in Volts.
1038  float get_gpio_voltage(uint8_t gpio);
1039 
1040  /// Read one of the Fast Read Response registers.
1041  /// The Fast Read Response register must be previously configured with the matching
1042  /// RH_RF24_PROPERTY_FRR_CTL_?_MODE property to select what chip property will be available in that register.
1043  /// \param[in] reg The index of the FRR register to read. 0 means FRR A, 1 means B etc.
1044  /// \return the value read from the specified Fast Read Response register.
1045  uint8_t frr_read(uint8_t reg);
1046 
1047  /// Sets the radio into low-power sleep mode.
1048  /// If successful, the transport will stay in sleep mode until woken by
1049  /// changing mode it idle, transmit or receive (eg by calling send(), recv(), available() etc)
1050  /// Caution: there is a time penalty as the radio takes a finte time to wake from sleep mode.
1051  /// \return true if sleep mode was successfully entered.
1052  virtual bool sleep();
1053 
1054  /// Return the integer value of the device type
1055  /// as read from the device in from RH_RF24_CMD_PART_INFO.
1056  /// One of 0x4460, 0x4461, 0x4462 or 0x4463, depending on the type of device actually
1057  /// connected.
1058  /// \return The integer device type
1059  uint16_t deviceType() {return _deviceType;};
1060 
1061 protected:
1062  /// This is a low level function to handle the interrupts for one instance of RF24.
1063  /// Called automatically by isr*()
1064  /// Should not need to be called by user code.
1065  void handleInterrupt();
1066 
1067  /// Clears the chips RX FIFO
1068  /// \return true if successful
1069  bool clearRxFifo();
1070 
1071  /// Clears RH_RF24's internal TX and RX buffers and counters
1072  void clearBuffer();
1073 
1074  /// Loads the next part of the currently transmitting message
1075  /// into the chips TX buffer
1076  void sendNextFragment();
1077 
1078  /// Copies the next part of the currenrtly received message from the chips RX FIFO to the
1079  /// receive buffer
1080  void readNextFragment();
1081 
1082  /// Loads data into the chips TX FIFO
1083  /// \param[in] data Array of data bytes to be loaded
1084  /// \param[in] len Number of bytes in data to be loaded
1085  /// \return true if successful
1086  bool writeTxFifo(uint8_t *data, uint8_t len);
1087 
1088  /// Checks the contents of the RX buffer.
1089  /// If it contans a valid message adressed to this node
1090  /// sets _rxBufValid.
1091  void validateRxBuf();
1092 
1093  /// Cycles the Shutdown pin to force the cradio chip to reset
1094  void power_on_reset();
1095 
1096  /// Sets registers, commands and properties
1097  /// in the ratio according to the data in the commands array
1098  /// \param[in] commands Array of data containing radio commands in the format provided by radio_config_Si4460.h
1099  /// \return true if successful
1100  bool configure(const uint8_t* commands);
1101 
1102  /// Clears all pending interrutps in the radio chip.
1103  bool cmd_clear_all_interrupts();
1104 
1105 private:
1106 
1107  /// Low level interrupt service routine for RF24 connected to interrupt 0
1108  static void isr0();
1109 
1110  /// Low level interrupt service routine for RF24 connected to interrupt 1
1111  static void isr1();
1112 
1113  /// Low level interrupt service routine for RF24 connected to interrupt 1
1114  static void isr2();
1115 
1116  /// Array of instances connected to interrupts 0 and 1
1117  static RH_RF24* _deviceForInterrupt[];
1118 
1119  /// Index of next interrupt number to use in _deviceForInterrupt
1120  static uint8_t _interruptCount;
1121 
1122  /// The configured interrupt pin connected to this instance
1123  uint8_t _interruptPin;
1124 
1125  /// The index into _deviceForInterrupt[] for this device (if an interrupt is already allocated)
1126  /// else 0xff
1127  uint8_t _myInterruptIndex;
1128 
1129  /// The configured pin connected to the SDN pin of the radio
1130  uint8_t _sdnPin;
1131 
1132  /// The radio OP mode to use when mode is RHModeIdle
1133  uint8_t _idleMode;
1134 
1135  /// The reported PART device type
1136  uint16_t _deviceType;
1137 
1138  /// The selected output power in dBm
1139  int8_t _power;
1140 
1141  /// The message length in _buf
1142  volatile uint8_t _bufLen;
1143 
1144  /// Array of octets of the last received message or the next to transmit message
1145  uint8_t _buf[RH_RF24_MAX_PAYLOAD_LEN];
1146 
1147  /// True when there is a valid message in the Rx buffer
1148  volatile bool _rxBufValid;
1149 
1150  /// Index into TX buffer of the next to send chunk
1151  volatile uint8_t _txBufSentIndex;
1152 
1153  /// Time in millis since the last preamble was received (and the last time the RSSI was measured)
1154  uint32_t _lastPreambleTime;
1155 
1156 };
1157 
1158 /// @example rf24_client.pde
1159 /// @example rf24_server.pde
1160 /// @example rf24_lowpower_client.pde
1161 /// @example rf24_reliable_datagram_client.pde
1162 /// @example rf24_reliable_datagram_server.pde
1163 
1164 #endif
RHGenericDriver::_rxGood
volatile uint16_t _rxGood
Count of the number of successfully transmitted messaged.
Definition: RHGenericDriver.h:292
RH_RF24::ModemConfig::prop_2022
uint8_t prop_2022
Value for property RH_RF24_PROPERTY_MODEM_BCR_OSR_1.
Definition: RH_RF24.h:712
RH_RF24::ModemConfig::prop_2038
uint8_t prop_2038
Value for property RH_RF24_PROPERTY_MODEM_AGC_WINDOW_SIZE.
Definition: RH_RF24.h:726
RH_RF24::FSK_Rb150Fd300
@ FSK_Rb150Fd300
FSK Rb = 50kbs, Fd = 100kHz.
Definition: RH_RF24.h:798
RH_RF24::get_gpio_voltage
float get_gpio_voltage(uint8_t gpio)
Definition: RH_RF24.cpp:755
RH_RF24::ModemConfig::prop_2039
uint8_t prop_2039
Value for property RH_RF24_PROPERTY_MODEM_AGC_RFPD_DECAY.
Definition: RH_RF24.h:727
RH_RF24::ModemConfig::prop_2045
uint8_t prop_2045
Value for property RH_RF24_PROPERTY_MODEM_RAW_CONTROL.
Definition: RH_RF24.h:736
RH_RF24::setIdleMode
void setIdleMode(uint8_t idleMode)
Definition: RH_RF24.cpp:39
RH_RF24::ModemConfig::prop_2040
uint8_t prop_2040
Value for property RH_RF24_PROPERTY_MODEM_OOK_PDTC.
Definition: RH_RF24.h:734
RH_RF24::get_temperature
float get_temperature()
Definition: RH_RF24.cpp:735
RH_RF24::ModemConfig::prop_210d
uint8_t prop_210d
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE0_7_0.
Definition: RH_RF24.h:753
RH_RF24::CommandInfo::cmd
uint8_t cmd
The command number.
Definition: RH_RF24.h:832
RH_RF24::ModemConfig::prop_2003
uint8_t prop_2003
Value for property RH_RF24_PROPERTY_MODEM_DATA_RATE_2.
Definition: RH_RF24.h:699
RHGenericSPI
Base class for SPI interfaces.
Definition: RHGenericSPI.h:30
RH_RF24::ModemConfig::prop_200b
uint8_t prop_200b
Value for property RH_RF24_PROPERTY_MODEM_FREQ_DEV_1.
Definition: RH_RF24.h:707
RH_RF24::ModemConfig
Defines property values for a set of modem configuration registers.
Definition: RH_RF24.h:696
RHGenericSPI::beginTransaction
virtual void beginTransaction()
Definition: RHGenericSPI.h:155
RH_RF24::ModemConfig::prop_2120
uint8_t prop_2120
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM0.
Definition: RH_RF24.h:772
RH_RF24::ModemConfig::prop_2203
uint8_t prop_2203
Value for property RH_RF24_PROPERTY_PA_TC.
Definition: RH_RF24.h:776
RHGenericDriver::_rxHeaderFrom
volatile uint8_t _rxHeaderFrom
FROM header in the last received mesasge.
Definition: RHGenericDriver.h:265
RH_RF24::setCRCPolynomial
bool setCRCPolynomial(CRCPolynomial polynomial)
Definition: RH_RF24.cpp:442
RH_RF24::recv
bool recv(uint8_t *buf, uint8_t *len)
Definition: RH_RF24.cpp:293
RH_RF24::ModemConfig::prop_2123
uint8_t prop_2123
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM3.
Definition: RH_RF24.h:775
RH_RF24::ModemConfig::prop_211c
uint8_t prop_211c
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE3_7_0.
Definition: RH_RF24.h:768
RH_RF24::CommandInfo
Defines the commands we can interrogate in printRegisters.
Definition: RH_RF24.h:830
RHSPIDriver
Base class for RadioHead drivers that use the SPI bus to communicate with its transport hardware.
Definition: RHSPIDriver.h:38
RH_RF24::ModemConfig::prop_211f
uint8_t prop_211f
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE0_7_0.
Definition: RH_RF24.h:771
RH_RF24::RH_RF24
RH_RF24(uint8_t slaveSelectPin=SS, uint8_t interruptPin=2, uint8_t sdnPin=9, RHGenericSPI &spi=hardware_spi)
Definition: RH_RF24.cpp:29
RH_RF24::ModemConfig::prop_2006
uint8_t prop_2006
Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_3.
Definition: RH_RF24.h:702
RH_RF24::ModemConfig::prop_2026
uint8_t prop_2026
Value for property RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_0.
Definition: RH_RF24.h:716
RH_RF24::readNextFragment
void readNextFragment()
Definition: RH_RF24.cpp:380
RH_RF24::set_properties
bool set_properties(uint16_t firstProperty, const uint8_t *values, uint8_t count)
Definition: RH_RF24.cpp:711
RH_RF24::deviceType
uint16_t deviceType()
Definition: RH_RF24.h:1059
RH_RF24::ModemConfig::prop_2027
uint8_t prop_2027
Value for property RH_RF24_PROPERTY_MODEM_BCR_GAIN_1.
Definition: RH_RF24.h:717
RHGenericDriver::_lastRssi
volatile int16_t _lastRssi
The value of the last received RSSI value, in some transport specific units.
Definition: RHGenericDriver.h:286
RH_RF24::ModemConfig::prop_211a
uint8_t prop_211a
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE5_7_0.
Definition: RH_RF24.h:766
RH_RF24::ModemConfig::prop_203b
uint8_t prop_203b
Value for property RH_RF24_PROPERTY_MODEM_FSK4_GAIN1.
Definition: RH_RF24.h:729
RHGenericDriver::_rxBad
volatile uint16_t _rxBad
Count of the number of bad messages (eg bad checksum etc) received.
Definition: RHGenericDriver.h:289
RH_RF24::FSK_Rb50Fd100
@ FSK_Rb50Fd100
FSK Rb = 50kbs, Fd = 100kHz.
Definition: RH_RF24.h:797
RH_RF24::GFSK_Rb0_5Fd1
@ GFSK_Rb0_5Fd1
GFSK Rb = 0.5kbs, Fd = 1kHz.
Definition: RH_RF24.h:800
RH_RF24::ModemConfig::prop_204e
uint8_t prop_204e
Value for property RH_RF24_PROPERTY_MODEM_RSSI_COMP.
Definition: RH_RF24.h:739
RHGenericDriver::_rxHeaderTo
volatile uint8_t _rxHeaderTo
TO header in the last received mesasge.
Definition: RHGenericDriver.h:262
RH_RF24
Driver to send and receive unaddressed, unreliable datagrams via an RF24 and compatible radio transce...
Definition: RH_RF24.h:685
RH_RF24::ModemConfig::prop_201e
uint8_t prop_201e
Value for property RH_RF24_PROPERTY_MODEM_DECIMATION_CFG1.
Definition: RH_RF24.h:710
RH_RF24::ModemConfig::prop_201f
uint8_t prop_201f
Value for property RH_RF24_PROPERTY_MODEM_DECIMATION_CFG0.
Definition: RH_RF24.h:711
RHGenericDriver::_txHeaderFrom
uint8_t _txHeaderFrom
FROM header to send in all messages.
Definition: RHGenericDriver.h:277
RH_RF24::FSK_Rb0_5Fd1
@ FSK_Rb0_5Fd1
FSK Rb = 0.5kbs, Fd = 1kHz.
Definition: RH_RF24.h:795
RH_RF24::ModemConfig::prop_2030
uint8_t prop_2030
Value for property RH_RF24_PROPERTY_MODEM_AFC_LIMITER_1.
Definition: RH_RF24.h:723
RH_RF24::ModemConfig::prop_2031
uint8_t prop_2031
Value for property RH_RF24_PROPERTY_MODEM_AFC_LIMITER_0.
Definition: RH_RF24.h:724
RHSPIDriver::spiUsingInterrupt
void spiUsingInterrupt(uint8_t interruptNumber)
Definition: RHSPIDriver.cpp:91
RH_RF24::setModeRx
void setModeRx()
Definition: RH_RF24.cpp:559
RHGenericDriver::_thisAddress
uint8_t _thisAddress
This node id.
Definition: RHGenericDriver.h:256
RH_RF24::ModemConfig::prop_2025
uint8_t prop_2025
Value for property RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_1.
Definition: RH_RF24.h:715
RHGenericDriver::_txGood
volatile uint16_t _txGood
Count of the number of bad messages (correct checksum etc) received.
Definition: RHGenericDriver.h:295
RH_RF24::ModemConfig::prop_202f
uint8_t prop_202f
Value for property RH_RF24_PROPERTY_MODEM_AFC_GAIN_0.
Definition: RH_RF24.h:722
RH_RF24::ModemConfig::prop_211e
uint8_t prop_211e
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE1_7_0.
Definition: RH_RF24.h:770
RH_RF24::setPreambleLength
void setPreambleLength(uint16_t bytes)
Definition: RH_RF24.cpp:435
RH_RF24::ModemConfig::prop_2118
uint8_t prop_2118
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE7_7_0.
Definition: RH_RF24.h:764
RH_RF24::ModemConfig::prop_2108
uint8_t prop_2108
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE5_7_0.
Definition: RH_RF24.h:748
RHGenericDriver::_promiscuous
bool _promiscuous
Whether the transport is in promiscuous mode.
Definition: RHGenericDriver.h:259
RH_RF24::setTxPower
void setTxPower(uint8_t power)
Definition: RH_RF24.cpp:595
RH_RF24::ModemConfig::prop_200c
uint8_t prop_200c
Value for property RH_RF24_PROPERTY_MODEM_FREQ_DEV_0.
Definition: RH_RF24.h:708
RHGenericDriver::_rxHeaderFlags
volatile uint8_t _rxHeaderFlags
FLAGS header in the last received mesasge.
Definition: RHGenericDriver.h:271
RH_RF24::writeTxFifo
bool writeTxFifo(uint8_t *data, uint8_t len)
Definition: RH_RF24.cpp:346
RH_RF24::CommandInfo::replyLen
uint8_t replyLen
Number of bytes in the reply stream (after the CTS)
Definition: RH_RF24.h:833
RH_RF24::ModemConfig::prop_2304
uint8_t prop_2304
Value for property RH_RF24_PROPERTY_SYNTH_LPFILT2.
Definition: RH_RF24.h:780
RH_RF24::validateRxBuf
void validateRxBuf()
Definition: RH_RF24.cpp:232
RH_RF24::clearRxFifo
bool clearRxFifo()
Definition: RH_RF24.cpp:252
RH_RF24::handleInterrupt
void handleInterrupt()
Definition: RH_RF24.cpp:162
RH_RF24::configure
bool configure(const uint8_t *commands)
Definition: RH_RF24.cpp:676
RH_RF24::OOK_Rb10Bw40
@ OOK_Rb10Bw40
OOK Rb = 10kbs, Bw = 40kHz.
Definition: RH_RF24.h:807
RHGenericDriver::RHModeSleep
@ RHModeSleep
Transport hardware is in low power sleep mode (if supported)
Definition: RHGenericDriver.h:51
RH_RF24::FSK_Rb5Fd10
@ FSK_Rb5Fd10
FSK Rb = 5kbs, Fd = 10kHz.
Definition: RH_RF24.h:796
RH_RF24::setModemConfig
bool setModemConfig(ModemConfigChoice index)
Definition: RH_RF24.cpp:426
RH_RF24::ModemConfig::prop_2104
uint8_t prop_2104
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE9_7_0.
Definition: RH_RF24.h:744
RH_RF24::ModemConfig::prop_2046
uint8_t prop_2046
Value for property RH_RF24_PROPERTY_MODEM_RAW_EYE_1.
Definition: RH_RF24.h:737
RH_RF24::ModemConfig::prop_2009
uint8_t prop_2009
Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_0.
Definition: RH_RF24.h:705
RHSPIDriver::init
bool init()
Definition: RHSPIDriver.cpp:15
RH_RF24::ModemConfig::prop_2117
uint8_t prop_2117
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE8_7_0.
Definition: RH_RF24.h:763
RH_RF24::ModemConfig::prop_2047
uint8_t prop_2047
Value for property RH_RF24_PROPERTY_MODEM_RAW_EYE_0.
Definition: RH_RF24.h:738
RHSPIDriver::_slaveSelectPin
uint8_t _slaveSelectPin
The pin number of the Slave Select pin that is used to select the desired device.
Definition: RHSPIDriver.h:97
RH_RF24::ModemConfig::prop_2043
uint8_t prop_2043
Value for property RH_RF24_PROPERTY_MODEM_OOK_MISC.
Definition: RH_RF24.h:735
RH_RF24::OOK_Rb5Bw30
@ OOK_Rb5Bw30
OOK Rb = 5kbs, Bw = 30kHz.
Definition: RH_RF24.h:806
RH_RF24::ModemConfig::prop_211b
uint8_t prop_211b
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE4_7_0.
Definition: RH_RF24.h:767
RH_RF24::ModemConfig::prop_2106
uint8_t prop_2106
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE7_7_0.
Definition: RH_RF24.h:746
RH_RF24::ModemConfig::prop_2121
uint8_t prop_2121
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM1.
Definition: RH_RF24.h:773
RH_RF24::ModemConfig::prop_2007
uint8_t prop_2007
Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_2.
Definition: RH_RF24.h:703
RH_RF24::setSyncWords
void setSyncWords(const uint8_t *syncWords=NULL, uint8_t len=0)
Definition: RH_RF24.cpp:455
RH_RF24::ModemConfig::prop_2008
uint8_t prop_2008
Value for property RH_RF24_PROPERTY_MODEM_TX_NCO_MODE_1.
Definition: RH_RF24.h:704
RH_RF24::ModemConfig::prop_2103
uint8_t prop_2103
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE10_7_0.
Definition: RH_RF24.h:743
RH_RF24::setFrequency
bool setFrequency(float centre, float afcPullInRange=0.05)
Definition: RH_RF24.cpp:464
RH_RF24::ModemConfig::prop_2113
uint8_t prop_2113
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE12_7_0.
Definition: RH_RF24.h:759
RH_RF24::ModemConfig::prop_203e
uint8_t prop_203e
Value for property RH_RF24_PROPERTY_MODEM_FSK4_TH0.
Definition: RH_RF24.h:732
RH_RF24::ModemConfig::prop_200a
uint8_t prop_200a
Value for property RH_RF24_PROPERTY_MODEM_FREQ_DEV_2.
Definition: RH_RF24.h:706
RH_RF24::GFSK_Rb5Fd10
@ GFSK_Rb5Fd10
GFSK Rb = 5kbs, Fd = 10kHz.
Definition: RH_RF24.h:801
RHGenericDriver::_txHeaderId
uint8_t _txHeaderId
ID header to send in all messages.
Definition: RHGenericDriver.h:280
RH_RF24::ModemConfig::prop_211d
uint8_t prop_211d
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE2_7_0.
Definition: RH_RF24.h:769
RH_RF24::ModemConfig::prop_2115
uint8_t prop_2115
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE10_7_0.
Definition: RH_RF24.h:761
RHGenericDriver::_txHeaderTo
uint8_t _txHeaderTo
TO header to send in all messages.
Definition: RHGenericDriver.h:274
RH_RF24::init
bool init()
Definition: RH_RF24.cpp:44
RHGenericDriver::_txHeaderFlags
uint8_t _txHeaderFlags
FLAGS header to send in all messages.
Definition: RHGenericDriver.h:283
RH_RF24::ModemConfig::prop_2029
uint8_t prop_2029
Value for property RH_RF24_PROPERTY_MODEM_BCR_GEAR.
Definition: RH_RF24.h:719
RH_RF24::ModemConfig::prop_2301
uint8_t prop_2301
Value for property RH_RF24_PROPERTY_SYNTH_PFDCP_CPINT.
Definition: RH_RF24.h:778
RH_RF24::ModemConfig::prop_2303
uint8_t prop_2303
Value for property RH_RF24_PROPERTY_SYNTH_LPFILT3.
Definition: RH_RF24.h:779
RH_RF24::GFSK_Rb150Fd300
@ GFSK_Rb150Fd300
GFSK Rb = 150kbs, Fd = 300kHz.
Definition: RH_RF24.h:803
RH_RF24::ModemConfig::prop_2300
uint8_t prop_2300
Value for property RH_RF24_PROPERTY_SYNTH_PFDCP_CPFF.
Definition: RH_RF24.h:777
RH_RF24::setModemRegisters
void setModemRegisters(const ModemConfig *config)
Definition: RH_RF24.cpp:416
RH_RF24::ModemConfig::prop_203f
uint8_t prop_203f
Value for property RH_RF24_PROPERTY_MODEM_FSK4_MAP.
Definition: RH_RF24.h:733
RH_RF24::ModemConfig::prop_2018
uint8_t prop_2018
Value for property RH_RF24_PROPERTY_MODEM_TX_RAMP_DELAY.
Definition: RH_RF24.h:709
RH_RF24::ModemConfig::prop_2000
uint8_t prop_2000
Value for property RH_RF24_PROPERTY_MODEM_MOD_TYPE.
Definition: RH_RF24.h:698
RH_RF24::ModemConfig::prop_202e
uint8_t prop_202e
Value for property RH_RF24_PROPERTY_MODEM_AFC_GAIN_1.
Definition: RH_RF24.h:721
RH_RF24::ModemConfig::prop_2101
uint8_t prop_2101
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE12_7_0.
Definition: RH_RF24.h:741
RH_RF24::ModemConfig::prop_2035
uint8_t prop_2035
Value for property RH_RF24_PROPERTY_MODEM_AGC_CONTROL.
Definition: RH_RF24.h:725
RH_RF24::ModemConfig::prop_2023
uint8_t prop_2023
Value for property RH_RF24_PROPERTY_MODEM_BCR_OSR_0.
Definition: RH_RF24.h:713
RH_RF24::ModemConfigChoice
ModemConfigChoice
Definition: RH_RF24.h:793
RH_RF24::ModemConfig::prop_2114
uint8_t prop_2114
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE11_7_0.
Definition: RH_RF24.h:760
RH_RF24::GFSK_Rb50Fd100
@ GFSK_Rb50Fd100
GFSK Rb = 50kbs, Fd = 100kHz.
Definition: RH_RF24.h:802
RH_RF24::ModemConfig::prop_210a
uint8_t prop_210a
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE3_7_0.
Definition: RH_RF24.h:750
RH_RF24::get_properties
bool get_properties(uint16_t firstProperty, uint8_t *values, uint8_t count)
Definition: RH_RF24.cpp:724
RH_RF24::ModemConfig::prop_210e
uint8_t prop_210e
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM0.
Definition: RH_RF24.h:754
RH_RF24::ModemConfig::prop_2111
uint8_t prop_2111
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM3.
Definition: RH_RF24.h:757
RH_RF24::ModemConfig::prop_2107
uint8_t prop_2107
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE6_7_0.
Definition: RH_RF24.h:747
RH_RF24::ModemConfig::prop_2119
uint8_t prop_2119
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE6_7_0.
Definition: RH_RF24.h:765
RHGenericDriver::_rxHeaderId
volatile uint8_t _rxHeaderId
ID header in the last received mesasge.
Definition: RHGenericDriver.h:268
RH_RF24::sendNextFragment
void sendNextFragment()
Definition: RH_RF24.cpp:362
RH_RF24::frr_read
uint8_t frr_read(uint8_t reg)
Definition: RH_RF24.cpp:766
RH_RF24::ModemConfig::prop_203a
uint8_t prop_203a
Value for property RH_RF24_PROPERTY_MODEM_AGC_IFPD_DECAY.
Definition: RH_RF24.h:728
RH_RF24::ModemConfig::prop_2004
uint8_t prop_2004
Value for property RH_RF24_PROPERTY_MODEM_DATA_RATE_1.
Definition: RH_RF24.h:700
RH_RF24::ModemConfig::prop_210f
uint8_t prop_210f
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM1.
Definition: RH_RF24.h:755
RH_RF24::CRCPolynomial
CRCPolynomial
Defines the available choices for CRC Types of permitted CRC polynomials, to be passed to setCRCPolyn...
Definition: RH_RF24.h:816
RHGenericDriver::RHModeIdle
@ RHModeIdle
Transport is idle.
Definition: RHGenericDriver.h:52
RH_RF24::get_battery_voltage
float get_battery_voltage()
Definition: RH_RF24.cpp:745
RH_RF24::clearBuffer
void clearBuffer()
Clears RH_RF24's internal TX and RX buffers and counters.
Definition: RH_RF24.cpp:258
RH_RF24::ModemConfig::prop_2109
uint8_t prop_2109
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE4_7_0.
Definition: RH_RF24.h:749
RH_RF24::send
bool send(const uint8_t *data, uint8_t len)
Definition: RH_RF24.cpp:310
RHGenericDriver::waitPacketSent
virtual bool waitPacketSent()
Definition: RHGenericDriver.cpp:52
RHGenericDriver::_mode
volatile RHMode _mode
The current transport operating mode.
Definition: RHGenericDriver.h:253
RH_RF24::printRegisters
bool printRegisters()
Definition: RH_RF24.cpp:1013
RH_RF24::ModemConfig::prop_2105
uint8_t prop_2105
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE8_7_0.
Definition: RH_RF24.h:745
RH_RF24::setModeTx
void setModeTx()
Definition: RH_RF24.cpp:580
RH_RF24::ModemConfig::prop_2100
uint8_t prop_2100
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE13_7_0.
Definition: RH_RF24.h:740
RH_RF24::ModemConfig::prop_202d
uint8_t prop_202d
Value for property RH_RF24_PROPERTY_MODEM_AFC_WAIT.
Definition: RH_RF24.h:720
RH_RF24::ModemConfig::prop_2305
uint8_t prop_2305
Value for property RH_RF24_PROPERTY_SYNTH_LPFILT1.
Definition: RH_RF24.h:781
RH_RF24::setModeIdle
void setModeIdle()
Definition: RH_RF24.cpp:531
RHSPIDriver::_spi
RHGenericSPI & _spi
Reference to the RHGenericSPI instance to use to transfer data with the SPI device.
Definition: RHSPIDriver.h:94
RH_RF24::ModemConfig::prop_2112
uint8_t prop_2112
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE13_7_0.
Definition: RH_RF24.h:758
RH_RF24::power_on_reset
void power_on_reset()
Cycles the Shutdown pin to force the cradio chip to reset.
Definition: RH_RF24.cpp:693
RHGenericDriver::RHModeTx
@ RHModeTx
Transport is in the process of transmitting a message.
Definition: RHGenericDriver.h:53
RH_RF24::ModemConfig::prop_2110
uint8_t prop_2110
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COEM2.
Definition: RH_RF24.h:756
RH_RF24::cmd_clear_all_interrupts
bool cmd_clear_all_interrupts()
Clears all pending interrutps in the radio chip.
Definition: RH_RF24.cpp:705
RH_RF24::ModemConfig::prop_2024
uint8_t prop_2024
Value for property RH_RF24_PROPERTY_MODEM_BCR_NCO_OFFSET_2.
Definition: RH_RF24.h:714
RHGenericSPI::endTransaction
virtual void endTransaction()
Definition: RHGenericSPI.h:160
RH_RF24::ModemConfig::prop_203c
uint8_t prop_203c
Value for property RH_RF24_PROPERTY_MODEM_FSK4_GAIN0.
Definition: RH_RF24.h:730
RH_RF24::ModemConfig::prop_2122
uint8_t prop_2122
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COEM2.
Definition: RH_RF24.h:774
RH_RF24::available
bool available()
Definition: RH_RF24.cpp:284
RH_RF24::ModemConfig::prop_210c
uint8_t prop_210c
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE1_7_0.
Definition: RH_RF24.h:752
RH_RF24::maxMessageLength
uint8_t maxMessageLength()
Definition: RH_RF24.cpp:410
RH_RF24::command
bool command(uint8_t cmd, const uint8_t *write_buf=0, uint8_t write_len=0, uint8_t *read_buf=0, uint8_t read_len=0)
Definition: RH_RF24.cpp:628
RH_RF24::ModemConfig::prop_203d
uint8_t prop_203d
Value for property RH_RF24_PROPERTY_MODEM_FSK4_TH1.
Definition: RH_RF24.h:731
RH_RF24::ModemConfig::prop_210b
uint8_t prop_210b
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE2_7_0.
Definition: RH_RF24.h:751
RH_RF24::sleep
virtual bool sleep()
Definition: RH_RF24.cpp:545
RH_RF24::ModemConfig::prop_2005
uint8_t prop_2005
Value for property RH_RF24_PROPERTY_MODEM_DATA_RATE_0.
Definition: RH_RF24.h:701
RH_RF24::ModemConfig::prop_2102
uint8_t prop_2102
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX1_CHFLT_COE11_7_0.
Definition: RH_RF24.h:742
RH_RF24::ModemConfig::prop_2116
uint8_t prop_2116
Value for property RH_RF24_PROPERTY_MODEM_CHFLT_RX2_CHFLT_COE9_7_0.
Definition: RH_RF24.h:762
RH_RF24::ModemConfig::prop_2028
uint8_t prop_2028
Value for property RH_RF24_PROPERTY_MODEM_BCR_GAIN_0.
Definition: RH_RF24.h:718
RHGenericDriver::RHModeRx
@ RHModeRx
Transport is in the process of receiving a message.
Definition: RHGenericDriver.h:54
RHGenericSPI::transfer
virtual uint8_t transfer(uint8_t data)=0
RHGenericDriver::waitCAD
virtual bool waitCAD()
Definition: RHGenericDriver.cpp:72