10 #include <RHGenericSPI.h>
11 #include <RHSPIDriver.h>
15 #define RH_RF22_NUM_INTERRUPTS 3
18 #define RH_RF22_SPI_WRITE_MASK 0x80
26 #ifndef RH_RF22_MAX_MESSAGE_LEN
28 #define RH_RF22_MAX_MESSAGE_LEN 50
32 #define RH_RF22_FIFO_SIZE 64
35 #define RH_RF22_TXFFAEM_THRESHOLD 4
36 #define RH_RF22_RXFFAFULL_THRESHOLD 55
39 #define RH_RF22_NUM_MODEM_CONFIG_REGS 18
42 #define RH_RF22_REG_00_DEVICE_TYPE 0x00
43 #define RH_RF22_REG_01_VERSION_CODE 0x01
44 #define RH_RF22_REG_02_DEVICE_STATUS 0x02
45 #define RH_RF22_REG_03_INTERRUPT_STATUS1 0x03
46 #define RH_RF22_REG_04_INTERRUPT_STATUS2 0x04
47 #define RH_RF22_REG_05_INTERRUPT_ENABLE1 0x05
48 #define RH_RF22_REG_06_INTERRUPT_ENABLE2 0x06
49 #define RH_RF22_REG_07_OPERATING_MODE1 0x07
50 #define RH_RF22_REG_08_OPERATING_MODE2 0x08
51 #define RH_RF22_REG_09_OSCILLATOR_LOAD_CAPACITANCE 0x09
52 #define RH_RF22_REG_0A_UC_OUTPUT_CLOCK 0x0a
53 #define RH_RF22_REG_0B_GPIO_CONFIGURATION0 0x0b
54 #define RH_RF22_REG_0C_GPIO_CONFIGURATION1 0x0c
55 #define RH_RF22_REG_0D_GPIO_CONFIGURATION2 0x0d
56 #define RH_RF22_REG_0E_IO_PORT_CONFIGURATION 0x0e
57 #define RH_RF22_REG_0F_ADC_CONFIGURATION 0x0f
58 #define RH_RF22_REG_10_ADC_SENSOR_AMP_OFFSET 0x10
59 #define RH_RF22_REG_11_ADC_VALUE 0x11
60 #define RH_RF22_REG_12_TEMPERATURE_SENSOR_CALIBRATION 0x12
61 #define RH_RF22_REG_13_TEMPERATURE_VALUE_OFFSET 0x13
62 #define RH_RF22_REG_14_WAKEUP_TIMER_PERIOD1 0x14
63 #define RH_RF22_REG_15_WAKEUP_TIMER_PERIOD2 0x15
64 #define RH_RF22_REG_16_WAKEUP_TIMER_PERIOD3 0x16
65 #define RH_RF22_REG_17_WAKEUP_TIMER_VALUE1 0x17
66 #define RH_RF22_REG_18_WAKEUP_TIMER_VALUE2 0x18
67 #define RH_RF22_REG_19_LDC_MODE_DURATION 0x19
68 #define RH_RF22_REG_1A_LOW_BATTERY_DETECTOR_THRESHOLD 0x1a
69 #define RH_RF22_REG_1B_BATTERY_VOLTAGE_LEVEL 0x1b
70 #define RH_RF22_REG_1C_IF_FILTER_BANDWIDTH 0x1c
71 #define RH_RF22_REG_1D_AFC_LOOP_GEARSHIFT_OVERRIDE 0x1d
72 #define RH_RF22_REG_1E_AFC_TIMING_CONTROL 0x1e
73 #define RH_RF22_REG_1F_CLOCK_RECOVERY_GEARSHIFT_OVERRIDE 0x1f
74 #define RH_RF22_REG_20_CLOCK_RECOVERY_OVERSAMPLING_RATE 0x20
75 #define RH_RF22_REG_21_CLOCK_RECOVERY_OFFSET2 0x21
76 #define RH_RF22_REG_22_CLOCK_RECOVERY_OFFSET1 0x22
77 #define RH_RF22_REG_23_CLOCK_RECOVERY_OFFSET0 0x23
78 #define RH_RF22_REG_24_CLOCK_RECOVERY_TIMING_LOOP_GAIN1 0x24
79 #define RH_RF22_REG_25_CLOCK_RECOVERY_TIMING_LOOP_GAIN0 0x25
80 #define RH_RF22_REG_26_RSSI 0x26
81 #define RH_RF22_REG_27_RSSI_THRESHOLD 0x27
82 #define RH_RF22_REG_28_ANTENNA_DIVERSITY1 0x28
83 #define RH_RF22_REG_29_ANTENNA_DIVERSITY2 0x29
84 #define RH_RF22_REG_2A_AFC_LIMITER 0x2a
85 #define RH_RF22_REG_2B_AFC_CORRECTION_READ 0x2b
86 #define RH_RF22_REG_2C_OOK_COUNTER_VALUE_1 0x2c
87 #define RH_RF22_REG_2D_OOK_COUNTER_VALUE_2 0x2d
88 #define RH_RF22_REG_2E_SLICER_PEAK_HOLD 0x2e
89 #define RH_RF22_REG_30_DATA_ACCESS_CONTROL 0x30
90 #define RH_RF22_REG_31_EZMAC_STATUS 0x31
91 #define RH_RF22_REG_32_HEADER_CONTROL1 0x32
92 #define RH_RF22_REG_33_HEADER_CONTROL2 0x33
93 #define RH_RF22_REG_34_PREAMBLE_LENGTH 0x34
94 #define RH_RF22_REG_35_PREAMBLE_DETECTION_CONTROL1 0x35
95 #define RH_RF22_REG_36_SYNC_WORD3 0x36
96 #define RH_RF22_REG_37_SYNC_WORD2 0x37
97 #define RH_RF22_REG_38_SYNC_WORD1 0x38
98 #define RH_RF22_REG_39_SYNC_WORD0 0x39
99 #define RH_RF22_REG_3A_TRANSMIT_HEADER3 0x3a
100 #define RH_RF22_REG_3B_TRANSMIT_HEADER2 0x3b
101 #define RH_RF22_REG_3C_TRANSMIT_HEADER1 0x3c
102 #define RH_RF22_REG_3D_TRANSMIT_HEADER0 0x3d
103 #define RH_RF22_REG_3E_PACKET_LENGTH 0x3e
104 #define RH_RF22_REG_3F_CHECK_HEADER3 0x3f
105 #define RH_RF22_REG_40_CHECK_HEADER2 0x40
106 #define RH_RF22_REG_41_CHECK_HEADER1 0x41
107 #define RH_RF22_REG_42_CHECK_HEADER0 0x42
108 #define RH_RF22_REG_43_HEADER_ENABLE3 0x43
109 #define RH_RF22_REG_44_HEADER_ENABLE2 0x44
110 #define RH_RF22_REG_45_HEADER_ENABLE1 0x45
111 #define RH_RF22_REG_46_HEADER_ENABLE0 0x46
112 #define RH_RF22_REG_47_RECEIVED_HEADER3 0x47
113 #define RH_RF22_REG_48_RECEIVED_HEADER2 0x48
114 #define RH_RF22_REG_49_RECEIVED_HEADER1 0x49
115 #define RH_RF22_REG_4A_RECEIVED_HEADER0 0x4a
116 #define RH_RF22_REG_4B_RECEIVED_PACKET_LENGTH 0x4b
117 #define RH_RF22_REG_50_ANALOG_TEST_BUS_SELECT 0x50
118 #define RH_RF22_REG_51_DIGITAL_TEST_BUS_SELECT 0x51
119 #define RH_RF22_REG_52_TX_RAMP_CONTROL 0x52
120 #define RH_RF22_REG_53_PLL_TUNE_TIME 0x53
121 #define RH_RF22_REG_55_CALIBRATION_CONTROL 0x55
122 #define RH_RF22_REG_56_MODEM_TEST 0x56
123 #define RH_RF22_REG_57_CHARGE_PUMP_TEST 0x57
124 #define RH_RF22_REG_58_CHARGE_PUMP_CURRENT_TRIMMING 0x58
125 #define RH_RF22_REG_59_DIVIDER_CURRENT_TRIMMING 0x59
126 #define RH_RF22_REG_5A_VCO_CURRENT_TRIMMING 0x5a
127 #define RH_RF22_REG_5B_VCO_CALIBRATION 0x5b
128 #define RH_RF22_REG_5C_SYNTHESIZER_TEST 0x5c
129 #define RH_RF22_REG_5D_BLOCK_ENABLE_OVERRIDE1 0x5d
130 #define RH_RF22_REG_5E_BLOCK_ENABLE_OVERRIDE2 0x5e
131 #define RH_RF22_REG_5F_BLOCK_ENABLE_OVERRIDE3 0x5f
132 #define RH_RF22_REG_60_CHANNEL_FILTER_COEFFICIENT_ADDRESS 0x60
133 #define RH_RF22_REG_61_CHANNEL_FILTER_COEFFICIENT_VALUE 0x61
134 #define RH_RF22_REG_62_CRYSTAL_OSCILLATOR_POR_CONTROL 0x62
135 #define RH_RF22_REG_63_RC_OSCILLATOR_COARSE_CALIBRATION 0x63
136 #define RH_RF22_REG_64_RC_OSCILLATOR_FINE_CALIBRATION 0x64
137 #define RH_RF22_REG_65_LDO_CONTROL_OVERRIDE 0x65
138 #define RH_RF22_REG_66_LDO_LEVEL_SETTINGS 0x66
139 #define RH_RF22_REG_67_DELTA_SIGMA_ADC_TUNING1 0x67
140 #define RH_RF22_REG_68_DELTA_SIGMA_ADC_TUNING2 0x68
141 #define RH_RF22_REG_69_AGC_OVERRIDE1 0x69
142 #define RH_RF22_REG_6A_AGC_OVERRIDE2 0x6a
143 #define RH_RF22_REG_6B_GFSK_FIR_FILTER_COEFFICIENT_ADDRESS 0x6b
144 #define RH_RF22_REG_6C_GFSK_FIR_FILTER_COEFFICIENT_VALUE 0x6c
145 #define RH_RF22_REG_6D_TX_POWER 0x6d
146 #define RH_RF22_REG_6E_TX_DATA_RATE1 0x6e
147 #define RH_RF22_REG_6F_TX_DATA_RATE0 0x6f
148 #define RH_RF22_REG_70_MODULATION_CONTROL1 0x70
149 #define RH_RF22_REG_71_MODULATION_CONTROL2 0x71
150 #define RH_RF22_REG_72_FREQUENCY_DEVIATION 0x72
151 #define RH_RF22_REG_73_FREQUENCY_OFFSET1 0x73
152 #define RH_RF22_REG_74_FREQUENCY_OFFSET2 0x74
153 #define RH_RF22_REG_75_FREQUENCY_BAND_SELECT 0x75
154 #define RH_RF22_REG_76_NOMINAL_CARRIER_FREQUENCY1 0x76
155 #define RH_RF22_REG_77_NOMINAL_CARRIER_FREQUENCY0 0x77
156 #define RH_RF22_REG_79_FREQUENCY_HOPPING_CHANNEL_SELECT 0x79
157 #define RH_RF22_REG_7A_FREQUENCY_HOPPING_STEP_SIZE 0x7a
158 #define RH_RF22_REG_7C_TX_FIFO_CONTROL1 0x7c
159 #define RH_RF22_REG_7D_TX_FIFO_CONTROL2 0x7d
160 #define RH_RF22_REG_7E_RX_FIFO_CONTROL 0x7e
161 #define RH_RF22_REG_7F_FIFO_ACCESS 0x7f
166 #define RH_RF22_DEVICE_TYPE_RX_TRX 0x08
167 #define RH_RF22_DEVICE_TYPE_TX 0x07
170 #define RH_RF22_FFOVL 0x80
171 #define RH_RF22_FFUNFL 0x40
172 #define RH_RF22_RXFFEM 0x20
173 #define RH_RF22_HEADERR 0x10
174 #define RH_RF22_FREQERR 0x08
175 #define RH_RF22_LOCKDET 0x04
176 #define RH_RF22_CPS 0x03
177 #define RH_RF22_CPS_IDLE 0x00
178 #define RH_RF22_CPS_RX 0x01
179 #define RH_RF22_CPS_TX 0x10
182 #define RH_RF22_IFFERROR 0x80
183 #define RH_RF22_ITXFFAFULL 0x40
184 #define RH_RF22_ITXFFAEM 0x20
185 #define RH_RF22_IRXFFAFULL 0x10
186 #define RH_RF22_IEXT 0x08
187 #define RH_RF22_IPKSENT 0x04
188 #define RH_RF22_IPKVALID 0x02
189 #define RH_RF22_ICRCERROR 0x01
192 #define RH_RF22_ISWDET 0x80
193 #define RH_RF22_IPREAVAL 0x40
194 #define RH_RF22_IPREAINVAL 0x20
195 #define RH_RF22_IRSSI 0x10
196 #define RH_RF22_IWUT 0x08
197 #define RH_RF22_ILBD 0x04
198 #define RH_RF22_ICHIPRDY 0x02
199 #define RH_RF22_IPOR 0x01
202 #define RH_RF22_ENFFERR 0x80
203 #define RH_RF22_ENTXFFAFULL 0x40
204 #define RH_RF22_ENTXFFAEM 0x20
205 #define RH_RF22_ENRXFFAFULL 0x10
206 #define RH_RF22_ENEXT 0x08
207 #define RH_RF22_ENPKSENT 0x04
208 #define RH_RF22_ENPKVALID 0x02
209 #define RH_RF22_ENCRCERROR 0x01
212 #define RH_RF22_ENSWDET 0x80
213 #define RH_RF22_ENPREAVAL 0x40
214 #define RH_RF22_ENPREAINVAL 0x20
215 #define RH_RF22_ENRSSI 0x10
216 #define RH_RF22_ENWUT 0x08
217 #define RH_RF22_ENLBDI 0x04
218 #define RH_RF22_ENCHIPRDY 0x02
219 #define RH_RF22_ENPOR 0x01
222 #define RH_RF22_SWRES 0x80
223 #define RH_RF22_ENLBD 0x40
224 #define RH_RF22_ENWT 0x20
225 #define RH_RF22_X32KSEL 0x10
226 #define RH_RF22_TXON 0x08
227 #define RH_RF22_RXON 0x04
228 #define RH_RF22_PLLON 0x02
229 #define RH_RF22_XTON 0x01
232 #define RH_RF22_ANTDIV 0xc0
233 #define RH_RF22_RXMPK 0x10
234 #define RH_RF22_AUTOTX 0x08
235 #define RH_RF22_ENLDM 0x04
236 #define RH_RF22_FFCLRRX 0x02
237 #define RH_RF22_FFCLRTX 0x01
240 #define RH_RF22_ADCSTART 0x80
241 #define RH_RF22_ADCDONE 0x80
242 #define RH_RF22_ADCSEL 0x70
243 #define RH_RF22_ADCSEL_INTERNAL_TEMPERATURE_SENSOR 0x00
244 #define RH_RF22_ADCSEL_GPIO0_SINGLE_ENDED 0x10
245 #define RH_RF22_ADCSEL_GPIO1_SINGLE_ENDED 0x20
246 #define RH_RF22_ADCSEL_GPIO2_SINGLE_ENDED 0x30
247 #define RH_RF22_ADCSEL_GPIO0_GPIO1_DIFFERENTIAL 0x40
248 #define RH_RF22_ADCSEL_GPIO1_GPIO2_DIFFERENTIAL 0x50
249 #define RH_RF22_ADCSEL_GPIO0_GPIO2_DIFFERENTIAL 0x60
250 #define RH_RF22_ADCSEL_GND 0x70
251 #define RH_RF22_ADCREF 0x0c
252 #define RH_RF22_ADCREF_BANDGAP_VOLTAGE 0x00
253 #define RH_RF22_ADCREF_VDD_ON_3 0x08
254 #define RH_RF22_ADCREF_VDD_ON_2 0x0c
255 #define RH_RF22_ADCGAIN 0x03
258 #define RH_RF22_ADCOFFS 0x0f
261 #define RH_RF22_TSRANGE 0xc0
262 #define RH_RF22_TSRANGE_M64_64C 0x00
263 #define RH_RF22_TSRANGE_M64_192C 0x40
264 #define RH_RF22_TSRANGE_0_128C 0x80
265 #define RH_RF22_TSRANGE_M40_216F 0xc0
266 #define RH_RF22_ENTSOFFS 0x20
267 #define RH_RF22_ENTSTRIM 0x10
268 #define RH_RF22_TSTRIM 0x0f
271 #define RH_RF22_WTR 0x3c
272 #define RH_RF22_WTD 0x03
275 #define RH_RF22_AFBCD 0x80
276 #define RH_RF22_ENAFC 0x40
277 #define RH_RF22_AFCGEARH 0x38
278 #define RH_RF22_AFCGEARL 0x07
281 #define RH_RF22_SWAIT_TIMER 0xc0
282 #define RH_RF22_SHWAIT 0x38
283 #define RH_RF22_ANWAIT 0x07
286 #define RH_RF22_ENPACRX 0x80
287 #define RH_RF22_MSBFRST 0x00
288 #define RH_RF22_LSBFRST 0x40
289 #define RH_RF22_CRCHDRS 0x00
290 #define RH_RF22_CRCDONLY 0x20
291 #define RH_RF22_SKIP2PH 0x10
292 #define RH_RF22_ENPACTX 0x08
293 #define RH_RF22_ENCRC 0x04
294 #define RH_RF22_CRC 0x03
295 #define RH_RF22_CRC_CCITT 0x00
296 #define RH_RF22_CRC_CRC_16_IBM 0x01
297 #define RH_RF22_CRC_IEC_16 0x02
298 #define RH_RF22_CRC_BIACHEVA 0x03
301 #define RH_RF22_BCEN 0xf0
302 #define RH_RF22_BCEN_NONE 0x00
303 #define RH_RF22_BCEN_HEADER0 0x10
304 #define RH_RF22_BCEN_HEADER1 0x20
305 #define RH_RF22_BCEN_HEADER2 0x40
306 #define RH_RF22_BCEN_HEADER3 0x80
307 #define RH_RF22_HDCH 0x0f
308 #define RH_RF22_HDCH_NONE 0x00
309 #define RH_RF22_HDCH_HEADER0 0x01
310 #define RH_RF22_HDCH_HEADER1 0x02
311 #define RH_RF22_HDCH_HEADER2 0x04
312 #define RH_RF22_HDCH_HEADER3 0x08
315 #define RH_RF22_HDLEN 0x70
316 #define RH_RF22_HDLEN_0 0x00
317 #define RH_RF22_HDLEN_1 0x10
318 #define RH_RF22_HDLEN_2 0x20
319 #define RH_RF22_HDLEN_3 0x30
320 #define RH_RF22_HDLEN_4 0x40
321 #define RH_RF22_VARPKLEN 0x00
322 #define RH_RF22_FIXPKLEN 0x08
323 #define RH_RF22_SYNCLEN 0x06
324 #define RH_RF22_SYNCLEN_1 0x00
325 #define RH_RF22_SYNCLEN_2 0x02
326 #define RH_RF22_SYNCLEN_3 0x04
327 #define RH_RF22_SYNCLEN_4 0x06
328 #define RH_RF22_PREALEN8 0x01
332 #define RH_RF22_PAPEAKVAL 0x80
333 #define RH_RF22_PAPEAKEN 0x40
334 #define RH_RF22_PAPEAKLVL 0x30
335 #define RH_RF22_PAPEAKLVL6_5 0x00
336 #define RH_RF22_PAPEAKLVL7 0x10
337 #define RH_RF22_PAPEAKLVL7_5 0x20
338 #define RH_RF22_PAPEAKLVL8 0x30
339 #define RH_RF22_LNA_SW 0x08
340 #define RH_RF22_TXPOW 0x07
341 #define RH_RF22_TXPOW_4X31 0x08 // Not used in RFM22B
343 #define RH_RF22_TXPOW_1DBM 0x00
344 #define RH_RF22_TXPOW_2DBM 0x01
345 #define RH_RF22_TXPOW_5DBM 0x02
346 #define RH_RF22_TXPOW_8DBM 0x03
347 #define RH_RF22_TXPOW_11DBM 0x04
348 #define RH_RF22_TXPOW_14DBM 0x05
349 #define RH_RF22_TXPOW_17DBM 0x06
350 #define RH_RF22_TXPOW_20DBM 0x07
352 #define RH_RF22_RF23B_TXPOW_M8DBM 0x00 // -8dBm
353 #define RH_RF22_RF23B_TXPOW_M5DBM 0x01 // -5dBm
354 #define RH_RF22_RF23B_TXPOW_M2DBM 0x02 // -2dBm
355 #define RH_RF22_RF23B_TXPOW_1DBM 0x03 // 1dBm
356 #define RH_RF22_RF23B_TXPOW_4DBM 0x04 // 4dBm
357 #define RH_RF22_RF23B_TXPOW_7DBM 0x05 // 7dBm
358 #define RH_RF22_RF23B_TXPOW_10DBM 0x06 // 10dBm
359 #define RH_RF22_RF23B_TXPOW_13DBM 0x07 // 13dBm
361 #define RH_RF22_RF23BP_TXPOW_28DBM 0x05 // 28dBm
362 #define RH_RF22_RF23BP_TXPOW_29DBM 0x06 // 29dBm
363 #define RH_RF22_RF23BP_TXPOW_30DBM 0x07 // 30dBm
366 #define RH_RF22_TRCLK 0xc0
367 #define RH_RF22_TRCLK_NONE 0x00
368 #define RH_RF22_TRCLK_GPIO 0x40
369 #define RH_RF22_TRCLK_SDO 0x80
370 #define RH_RF22_TRCLK_NIRQ 0xc0
371 #define RH_RF22_DTMOD 0x30
372 #define RH_RF22_DTMOD_DIRECT_GPIO 0x00
373 #define RH_RF22_DTMOD_DIRECT_SDI 0x10
374 #define RH_RF22_DTMOD_FIFO 0x20
375 #define RH_RF22_DTMOD_PN9 0x30
376 #define RH_RF22_ENINV 0x08
377 #define RH_RF22_FD8 0x04
378 #define RH_RF22_MODTYP 0x30
379 #define RH_RF22_MODTYP_UNMODULATED 0x00
380 #define RH_RF22_MODTYP_OOK 0x01
381 #define RH_RF22_MODTYP_FSK 0x02
382 #define RH_RF22_MODTYP_GFSK 0x03
386 #define RH_RF22_SBSEL 0x40
387 #define RH_RF22_HBSEL 0x20
388 #define RH_RF22_FB 0x1f
391 #define RH_RF22_HAVE_SERIAL
1031 RH_RF22(uint8_t slaveSelectPin = SS, uint8_t interruptPin = 2,
RHGenericSPI& spi = hardware_spi);
1061 uint8_t
adcRead(uint8_t adcsel = RH_RF22_ADCSEL_INTERNAL_TEMPERATURE_SENSOR,
1062 uint8_t adcref = RH_RF22_ADCREF_BANDGAP_VOLTAGE,
1063 uint8_t adcgain = 0,
1064 uint8_t adcoffs = 0);
1071 uint8_t
temperatureRead(uint8_t tsrange = RH_RF22_TSRANGE_M64_64C, uint8_t tvoffs = 0);
1083 void setWutPeriod(uint16_t wtm, uint8_t wtr = 0, uint8_t wtd = 0);
1093 bool setFrequency(
float centre,
float afcPullInRange = 0.05);
1175 bool recv(uint8_t* buf, uint8_t* len);
1183 bool send(
const uint8_t* data, uint8_t len);
1201 void setSyncWords(
const uint8_t* syncWords, uint8_t len);
1238 virtual bool sleep();
1258 bool fillTxBuf(
const uint8_t* data, uint8_t len);
1264 bool appendTxBuf(
const uint8_t* data, uint8_t len);
1355 uint8_t
_buf[RH_RF22_MAX_MESSAGE_LEN];
volatile uint16_t _rxGood
Count of the number of successfully transmitted messaged.
Definition: RHGenericDriver.h:292
uint16_t wutRead()
Definition: RH_RF22.cpp:364
@ FSK_PN9_Rb2Fd5
FSK, No Manchester, Rb = 2kbs, Fd = 5kHz, PN9 random modulation for testing.
Definition: RH_RF22.h:970
uint8_t _deviceType
The device type reported by the RF22.
Definition: RH_RF22.h:1345
volatile bool _rxBufValid
True when there is a valid message in the Rx buffer.
Definition: RH_RF22.h:1358
uint8_t reg_23
Value for register RH_RF22_REG_23_CLOCK_RECOVERY_OFFSET0.
Definition: RH_RF22.h:946
bool setModemConfig(ModemConfigChoice index)
Definition: RH_RF22.cpp:512
@ FSK_Rb57_6Fd28_8
FSK, No Manchester, Rb = 57.6kbs, Fd = 28.8kHz.
Definition: RH_RF22.h:978
static void isr0()
Low level interrupt service routine for RF22 connected to interrupt 0.
Definition: RH_RF22.cpp:312
@ GFSK_Rb125Fd125
GFSK, No Manchester, Rb = 125kbs, Fd = 125kHz.
Definition: RH_RF22.h:990
void setOpMode(uint8_t mode)
Definition: RH_RF22.cpp:447
uint8_t reg_71
Value for register RH_RF22_REG_71_MODULATION_CONTROL2.
Definition: RH_RF22.h:957
uint8_t reg_69
Value for register RH_RF22_REG_69_AGC_OVERRIDE1.
Definition: RH_RF22.h:953
uint8_t _myInterruptIndex
Definition: RH_RF22.h:1339
void setModeRx()
Definition: RH_RF22.cpp:471
Base class for SPI interfaces.
Definition: RHGenericSPI.h:30
bool setFrequency(float centre, float afcPullInRange=0.05)
Definition: RH_RF22.cpp:385
bool setCRCPolynomial(CRCPolynomial polynomial)
Definition: RH_RF22.cpp:705
@ OOK_Rb4_8Bw335
OOK, No Manchester, Rb = 4.8kbs, Rx Bandwidth = 335kHz.
Definition: RH_RF22.h:994
volatile uint8_t _rxHeaderFrom
FROM header in the last received mesasge.
Definition: RHGenericDriver.h:265
void resetFifos()
Definition: RH_RF22.cpp:668
uint8_t ezmacStatusRead()
Definition: RH_RF22.cpp:442
static uint8_t _interruptCount
Index of next interrupt number to use in _deviceForInterrupt.
Definition: RH_RF22.h:1332
uint8_t spiWrite(uint8_t reg, uint8_t val)
Definition: RHSPIDriver.cpp:42
Base class for RadioHead drivers that use the SPI bus to communicate with its transport hardware.
Definition: RHSPIDriver.h:38
virtual bool sleep()
Definition: RH_RF22.cpp:461
@ GFSK_Rb9_6Fd45
GFSK, No Manchester, Rb = 9.6kbs, Fd = 45kHz.
Definition: RH_RF22.h:986
bool appendTxBuf(const uint8_t *data, uint8_t len)
Definition: RH_RF22.cpp:627
void setSyncWords(const uint8_t *syncWords, uint8_t len)
Definition: RH_RF22.cpp:531
volatile int16_t _lastRssi
The value of the last received RSSI value, in some transport specific units.
Definition: RHGenericDriver.h:286
uint8_t reg_2e
Value for register RH_RF22_REG_2E_SLICER_PEAK_HOLD.
Definition: RH_RF22.h:951
volatile uint16_t _rxBad
Count of the number of bad messages (eg bad checksum etc) received.
Definition: RHGenericDriver.h:289
Driver to send and receive unaddressed, unreliable datagrams via an RF22 and compatible radio transce...
Definition: RH_RF22.h:926
@ FSK_Rb2Fd5
FSK, No Manchester, Rb = 2kbs, Fd = 5kHz.
Definition: RH_RF22.h:972
void resetRxFifo()
Definition: RH_RF22.cpp:675
Defines register values for a set of modem configuration registers.
Definition: RH_RF22.h:939
volatile uint8_t _rxHeaderTo
TO header in the last received mesasge.
Definition: RHGenericDriver.h:262
uint8_t reg_1f
Value for register RH_RF22_REG_1F_CLOCK_RECOVERY_GEARSHIFT_OVERRIDE.
Definition: RH_RF22.h:942
bool available()
Definition: RH_RF22.cpp:544
uint8_t reg_6f
Value for register RH_RF22_REG_6F_TX_DATA_RATE0.
Definition: RH_RF22.h:955
uint8_t _txHeaderFrom
FROM header to send in all messages.
Definition: RHGenericDriver.h:277
bool setFHStepSize(uint8_t fhs)
Definition: RH_RF22.cpp:423
@ UnmodulatedCarrier
Unmodulated carrier for testing.
Definition: RH_RF22.h:969
uint8_t reg_21
Value for register RH_RF22_REG_21_CLOCK_RECOVERY_OFFSET2.
Definition: RH_RF22.h:944
volatile uint8_t _bufLen
Number of octets in the receiver buffer.
Definition: RH_RF22.h:1352
uint8_t rssiRead()
Definition: RH_RF22.cpp:437
uint8_t _interruptPin
The configured interrupt pin connected to this instance.
Definition: RH_RF22.h:1335
void setThisAddress(uint8_t thisAddress)
Definition: RH_RF22.cpp:722
CRCPolynomial
Defines the available choices for CRC Types of permitted CRC polynomials, to be passed to setCRCPolyn...
Definition: RH_RF22.h:1006
void spiUsingInterrupt(uint8_t interruptNumber)
Definition: RHSPIDriver.cpp:91
@ GFSK_Rb4_8Fd45
GFSK, No Manchester, Rb = 4.8kbs, Fd = 45kHz.
Definition: RH_RF22.h:985
@ CRC_16_IBM
CRC-16 (IBM) The default used by RH_RF22 driver.
Definition: RH_RF22.h:1009
uint8_t reg_58
Value for register RH_RF22_REG_58_CHARGE_PUMP_CURRENT_TRIMMING.
Definition: RH_RF22.h:952
virtual void handleExternalInterrupt()
Definition: RH_RF22.cpp:690
uint8_t reg_20
Value for register RH_RF22_REG_20_CLOCK_RECOVERY_OVERSAMPLING_RATE.
Definition: RH_RF22.h:943
volatile uint16_t _txGood
Count of the number of bad messages (correct checksum etc) received.
Definition: RHGenericDriver.h:295
@ FSK_Rb4_8Fd45
FSK, No Manchester, Rb = 4.8kbs, Fd = 45kHz.
Definition: RH_RF22.h:974
virtual void setPromiscuous(bool promiscuous)
Definition: RHGenericDriver.cpp:103
uint8_t reg_1c
Value for register RH_RF22_REG_1C_IF_FILTER_BANDWIDTH.
Definition: RH_RF22.h:941
void clearTxBuf()
Definition: RH_RF22.cpp:573
virtual void setThisAddress(uint8_t thisAddress)
Definition: RHGenericDriver.cpp:108
ModemConfigChoice
Definition: RH_RF22.h:967
volatile uint8_t _rxHeaderFlags
FLAGS header in the last received mesasge.
Definition: RHGenericDriver.h:271
static void isr2()
Low level interrupt service routine for RF22 connected to interrupt 1.
Definition: RH_RF22.cpp:322
@ GFSK_Rb57_6Fd28_8
GFSK, No Manchester, Rb = 57.6kbs, Fd = 28.8kHz.
Definition: RH_RF22.h:989
uint32_t getLastPreambleTime()
Definition: RH_RF22.cpp:728
void setTxPower(uint8_t power)
Definition: RH_RF22.cpp:493
void setGpioReversed(bool gpioReversed=false)
Definition: RH_RF22.cpp:733
virtual void handleWakeupTimerInterrupt()
Definition: RH_RF22.cpp:695
@ OOK_Rb19_2Bw335
OOK, No Manchester, Rb = 19.2kbs, Rx Bandwidth = 335kHz.
Definition: RH_RF22.h:996
uint8_t _buf[RH_RF22_MAX_MESSAGE_LEN]
The receiver buffer.
Definition: RH_RF22.h:1355
uint8_t spiBurstRead(uint8_t reg, uint8_t *dest, uint8_t len)
Definition: RHSPIDriver.cpp:56
void sendNextFragment()
Definition: RH_RF22.cpp:640
uint8_t temperatureRead(uint8_t tsrange=RH_RF22_TSRANGE_M64_64C, uint8_t tvoffs=0)
Definition: RH_RF22.cpp:357
bool setFHChannel(uint8_t fhch)
Definition: RH_RF22.cpp:431
uint8_t reg_2d
Value for register RH_RF22_REG_2D_OOK_COUNTER_VALUE_2.
Definition: RH_RF22.h:950
@ RHModeSleep
Transport hardware is in low power sleep mode (if supported)
Definition: RHGenericDriver.h:51
bool init()
Definition: RH_RF22.cpp:74
uint8_t spiBurstWrite(uint8_t reg, const uint8_t *src, uint8_t len)
Definition: RHSPIDriver.cpp:71
@ OOK_Rb2_4Bw335
OOK, No Manchester, Rb = 2.4kbs, Rx Bandwidth = 335kHz.
Definition: RH_RF22.h:993
bool init()
Definition: RHSPIDriver.cpp:15
@ FSK_Rb9_6Fd45
FSK, No Manchester, Rb = 9.6kbs, Fd = 45kHz.
Definition: RH_RF22.h:975
void resetTxFifo()
Definition: RH_RF22.cpp:683
void handleInterrupt()
Definition: RH_RF22.cpp:190
@ CRC_IEC_16
IEC-16.
Definition: RH_RF22.h:1010
@ FSK_Rb125Fd125
FSK, No Manchester, Rb = 125kbs, Fd = 125kHz.
Definition: RH_RF22.h:979
void setModeTx()
Definition: RH_RF22.cpp:480
@ OOK_Rb40Bw335
OOK, No Manchester, Rb = 40kbs, Rx Bandwidth = 335kHz.
Definition: RH_RF22.h:998
virtual void setPromiscuous(bool promiscuous)
Definition: RH_RF22.cpp:699
void setIdleMode(uint8_t idleMode)
Definition: RH_RF22.cpp:69
void reset()
Definition: RH_RF22.cpp:328
bool fillTxBuf(const uint8_t *data, uint8_t len)
Definition: RH_RF22.cpp:619
void setModemRegisters(const ModemConfig *config)
Definition: RH_RF22.cpp:499
CRCPolynomial _polynomial
The selected CRC polynomial.
Definition: RH_RF22.h:1348
void setWutPeriod(uint16_t wtm, uint8_t wtr=0, uint8_t wtd=0)
Definition: RH_RF22.cpp:372
@ OOK_Rb38_4Bw335
OOK, No Manchester, Rb = 38.4kbs, Rx Bandwidth = 335kHz.
Definition: RH_RF22.h:997
uint8_t reg_70
Value for register RH_RF22_REG_70_MODULATION_CONTROL1.
Definition: RH_RF22.h:956
uint8_t _txHeaderId
ID header to send in all messages.
Definition: RHGenericDriver.h:280
void readNextFragment()
Definition: RH_RF22.cpp:657
uint8_t _txHeaderTo
TO header to send in all messages.
Definition: RHGenericDriver.h:274
uint8_t maxMessageLength()
Definition: RH_RF22.cpp:717
uint8_t reg_72
Value for register RH_RF22_REG_72_FREQUENCY_DEVIATION.
Definition: RH_RF22.h:958
@ OOK_Rb9_6Bw335
OOK, No Manchester, Rb = 9.6kbs, Rx Bandwidth = 335kHz.
Definition: RH_RF22.h:995
void startTransmit()
Definition: RH_RF22.cpp:581
uint8_t _txHeaderFlags
FLAGS header to send in all messages.
Definition: RHGenericDriver.h:283
uint8_t _idleMode
The radio mode to use when mode is idle.
Definition: RH_RF22.h:1342
@ CRC_CCITT
CCITT.
Definition: RH_RF22.h:1008
@ FSK_Rb19_2Fd9_6
FSK, No Manchester, Rb = 19.2kbs, Fd = 9.6kHz.
Definition: RH_RF22.h:976
@ OOK_Rb1_2Bw75
OOK, No Manchester, Rb = 1.2kbs, Rx Bandwidth = 75kHz.
Definition: RH_RF22.h:992
@ GFSK_Rb19_2Fd9_6
GFSK, No Manchester, Rb = 19.2kbs, Fd = 9.6kHz.
Definition: RH_RF22.h:987
void setPreambleLength(uint8_t nibbles)
Definition: RH_RF22.cpp:525
@ FSK_Rb_512Fd2_5
FSK, No Manchester, Rb = 512bs, Fd = 2.5kHz, for POCSAG compatibility.
Definition: RH_RF22.h:980
@ GFSK_Rb38_4Fd19_6
GFSK, No Manchester, Rb = 38.4kbs, Fd = 19.6kHz.
Definition: RH_RF22.h:988
@ FSK_Rb38_4Fd19_6
FSK, No Manchester, Rb = 38.4kbs, Fd = 19.6kHz.
Definition: RH_RF22.h:977
volatile uint8_t _rxHeaderId
ID header in the last received mesasge.
Definition: RHGenericDriver.h:268
static RH_RF22 * _deviceForInterrupt[]
Array of instances connected to interrupts 0 and 1.
Definition: RH_RF22.h:1329
uint8_t adcRead(uint8_t adcsel=RH_RF22_ADCSEL_INTERNAL_TEMPERATURE_SENSOR, uint8_t adcref=RH_RF22_ADCREF_BANDGAP_VOLTAGE, uint8_t adcgain=0, uint8_t adcoffs=0)
Definition: RH_RF22.cpp:340
RH_RF22(uint8_t slaveSelectPin=SS, uint8_t interruptPin=2, RHGenericSPI &spi=hardware_spi)
Definition: RH_RF22.cpp:59
uint8_t reg_2c
Value for register RH_RF22_REG_2C_OOK_COUNTER_VALUE_1.
Definition: RH_RF22.h:949
@ RHModeIdle
Transport is idle.
Definition: RHGenericDriver.h:52
volatile uint8_t _txBufSentIndex
Index into TX buffer of the next to send chunk.
Definition: RH_RF22.h:1361
uint8_t reg_22
Value for register RH_RF22_REG_22_CLOCK_RECOVERY_OFFSET1.
Definition: RH_RF22.h:945
uint8_t reg_25
Value for register RH_RF22_REG_25_CLOCK_RECOVERY_TIMING_LOOP_GAIN0.
Definition: RH_RF22.h:948
uint8_t reg_24
Value for register RH_RF22_REG_24_CLOCK_RECOVERY_TIMING_LOOP_GAIN1.
Definition: RH_RF22.h:947
void setModeIdle()
Definition: RH_RF22.cpp:452
uint8_t spiRead(uint8_t reg)
Definition: RHSPIDriver.cpp:30
virtual bool waitPacketSent()
Definition: RHGenericDriver.cpp:52
volatile RHMode _mode
The current transport operating mode.
Definition: RHGenericDriver.h:253
uint32_t _lastPreambleTime
Time in millis since the last preamble was received (and the last time the RSSI was measured)
Definition: RH_RF22.h:1364
@ RHModeTx
Transport is in the process of transmitting a message.
Definition: RHGenericDriver.h:53
bool send(const uint8_t *data, uint8_t len)
Definition: RH_RF22.cpp:597
uint8_t reg_6e
Value for register RH_RF22_REG_6E_TX_DATA_RATE1.
Definition: RH_RF22.h:954
@ FSK_Rb_512Fd4_5
FSK, No Manchester, Rb = 512bs, Fd = 4.5kHz, for POCSAG compatibility.
Definition: RH_RF22.h:981
@ GFSK_Rb2_4Fd36
GFSK, No Manchester, Rb = 2.4kbs, Fd = 36kHz.
Definition: RH_RF22.h:984
void restartTransmit()
Definition: RH_RF22.cpp:589
void clearRxBuf()
Definition: RH_RF22.cpp:536
bool recv(uint8_t *buf, uint8_t *len)
Definition: RH_RF22.cpp:555
virtual RHMode mode()
Definition: RHGenericDriver.cpp:159
@ RHModeRx
Transport is in the process of receiving a message.
Definition: RHGenericDriver.h:54
@ CRC_Biacheva
Biacheva.
Definition: RH_RF22.h:1011
virtual bool waitCAD()
Definition: RHGenericDriver.cpp:72
@ FSK_Rb2_4Fd36
FSK, No Manchester, Rb = 2.4kbs, Fd = 36kHz.
Definition: RH_RF22.h:973
static void isr1()
Low level interrupt service routine for RF22 connected to interrupt 1.
Definition: RH_RF22.cpp:317
uint8_t statusRead()
Definition: RH_RF22.cpp:335
@ GFSK_Rb2Fd5
GFSK, No Manchester, Rb = 2kbs, Fd = 5kHz.
Definition: RH_RF22.h:983