From c89dc4cad2827735f098ca37a51dd2f1d6831759 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 14 Dec 2024 13:50:00 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=20111de?= =?UTF-8?q?250ec1bc293dfd326388b454a46b157364b=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _c_c1101_8h_source.html | 1033 +++++++++++++++++++-------------------- 1 file changed, 515 insertions(+), 518 deletions(-) diff --git a/_c_c1101_8h_source.html b/_c_c1101_8h_source.html index e599384f..4ef83ccf 100644 --- a/_c_c1101_8h_source.html +++ b/_c_c1101_8h_source.html @@ -96,7 +96,7 @@ $(document).ready(function(){initNavTree('_c_c1101_8h_source.html',''); initResi
8 
9 // CC1101 physical layer properties
10 #define RADIOLIB_CC1101_FREQUENCY_STEP_SIZE 396.7285156
-
11 #define RADIOLIB_CC1101_MAX_PACKET_LENGTH 63
+
11 #define RADIOLIB_CC1101_MAX_PACKET_LENGTH 64
12 #define RADIOLIB_CC1101_CRYSTAL_FREQ 26.0
13 #define RADIOLIB_CC1101_DIV_EXPONENT 16
14 
@@ -279,536 +279,533 @@ $(document).ready(function(){initNavTree('_c_c1101_8h_source.html',''); initResi
191 // RADIOLIB_CC1101_REG_SYNC0
192 #define RADIOLIB_CC1101_SYNC_WORD_LSB 0x91 // 7 0 sync word LSB
193 
-
194 // RADIOLIB_CC1101_REG_PKTLEN
-
195 #define RADIOLIB_CC1101_PACKET_LENGTH 0xFF // 7 0 packet length in bytes
-
196 
-
197 // RADIOLIB_CC1101_REG_PKTCTRL1
-
198 #define RADIOLIB_CC1101_PQT 0x00 // 7 5 preamble quality threshold
-
199 #define RADIOLIB_CC1101_CRC_AUTOFLUSH_OFF 0b00000000 // 3 3 automatic Rx FIFO flush on CRC check fail: disabled (default)
-
200 #define RADIOLIB_CC1101_CRC_AUTOFLUSH_ON 0b00001000 // 3 3 enabled
-
201 #define RADIOLIB_CC1101_APPEND_STATUS_OFF 0b00000000 // 2 2 append 2 status bytes to packet: disabled
-
202 #define RADIOLIB_CC1101_APPEND_STATUS_ON 0b00000100 // 2 2 enabled (default)
-
203 #define RADIOLIB_CC1101_ADR_CHK_NONE 0b00000000 // 1 0 address check: none (default)
-
204 #define RADIOLIB_CC1101_ADR_CHK_NO_BROADCAST 0b00000001 // 1 0 without broadcast
-
205 #define RADIOLIB_CC1101_ADR_CHK_SINGLE_BROADCAST 0b00000010 // 1 0 broadcast address 0x00
-
206 #define RADIOLIB_CC1101_ADR_CHK_DOUBLE_BROADCAST 0b00000011 // 1 0 broadcast addresses 0x00 and 0xFF
-
207 
-
208 // RADIOLIB_CC1101_REG_PKTCTRL0
-
209 #define RADIOLIB_CC1101_WHITE_DATA_OFF 0b00000000 // 6 6 data whitening: disabled
-
210 #define RADIOLIB_CC1101_WHITE_DATA_ON 0b01000000 // 6 6 enabled (default)
-
211 #define RADIOLIB_CC1101_PKT_FORMAT_NORMAL 0b00000000 // 5 4 packet format: normal (FIFOs)
-
212 #define RADIOLIB_CC1101_PKT_FORMAT_SYNCHRONOUS 0b00010000 // 5 4 synchronous serial
-
213 #define RADIOLIB_CC1101_PKT_FORMAT_RANDOM 0b00100000 // 5 4 random transmissions
-
214 #define RADIOLIB_CC1101_PKT_FORMAT_ASYNCHRONOUS 0b00110000 // 5 4 asynchronous serial
-
215 #define RADIOLIB_CC1101_CRC_OFF 0b00000000 // 2 2 CRC disabled
-
216 #define RADIOLIB_CC1101_CRC_ON 0b00000100 // 2 2 CRC enabled (default)
-
217 #define RADIOLIB_CC1101_LENGTH_CONFIG_FIXED 0b00000000 // 1 0 packet length: fixed
-
218 #define RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE 0b00000001 // 1 0 variable (default)
-
219 #define RADIOLIB_CC1101_LENGTH_CONFIG_INFINITE 0b00000010 // 1 0 infinite
+
194 // RADIOLIB_CC1101_REG_PKTCTRL1
+
195 #define RADIOLIB_CC1101_PQT 0x00 // 7 5 preamble quality threshold
+
196 #define RADIOLIB_CC1101_CRC_AUTOFLUSH_OFF 0b00000000 // 3 3 automatic Rx FIFO flush on CRC check fail: disabled (default)
+
197 #define RADIOLIB_CC1101_CRC_AUTOFLUSH_ON 0b00001000 // 3 3 enabled
+
198 #define RADIOLIB_CC1101_APPEND_STATUS_OFF 0b00000000 // 2 2 append 2 status bytes to packet: disabled
+
199 #define RADIOLIB_CC1101_APPEND_STATUS_ON 0b00000100 // 2 2 enabled (default)
+
200 #define RADIOLIB_CC1101_ADR_CHK_NONE 0b00000000 // 1 0 address check: none (default)
+
201 #define RADIOLIB_CC1101_ADR_CHK_NO_BROADCAST 0b00000001 // 1 0 without broadcast
+
202 #define RADIOLIB_CC1101_ADR_CHK_SINGLE_BROADCAST 0b00000010 // 1 0 broadcast address 0x00
+
203 #define RADIOLIB_CC1101_ADR_CHK_DOUBLE_BROADCAST 0b00000011 // 1 0 broadcast addresses 0x00 and 0xFF
+
204 
+
205 // RADIOLIB_CC1101_REG_PKTCTRL0
+
206 #define RADIOLIB_CC1101_WHITE_DATA_OFF 0b00000000 // 6 6 data whitening: disabled
+
207 #define RADIOLIB_CC1101_WHITE_DATA_ON 0b01000000 // 6 6 enabled (default)
+
208 #define RADIOLIB_CC1101_PKT_FORMAT_NORMAL 0b00000000 // 5 4 packet format: normal (FIFOs)
+
209 #define RADIOLIB_CC1101_PKT_FORMAT_SYNCHRONOUS 0b00010000 // 5 4 synchronous serial
+
210 #define RADIOLIB_CC1101_PKT_FORMAT_RANDOM 0b00100000 // 5 4 random transmissions
+
211 #define RADIOLIB_CC1101_PKT_FORMAT_ASYNCHRONOUS 0b00110000 // 5 4 asynchronous serial
+
212 #define RADIOLIB_CC1101_CRC_OFF 0b00000000 // 2 2 CRC disabled
+
213 #define RADIOLIB_CC1101_CRC_ON 0b00000100 // 2 2 CRC enabled (default)
+
214 #define RADIOLIB_CC1101_LENGTH_CONFIG_FIXED 0b00000000 // 1 0 packet length: fixed
+
215 #define RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE 0b00000001 // 1 0 variable (default)
+
216 #define RADIOLIB_CC1101_LENGTH_CONFIG_INFINITE 0b00000010 // 1 0 infinite
+
217 
+
218 // RADIOLIB_CC1101_REG_ADDR
+
219 #define RADIOLIB_CC1101_DEVICE_ADDR 0x00 // 7 0 device address
220 
-
221 // RADIOLIB_CC1101_REG_ADDR
-
222 #define RADIOLIB_CC1101_DEVICE_ADDR 0x00 // 7 0 device address
+
221 // RADIOLIB_CC1101_REG_CHANNR
+
222 #define RADIOLIB_CC1101_CHAN 0x00 // 7 0 channel number
223 
-
224 // RADIOLIB_CC1101_REG_CHANNR
-
225 #define RADIOLIB_CC1101_CHAN 0x00 // 7 0 channel number
+
224 // RADIOLIB_CC1101_REG_FSCTRL1
+
225 #define RADIOLIB_CC1101_FREQ_IF 0x0F // 4 0 IF frequency setting; f_IF = (f(XOSC) / 2^10) * CC1101_FREQ_IF
226 
-
227 // RADIOLIB_CC1101_REG_FSCTRL1
-
228 #define RADIOLIB_CC1101_FREQ_IF 0x0F // 4 0 IF frequency setting; f_IF = (f(XOSC) / 2^10) * CC1101_FREQ_IF
+
227 // CC1101_REG_FSCTRL0
+
228 #define RADIOLIB_CC1101_FREQOFF 0x00 // 7 0 base frequency offset (2s-compliment)
229 
-
230 // CC1101_REG_FSCTRL0
-
231 #define RADIOLIB_CC1101_FREQOFF 0x00 // 7 0 base frequency offset (2s-compliment)
-
232 
-
233 // RADIOLIB_CC1101_REG_FREQ2 + REG_FREQ1 + REG_FREQ0
-
234 #define RADIOLIB_CC1101_FREQ_MSB 0x1E // 5 0 base frequency setting: f_carrier = (f(XOSC) / 2^16) * FREQ
-
235 #define RADIOLIB_CC1101_FREQ_MID 0xC4 // 7 0 where f(XOSC) = 26 MHz
-
236 #define RADIOLIB_CC1101_FREQ_LSB 0xEC // 7 0 FREQ = 3-byte value of FREQ registers
-
237 
-
238 // RADIOLIB_CC1101_REG_MDMCFG4
-
239 #define RADIOLIB_CC1101_CHANBW_E 0b10000000 // 7 6 channel bandwidth: BW_channel = f(XOSC) / (8 * (4 + CHANBW_M)*2^CHANBW_E) [Hz]
-
240 #define RADIOLIB_CC1101_CHANBW_M 0b00000000 // 5 4 default value for 26 MHz crystal: 203 125 Hz
-
241 #define RADIOLIB_CC1101_DRATE_E 0x0C // 3 0 symbol rate: R_data = (((256 + DRATE_M) * 2^DRATE_E) / 2^28) * f(XOSC) [Baud]
+
230 // RADIOLIB_CC1101_REG_FREQ2 + REG_FREQ1 + REG_FREQ0
+
231 #define RADIOLIB_CC1101_FREQ_MSB 0x1E // 5 0 base frequency setting: f_carrier = (f(XOSC) / 2^16) * FREQ
+
232 #define RADIOLIB_CC1101_FREQ_MID 0xC4 // 7 0 where f(XOSC) = 26 MHz
+
233 #define RADIOLIB_CC1101_FREQ_LSB 0xEC // 7 0 FREQ = 3-byte value of FREQ registers
+
234 
+
235 // RADIOLIB_CC1101_REG_MDMCFG4
+
236 #define RADIOLIB_CC1101_CHANBW_E 0b10000000 // 7 6 channel bandwidth: BW_channel = f(XOSC) / (8 * (4 + CHANBW_M)*2^CHANBW_E) [Hz]
+
237 #define RADIOLIB_CC1101_CHANBW_M 0b00000000 // 5 4 default value for 26 MHz crystal: 203 125 Hz
+
238 #define RADIOLIB_CC1101_DRATE_E 0x0C // 3 0 symbol rate: R_data = (((256 + DRATE_M) * 2^DRATE_E) / 2^28) * f(XOSC) [Baud]
+
239 
+
240 // RADIOLIB_CC1101_REG_MDMCFG3
+
241 #define RADIOLIB_CC1101_DRATE_M 0x22 // 7 0 default value for 26 MHz crystal: 115 051 Baud
242 
-
243 // RADIOLIB_CC1101_REG_MDMCFG3
-
244 #define RADIOLIB_CC1101_DRATE_M 0x22 // 7 0 default value for 26 MHz crystal: 115 051 Baud
-
245 
-
246 // RADIOLIB_CC1101_REG_MDMCFG2
-
247 #define RADIOLIB_CC1101_DEM_DCFILT_OFF 0b10000000 // 7 7 digital DC filter: disabled
-
248 #define RADIOLIB_CC1101_DEM_DCFILT_ON 0b00000000 // 7 7 enabled - only for data rates above 250 kBaud (default)
-
249 #define RADIOLIB_CC1101_MOD_FORMAT_2_FSK 0b00000000 // 6 4 modulation format: 2-FSK (default)
-
250 #define RADIOLIB_CC1101_MOD_FORMAT_GFSK 0b00010000 // 6 4 GFSK
-
251 #define RADIOLIB_CC1101_MOD_FORMAT_ASK_OOK 0b00110000 // 6 4 ASK/OOK
-
252 #define RADIOLIB_CC1101_MOD_FORMAT_4_FSK 0b01000000 // 6 4 4-FSK
-
253 #define RADIOLIB_CC1101_MOD_FORMAT_MFSK 0b01110000 // 6 4 MFSK - only for data rates above 26 kBaud
-
254 #define RADIOLIB_CC1101_MANCHESTER_EN_OFF 0b00000000 // 3 3 Manchester encoding: disabled (default)
-
255 #define RADIOLIB_CC1101_MANCHESTER_EN_ON 0b00001000 // 3 3 enabled
-
256 #define RADIOLIB_CC1101_SYNC_MODE_NONE 0b00000000 // 2 0 synchronization: no preamble/sync
-
257 #define RADIOLIB_CC1101_SYNC_MODE_15_16 0b00000001 // 2 0 15/16 sync word bits
-
258 #define RADIOLIB_CC1101_SYNC_MODE_16_16 0b00000010 // 2 0 16/16 sync word bits (default)
-
259 #define RADIOLIB_CC1101_SYNC_MODE_30_32 0b00000011 // 2 0 30/32 sync word bits
-
260 #define RADIOLIB_CC1101_SYNC_MODE_NONE_THR 0b00000100 // 2 0 no preamble sync, carrier sense above threshold
-
261 #define RADIOLIB_CC1101_SYNC_MODE_15_16_THR 0b00000101 // 2 0 15/16 sync word bits, carrier sense above threshold
-
262 #define RADIOLIB_CC1101_SYNC_MODE_16_16_THR 0b00000110 // 2 0 16/16 sync word bits, carrier sense above threshold
-
263 #define RADIOLIB_CC1101_SYNC_MODE_30_32_THR 0b00000111 // 2 0 30/32 sync word bits, carrier sense above threshold
-
264 
-
265 // RADIOLIB_CC1101_REG_MDMCFG1
-
266 #define RADIOLIB_CC1101_FEC_OFF 0b00000000 // 7 7 forward error correction: disabled (default)
-
267 #define RADIOLIB_CC1101_FEC_ON 0b10000000 // 7 7 enabled - only for fixed packet length
-
268 #define RADIOLIB_CC1101_NUM_PREAMBLE_2 0b00000000 // 6 4 number of preamble bytes: 2
-
269 #define RADIOLIB_CC1101_NUM_PREAMBLE_3 0b00010000 // 6 4 3
-
270 #define RADIOLIB_CC1101_NUM_PREAMBLE_4 0b00100000 // 6 4 4 (default)
-
271 #define RADIOLIB_CC1101_NUM_PREAMBLE_6 0b00110000 // 6 4 6
-
272 #define RADIOLIB_CC1101_NUM_PREAMBLE_8 0b01000000 // 6 4 8
-
273 #define RADIOLIB_CC1101_NUM_PREAMBLE_12 0b01010000 // 6 4 12
-
274 #define RADIOLIB_CC1101_NUM_PREAMBLE_16 0b01100000 // 6 4 16
-
275 #define RADIOLIB_CC1101_NUM_PREAMBLE_24 0b01110000 // 6 4 24
-
276 #define RADIOLIB_CC1101_CHANSPC_E 0x02 // 1 0 channel spacing: df_channel = (f(XOSC) / 2^18) * (256 + CHANSPC_M) * 2^CHANSPC_E [Hz]
+
243 // RADIOLIB_CC1101_REG_MDMCFG2
+
244 #define RADIOLIB_CC1101_DEM_DCFILT_OFF 0b10000000 // 7 7 digital DC filter: disabled
+
245 #define RADIOLIB_CC1101_DEM_DCFILT_ON 0b00000000 // 7 7 enabled - only for data rates above 250 kBaud (default)
+
246 #define RADIOLIB_CC1101_MOD_FORMAT_2_FSK 0b00000000 // 6 4 modulation format: 2-FSK (default)
+
247 #define RADIOLIB_CC1101_MOD_FORMAT_GFSK 0b00010000 // 6 4 GFSK
+
248 #define RADIOLIB_CC1101_MOD_FORMAT_ASK_OOK 0b00110000 // 6 4 ASK/OOK
+
249 #define RADIOLIB_CC1101_MOD_FORMAT_4_FSK 0b01000000 // 6 4 4-FSK
+
250 #define RADIOLIB_CC1101_MOD_FORMAT_MFSK 0b01110000 // 6 4 MFSK - only for data rates above 26 kBaud
+
251 #define RADIOLIB_CC1101_MANCHESTER_EN_OFF 0b00000000 // 3 3 Manchester encoding: disabled (default)
+
252 #define RADIOLIB_CC1101_MANCHESTER_EN_ON 0b00001000 // 3 3 enabled
+
253 #define RADIOLIB_CC1101_SYNC_MODE_NONE 0b00000000 // 2 0 synchronization: no preamble/sync
+
254 #define RADIOLIB_CC1101_SYNC_MODE_15_16 0b00000001 // 2 0 15/16 sync word bits
+
255 #define RADIOLIB_CC1101_SYNC_MODE_16_16 0b00000010 // 2 0 16/16 sync word bits (default)
+
256 #define RADIOLIB_CC1101_SYNC_MODE_30_32 0b00000011 // 2 0 30/32 sync word bits
+
257 #define RADIOLIB_CC1101_SYNC_MODE_NONE_THR 0b00000100 // 2 0 no preamble sync, carrier sense above threshold
+
258 #define RADIOLIB_CC1101_SYNC_MODE_15_16_THR 0b00000101 // 2 0 15/16 sync word bits, carrier sense above threshold
+
259 #define RADIOLIB_CC1101_SYNC_MODE_16_16_THR 0b00000110 // 2 0 16/16 sync word bits, carrier sense above threshold
+
260 #define RADIOLIB_CC1101_SYNC_MODE_30_32_THR 0b00000111 // 2 0 30/32 sync word bits, carrier sense above threshold
+
261 
+
262 // RADIOLIB_CC1101_REG_MDMCFG1
+
263 #define RADIOLIB_CC1101_FEC_OFF 0b00000000 // 7 7 forward error correction: disabled (default)
+
264 #define RADIOLIB_CC1101_FEC_ON 0b10000000 // 7 7 enabled - only for fixed packet length
+
265 #define RADIOLIB_CC1101_NUM_PREAMBLE_2 0b00000000 // 6 4 number of preamble bytes: 2
+
266 #define RADIOLIB_CC1101_NUM_PREAMBLE_3 0b00010000 // 6 4 3
+
267 #define RADIOLIB_CC1101_NUM_PREAMBLE_4 0b00100000 // 6 4 4 (default)
+
268 #define RADIOLIB_CC1101_NUM_PREAMBLE_6 0b00110000 // 6 4 6
+
269 #define RADIOLIB_CC1101_NUM_PREAMBLE_8 0b01000000 // 6 4 8
+
270 #define RADIOLIB_CC1101_NUM_PREAMBLE_12 0b01010000 // 6 4 12
+
271 #define RADIOLIB_CC1101_NUM_PREAMBLE_16 0b01100000 // 6 4 16
+
272 #define RADIOLIB_CC1101_NUM_PREAMBLE_24 0b01110000 // 6 4 24
+
273 #define RADIOLIB_CC1101_CHANSPC_E 0x02 // 1 0 channel spacing: df_channel = (f(XOSC) / 2^18) * (256 + CHANSPC_M) * 2^CHANSPC_E [Hz]
+
274 
+
275 // RADIOLIB_CC1101_REG_MDMCFG0
+
276 #define RADIOLIB_CC1101_CHANSPC_M 0xF8 // 7 0 default value for 26 MHz crystal: 199 951 kHz
277 
-
278 // RADIOLIB_CC1101_REG_MDMCFG0
-
279 #define RADIOLIB_CC1101_CHANSPC_M 0xF8 // 7 0 default value for 26 MHz crystal: 199 951 kHz
-
280 
-
281 // RADIOLIB_CC1101_REG_DEVIATN
-
282 #define RADIOLIB_CC1101_DEVIATION_E 0b01000000 // 6 4 frequency deviation: f_dev = (f(XOSC) / 2^17) * (8 + DEVIATION_M) * 2^DEVIATION_E [Hz]
-
283 #define RADIOLIB_CC1101_DEVIATION_M 0b00000111 // 2 0 default value for 26 MHz crystal: +- 47 607 Hz
-
284 #define RADIOLIB_CC1101_MSK_PHASE_CHANGE_PERIOD 0x07 // 2 0 phase change symbol period fraction: 1 / (MSK_PHASE_CHANGE_PERIOD + 1)
-
285 
-
286 // RADIOLIB_CC1101_REG_MCSM2
-
287 #define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_OFF 0b00000000 // 4 4 Rx timeout based on RSSI value: disabled (default)
-
288 #define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_ON 0b00010000 // 4 4 enabled
-
289 #define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_OFF 0b00000000 // 3 3 check for sync word on Rx timeout
-
290 #define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_ON 0b00001000 // 3 3 check for PQI set on Rx timeout
-
291 #define RADIOLIB_CC1101_RX_TIMEOUT_OFF 0b00000111 // 2 0 Rx timeout: disabled (default)
-
292 #define RADIOLIB_CC1101_RX_TIMEOUT_MAX 0b00000000 // 2 0 max value (actual value depends on WOR_RES, EVENT0 and f(XOSC))
-
293 
-
294 // RADIOLIB_CC1101_REG_MCSM1
-
295 #define RADIOLIB_CC1101_CCA_MODE_ALWAYS 0b00000000 // 5 4 clear channel indication: always
-
296 #define RADIOLIB_CC1101_CCA_MODE_RSSI_THR 0b00010000 // 5 4 RSSI below threshold
-
297 #define RADIOLIB_CC1101_CCA_MODE_RX_PKT 0b00100000 // 5 4 unless receiving packet
-
298 #define RADIOLIB_CC1101_CCA_MODE_RSSI_THR_RX_PKT 0b00110000 // 5 4 RSSI below threshold unless receiving packet (default)
-
299 #define RADIOLIB_CC1101_RXOFF_IDLE 0b00000000 // 3 2 next mode after packet reception: idle (default)
-
300 #define RADIOLIB_CC1101_RXOFF_FSTXON 0b00000100 // 3 2 FSTxOn
-
301 #define RADIOLIB_CC1101_RXOFF_TX 0b00001000 // 3 2 Tx
-
302 #define RADIOLIB_CC1101_RXOFF_RX 0b00001100 // 3 2 Rx
-
303 #define RADIOLIB_CC1101_TXOFF_IDLE 0b00000000 // 1 0 next mode after packet transmission: idle (default)
-
304 #define RADIOLIB_CC1101_TXOFF_FSTXON 0b00000001 // 1 0 FSTxOn
-
305 #define RADIOLIB_CC1101_TXOFF_TX 0b00000010 // 1 0 Tx
-
306 #define RADIOLIB_CC1101_TXOFF_RX 0b00000011 // 1 0 Rx
-
307 
-
308 // RADIOLIB_CC1101_REG_MCSM0
-
309 #define RADIOLIB_CC1101_FS_AUTOCAL_NEVER 0b00000000 // 5 4 automatic calibration: never (default)
-
310 #define RADIOLIB_CC1101_FS_AUTOCAL_IDLE_TO_RXTX 0b00010000 // 5 4 every transition from idle to Rx/Tx
-
311 #define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE 0b00100000 // 5 4 every transition from Rx/Tx to idle
-
312 #define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE_4TH 0b00110000 // 5 4 every 4th transition from Rx/Tx to idle
-
313 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_1 0b00000000 // 3 2 number of counter expirations before CHP_RDYN goes low: 1 (default)
-
314 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_16 0b00000100 // 3 2 16
-
315 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_64 0b00001000 // 3 2 64
-
316 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_256 0b00001100 // 3 2 256
-
317 #define RADIOLIB_CC1101_PIN_CTRL_OFF 0b00000000 // 1 1 pin radio control: disabled (default)
-
318 #define RADIOLIB_CC1101_PIN_CTRL_ON 0b00000010 // 1 1 enabled
-
319 #define RADIOLIB_CC1101_XOSC_FORCE_OFF 0b00000000 // 0 0 do not force XOSC to remain on in sleep (default)
-
320 #define RADIOLIB_CC1101_XOSC_FORCE_ON 0b00000001 // 0 0 force XOSC to remain on in sleep
-
321 
-
322 // RADIOLIB_CC1101_REG_FOCCFG
-
323 #define RADIOLIB_CC1101_FOC_BS_CS_GATE_OFF 0b00000000 // 5 5 do not freeze frequency compensation until CS goes high
-
324 #define RADIOLIB_CC1101_FOC_BS_CS_GATE_ON 0b00100000 // 5 5 freeze frequency compensation until CS goes high (default)
-
325 #define RADIOLIB_CC1101_FOC_PRE_K 0b00000000 // 4 3 frequency compensation loop gain before sync word: K
-
326 #define RADIOLIB_CC1101_FOC_PRE_2K 0b00001000 // 4 3 2K
-
327 #define RADIOLIB_CC1101_FOC_PRE_3K 0b00010000 // 4 3 3K (default)
-
328 #define RADIOLIB_CC1101_FOC_PRE_4K 0b00011000 // 4 3 4K
-
329 #define RADIOLIB_CC1101_FOC_POST_K 0b00000000 // 2 2 frequency compensation loop gain after sync word: same as FOC_PRE
-
330 #define RADIOLIB_CC1101_FOC_POST_K_2 0b00000100 // 2 2 K/2 (default)
-
331 #define RADIOLIB_CC1101_FOC_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 frequency compensation saturation point: no compensation - required for ASK/OOK
-
332 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_8 0b00000001 // 1 0 +- BW_chan/8
-
333 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_4 0b00000010 // 1 0 +- BW_chan/4 (default)
-
334 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_2 0b00000011 // 1 0 +- BW_chan/2
-
335 
-
336 // RADIOLIB_CC1101_REG_BSCFG
-
337 #define RADIOLIB_CC1101_BS_PRE_KI 0b00000000 // 7 6 clock recovery integral gain before sync word: Ki
-
338 #define RADIOLIB_CC1101_BS_PRE_2KI 0b01000000 // 7 6 2Ki (default)
-
339 #define RADIOLIB_CC1101_BS_PRE_3KI 0b10000000 // 7 6 3Ki
-
340 #define RADIOLIB_CC1101_BS_PRE_4KI 0b11000000 // 7 6 4Ki
-
341 #define RADIOLIB_CC1101_BS_PRE_KP 0b00000000 // 5 4 clock recovery proportional gain before sync word: Kp
-
342 #define RADIOLIB_CC1101_BS_PRE_2KP 0b00010000 // 5 4 2Kp
-
343 #define RADIOLIB_CC1101_BS_PRE_3KP 0b00100000 // 5 4 3Kp (default)
-
344 #define RADIOLIB_CC1101_BS_PRE_4KP 0b00110000 // 5 4 4Kp
-
345 #define RADIOLIB_CC1101_BS_POST_KI 0b00000000 // 3 3 clock recovery integral gain after sync word: same as BS_PRE
-
346 #define RADIOLIB_CC1101_BS_POST_KI_2 0b00001000 // 3 3 Ki/2 (default)
-
347 #define RADIOLIB_CC1101_BS_POST_KP 0b00000000 // 2 2 clock recovery proportional gain after sync word: same as BS_PRE
-
348 #define RADIOLIB_CC1101_BS_POST_KP_1 0b00000100 // 2 2 Kp (default)
-
349 #define RADIOLIB_CC1101_BS_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 data rate compensation saturation point: no compensation
-
350 #define RADIOLIB_CC1101_BS_LIMIT_3_125 0b00000001 // 1 0 +- 3.125 %
-
351 #define RADIOLIB_CC1101_BS_LIMIT_6_25 0b00000010 // 1 0 +- 6.25 %
-
352 #define RADIOLIB_CC1101_BS_LIMIT_12_5 0b00000011 // 1 0 +- 12.5 %
-
353 
-
354 // RADIOLIB_CC1101_REG_AGCCTRL2
-
355 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_0 0b00000000 // 7 6 reduce maximum available DVGA gain: no reduction (default)
-
356 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_1 0b01000000 // 7 6 disable top gain setting
-
357 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_2 0b10000000 // 7 6 disable top two gain setting
-
358 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_3 0b11000000 // 7 6 disable top three gain setting
-
359 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_0_DB 0b00000000 // 5 3 reduce maximum LNA gain by: 0 dB (default)
-
360 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_2_6_DB 0b00001000 // 5 3 2.6 dB
-
361 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_6_1_DB 0b00010000 // 5 3 6.1 dB
-
362 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_7_4_DB 0b00011000 // 5 3 7.4 dB
-
363 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_9_2_DB 0b00100000 // 5 3 9.2 dB
-
364 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_11_5_DB 0b00101000 // 5 3 11.5 dB
-
365 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_14_6_DB 0b00110000 // 5 3 14.6 dB
-
366 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_17_1_DB 0b00111000 // 5 3 17.1 dB
-
367 #define RADIOLIB_CC1101_MAGN_TARGET_24_DB 0b00000000 // 2 0 average amplitude target for filter: 24 dB
-
368 #define RADIOLIB_CC1101_MAGN_TARGET_27_DB 0b00000001 // 2 0 27 dB
-
369 #define RADIOLIB_CC1101_MAGN_TARGET_30_DB 0b00000010 // 2 0 30 dB
-
370 #define RADIOLIB_CC1101_MAGN_TARGET_33_DB 0b00000011 // 2 0 33 dB (default)
-
371 #define RADIOLIB_CC1101_MAGN_TARGET_36_DB 0b00000100 // 2 0 36 dB
-
372 #define RADIOLIB_CC1101_MAGN_TARGET_38_DB 0b00000101 // 2 0 38 dB
-
373 #define RADIOLIB_CC1101_MAGN_TARGET_40_DB 0b00000110 // 2 0 40 dB
-
374 #define RADIOLIB_CC1101_MAGN_TARGET_42_DB 0b00000111 // 2 0 42 dB
-
375 
-
376 // RADIOLIB_CC1101_REG_AGCCTRL1
-
377 #define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA2 0b00000000 // 6 6 LNA priority setting: LNA2 first
-
378 #define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA 0b01000000 // 6 6 LNA first (default)
-
379 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_OFF 0b00000000 // 5 4 RSSI relative change to assert carrier sense: disabled (default)
-
380 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_6_DB 0b00010000 // 5 4 6 dB
-
381 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_10_DB 0b00100000 // 5 4 10 dB
-
382 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_14_DB 0b00110000 // 5 4 14 dB
-
383 #define RADIOLIB_CC1101_CARRIER_SENSE_ABS_THR 0x00 // 3 0 RSSI threshold to assert carrier sense in 2s compliment, Thr = MAGN_TARGET + CARRIER_SENSE_ABS_TH [dB]
-
384 
-
385 // RADIOLIB_CC1101_REG_AGCCTRL0
-
386 #define RADIOLIB_CC1101_HYST_LEVEL_NONE 0b00000000 // 7 6 AGC hysteresis level: none
-
387 #define RADIOLIB_CC1101_HYST_LEVEL_LOW 0b01000000 // 7 6 low
-
388 #define RADIOLIB_CC1101_HYST_LEVEL_MEDIUM 0b10000000 // 7 6 medium (default)
-
389 #define RADIOLIB_CC1101_HYST_LEVEL_HIGH 0b11000000 // 7 6 high
-
390 #define RADIOLIB_CC1101_WAIT_TIME_8_SAMPLES 0b00000000 // 5 4 AGC wait time: 8 samples
-
391 #define RADIOLIB_CC1101_WAIT_TIME_16_SAMPLES 0b00010000 // 5 4 16 samples (default)
-
392 #define RADIOLIB_CC1101_WAIT_TIME_24_SAMPLES 0b00100000 // 5 4 24 samples
-
393 #define RADIOLIB_CC1101_WAIT_TIME_32_SAMPLES 0b00110000 // 5 4 32 samples
-
394 #define RADIOLIB_CC1101_AGC_FREEZE_NEVER 0b00000000 // 3 2 freeze AGC gain: never (default)
-
395 #define RADIOLIB_CC1101_AGC_FREEZE_SYNC_WORD 0b00000100 // 3 2 when sync word is found
-
396 #define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_A 0b00001000 // 3 2 manually freeze analog control
-
397 #define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_AD 0b00001100 // 3 2 manually freeze analog and digital control
-
398 #define RADIOLIB_CC1101_FILTER_LENGTH_8 0b00000000 // 1 0 averaging length for channel filter: 8 samples
-
399 #define RADIOLIB_CC1101_FILTER_LENGTH_16 0b00000001 // 1 0 16 samples (default)
-
400 #define RADIOLIB_CC1101_FILTER_LENGTH_32 0b00000010 // 1 0 32 samples
-
401 #define RADIOLIB_CC1101_FILTER_LENGTH_64 0b00000011 // 1 0 64 samples
-
402 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_4_DB 0b00000000 // 1 0 ASK/OOK decision boundary: 4 dB
-
403 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_8_DB 0b00000001 // 1 0 8 dB (default)
-
404 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_12_DB 0b00000010 // 1 0 12 dB
-
405 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_16_DB 0b00000011 // 1 0 16 dB
-
406 
-
407 // RADIOLIB_CC1101_REG_WOREVT1 + REG_WOREVT0
-
408 #define RADIOLIB_CC1101_EVENT0_TIMEOUT_MSB 0x87 // 7 0 EVENT0 timeout: t_event0 = (750 / f(XOSC)) * EVENT0_TIMEOUT * 2^(5 * WOR_RES) [s]
-
409 #define RADIOLIB_CC1101_EVENT0_TIMEOUT_LSB 0x6B // 7 0 default value for 26 MHz crystal: 1.0 s
-
410 
-
411 // RADIOLIB_CC1101_REG_WORCTRL
-
412 #define RADIOLIB_CC1101_RC_POWER_UP 0b00000000 // 7 7 power up RC oscillator
-
413 #define RADIOLIB_CC1101_RC_POWER_DOWN 0b10000000 // 7 7 power down RC oscillator
-
414 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_4 0b00000000 // 6 4 EVENT1 timeout: 4 RC periods
-
415 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_6 0b00010000 // 6 4 6 RC periods
-
416 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_8 0b00100000 // 6 4 8 RC periods
-
417 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_12 0b00110000 // 6 4 12 RC periods
-
418 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_16 0b01000000 // 6 4 16 RC periods
-
419 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_24 0b01010000 // 6 4 24 RC periods
-
420 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_32 0b01100000 // 6 4 32 RC periods
-
421 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_48 0b01110000 // 6 4 48 RC periods (default)
-
422 #define RADIOLIB_CC1101_RC_CAL_OFF 0b00000000 // 3 3 disable RC oscillator calibration
-
423 #define RADIOLIB_CC1101_RC_CAL_ON 0b00001000 // 3 3 enable RC oscillator calibration (default)
-
424 #define RADIOLIB_CC1101_WOR_RES_1 0b00000000 // 1 0 EVENT0 resolution: 1 period (default)
-
425 #define RADIOLIB_CC1101_WOR_RES_2_5 0b00000001 // 1 0 2^5 periods
-
426 #define RADIOLIB_CC1101_WOR_RES_2_10 0b00000010 // 1 0 2^10 periods
-
427 #define RADIOLIB_CC1101_WOR_RES_2_15 0b00000011 // 1 0 2^15 periods
-
428 
-
429 // RADIOLIB_CC1101_REG_FREND1
-
430 #define RADIOLIB_CC1101_LNA_CURRENT 0x01 // 7 6 front-end LNA PTAT current output adjustment
-
431 #define RADIOLIB_CC1101_LNA2MIX_CURRENT 0x01 // 5 4 front-end PTAT output adjustment
-
432 #define RADIOLIB_CC1101_LODIV_BUF_CURRENT_RX 0x01 // 3 2 Rx LO buffer current adjustment
-
433 #define RADIOLIB_CC1101_MIX_CURRENT 0x02 // 1 0 mixer current adjustment
-
434 
-
435 // RADIOLIB_CC1101_REG_FREND0
-
436 #define RADIOLIB_CC1101_LODIV_BUF_CURRENT_TX 0x01 // 5 4 Tx LO buffer current adjustment
-
437 #define RADIOLIB_CC1101_PA_POWER 0x00 // 2 0 set power amplifier power according to PATABLE
-
438 
-
439 // RADIOLIB_CC1101_REG_FSCAL3
-
440 #define RADIOLIB_CC1101_CHP_CURR_CAL_OFF 0b00000000 // 5 4 disable charge pump calibration
-
441 #define RADIOLIB_CC1101_CHP_CURR_CAL_ON 0b00100000 // 5 4 enable charge pump calibration (default)
-
442 #define RADIOLIB_CC1101_FSCAL3 0x09 // 3 0 charge pump output current: I_out = I_0 * 2^(FSCAL3/4) [A]
-
443 
-
444 // RADIOLIB_CC1101_REG_FSCAL2
-
445 #define RADIOLIB_CC1101_VCO_CORE_LOW 0b00000000 // 5 5 VCO: low (default)
-
446 #define RADIOLIB_CC1101_VCO_CORE_HIGH 0b00100000 // 5 5 high
-
447 #define RADIOLIB_CC1101_FSCAL2 0x0A // 4 0 VCO current result/override
+
278 // RADIOLIB_CC1101_REG_DEVIATN
+
279 #define RADIOLIB_CC1101_DEVIATION_E 0b01000000 // 6 4 frequency deviation: f_dev = (f(XOSC) / 2^17) * (8 + DEVIATION_M) * 2^DEVIATION_E [Hz]
+
280 #define RADIOLIB_CC1101_DEVIATION_M 0b00000111 // 2 0 default value for 26 MHz crystal: +- 47 607 Hz
+
281 #define RADIOLIB_CC1101_MSK_PHASE_CHANGE_PERIOD 0x07 // 2 0 phase change symbol period fraction: 1 / (MSK_PHASE_CHANGE_PERIOD + 1)
+
282 
+
283 // RADIOLIB_CC1101_REG_MCSM2
+
284 #define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_OFF 0b00000000 // 4 4 Rx timeout based on RSSI value: disabled (default)
+
285 #define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_ON 0b00010000 // 4 4 enabled
+
286 #define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_OFF 0b00000000 // 3 3 check for sync word on Rx timeout
+
287 #define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_ON 0b00001000 // 3 3 check for PQI set on Rx timeout
+
288 #define RADIOLIB_CC1101_RX_TIMEOUT_OFF 0b00000111 // 2 0 Rx timeout: disabled (default)
+
289 #define RADIOLIB_CC1101_RX_TIMEOUT_MAX 0b00000000 // 2 0 max value (actual value depends on WOR_RES, EVENT0 and f(XOSC))
+
290 
+
291 // RADIOLIB_CC1101_REG_MCSM1
+
292 #define RADIOLIB_CC1101_CCA_MODE_ALWAYS 0b00000000 // 5 4 clear channel indication: always
+
293 #define RADIOLIB_CC1101_CCA_MODE_RSSI_THR 0b00010000 // 5 4 RSSI below threshold
+
294 #define RADIOLIB_CC1101_CCA_MODE_RX_PKT 0b00100000 // 5 4 unless receiving packet
+
295 #define RADIOLIB_CC1101_CCA_MODE_RSSI_THR_RX_PKT 0b00110000 // 5 4 RSSI below threshold unless receiving packet (default)
+
296 #define RADIOLIB_CC1101_RXOFF_IDLE 0b00000000 // 3 2 next mode after packet reception: idle (default)
+
297 #define RADIOLIB_CC1101_RXOFF_FSTXON 0b00000100 // 3 2 FSTxOn
+
298 #define RADIOLIB_CC1101_RXOFF_TX 0b00001000 // 3 2 Tx
+
299 #define RADIOLIB_CC1101_RXOFF_RX 0b00001100 // 3 2 Rx
+
300 #define RADIOLIB_CC1101_TXOFF_IDLE 0b00000000 // 1 0 next mode after packet transmission: idle (default)
+
301 #define RADIOLIB_CC1101_TXOFF_FSTXON 0b00000001 // 1 0 FSTxOn
+
302 #define RADIOLIB_CC1101_TXOFF_TX 0b00000010 // 1 0 Tx
+
303 #define RADIOLIB_CC1101_TXOFF_RX 0b00000011 // 1 0 Rx
+
304 
+
305 // RADIOLIB_CC1101_REG_MCSM0
+
306 #define RADIOLIB_CC1101_FS_AUTOCAL_NEVER 0b00000000 // 5 4 automatic calibration: never (default)
+
307 #define RADIOLIB_CC1101_FS_AUTOCAL_IDLE_TO_RXTX 0b00010000 // 5 4 every transition from idle to Rx/Tx
+
308 #define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE 0b00100000 // 5 4 every transition from Rx/Tx to idle
+
309 #define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE_4TH 0b00110000 // 5 4 every 4th transition from Rx/Tx to idle
+
310 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_1 0b00000000 // 3 2 number of counter expirations before CHP_RDYN goes low: 1 (default)
+
311 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_16 0b00000100 // 3 2 16
+
312 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_64 0b00001000 // 3 2 64
+
313 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_256 0b00001100 // 3 2 256
+
314 #define RADIOLIB_CC1101_PIN_CTRL_OFF 0b00000000 // 1 1 pin radio control: disabled (default)
+
315 #define RADIOLIB_CC1101_PIN_CTRL_ON 0b00000010 // 1 1 enabled
+
316 #define RADIOLIB_CC1101_XOSC_FORCE_OFF 0b00000000 // 0 0 do not force XOSC to remain on in sleep (default)
+
317 #define RADIOLIB_CC1101_XOSC_FORCE_ON 0b00000001 // 0 0 force XOSC to remain on in sleep
+
318 
+
319 // RADIOLIB_CC1101_REG_FOCCFG
+
320 #define RADIOLIB_CC1101_FOC_BS_CS_GATE_OFF 0b00000000 // 5 5 do not freeze frequency compensation until CS goes high
+
321 #define RADIOLIB_CC1101_FOC_BS_CS_GATE_ON 0b00100000 // 5 5 freeze frequency compensation until CS goes high (default)
+
322 #define RADIOLIB_CC1101_FOC_PRE_K 0b00000000 // 4 3 frequency compensation loop gain before sync word: K
+
323 #define RADIOLIB_CC1101_FOC_PRE_2K 0b00001000 // 4 3 2K
+
324 #define RADIOLIB_CC1101_FOC_PRE_3K 0b00010000 // 4 3 3K (default)
+
325 #define RADIOLIB_CC1101_FOC_PRE_4K 0b00011000 // 4 3 4K
+
326 #define RADIOLIB_CC1101_FOC_POST_K 0b00000000 // 2 2 frequency compensation loop gain after sync word: same as FOC_PRE
+
327 #define RADIOLIB_CC1101_FOC_POST_K_2 0b00000100 // 2 2 K/2 (default)
+
328 #define RADIOLIB_CC1101_FOC_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 frequency compensation saturation point: no compensation - required for ASK/OOK
+
329 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_8 0b00000001 // 1 0 +- BW_chan/8
+
330 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_4 0b00000010 // 1 0 +- BW_chan/4 (default)
+
331 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_2 0b00000011 // 1 0 +- BW_chan/2
+
332 
+
333 // RADIOLIB_CC1101_REG_BSCFG
+
334 #define RADIOLIB_CC1101_BS_PRE_KI 0b00000000 // 7 6 clock recovery integral gain before sync word: Ki
+
335 #define RADIOLIB_CC1101_BS_PRE_2KI 0b01000000 // 7 6 2Ki (default)
+
336 #define RADIOLIB_CC1101_BS_PRE_3KI 0b10000000 // 7 6 3Ki
+
337 #define RADIOLIB_CC1101_BS_PRE_4KI 0b11000000 // 7 6 4Ki
+
338 #define RADIOLIB_CC1101_BS_PRE_KP 0b00000000 // 5 4 clock recovery proportional gain before sync word: Kp
+
339 #define RADIOLIB_CC1101_BS_PRE_2KP 0b00010000 // 5 4 2Kp
+
340 #define RADIOLIB_CC1101_BS_PRE_3KP 0b00100000 // 5 4 3Kp (default)
+
341 #define RADIOLIB_CC1101_BS_PRE_4KP 0b00110000 // 5 4 4Kp
+
342 #define RADIOLIB_CC1101_BS_POST_KI 0b00000000 // 3 3 clock recovery integral gain after sync word: same as BS_PRE
+
343 #define RADIOLIB_CC1101_BS_POST_KI_2 0b00001000 // 3 3 Ki/2 (default)
+
344 #define RADIOLIB_CC1101_BS_POST_KP 0b00000000 // 2 2 clock recovery proportional gain after sync word: same as BS_PRE
+
345 #define RADIOLIB_CC1101_BS_POST_KP_1 0b00000100 // 2 2 Kp (default)
+
346 #define RADIOLIB_CC1101_BS_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 data rate compensation saturation point: no compensation
+
347 #define RADIOLIB_CC1101_BS_LIMIT_3_125 0b00000001 // 1 0 +- 3.125 %
+
348 #define RADIOLIB_CC1101_BS_LIMIT_6_25 0b00000010 // 1 0 +- 6.25 %
+
349 #define RADIOLIB_CC1101_BS_LIMIT_12_5 0b00000011 // 1 0 +- 12.5 %
+
350 
+
351 // RADIOLIB_CC1101_REG_AGCCTRL2
+
352 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_0 0b00000000 // 7 6 reduce maximum available DVGA gain: no reduction (default)
+
353 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_1 0b01000000 // 7 6 disable top gain setting
+
354 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_2 0b10000000 // 7 6 disable top two gain setting
+
355 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_3 0b11000000 // 7 6 disable top three gain setting
+
356 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_0_DB 0b00000000 // 5 3 reduce maximum LNA gain by: 0 dB (default)
+
357 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_2_6_DB 0b00001000 // 5 3 2.6 dB
+
358 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_6_1_DB 0b00010000 // 5 3 6.1 dB
+
359 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_7_4_DB 0b00011000 // 5 3 7.4 dB
+
360 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_9_2_DB 0b00100000 // 5 3 9.2 dB
+
361 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_11_5_DB 0b00101000 // 5 3 11.5 dB
+
362 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_14_6_DB 0b00110000 // 5 3 14.6 dB
+
363 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_17_1_DB 0b00111000 // 5 3 17.1 dB
+
364 #define RADIOLIB_CC1101_MAGN_TARGET_24_DB 0b00000000 // 2 0 average amplitude target for filter: 24 dB
+
365 #define RADIOLIB_CC1101_MAGN_TARGET_27_DB 0b00000001 // 2 0 27 dB
+
366 #define RADIOLIB_CC1101_MAGN_TARGET_30_DB 0b00000010 // 2 0 30 dB
+
367 #define RADIOLIB_CC1101_MAGN_TARGET_33_DB 0b00000011 // 2 0 33 dB (default)
+
368 #define RADIOLIB_CC1101_MAGN_TARGET_36_DB 0b00000100 // 2 0 36 dB
+
369 #define RADIOLIB_CC1101_MAGN_TARGET_38_DB 0b00000101 // 2 0 38 dB
+
370 #define RADIOLIB_CC1101_MAGN_TARGET_40_DB 0b00000110 // 2 0 40 dB
+
371 #define RADIOLIB_CC1101_MAGN_TARGET_42_DB 0b00000111 // 2 0 42 dB
+
372 
+
373 // RADIOLIB_CC1101_REG_AGCCTRL1
+
374 #define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA2 0b00000000 // 6 6 LNA priority setting: LNA2 first
+
375 #define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA 0b01000000 // 6 6 LNA first (default)
+
376 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_OFF 0b00000000 // 5 4 RSSI relative change to assert carrier sense: disabled (default)
+
377 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_6_DB 0b00010000 // 5 4 6 dB
+
378 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_10_DB 0b00100000 // 5 4 10 dB
+
379 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_14_DB 0b00110000 // 5 4 14 dB
+
380 #define RADIOLIB_CC1101_CARRIER_SENSE_ABS_THR 0x00 // 3 0 RSSI threshold to assert carrier sense in 2s compliment, Thr = MAGN_TARGET + CARRIER_SENSE_ABS_TH [dB]
+
381 
+
382 // RADIOLIB_CC1101_REG_AGCCTRL0
+
383 #define RADIOLIB_CC1101_HYST_LEVEL_NONE 0b00000000 // 7 6 AGC hysteresis level: none
+
384 #define RADIOLIB_CC1101_HYST_LEVEL_LOW 0b01000000 // 7 6 low
+
385 #define RADIOLIB_CC1101_HYST_LEVEL_MEDIUM 0b10000000 // 7 6 medium (default)
+
386 #define RADIOLIB_CC1101_HYST_LEVEL_HIGH 0b11000000 // 7 6 high
+
387 #define RADIOLIB_CC1101_WAIT_TIME_8_SAMPLES 0b00000000 // 5 4 AGC wait time: 8 samples
+
388 #define RADIOLIB_CC1101_WAIT_TIME_16_SAMPLES 0b00010000 // 5 4 16 samples (default)
+
389 #define RADIOLIB_CC1101_WAIT_TIME_24_SAMPLES 0b00100000 // 5 4 24 samples
+
390 #define RADIOLIB_CC1101_WAIT_TIME_32_SAMPLES 0b00110000 // 5 4 32 samples
+
391 #define RADIOLIB_CC1101_AGC_FREEZE_NEVER 0b00000000 // 3 2 freeze AGC gain: never (default)
+
392 #define RADIOLIB_CC1101_AGC_FREEZE_SYNC_WORD 0b00000100 // 3 2 when sync word is found
+
393 #define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_A 0b00001000 // 3 2 manually freeze analog control
+
394 #define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_AD 0b00001100 // 3 2 manually freeze analog and digital control
+
395 #define RADIOLIB_CC1101_FILTER_LENGTH_8 0b00000000 // 1 0 averaging length for channel filter: 8 samples
+
396 #define RADIOLIB_CC1101_FILTER_LENGTH_16 0b00000001 // 1 0 16 samples (default)
+
397 #define RADIOLIB_CC1101_FILTER_LENGTH_32 0b00000010 // 1 0 32 samples
+
398 #define RADIOLIB_CC1101_FILTER_LENGTH_64 0b00000011 // 1 0 64 samples
+
399 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_4_DB 0b00000000 // 1 0 ASK/OOK decision boundary: 4 dB
+
400 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_8_DB 0b00000001 // 1 0 8 dB (default)
+
401 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_12_DB 0b00000010 // 1 0 12 dB
+
402 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_16_DB 0b00000011 // 1 0 16 dB
+
403 
+
404 // RADIOLIB_CC1101_REG_WOREVT1 + REG_WOREVT0
+
405 #define RADIOLIB_CC1101_EVENT0_TIMEOUT_MSB 0x87 // 7 0 EVENT0 timeout: t_event0 = (750 / f(XOSC)) * EVENT0_TIMEOUT * 2^(5 * WOR_RES) [s]
+
406 #define RADIOLIB_CC1101_EVENT0_TIMEOUT_LSB 0x6B // 7 0 default value for 26 MHz crystal: 1.0 s
+
407 
+
408 // RADIOLIB_CC1101_REG_WORCTRL
+
409 #define RADIOLIB_CC1101_RC_POWER_UP 0b00000000 // 7 7 power up RC oscillator
+
410 #define RADIOLIB_CC1101_RC_POWER_DOWN 0b10000000 // 7 7 power down RC oscillator
+
411 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_4 0b00000000 // 6 4 EVENT1 timeout: 4 RC periods
+
412 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_6 0b00010000 // 6 4 6 RC periods
+
413 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_8 0b00100000 // 6 4 8 RC periods
+
414 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_12 0b00110000 // 6 4 12 RC periods
+
415 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_16 0b01000000 // 6 4 16 RC periods
+
416 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_24 0b01010000 // 6 4 24 RC periods
+
417 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_32 0b01100000 // 6 4 32 RC periods
+
418 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_48 0b01110000 // 6 4 48 RC periods (default)
+
419 #define RADIOLIB_CC1101_RC_CAL_OFF 0b00000000 // 3 3 disable RC oscillator calibration
+
420 #define RADIOLIB_CC1101_RC_CAL_ON 0b00001000 // 3 3 enable RC oscillator calibration (default)
+
421 #define RADIOLIB_CC1101_WOR_RES_1 0b00000000 // 1 0 EVENT0 resolution: 1 period (default)
+
422 #define RADIOLIB_CC1101_WOR_RES_2_5 0b00000001 // 1 0 2^5 periods
+
423 #define RADIOLIB_CC1101_WOR_RES_2_10 0b00000010 // 1 0 2^10 periods
+
424 #define RADIOLIB_CC1101_WOR_RES_2_15 0b00000011 // 1 0 2^15 periods
+
425 
+
426 // RADIOLIB_CC1101_REG_FREND1
+
427 #define RADIOLIB_CC1101_LNA_CURRENT 0x01 // 7 6 front-end LNA PTAT current output adjustment
+
428 #define RADIOLIB_CC1101_LNA2MIX_CURRENT 0x01 // 5 4 front-end PTAT output adjustment
+
429 #define RADIOLIB_CC1101_LODIV_BUF_CURRENT_RX 0x01 // 3 2 Rx LO buffer current adjustment
+
430 #define RADIOLIB_CC1101_MIX_CURRENT 0x02 // 1 0 mixer current adjustment
+
431 
+
432 // RADIOLIB_CC1101_REG_FREND0
+
433 #define RADIOLIB_CC1101_LODIV_BUF_CURRENT_TX 0x01 // 5 4 Tx LO buffer current adjustment
+
434 #define RADIOLIB_CC1101_PA_POWER 0x00 // 2 0 set power amplifier power according to PATABLE
+
435 
+
436 // RADIOLIB_CC1101_REG_FSCAL3
+
437 #define RADIOLIB_CC1101_CHP_CURR_CAL_OFF 0b00000000 // 5 4 disable charge pump calibration
+
438 #define RADIOLIB_CC1101_CHP_CURR_CAL_ON 0b00100000 // 5 4 enable charge pump calibration (default)
+
439 #define RADIOLIB_CC1101_FSCAL3 0x09 // 3 0 charge pump output current: I_out = I_0 * 2^(FSCAL3/4) [A]
+
440 
+
441 // RADIOLIB_CC1101_REG_FSCAL2
+
442 #define RADIOLIB_CC1101_VCO_CORE_LOW 0b00000000 // 5 5 VCO: low (default)
+
443 #define RADIOLIB_CC1101_VCO_CORE_HIGH 0b00100000 // 5 5 high
+
444 #define RADIOLIB_CC1101_FSCAL2 0x0A // 4 0 VCO current result/override
+
445 
+
446 // RADIOLIB_CC1101_REG_FSCAL1
+
447 #define RADIOLIB_CC1101_FSCAL1 0x20 // 5 0 capacitor array setting for coarse VCO tuning
448 
-
449 // RADIOLIB_CC1101_REG_FSCAL1
-
450 #define RADIOLIB_CC1101_FSCAL1 0x20 // 5 0 capacitor array setting for coarse VCO tuning
+
449 // RADIOLIB_CC1101_REG_FSCAL0
+
450 #define RADIOLIB_CC1101_FSCAL0 0x0D // 6 0 frequency synthesizer calibration setting
451 
-
452 // RADIOLIB_CC1101_REG_FSCAL0
-
453 #define RADIOLIB_CC1101_FSCAL0 0x0D // 6 0 frequency synthesizer calibration setting
+
452 // RADIOLIB_CC1101_REG_RCCTRL1
+
453 #define RADIOLIB_CC1101_RCCTRL1 0x41 // 6 0 RC oscillator configuration
454 
-
455 // RADIOLIB_CC1101_REG_RCCTRL1
-
456 #define RADIOLIB_CC1101_RCCTRL1 0x41 // 6 0 RC oscillator configuration
+
455 // RADIOLIB_CC1101_REG_RCCTRL0
+
456 #define RADIOLIB_CC1101_RCCTRL0 0x00 // 6 0 RC oscillator configuration
457 
-
458 // RADIOLIB_CC1101_REG_RCCTRL0
-
459 #define RADIOLIB_CC1101_RCCTRL0 0x00 // 6 0 RC oscillator configuration
-
460 
-
461 // RADIOLIB_CC1101_REG_PTEST
-
462 #define RADIOLIB_CC1101_TEMP_SENS_IDLE_OFF 0x7F // 7 0 temperature sensor will not be available in idle mode (default)
-
463 #define RADIOLIB_CC1101_TEMP_SENS_IDLE_ON 0xBF // 7 0 temperature sensor will be available in idle mode
-
464 
-
465 // RADIOLIB_CC1101_REG_TEST0
-
466 #define RADIOLIB_CC1101_VCO_SEL_CAL_OFF 0b00000000 // 1 1 disable VCO selection calibration stage
-
467 #define RADIOLIB_CC1101_VCO_SEL_CAL_ON 0b00000010 // 1 1 enable VCO selection calibration stage
+
458 // RADIOLIB_CC1101_REG_PTEST
+
459 #define RADIOLIB_CC1101_TEMP_SENS_IDLE_OFF 0x7F // 7 0 temperature sensor will not be available in idle mode (default)
+
460 #define RADIOLIB_CC1101_TEMP_SENS_IDLE_ON 0xBF // 7 0 temperature sensor will be available in idle mode
+
461 
+
462 // RADIOLIB_CC1101_REG_TEST0
+
463 #define RADIOLIB_CC1101_VCO_SEL_CAL_OFF 0b00000000 // 1 1 disable VCO selection calibration stage
+
464 #define RADIOLIB_CC1101_VCO_SEL_CAL_ON 0b00000010 // 1 1 enable VCO selection calibration stage
+
465 
+
466 // RADIOLIB_CC1101_REG_PARTNUM
+
467 #define RADIOLIB_CC1101_PARTNUM 0x00
468 
-
469 // RADIOLIB_CC1101_REG_PARTNUM
-
470 #define RADIOLIB_CC1101_PARTNUM 0x00
-
471 
-
472 // RADIOLIB_CC1101_REG_VERSION
-
473 #define RADIOLIB_CC1101_VERSION_CURRENT 0x14
-
474 #define RADIOLIB_CC1101_VERSION_LEGACY 0x04
-
475 #define RADIOLIB_CC1101_VERSION_CLONE 0x17
-
476 
-
477 // RADIOLIB_CC1101_REG_MARCSTATE
-
478 #define RADIOLIB_CC1101_MARC_STATE_SLEEP 0x00 // 4 0 main radio control state: sleep
-
479 #define RADIOLIB_CC1101_MARC_STATE_IDLE 0x01 // 4 0 idle
-
480 #define RADIOLIB_CC1101_MARC_STATE_XOFF 0x02 // 4 0 XOFF
-
481 #define RADIOLIB_CC1101_MARC_STATE_VCOON_MC 0x03 // 4 0 VCOON_MC
-
482 #define RADIOLIB_CC1101_MARC_STATE_REGON_MC 0x04 // 4 0 REGON_MC
-
483 #define RADIOLIB_CC1101_MARC_STATE_MANCAL 0x05 // 4 0 MANCAL
-
484 #define RADIOLIB_CC1101_MARC_STATE_VCOON 0x06 // 4 0 VCOON
-
485 #define RADIOLIB_CC1101_MARC_STATE_REGON 0x07 // 4 0 REGON
-
486 #define RADIOLIB_CC1101_MARC_STATE_STARTCAL 0x08 // 4 0 STARTCAL
-
487 #define RADIOLIB_CC1101_MARC_STATE_BWBOOST 0x09 // 4 0 BWBOOST
-
488 #define RADIOLIB_CC1101_MARC_STATE_FS_LOCK 0x0A // 4 0 FS_LOCK
-
489 #define RADIOLIB_CC1101_MARC_STATE_IFADCON 0x0B // 4 0 IFADCON
-
490 #define RADIOLIB_CC1101_MARC_STATE_ENDCAL 0x0C // 4 0 ENDCAL
-
491 #define RADIOLIB_CC1101_MARC_STATE_RX 0x0D // 4 0 RX
-
492 #define RADIOLIB_CC1101_MARC_STATE_RX_END 0x0E // 4 0 RX_END
-
493 #define RADIOLIB_CC1101_MARC_STATE_RX_RST 0x0F // 4 0 RX_RST
-
494 #define RADIOLIB_CC1101_MARC_STATE_TXRX_SWITCH 0x10 // 4 0 TXRX_SWITCH
-
495 #define RADIOLIB_CC1101_MARC_STATE_RXFIFO_OVERFLOW 0x11 // 4 0 RXFIFO_OVERFLOW
-
496 #define RADIOLIB_CC1101_MARC_STATE_FSTXON 0x12 // 4 0 FSTXON
-
497 #define RADIOLIB_CC1101_MARC_STATE_TX 0x13 // 4 0 TX
-
498 #define RADIOLIB_CC1101_MARC_STATE_TX_END 0x14 // 4 0 TX_END
-
499 #define RADIOLIB_CC1101_MARC_STATE_RXTX_SWITCH 0x15 // 4 0 RXTX_SWITCH
-
500 #define RADIOLIB_CC1101_MARC_STATE_TXFIFO_UNDERFLOW 0x16 // 4 0 TXFIFO_UNDERFLOW
-
501 
-
502 // RADIOLIB_CC1101_REG_WORTIME1 + REG_WORTIME0
-
503 #define RADIOLIB_CC1101_WORTIME_MSB 0x00 // 7 0 WOR timer value
-
504 #define RADIOLIB_CC1101_WORTIME_LSB 0x00 // 7 0
-
505 
-
506 // RADIOLIB_CC1101_REG_PKTSTATUS
-
507 #define RADIOLIB_CC1101_CRC_OK 0b10000000 // 7 7 CRC check passed
-
508 #define RADIOLIB_CC1101_CRC_ERROR 0b00000000 // 7 7 CRC check failed
-
509 #define RADIOLIB_CC1101_CS 0b01000000 // 6 6 carrier sense
-
510 #define RADIOLIB_CC1101_PQT_REACHED 0b00100000 // 5 5 preamble quality reached
-
511 #define RADIOLIB_CC1101_CCA 0b00010000 // 4 4 channel clear
-
512 #define RADIOLIB_CC1101_SFD 0b00001000 // 3 3 start of frame delimiter - sync word received
-
513 #define RADIOLIB_CC1101_GDO2_ACTIVE 0b00000100 // 2 2 GDO2 is active/asserted
-
514 #define RADIOLIB_CC1101_GDO0_ACTIVE 0b00000001 // 0 0 GDO0 is active/asserted
-
515 
-
516 // RadioLib defaults
-
517 #define RADIOLIB_CC1101_DEFAULT_FREQ 434.0
-
518 #define RADIOLIB_CC1101_DEFAULT_BR 4.8
-
519 #define RADIOLIB_CC1101_DEFAULT_FREQDEV 5.0
-
520 #define RADIOLIB_CC1101_DEFAULT_RXBW 58.0
-
521 #define RADIOLIB_CC1101_DEFAULT_POWER 10
-
522 #define RADIOLIB_CC1101_DEFAULT_PREAMBLELEN 16
-
523 #define RADIOLIB_CC1101_DEFAULT_SW {0x12, 0xAD}
-
524 #define RADIOLIB_CC1101_DEFAULT_SW_LEN 2
-
525 
-
530 class CC1101: public PhysicalLayer {
-
531  public:
-
532  // introduce PhysicalLayer overloads
-
533  using PhysicalLayer::transmit;
-
534  using PhysicalLayer::receive;
-
535  using PhysicalLayer::startTransmit;
-
536  using PhysicalLayer::readData;
-
537 
-
542  // cppcheck-suppress noExplicitConstructor
-
543  CC1101(Module* module);
-
544 
-
545  // basic methods
-
546 
-
557  int16_t begin(
-
558  float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
-
559  float br = RADIOLIB_CC1101_DEFAULT_BR,
-
560  float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
-
561  float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
-
562  int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
-
563  uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
-
564 
-
575  int16_t beginFSK4(
-
576  float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
-
577  float br = RADIOLIB_CC1101_DEFAULT_BR,
-
578  float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
-
579  float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
-
580  int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
-
581  uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
-
582 
-
586  void reset();
-
587 
-
596  int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
-
597 
-
605  int16_t receive(uint8_t* data, size_t len) override;
-
606 
-
611  int16_t standby() override;
-
612 
-
618  int16_t standby(uint8_t mode) override;
-
619 
-
625  int16_t transmitDirect(uint32_t frf = 0) override;
-
626 
-
631  int16_t receiveDirect() override;
-
632 
-
638  int16_t transmitDirectAsync(uint32_t frf = 0);
-
639 
-
644  int16_t receiveDirectAsync();
-
645 
-
650  int16_t packetMode();
-
651 
-
652  // interrupt methods
-
653 
-
659  void setGdo0Action(void (*func)(void), uint32_t dir);
-
660 
-
664  void clearGdo0Action();
-
665 
-
671  void setGdo2Action(void (*func)(void), uint32_t dir);
-
672 
-
676  void clearGdo2Action();
-
677 
-
682  void setPacketReceivedAction(void (*func)(void)) override;
-
683 
-
687  void clearPacketReceivedAction() override;
-
688 
-
693  void setPacketSentAction(void (*func)(void)) override;
-
694 
-
698  void clearPacketSentAction() override;
-
699 
-
708  int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
-
709 
-
714  int16_t finishTransmit() override;
-
715 
-
720  int16_t startReceive() override;
-
721 
-
730  int16_t startReceive(uint32_t timeout, uint32_t irqFlags, uint32_t irqMask, size_t len) override;
-
731 
-
740  int16_t readData(uint8_t* data, size_t len) override;
-
741 
-
742  // configuration methods
-
743 
-
750  int16_t setFrequency(float freq) override;
-
751 
-
757  int16_t setBitRate(float br) override;
-
758 
-
764  int16_t setBitRateTolerance(uint8_t brt);
-
765 
-
772  int16_t setRxBandwidth(float rxBw);
-
773 
-
780  int16_t autoSetRxBandwidth();
-
781 
-
787  int16_t setFrequencyDeviation(float freqDev) override;
-
788 
-
794  int16_t getFrequencyDeviation(float *freqDev);
-
795 
-
801  int16_t setOutputPower(int8_t pwr) override;
-
802 
-
810  int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
-
811 
-
819  int16_t checkOutputPower(int8_t power, int8_t* clipped, uint8_t* raw);
-
820 
-
829  int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
830 
-
839  int16_t setSyncWord(uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
840 
-
847  int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold);
-
848 
-
856  int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
-
857 
-
862  int16_t disableAddressFiltering();
-
863 
-
869  int16_t setOOK(bool enableOOK);
-
870 
-
876  float getRSSI() override;
-
877 
-
882  uint8_t getLQI() const;
-
883 
-
889  size_t getPacketLength(bool update = true) override;
-
890 
-
896  int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
-
897 
-
903  int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
-
904 
-
911  int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
912 
-
918  int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
-
919 
-
925  int16_t setCrcFiltering(bool enable = true);
-
926 
-
933  int16_t setPromiscuousMode(bool enable = true, bool requireCarrierSense = false);
-
934 
-
940  bool getPromiscuousMode();
-
941 
-
948  int16_t setDataShaping(uint8_t sh) override;
-
949 
-
956  int16_t setEncoding(uint8_t encoding) override;
+
469 // RADIOLIB_CC1101_REG_VERSION
+
470 #define RADIOLIB_CC1101_VERSION_CURRENT 0x14
+
471 #define RADIOLIB_CC1101_VERSION_LEGACY 0x04
+
472 #define RADIOLIB_CC1101_VERSION_CLONE 0x17
+
473 
+
474 // RADIOLIB_CC1101_REG_MARCSTATE
+
475 #define RADIOLIB_CC1101_MARC_STATE_SLEEP 0x00 // 4 0 main radio control state: sleep
+
476 #define RADIOLIB_CC1101_MARC_STATE_IDLE 0x01 // 4 0 idle
+
477 #define RADIOLIB_CC1101_MARC_STATE_XOFF 0x02 // 4 0 XOFF
+
478 #define RADIOLIB_CC1101_MARC_STATE_VCOON_MC 0x03 // 4 0 VCOON_MC
+
479 #define RADIOLIB_CC1101_MARC_STATE_REGON_MC 0x04 // 4 0 REGON_MC
+
480 #define RADIOLIB_CC1101_MARC_STATE_MANCAL 0x05 // 4 0 MANCAL
+
481 #define RADIOLIB_CC1101_MARC_STATE_VCOON 0x06 // 4 0 VCOON
+
482 #define RADIOLIB_CC1101_MARC_STATE_REGON 0x07 // 4 0 REGON
+
483 #define RADIOLIB_CC1101_MARC_STATE_STARTCAL 0x08 // 4 0 STARTCAL
+
484 #define RADIOLIB_CC1101_MARC_STATE_BWBOOST 0x09 // 4 0 BWBOOST
+
485 #define RADIOLIB_CC1101_MARC_STATE_FS_LOCK 0x0A // 4 0 FS_LOCK
+
486 #define RADIOLIB_CC1101_MARC_STATE_IFADCON 0x0B // 4 0 IFADCON
+
487 #define RADIOLIB_CC1101_MARC_STATE_ENDCAL 0x0C // 4 0 ENDCAL
+
488 #define RADIOLIB_CC1101_MARC_STATE_RX 0x0D // 4 0 RX
+
489 #define RADIOLIB_CC1101_MARC_STATE_RX_END 0x0E // 4 0 RX_END
+
490 #define RADIOLIB_CC1101_MARC_STATE_RX_RST 0x0F // 4 0 RX_RST
+
491 #define RADIOLIB_CC1101_MARC_STATE_TXRX_SWITCH 0x10 // 4 0 TXRX_SWITCH
+
492 #define RADIOLIB_CC1101_MARC_STATE_RXFIFO_OVERFLOW 0x11 // 4 0 RXFIFO_OVERFLOW
+
493 #define RADIOLIB_CC1101_MARC_STATE_FSTXON 0x12 // 4 0 FSTXON
+
494 #define RADIOLIB_CC1101_MARC_STATE_TX 0x13 // 4 0 TX
+
495 #define RADIOLIB_CC1101_MARC_STATE_TX_END 0x14 // 4 0 TX_END
+
496 #define RADIOLIB_CC1101_MARC_STATE_RXTX_SWITCH 0x15 // 4 0 RXTX_SWITCH
+
497 #define RADIOLIB_CC1101_MARC_STATE_TXFIFO_UNDERFLOW 0x16 // 4 0 TXFIFO_UNDERFLOW
+
498 
+
499 // RADIOLIB_CC1101_REG_WORTIME1 + REG_WORTIME0
+
500 #define RADIOLIB_CC1101_WORTIME_MSB 0x00 // 7 0 WOR timer value
+
501 #define RADIOLIB_CC1101_WORTIME_LSB 0x00 // 7 0
+
502 
+
503 // RADIOLIB_CC1101_REG_PKTSTATUS
+
504 #define RADIOLIB_CC1101_CRC_OK 0b10000000 // 7 7 CRC check passed
+
505 #define RADIOLIB_CC1101_CRC_ERROR 0b00000000 // 7 7 CRC check failed
+
506 #define RADIOLIB_CC1101_CS 0b01000000 // 6 6 carrier sense
+
507 #define RADIOLIB_CC1101_PQT_REACHED 0b00100000 // 5 5 preamble quality reached
+
508 #define RADIOLIB_CC1101_CCA 0b00010000 // 4 4 channel clear
+
509 #define RADIOLIB_CC1101_SFD 0b00001000 // 3 3 start of frame delimiter - sync word received
+
510 #define RADIOLIB_CC1101_GDO2_ACTIVE 0b00000100 // 2 2 GDO2 is active/asserted
+
511 #define RADIOLIB_CC1101_GDO0_ACTIVE 0b00000001 // 0 0 GDO0 is active/asserted
+
512 
+
513 // RadioLib defaults
+
514 #define RADIOLIB_CC1101_DEFAULT_FREQ 434.0
+
515 #define RADIOLIB_CC1101_DEFAULT_BR 4.8
+
516 #define RADIOLIB_CC1101_DEFAULT_FREQDEV 5.0
+
517 #define RADIOLIB_CC1101_DEFAULT_RXBW 58.0
+
518 #define RADIOLIB_CC1101_DEFAULT_POWER 10
+
519 #define RADIOLIB_CC1101_DEFAULT_PREAMBLELEN 16
+
520 #define RADIOLIB_CC1101_DEFAULT_SW {0x12, 0xAD}
+
521 #define RADIOLIB_CC1101_DEFAULT_SW_LEN 2
+
522 
+
527 class CC1101: public PhysicalLayer {
+
528  public:
+
529  // introduce PhysicalLayer overloads
+
530  using PhysicalLayer::transmit;
+
531  using PhysicalLayer::receive;
+
532  using PhysicalLayer::startTransmit;
+
533  using PhysicalLayer::readData;
+
534 
+
539  // cppcheck-suppress noExplicitConstructor
+
540  CC1101(Module* module);
+
541 
+
542  // basic methods
+
543 
+
554  int16_t begin(
+
555  float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
+
556  float br = RADIOLIB_CC1101_DEFAULT_BR,
+
557  float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
+
558  float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
+
559  int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
+
560  uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
+
561 
+
572  int16_t beginFSK4(
+
573  float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
+
574  float br = RADIOLIB_CC1101_DEFAULT_BR,
+
575  float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
+
576  float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
+
577  int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
+
578  uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
+
579 
+
583  void reset();
+
584 
+
593  int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
+
594 
+
602  int16_t receive(uint8_t* data, size_t len) override;
+
603 
+
608  int16_t standby() override;
+
609 
+
615  int16_t standby(uint8_t mode) override;
+
616 
+
622  int16_t transmitDirect(uint32_t frf = 0) override;
+
623 
+
628  int16_t receiveDirect() override;
+
629 
+
635  int16_t transmitDirectAsync(uint32_t frf = 0);
+
636 
+
641  int16_t receiveDirectAsync();
+
642 
+
647  int16_t packetMode();
+
648 
+
649  // interrupt methods
+
650 
+
656  void setGdo0Action(void (*func)(void), uint32_t dir);
+
657 
+
661  void clearGdo0Action();
+
662 
+
668  void setGdo2Action(void (*func)(void), uint32_t dir);
+
669 
+
673  void clearGdo2Action();
+
674 
+
679  void setPacketReceivedAction(void (*func)(void)) override;
+
680 
+
684  void clearPacketReceivedAction() override;
+
685 
+
690  void setPacketSentAction(void (*func)(void)) override;
+
691 
+
695  void clearPacketSentAction() override;
+
696 
+
705  int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
+
706 
+
711  int16_t finishTransmit() override;
+
712 
+
717  int16_t startReceive() override;
+
718 
+
727  int16_t startReceive(uint32_t timeout, uint32_t irqFlags, uint32_t irqMask, size_t len) override;
+
728 
+
737  int16_t readData(uint8_t* data, size_t len) override;
+
738 
+
739  // configuration methods
+
740 
+
747  int16_t setFrequency(float freq) override;
+
748 
+
754  int16_t setBitRate(float br) override;
+
755 
+
761  int16_t setBitRateTolerance(uint8_t brt);
+
762 
+
769  int16_t setRxBandwidth(float rxBw);
+
770 
+
777  int16_t autoSetRxBandwidth();
+
778 
+
784  int16_t setFrequencyDeviation(float freqDev) override;
+
785 
+
791  int16_t getFrequencyDeviation(float *freqDev);
+
792 
+
798  int16_t setOutputPower(int8_t pwr) override;
+
799 
+
807  int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
+
808 
+
816  int16_t checkOutputPower(int8_t power, int8_t* clipped, uint8_t* raw);
+
817 
+
826  int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
827 
+
836  int16_t setSyncWord(uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
837 
+
844  int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold);
+
845 
+
853  int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
+
854 
+
859  int16_t disableAddressFiltering();
+
860 
+
866  int16_t setOOK(bool enableOOK);
+
867 
+
873  float getRSSI() override;
+
874 
+
879  uint8_t getLQI() const;
+
880 
+
886  size_t getPacketLength(bool update = true) override;
+
887 
+
893  int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
+
894 
+
900  int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
+
901 
+
908  int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
909 
+
915  int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
+
916 
+
922  int16_t setCrcFiltering(bool enable = true);
+
923 
+
930  int16_t setPromiscuousMode(bool enable = true, bool requireCarrierSense = false);
+
931 
+
937  bool getPromiscuousMode();
+
938 
+
945  int16_t setDataShaping(uint8_t sh) override;
+
946 
+
953  int16_t setEncoding(uint8_t encoding) override;
+
954 
+
956  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
957 
-
959  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
+
959  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
960 
-
962  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
-
963 
-
968  uint8_t randomByte() override;
-
969 
-
975  int16_t getChipVersion();
-
976 
-
977  #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
-
982  void setDirectAction(void (*func)(void)) override;
-
983 
-
988  void readBit(uint32_t pin) override;
-
989  #endif
-
990 
-
997  int16_t setDIOMapping(uint32_t pin, uint32_t value) override;
-
998 
-
999  #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
-
1000  protected:
-
1001  #endif
-
1002  Module* getMod() override;
-
1003 
-
1004  // SPI read overrides to set bit for burst write and status registers access
-
1005  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
-
1006  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
-
1007  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
-
1008  uint8_t SPIreadRegister(uint8_t reg);
-
1009  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, size_t len);
-
1010  void SPIwriteRegister(uint8_t reg, uint8_t data);
-
1011 
-
1012  void SPIsendCommand(uint8_t cmd);
-
1013 
-
1014  #if !RADIOLIB_GODMODE
-
1015  private:
-
1016  #endif
-
1017  Module* mod;
-
1018 
-
1019  float frequency = RADIOLIB_CC1101_DEFAULT_FREQ;
-
1020  float bitRate = RADIOLIB_CC1101_DEFAULT_BR;
-
1021  uint8_t rawRSSI = 0;
-
1022  uint8_t rawLQI = 0;
-
1023  uint8_t modulation = RADIOLIB_CC1101_MOD_FORMAT_2_FSK;
-
1024 
-
1025  size_t packetLength = 0;
-
1026  bool packetLengthQueried = false;
-
1027  uint8_t packetLengthConfig = RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE;
-
1028 
-
1029  bool promiscuous = false;
-
1030  bool crcOn = true;
-
1031  bool directModeEnabled = false;
-
1032 
-
1033  int8_t power = RADIOLIB_CC1101_DEFAULT_POWER;
-
1034 
-
1035  int16_t beginCommon(float freq, float br, float freqDev, float rxBw, int8_t pwr, uint8_t preambleLength);
-
1036  int16_t config();
-
1037  int16_t transmitDirect(bool sync, uint32_t frf);
-
1038  int16_t receiveDirect(bool sync);
-
1039  int16_t directMode(bool sync);
-
1040  static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
-
1041  int16_t setPacketMode(uint8_t mode, uint16_t len);
-
1042 };
-
1043 
-
1044 #endif
-
Control class for CC1101 module.
Definition: CC1101.h:530
+
965  uint8_t randomByte() override;
+
966 
+
972  int16_t getChipVersion();
+
973 
+
974  #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
+
979  void setDirectAction(void (*func)(void)) override;
+
980 
+
985  void readBit(uint32_t pin) override;
+
986  #endif
+
987 
+
994  int16_t setDIOMapping(uint32_t pin, uint32_t value) override;
+
995 
+
996  #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
+
997  protected:
+
998  #endif
+
999  Module* getMod() override;
+
1000 
+
1001  // SPI read overrides to set bit for burst write and status registers access
+
1002  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
+
1003  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
+
1004  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
+
1005  uint8_t SPIreadRegister(uint8_t reg);
+
1006  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, size_t len);
+
1007  void SPIwriteRegister(uint8_t reg, uint8_t data);
+
1008 
+
1009  void SPIsendCommand(uint8_t cmd);
+
1010 
+
1011  #if !RADIOLIB_GODMODE
+
1012  private:
+
1013  #endif
+
1014  Module* mod;
+
1015 
+
1016  float frequency = RADIOLIB_CC1101_DEFAULT_FREQ;
+
1017  float bitRate = RADIOLIB_CC1101_DEFAULT_BR;
+
1018  uint8_t rawRSSI = 0;
+
1019  uint8_t rawLQI = 0;
+
1020  uint8_t modulation = RADIOLIB_CC1101_MOD_FORMAT_2_FSK;
+
1021 
+
1022  size_t packetLength = 0;
+
1023  bool packetLengthQueried = false;
+
1024  uint8_t packetLengthConfig = RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE;
+
1025 
+
1026  bool promiscuous = false;
+
1027  bool crcOn = true;
+
1028  bool directModeEnabled = false;
+
1029 
+
1030  int8_t power = RADIOLIB_CC1101_DEFAULT_POWER;
+
1031 
+
1032  int16_t beginCommon(float freq, float br, float freqDev, float rxBw, int8_t pwr, uint8_t preambleLength);
+
1033  int16_t config();
+
1034  int16_t transmitDirect(bool sync, uint32_t frf);
+
1035  int16_t receiveDirect(bool sync);
+
1036  int16_t directMode(bool sync);
+
1037  static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
+
1038  int16_t setPacketMode(uint8_t mode, uint16_t len);
+
1039 };
+
1040 
+
1041 #endif
+
Control class for CC1101 module.
Definition: CC1101.h:527
void clearPacketReceivedAction() override
Clears interrupt service routine to call when a packet is received.
Definition: CC1101.cpp:200
int16_t setFrequencyDeviation(float freqDev) override
Sets frequency deviation. Allowed values range from 1.587 to 380.8 kHz.
Definition: CC1101.cpp:456
void readBit(uint32_t pin) override
Function to read and process data bit in direct reception mode.
Definition: CC1101.cpp:927