diff --git a/_c_c1101_8h_source.html b/_c_c1101_8h_source.html index 3eef88f9..0bb8d3d6 100644 --- a/_c_c1101_8h_source.html +++ b/_c_c1101_8h_source.html @@ -96,756 +96,755 @@ $(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 255
+
11 #define RADIOLIB_CC1101_MAX_PACKET_LENGTH 63
12 #define RADIOLIB_CC1101_CRYSTAL_FREQ 26.0
13 #define RADIOLIB_CC1101_DIV_EXPONENT 16
-
14 #define RADIOLIB_CC1101_FIFO_SIZE 64
-
15 
-
16 // CC1101 SPI commands
-
17 #define RADIOLIB_CC1101_CMD_READ 0b10000000
-
18 #define RADIOLIB_CC1101_CMD_WRITE 0b00000000
-
19 #define RADIOLIB_CC1101_CMD_BURST 0b01000000
-
20 #define RADIOLIB_CC1101_CMD_ACCESS_STATUS_REG 0b01000000
-
21 #define RADIOLIB_CC1101_CMD_FIFO_RX 0b10000000
-
22 #define RADIOLIB_CC1101_CMD_FIFO_TX 0b00000000
-
23 #define RADIOLIB_CC1101_CMD_RESET 0x30
-
24 #define RADIOLIB_CC1101_CMD_FSTXON 0x31
-
25 #define RADIOLIB_CC1101_CMD_XOFF 0x32
-
26 #define RADIOLIB_CC1101_CMD_CAL 0x33
-
27 #define RADIOLIB_CC1101_CMD_RX 0x34
-
28 #define RADIOLIB_CC1101_CMD_TX 0x35
-
29 #define RADIOLIB_CC1101_CMD_IDLE 0x36
-
30 #define RADIOLIB_CC1101_CMD_WOR 0x38
-
31 #define RADIOLIB_CC1101_CMD_POWER_DOWN 0x39
-
32 #define RADIOLIB_CC1101_CMD_FLUSH_RX 0x3A
-
33 #define RADIOLIB_CC1101_CMD_FLUSH_TX 0x3B
-
34 #define RADIOLIB_CC1101_CMD_WOR_RESET 0x3C
-
35 #define RADIOLIB_CC1101_CMD_NOP 0x3D
-
36 
-
37 // CC1101 register map
-
38 #define RADIOLIB_CC1101_REG_IOCFG2 0x00
-
39 #define RADIOLIB_CC1101_REG_IOCFG1 0x01
-
40 #define RADIOLIB_CC1101_REG_IOCFG0 0x02
-
41 #define RADIOLIB_CC1101_REG_FIFOTHR 0x03
-
42 #define RADIOLIB_CC1101_REG_SYNC1 0x04
-
43 #define RADIOLIB_CC1101_REG_SYNC0 0x05
-
44 #define RADIOLIB_CC1101_REG_PKTLEN 0x06
-
45 #define RADIOLIB_CC1101_REG_PKTCTRL1 0x07
-
46 #define RADIOLIB_CC1101_REG_PKTCTRL0 0x08
-
47 #define RADIOLIB_CC1101_REG_ADDR 0x09
-
48 #define RADIOLIB_CC1101_REG_CHANNR 0x0A
-
49 #define RADIOLIB_CC1101_REG_FSCTRL1 0x0B
-
50 #define RADIOLIB_CC1101_REG_FSCTRL0 0x0C
-
51 #define RADIOLIB_CC1101_REG_FREQ2 0x0D
-
52 #define RADIOLIB_CC1101_REG_FREQ1 0x0E
-
53 #define RADIOLIB_CC1101_REG_FREQ0 0x0F
-
54 #define RADIOLIB_CC1101_REG_MDMCFG4 0x10
-
55 #define RADIOLIB_CC1101_REG_MDMCFG3 0x11
-
56 #define RADIOLIB_CC1101_REG_MDMCFG2 0x12
-
57 #define RADIOLIB_CC1101_REG_MDMCFG1 0x13
-
58 #define RADIOLIB_CC1101_REG_MDMCFG0 0x14
-
59 #define RADIOLIB_CC1101_REG_DEVIATN 0x15
-
60 #define RADIOLIB_CC1101_REG_MCSM2 0x16
-
61 #define RADIOLIB_CC1101_REG_MCSM1 0x17
-
62 #define RADIOLIB_CC1101_REG_MCSM0 0x18
-
63 #define RADIOLIB_CC1101_REG_FOCCFG 0x19
-
64 #define RADIOLIB_CC1101_REG_BSCFG 0x1A
-
65 #define RADIOLIB_CC1101_REG_AGCCTRL2 0x1B
-
66 #define RADIOLIB_CC1101_REG_AGCCTRL1 0x1C
-
67 #define RADIOLIB_CC1101_REG_AGCCTRL0 0x1D
-
68 #define RADIOLIB_CC1101_REG_WOREVT1 0x1E
-
69 #define RADIOLIB_CC1101_REG_WOREVT0 0x1F
-
70 #define RADIOLIB_CC1101_REG_WORCTRL 0x20
-
71 #define RADIOLIB_CC1101_REG_FREND1 0x21
-
72 #define RADIOLIB_CC1101_REG_FREND0 0x22
-
73 #define RADIOLIB_CC1101_REG_FSCAL3 0x23
-
74 #define RADIOLIB_CC1101_REG_FSCAL2 0x24
-
75 #define RADIOLIB_CC1101_REG_FSCAL1 0x25
-
76 #define RADIOLIB_CC1101_REG_FSCAL0 0x26
-
77 #define RADIOLIB_CC1101_REG_RCCTRL1 0x27
-
78 #define RADIOLIB_CC1101_REG_RCCTRL0 0x28
-
79 #define RADIOLIB_CC1101_REG_FSTEST 0x29
-
80 #define RADIOLIB_CC1101_REG_PTEST 0x2A
-
81 #define RADIOLIB_CC1101_REG_AGCTEST 0x2B
-
82 #define RADIOLIB_CC1101_REG_TEST2 0x2C
-
83 #define RADIOLIB_CC1101_REG_TEST1 0x2D
-
84 #define RADIOLIB_CC1101_REG_TEST0 0x2E
-
85 #define RADIOLIB_CC1101_REG_PARTNUM 0x30
-
86 #define RADIOLIB_CC1101_REG_VERSION 0x31
-
87 #define RADIOLIB_CC1101_REG_FREQEST 0x32
-
88 #define RADIOLIB_CC1101_REG_LQI 0x33
-
89 #define RADIOLIB_CC1101_REG_RSSI 0x34
-
90 #define RADIOLIB_CC1101_REG_MARCSTATE 0x35
-
91 #define RADIOLIB_CC1101_REG_WORTIME1 0x36
-
92 #define RADIOLIB_CC1101_REG_WORTIME0 0x37
-
93 #define RADIOLIB_CC1101_REG_PKTSTATUS 0x38
-
94 #define RADIOLIB_CC1101_REG_VCO_VC_DAC 0x39
-
95 #define RADIOLIB_CC1101_REG_TXBYTES 0x3A
-
96 #define RADIOLIB_CC1101_REG_RXBYTES 0x3B
-
97 #define RADIOLIB_CC1101_REG_RCCTRL1_STATUS 0x3C
-
98 #define RADIOLIB_CC1101_REG_RCCTRL0_STATUS 0x3D
-
99 #define RADIOLIB_CC1101_REG_PATABLE 0x3E
-
100 #define RADIOLIB_CC1101_REG_FIFO 0x3F
-
101 
-
102 // status byte (returned during SPI transactions) MSB LSB DESCRIPTION
-
103 #define RADIOLIB_CC1101_STATUS_CHIP_READY 0b00000000 // 7 7 chip ready
-
104 #define RADIOLIB_CC1101_STATUS_CHIP_NOT_READY 0b10000000 // 7 7 chip not ready (power/crystal not stable)
-
105 #define RADIOLIB_CC1101_STATUS_IDLE 0b00000000 // 6 4 idle
-
106 #define RADIOLIB_CC1101_STATUS_RX 0b00010000 // 6 4 Rx
-
107 #define RADIOLIB_CC1101_STATUS_TX 0b00100000 // 6 4 Tx
-
108 #define RADIOLIB_CC1101_STATUS_FSTXON 0b00110000 // 6 4 Fast Tx ready
-
109 #define RADIOLIB_CC1101_STATUS_CALIBRATE 0b01000000 // 6 4 synthesizer calibration running
-
110 #define RADIOLIB_CC1101_STATUS_SETTLING 0b01010000 // 6 4 PLL settling
-
111 #define RADIOLIB_CC1101_STATUS_RXFIFO_OVERFLOW 0b01100000 // 6 4 Rx FIFO overflow
-
112 #define RADIOLIB_CC1101_STATUS_TXFIFO_UNDERFLOW 0b01110000 // 6 4 Tx FIFO underflow
-
113 
-
114 // RADIOLIB_CC1101_REG_IOCFG2
-
115 #define RADIOLIB_CC1101_GDO2_NORM 0b00000000 // 6 6 GDO2 output: active high (default)
-
116 #define RADIOLIB_CC1101_GDO2_INV 0b01000000 // 6 6 active low
-
117 
-
118 // RADIOLIB_CC1101_REG_IOCFG1
-
119 #define RADIOLIB_CC1101_GDO1_DS_LOW 0b00000000 // 7 7 GDO1 output drive strength: low (default)
-
120 #define RADIOLIB_CC1101_GDO1_DS_HIGH 0b10000000 // 7 7 high
-
121 #define RADIOLIB_CC1101_GDO1_NORM 0b00000000 // 6 6 GDO1 output: active high (default)
-
122 #define RADIOLIB_CC1101_GDO1_INV 0b01000000 // 6 6 active low
-
123 
-
124 // RADIOLIB_CC1101_REG_IOCFG0
-
125 #define RADIOLIB_CC1101_GDO0_TEMP_SENSOR_OFF 0b00000000 // 7 7 analog temperature sensor output: disabled (default)
-
126 #define RADIOLIB_CC1101_GDO0_TEMP_SENSOR_ON 0b10000000 // 7 7 enabled
-
127 #define RADIOLIB_CC1101_GDO0_NORM 0b00000000 // 6 6 GDO0 output: active high (default)
-
128 #define RADIOLIB_CC1101_GDO0_INV 0b01000000 // 6 6 active low
-
129 
-
130 // RADIOLIB_CC1101_REG_IOCFG2 + REG_IOCFG1 + REG_IOCFG0
-
131 #define RADIOLIB_CC1101_GDOX_RX_FIFO_FULL 0x00 // 5 0 Rx FIFO full or above threshold
-
132 #define RADIOLIB_CC1101_GDOX_RX_FIFO_FULL_OR_PKT_END 0x01 // 5 0 Rx FIFO full or above threshold or reached packet end
-
133 #define RADIOLIB_CC1101_GDOX_TX_FIFO_ABOVE_THR 0x02 // 5 0 Tx FIFO above threshold
-
134 #define RADIOLIB_CC1101_GDOX_TX_FIFO_FULL 0x03 // 5 0 Tx FIFO full
-
135 #define RADIOLIB_CC1101_GDOX_RX_FIFO_OVERFLOW 0x04 // 5 0 Rx FIFO overflowed
-
136 #define RADIOLIB_CC1101_GDOX_TX_FIFO_UNDERFLOW 0x05 // 5 0 Tx FIFO underflowed
-
137 #define RADIOLIB_CC1101_GDOX_SYNC_WORD_SENT_OR_PKT_RECEIVED 0x06 // 5 0 sync word was sent or packet was received
-
138 #define RADIOLIB_CC1101_GDOX_PKT_RECEIVED_CRC_OK 0x07 // 5 0 packet received and CRC check passed
-
139 #define RADIOLIB_CC1101_GDOX_PREAMBLE_QUALITY_REACHED 0x08 // 5 0 received preamble quality is above threshold
-
140 #define RADIOLIB_CC1101_GDOX_CHANNEL_CLEAR 0x09 // 5 0 RSSI level below threshold (channel is clear)
-
141 #define RADIOLIB_CC1101_GDOX_PLL_LOCKED 0x0A // 5 0 PLL is locked
-
142 #define RADIOLIB_CC1101_GDOX_SERIAL_CLOCK 0x0B // 5 0 serial data clock
-
143 #define RADIOLIB_CC1101_GDOX_SERIAL_DATA_SYNC 0x0C // 5 0 serial data output in: synchronous mode
-
144 #define RADIOLIB_CC1101_GDOX_SERIAL_DATA_ASYNC 0x0D // 5 0 asynchronous mode
-
145 #define RADIOLIB_CC1101_GDOX_CARRIER_SENSE 0x0E // 5 0 RSSI above threshold
-
146 #define RADIOLIB_CC1101_GDOX_CRC_OK 0x0F // 5 0 CRC check passed
-
147 #define RADIOLIB_CC1101_GDOX_RX_HARD_DATA1 0x16 // 5 0 direct access to demodulated data
-
148 #define RADIOLIB_CC1101_GDOX_RX_HARD_DATA0 0x17 // 5 0 direct access to demodulated data
-
149 #define RADIOLIB_CC1101_GDOX_PA_PD 0x1B // 5 0 power amplifier circuit is powered down
-
150 #define RADIOLIB_CC1101_GDOX_LNA_PD 0x1C // 5 0 low-noise amplifier circuit is powered down
-
151 #define RADIOLIB_CC1101_GDOX_RX_SYMBOL_TICK 0x1D // 5 0 direct access to symbol tick of received data
-
152 #define RADIOLIB_CC1101_GDOX_WOR_EVNT0 0x24 // 5 0 wake-on-radio event 0
-
153 #define RADIOLIB_CC1101_GDOX_WOR_EVNT1 0x25 // 5 0 wake-on-radio event 1
-
154 #define RADIOLIB_CC1101_GDOX_CLK_256 0x26 // 5 0 256 Hz clock
-
155 #define RADIOLIB_CC1101_GDOX_CLK_32K 0x27 // 5 0 32 kHz clock
-
156 #define RADIOLIB_CC1101_GDOX_CHIP_RDYN 0x29 // 5 0 (default for GDO2)
-
157 #define RADIOLIB_CC1101_GDOX_XOSC_STABLE 0x2B // 5 0
-
158 #define RADIOLIB_CC1101_GDOX_HIGH_Z 0x2E // 5 0 high impedance state (default for GDO1)
-
159 #define RADIOLIB_CC1101_GDOX_HW_TO_0 0x2F // 5 0
-
160 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_1 0x30 // 5 0 crystal oscillator clock: f = f(XOSC)/1
-
161 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_1_5 0x31 // 5 0 f = f(XOSC)/1.5
-
162 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_2 0x32 // 5 0 f = f(XOSC)/2
-
163 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_3 0x33 // 5 0 f = f(XOSC)/3
-
164 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_4 0x34 // 5 0 f = f(XOSC)/4
-
165 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_6 0x35 // 5 0 f = f(XOSC)/6
-
166 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_8 0x36 // 5 0 f = f(XOSC)/8
-
167 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_12 0x37 // 5 0 f = f(XOSC)/12
-
168 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_16 0x38 // 5 0 f = f(XOSC)/16
-
169 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_24 0x39 // 5 0 f = f(XOSC)/24
-
170 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_32 0x3A // 5 0 f = f(XOSC)/32
-
171 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_48 0x3B // 5 0 f = f(XOSC)/48
-
172 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_64 0x3C // 5 0 f = f(XOSC)/64
-
173 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_96 0x3D // 5 0 f = f(XOSC)/96
-
174 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_128 0x3E // 5 0 f = f(XOSC)/128
-
175 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_192 0x3F // 5 0 f = f(XOSC)/192 (default for GDO0)
-
176 
-
177 // RADIOLIB_CC1101_REG_FIFOTHR
-
178 #define RADIOLIB_CC1101_ADC_RETENTION_OFF 0b00000000 // 6 6 do not retain ADC settings in sleep mode (default)
-
179 #define RADIOLIB_CC1101_ADC_RETENTION_ON 0b01000000 // 6 6 retain ADC settings in sleep mode
-
180 #define RADIOLIB_CC1101_RX_ATTEN_0_DB 0b00000000 // 5 4 Rx attenuation: 0 dB (default)
-
181 #define RADIOLIB_CC1101_RX_ATTEN_6_DB 0b00010000 // 5 4 6 dB
-
182 #define RADIOLIB_CC1101_RX_ATTEN_12_DB 0b00100000 // 5 4 12 dB
-
183 #define RADIOLIB_CC1101_RX_ATTEN_18_DB 0b00110000 // 5 4 18 dB
-
184 #define RADIOLIB_CC1101_FIFO_THR_TX_61_RX_4 0b00000000 // 3 0 TX fifo threshold: 61, RX fifo threshold: 4
-
185 #define RADIOLIB_CC1101_FIFO_THR_TX_33_RX_32 0b00000111 // 3 0 TX fifo threshold: 33, RX fifo threshold: 32
-
186 #define RADIOLIB_CC1101_FIFO_THRESH_TX 33
-
187 #define RADIOLIB_CC1101_FIFO_THRESH_RX 32
-
188 
-
189 // RADIOLIB_CC1101_REG_SYNC1
-
190 #define RADIOLIB_CC1101_SYNC_WORD_MSB 0xD3 // 7 0 sync word MSB
-
191 
-
192 // RADIOLIB_CC1101_REG_SYNC0
-
193 #define RADIOLIB_CC1101_SYNC_WORD_LSB 0x91 // 7 0 sync word LSB
-
194 
-
195 // RADIOLIB_CC1101_REG_PKTLEN
-
196 #define RADIOLIB_CC1101_PACKET_LENGTH 0xFF // 7 0 packet length in bytes
-
197 
-
198 // RADIOLIB_CC1101_REG_PKTCTRL1
-
199 #define RADIOLIB_CC1101_PQT 0x00 // 7 5 preamble quality threshold
-
200 #define RADIOLIB_CC1101_CRC_AUTOFLUSH_OFF 0b00000000 // 3 3 automatic Rx FIFO flush on CRC check fail: disabled (default)
-
201 #define RADIOLIB_CC1101_CRC_AUTOFLUSH_ON 0b00001000 // 3 3 enabled
-
202 #define RADIOLIB_CC1101_APPEND_STATUS_OFF 0b00000000 // 2 2 append 2 status bytes to packet: disabled
-
203 #define RADIOLIB_CC1101_APPEND_STATUS_ON 0b00000100 // 2 2 enabled (default)
-
204 #define RADIOLIB_CC1101_ADR_CHK_NONE 0b00000000 // 1 0 address check: none (default)
-
205 #define RADIOLIB_CC1101_ADR_CHK_NO_BROADCAST 0b00000001 // 1 0 without broadcast
-
206 #define RADIOLIB_CC1101_ADR_CHK_SINGLE_BROADCAST 0b00000010 // 1 0 broadcast address 0x00
-
207 #define RADIOLIB_CC1101_ADR_CHK_DOUBLE_BROADCAST 0b00000011 // 1 0 broadcast addresses 0x00 and 0xFF
-
208 
-
209 // RADIOLIB_CC1101_REG_PKTCTRL0
-
210 #define RADIOLIB_CC1101_WHITE_DATA_OFF 0b00000000 // 6 6 data whitening: disabled
-
211 #define RADIOLIB_CC1101_WHITE_DATA_ON 0b01000000 // 6 6 enabled (default)
-
212 #define RADIOLIB_CC1101_PKT_FORMAT_NORMAL 0b00000000 // 5 4 packet format: normal (FIFOs)
-
213 #define RADIOLIB_CC1101_PKT_FORMAT_SYNCHRONOUS 0b00010000 // 5 4 synchronous serial
-
214 #define RADIOLIB_CC1101_PKT_FORMAT_RANDOM 0b00100000 // 5 4 random transmissions
-
215 #define RADIOLIB_CC1101_PKT_FORMAT_ASYNCHRONOUS 0b00110000 // 5 4 asynchronous serial
-
216 #define RADIOLIB_CC1101_CRC_OFF 0b00000000 // 2 2 CRC disabled
-
217 #define RADIOLIB_CC1101_CRC_ON 0b00000100 // 2 2 CRC enabled (default)
-
218 #define RADIOLIB_CC1101_LENGTH_CONFIG_FIXED 0b00000000 // 1 0 packet length: fixed
-
219 #define RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE 0b00000001 // 1 0 variable (default)
-
220 #define RADIOLIB_CC1101_LENGTH_CONFIG_INFINITE 0b00000010 // 1 0 infinite
-
221 
-
222 // RADIOLIB_CC1101_REG_ADDR
-
223 #define RADIOLIB_CC1101_DEVICE_ADDR 0x00 // 7 0 device address
-
224 
-
225 // RADIOLIB_CC1101_REG_CHANNR
-
226 #define RADIOLIB_CC1101_CHAN 0x00 // 7 0 channel number
-
227 
-
228 // RADIOLIB_CC1101_REG_FSCTRL1
-
229 #define RADIOLIB_CC1101_FREQ_IF 0x0F // 4 0 IF frequency setting; f_IF = (f(XOSC) / 2^10) * CC1101_FREQ_IF
-
230 
-
231 // CC1101_REG_FSCTRL0
-
232 #define RADIOLIB_CC1101_FREQOFF 0x00 // 7 0 base frequency offset (2s-compliment)
-
233 
-
234 // RADIOLIB_CC1101_REG_FREQ2 + REG_FREQ1 + REG_FREQ0
-
235 #define RADIOLIB_CC1101_FREQ_MSB 0x1E // 5 0 base frequency setting: f_carrier = (f(XOSC) / 2^16) * FREQ
-
236 #define RADIOLIB_CC1101_FREQ_MID 0xC4 // 7 0 where f(XOSC) = 26 MHz
-
237 #define RADIOLIB_CC1101_FREQ_LSB 0xEC // 7 0 FREQ = 3-byte value of FREQ registers
-
238 
-
239 // RADIOLIB_CC1101_REG_MDMCFG4
-
240 #define RADIOLIB_CC1101_CHANBW_E 0b10000000 // 7 6 channel bandwidth: BW_channel = f(XOSC) / (8 * (4 + CHANBW_M)*2^CHANBW_E) [Hz]
-
241 #define RADIOLIB_CC1101_CHANBW_M 0b00000000 // 5 4 default value for 26 MHz crystal: 203 125 Hz
-
242 #define RADIOLIB_CC1101_DRATE_E 0x0C // 3 0 symbol rate: R_data = (((256 + DRATE_M) * 2^DRATE_E) / 2^28) * f(XOSC) [Baud]
-
243 
-
244 // RADIOLIB_CC1101_REG_MDMCFG3
-
245 #define RADIOLIB_CC1101_DRATE_M 0x22 // 7 0 default value for 26 MHz crystal: 115 051 Baud
-
246 
-
247 // RADIOLIB_CC1101_REG_MDMCFG2
-
248 #define RADIOLIB_CC1101_DEM_DCFILT_OFF 0b10000000 // 7 7 digital DC filter: disabled
-
249 #define RADIOLIB_CC1101_DEM_DCFILT_ON 0b00000000 // 7 7 enabled - only for data rates above 250 kBaud (default)
-
250 #define RADIOLIB_CC1101_MOD_FORMAT_2_FSK 0b00000000 // 6 4 modulation format: 2-FSK (default)
-
251 #define RADIOLIB_CC1101_MOD_FORMAT_GFSK 0b00010000 // 6 4 GFSK
-
252 #define RADIOLIB_CC1101_MOD_FORMAT_ASK_OOK 0b00110000 // 6 4 ASK/OOK
-
253 #define RADIOLIB_CC1101_MOD_FORMAT_4_FSK 0b01000000 // 6 4 4-FSK
-
254 #define RADIOLIB_CC1101_MOD_FORMAT_MFSK 0b01110000 // 6 4 MFSK - only for data rates above 26 kBaud
-
255 #define RADIOLIB_CC1101_MANCHESTER_EN_OFF 0b00000000 // 3 3 Manchester encoding: disabled (default)
-
256 #define RADIOLIB_CC1101_MANCHESTER_EN_ON 0b00001000 // 3 3 enabled
-
257 #define RADIOLIB_CC1101_SYNC_MODE_NONE 0b00000000 // 2 0 synchronization: no preamble/sync
-
258 #define RADIOLIB_CC1101_SYNC_MODE_15_16 0b00000001 // 2 0 15/16 sync word bits
-
259 #define RADIOLIB_CC1101_SYNC_MODE_16_16 0b00000010 // 2 0 16/16 sync word bits (default)
-
260 #define RADIOLIB_CC1101_SYNC_MODE_30_32 0b00000011 // 2 0 30/32 sync word bits
-
261 #define RADIOLIB_CC1101_SYNC_MODE_NONE_THR 0b00000100 // 2 0 no preamble sync, carrier sense above threshold
-
262 #define RADIOLIB_CC1101_SYNC_MODE_15_16_THR 0b00000101 // 2 0 15/16 sync word bits, carrier sense above threshold
-
263 #define RADIOLIB_CC1101_SYNC_MODE_16_16_THR 0b00000110 // 2 0 16/16 sync word bits, carrier sense above threshold
-
264 #define RADIOLIB_CC1101_SYNC_MODE_30_32_THR 0b00000111 // 2 0 30/32 sync word bits, carrier sense above threshold
-
265 
-
266 // RADIOLIB_CC1101_REG_MDMCFG1
-
267 #define RADIOLIB_CC1101_FEC_OFF 0b00000000 // 7 7 forward error correction: disabled (default)
-
268 #define RADIOLIB_CC1101_FEC_ON 0b10000000 // 7 7 enabled - only for fixed packet length
-
269 #define RADIOLIB_CC1101_NUM_PREAMBLE_2 0b00000000 // 6 4 number of preamble bytes: 2
-
270 #define RADIOLIB_CC1101_NUM_PREAMBLE_3 0b00010000 // 6 4 3
-
271 #define RADIOLIB_CC1101_NUM_PREAMBLE_4 0b00100000 // 6 4 4 (default)
-
272 #define RADIOLIB_CC1101_NUM_PREAMBLE_6 0b00110000 // 6 4 6
-
273 #define RADIOLIB_CC1101_NUM_PREAMBLE_8 0b01000000 // 6 4 8
-
274 #define RADIOLIB_CC1101_NUM_PREAMBLE_12 0b01010000 // 6 4 12
-
275 #define RADIOLIB_CC1101_NUM_PREAMBLE_16 0b01100000 // 6 4 16
-
276 #define RADIOLIB_CC1101_NUM_PREAMBLE_24 0b01110000 // 6 4 24
-
277 #define RADIOLIB_CC1101_CHANSPC_E 0x02 // 1 0 channel spacing: df_channel = (f(XOSC) / 2^18) * (256 + CHANSPC_M) * 2^CHANSPC_E [Hz]
-
278 
-
279 // RADIOLIB_CC1101_REG_MDMCFG0
-
280 #define RADIOLIB_CC1101_CHANSPC_M 0xF8 // 7 0 default value for 26 MHz crystal: 199 951 kHz
-
281 
-
282 // RADIOLIB_CC1101_REG_DEVIATN
-
283 #define RADIOLIB_CC1101_DEVIATION_E 0b01000000 // 6 4 frequency deviation: f_dev = (f(XOSC) / 2^17) * (8 + DEVIATION_M) * 2^DEVIATION_E [Hz]
-
284 #define RADIOLIB_CC1101_DEVIATION_M 0b00000111 // 2 0 default value for 26 MHz crystal: +- 47 607 Hz
-
285 #define RADIOLIB_CC1101_MSK_PHASE_CHANGE_PERIOD 0x07 // 2 0 phase change symbol period fraction: 1 / (MSK_PHASE_CHANGE_PERIOD + 1)
-
286 
-
287 // RADIOLIB_CC1101_REG_MCSM2
-
288 #define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_OFF 0b00000000 // 4 4 Rx timeout based on RSSI value: disabled (default)
-
289 #define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_ON 0b00010000 // 4 4 enabled
-
290 #define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_OFF 0b00000000 // 3 3 check for sync word on Rx timeout
-
291 #define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_ON 0b00001000 // 3 3 check for PQI set on Rx timeout
-
292 #define RADIOLIB_CC1101_RX_TIMEOUT_OFF 0b00000111 // 2 0 Rx timeout: disabled (default)
-
293 #define RADIOLIB_CC1101_RX_TIMEOUT_MAX 0b00000000 // 2 0 max value (actual value depends on WOR_RES, EVENT0 and f(XOSC))
-
294 
-
295 // RADIOLIB_CC1101_REG_MCSM1
-
296 #define RADIOLIB_CC1101_CCA_MODE_ALWAYS 0b00000000 // 5 4 clear channel indication: always
-
297 #define RADIOLIB_CC1101_CCA_MODE_RSSI_THR 0b00010000 // 5 4 RSSI below threshold
-
298 #define RADIOLIB_CC1101_CCA_MODE_RX_PKT 0b00100000 // 5 4 unless receiving packet
-
299 #define RADIOLIB_CC1101_CCA_MODE_RSSI_THR_RX_PKT 0b00110000 // 5 4 RSSI below threshold unless receiving packet (default)
-
300 #define RADIOLIB_CC1101_RXOFF_IDLE 0b00000000 // 3 2 next mode after packet reception: idle (default)
-
301 #define RADIOLIB_CC1101_RXOFF_FSTXON 0b00000100 // 3 2 FSTxOn
-
302 #define RADIOLIB_CC1101_RXOFF_TX 0b00001000 // 3 2 Tx
-
303 #define RADIOLIB_CC1101_RXOFF_RX 0b00001100 // 3 2 Rx
-
304 #define RADIOLIB_CC1101_TXOFF_IDLE 0b00000000 // 1 0 next mode after packet transmission: idle (default)
-
305 #define RADIOLIB_CC1101_TXOFF_FSTXON 0b00000001 // 1 0 FSTxOn
-
306 #define RADIOLIB_CC1101_TXOFF_TX 0b00000010 // 1 0 Tx
-
307 #define RADIOLIB_CC1101_TXOFF_RX 0b00000011 // 1 0 Rx
-
308 
-
309 // RADIOLIB_CC1101_REG_MCSM0
-
310 #define RADIOLIB_CC1101_FS_AUTOCAL_NEVER 0b00000000 // 5 4 automatic calibration: never (default)
-
311 #define RADIOLIB_CC1101_FS_AUTOCAL_IDLE_TO_RXTX 0b00010000 // 5 4 every transition from idle to Rx/Tx
-
312 #define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE 0b00100000 // 5 4 every transition from Rx/Tx to idle
-
313 #define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE_4TH 0b00110000 // 5 4 every 4th transition from Rx/Tx to idle
-
314 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_1 0b00000000 // 3 2 number of counter expirations before CHP_RDYN goes low: 1 (default)
-
315 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_16 0b00000100 // 3 2 16
-
316 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_64 0b00001000 // 3 2 64
-
317 #define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_256 0b00001100 // 3 2 256
-
318 #define RADIOLIB_CC1101_PIN_CTRL_OFF 0b00000000 // 1 1 pin radio control: disabled (default)
-
319 #define RADIOLIB_CC1101_PIN_CTRL_ON 0b00000010 // 1 1 enabled
-
320 #define RADIOLIB_CC1101_XOSC_FORCE_OFF 0b00000000 // 0 0 do not force XOSC to remain on in sleep (default)
-
321 #define RADIOLIB_CC1101_XOSC_FORCE_ON 0b00000001 // 0 0 force XOSC to remain on in sleep
-
322 
-
323 // RADIOLIB_CC1101_REG_FOCCFG
-
324 #define RADIOLIB_CC1101_FOC_BS_CS_GATE_OFF 0b00000000 // 5 5 do not freeze frequency compensation until CS goes high
-
325 #define RADIOLIB_CC1101_FOC_BS_CS_GATE_ON 0b00100000 // 5 5 freeze frequency compensation until CS goes high (default)
-
326 #define RADIOLIB_CC1101_FOC_PRE_K 0b00000000 // 4 3 frequency compensation loop gain before sync word: K
-
327 #define RADIOLIB_CC1101_FOC_PRE_2K 0b00001000 // 4 3 2K
-
328 #define RADIOLIB_CC1101_FOC_PRE_3K 0b00010000 // 4 3 3K (default)
-
329 #define RADIOLIB_CC1101_FOC_PRE_4K 0b00011000 // 4 3 4K
-
330 #define RADIOLIB_CC1101_FOC_POST_K 0b00000000 // 2 2 frequency compensation loop gain after sync word: same as FOC_PRE
-
331 #define RADIOLIB_CC1101_FOC_POST_K_2 0b00000100 // 2 2 K/2 (default)
-
332 #define RADIOLIB_CC1101_FOC_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 frequency compensation saturation point: no compensation - required for ASK/OOK
-
333 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_8 0b00000001 // 1 0 +- BW_chan/8
-
334 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_4 0b00000010 // 1 0 +- BW_chan/4 (default)
-
335 #define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_2 0b00000011 // 1 0 +- BW_chan/2
-
336 
-
337 // RADIOLIB_CC1101_REG_BSCFG
-
338 #define RADIOLIB_CC1101_BS_PRE_KI 0b00000000 // 7 6 clock recovery integral gain before sync word: Ki
-
339 #define RADIOLIB_CC1101_BS_PRE_2KI 0b01000000 // 7 6 2Ki (default)
-
340 #define RADIOLIB_CC1101_BS_PRE_3KI 0b10000000 // 7 6 3Ki
-
341 #define RADIOLIB_CC1101_BS_PRE_4KI 0b11000000 // 7 6 4Ki
-
342 #define RADIOLIB_CC1101_BS_PRE_KP 0b00000000 // 5 4 clock recovery proportional gain before sync word: Kp
-
343 #define RADIOLIB_CC1101_BS_PRE_2KP 0b00010000 // 5 4 2Kp
-
344 #define RADIOLIB_CC1101_BS_PRE_3KP 0b00100000 // 5 4 3Kp (default)
-
345 #define RADIOLIB_CC1101_BS_PRE_4KP 0b00110000 // 5 4 4Kp
-
346 #define RADIOLIB_CC1101_BS_POST_KI 0b00000000 // 3 3 clock recovery integral gain after sync word: same as BS_PRE
-
347 #define RADIOLIB_CC1101_BS_POST_KI_2 0b00001000 // 3 3 Ki/2 (default)
-
348 #define RADIOLIB_CC1101_BS_POST_KP 0b00000000 // 2 2 clock recovery proportional gain after sync word: same as BS_PRE
-
349 #define RADIOLIB_CC1101_BS_POST_KP_1 0b00000100 // 2 2 Kp (default)
-
350 #define RADIOLIB_CC1101_BS_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 data rate compensation saturation point: no compensation
-
351 #define RADIOLIB_CC1101_BS_LIMIT_3_125 0b00000001 // 1 0 +- 3.125 %
-
352 #define RADIOLIB_CC1101_BS_LIMIT_6_25 0b00000010 // 1 0 +- 6.25 %
-
353 #define RADIOLIB_CC1101_BS_LIMIT_12_5 0b00000011 // 1 0 +- 12.5 %
-
354 
-
355 // RADIOLIB_CC1101_REG_AGCCTRL2
-
356 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_0 0b00000000 // 7 6 reduce maximum available DVGA gain: no reduction (default)
-
357 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_1 0b01000000 // 7 6 disable top gain setting
-
358 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_2 0b10000000 // 7 6 disable top two gain setting
-
359 #define RADIOLIB_CC1101_MAX_DVGA_GAIN_3 0b11000000 // 7 6 disable top three gain setting
-
360 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_0_DB 0b00000000 // 5 3 reduce maximum LNA gain by: 0 dB (default)
-
361 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_2_6_DB 0b00001000 // 5 3 2.6 dB
-
362 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_6_1_DB 0b00010000 // 5 3 6.1 dB
-
363 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_7_4_DB 0b00011000 // 5 3 7.4 dB
-
364 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_9_2_DB 0b00100000 // 5 3 9.2 dB
-
365 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_11_5_DB 0b00101000 // 5 3 11.5 dB
-
366 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_14_6_DB 0b00110000 // 5 3 14.6 dB
-
367 #define RADIOLIB_CC1101_LNA_GAIN_REDUCE_17_1_DB 0b00111000 // 5 3 17.1 dB
-
368 #define RADIOLIB_CC1101_MAGN_TARGET_24_DB 0b00000000 // 2 0 average amplitude target for filter: 24 dB
-
369 #define RADIOLIB_CC1101_MAGN_TARGET_27_DB 0b00000001 // 2 0 27 dB
-
370 #define RADIOLIB_CC1101_MAGN_TARGET_30_DB 0b00000010 // 2 0 30 dB
-
371 #define RADIOLIB_CC1101_MAGN_TARGET_33_DB 0b00000011 // 2 0 33 dB (default)
-
372 #define RADIOLIB_CC1101_MAGN_TARGET_36_DB 0b00000100 // 2 0 36 dB
-
373 #define RADIOLIB_CC1101_MAGN_TARGET_38_DB 0b00000101 // 2 0 38 dB
-
374 #define RADIOLIB_CC1101_MAGN_TARGET_40_DB 0b00000110 // 2 0 40 dB
-
375 #define RADIOLIB_CC1101_MAGN_TARGET_42_DB 0b00000111 // 2 0 42 dB
-
376 
-
377 // RADIOLIB_CC1101_REG_AGCCTRL1
-
378 #define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA2 0b00000000 // 6 6 LNA priority setting: LNA2 first
-
379 #define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA 0b01000000 // 6 6 LNA first (default)
-
380 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_OFF 0b00000000 // 5 4 RSSI relative change to assert carrier sense: disabled (default)
-
381 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_6_DB 0b00010000 // 5 4 6 dB
-
382 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_10_DB 0b00100000 // 5 4 10 dB
-
383 #define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_14_DB 0b00110000 // 5 4 14 dB
-
384 #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]
-
385 
-
386 // RADIOLIB_CC1101_REG_AGCCTRL0
-
387 #define RADIOLIB_CC1101_HYST_LEVEL_NONE 0b00000000 // 7 6 AGC hysteresis level: none
-
388 #define RADIOLIB_CC1101_HYST_LEVEL_LOW 0b01000000 // 7 6 low
-
389 #define RADIOLIB_CC1101_HYST_LEVEL_MEDIUM 0b10000000 // 7 6 medium (default)
-
390 #define RADIOLIB_CC1101_HYST_LEVEL_HIGH 0b11000000 // 7 6 high
-
391 #define RADIOLIB_CC1101_WAIT_TIME_8_SAMPLES 0b00000000 // 5 4 AGC wait time: 8 samples
-
392 #define RADIOLIB_CC1101_WAIT_TIME_16_SAMPLES 0b00010000 // 5 4 16 samples (default)
-
393 #define RADIOLIB_CC1101_WAIT_TIME_24_SAMPLES 0b00100000 // 5 4 24 samples
-
394 #define RADIOLIB_CC1101_WAIT_TIME_32_SAMPLES 0b00110000 // 5 4 32 samples
-
395 #define RADIOLIB_CC1101_AGC_FREEZE_NEVER 0b00000000 // 3 2 freeze AGC gain: never (default)
-
396 #define RADIOLIB_CC1101_AGC_FREEZE_SYNC_WORD 0b00000100 // 3 2 when sync word is found
-
397 #define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_A 0b00001000 // 3 2 manually freeze analog control
-
398 #define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_AD 0b00001100 // 3 2 manually freeze analog and digital control
-
399 #define RADIOLIB_CC1101_FILTER_LENGTH_8 0b00000000 // 1 0 averaging length for channel filter: 8 samples
-
400 #define RADIOLIB_CC1101_FILTER_LENGTH_16 0b00000001 // 1 0 16 samples (default)
-
401 #define RADIOLIB_CC1101_FILTER_LENGTH_32 0b00000010 // 1 0 32 samples
-
402 #define RADIOLIB_CC1101_FILTER_LENGTH_64 0b00000011 // 1 0 64 samples
-
403 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_4_DB 0b00000000 // 1 0 ASK/OOK decision boundary: 4 dB
-
404 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_8_DB 0b00000001 // 1 0 8 dB (default)
-
405 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_12_DB 0b00000010 // 1 0 12 dB
-
406 #define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_16_DB 0b00000011 // 1 0 16 dB
-
407 
-
408 // RADIOLIB_CC1101_REG_WOREVT1 + REG_WOREVT0
-
409 #define RADIOLIB_CC1101_EVENT0_TIMEOUT_MSB 0x87 // 7 0 EVENT0 timeout: t_event0 = (750 / f(XOSC)) * EVENT0_TIMEOUT * 2^(5 * WOR_RES) [s]
-
410 #define RADIOLIB_CC1101_EVENT0_TIMEOUT_LSB 0x6B // 7 0 default value for 26 MHz crystal: 1.0 s
-
411 
-
412 // RADIOLIB_CC1101_REG_WORCTRL
-
413 #define RADIOLIB_CC1101_RC_POWER_UP 0b00000000 // 7 7 power up RC oscillator
-
414 #define RADIOLIB_CC1101_RC_POWER_DOWN 0b10000000 // 7 7 power down RC oscillator
-
415 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_4 0b00000000 // 6 4 EVENT1 timeout: 4 RC periods
-
416 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_6 0b00010000 // 6 4 6 RC periods
-
417 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_8 0b00100000 // 6 4 8 RC periods
-
418 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_12 0b00110000 // 6 4 12 RC periods
-
419 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_16 0b01000000 // 6 4 16 RC periods
-
420 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_24 0b01010000 // 6 4 24 RC periods
-
421 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_32 0b01100000 // 6 4 32 RC periods
-
422 #define RADIOLIB_CC1101_EVENT1_TIMEOUT_48 0b01110000 // 6 4 48 RC periods (default)
-
423 #define RADIOLIB_CC1101_RC_CAL_OFF 0b00000000 // 3 3 disable RC oscillator calibration
-
424 #define RADIOLIB_CC1101_RC_CAL_ON 0b00001000 // 3 3 enable RC oscillator calibration (default)
-
425 #define RADIOLIB_CC1101_WOR_RES_1 0b00000000 // 1 0 EVENT0 resolution: 1 period (default)
-
426 #define RADIOLIB_CC1101_WOR_RES_2_5 0b00000001 // 1 0 2^5 periods
-
427 #define RADIOLIB_CC1101_WOR_RES_2_10 0b00000010 // 1 0 2^10 periods
-
428 #define RADIOLIB_CC1101_WOR_RES_2_15 0b00000011 // 1 0 2^15 periods
-
429 
-
430 // RADIOLIB_CC1101_REG_FREND1
-
431 #define RADIOLIB_CC1101_LNA_CURRENT 0x01 // 7 6 front-end LNA PTAT current output adjustment
-
432 #define RADIOLIB_CC1101_LNA2MIX_CURRENT 0x01 // 5 4 front-end PTAT output adjustment
-
433 #define RADIOLIB_CC1101_LODIV_BUF_CURRENT_RX 0x01 // 3 2 Rx LO buffer current adjustment
-
434 #define RADIOLIB_CC1101_MIX_CURRENT 0x02 // 1 0 mixer current adjustment
-
435 
-
436 // RADIOLIB_CC1101_REG_FREND0
-
437 #define RADIOLIB_CC1101_LODIV_BUF_CURRENT_TX 0x01 // 5 4 Tx LO buffer current adjustment
-
438 #define RADIOLIB_CC1101_PA_POWER 0x00 // 2 0 set power amplifier power according to PATABLE
-
439 
-
440 // RADIOLIB_CC1101_REG_FSCAL3
-
441 #define RADIOLIB_CC1101_CHP_CURR_CAL_OFF 0b00000000 // 5 4 disable charge pump calibration
-
442 #define RADIOLIB_CC1101_CHP_CURR_CAL_ON 0b00100000 // 5 4 enable charge pump calibration (default)
-
443 #define RADIOLIB_CC1101_FSCAL3 0x09 // 3 0 charge pump output current: I_out = I_0 * 2^(FSCAL3/4) [A]
-
444 
-
445 // RADIOLIB_CC1101_REG_FSCAL2
-
446 #define RADIOLIB_CC1101_VCO_CORE_LOW 0b00000000 // 5 5 VCO: low (default)
-
447 #define RADIOLIB_CC1101_VCO_CORE_HIGH 0b00100000 // 5 5 high
-
448 #define RADIOLIB_CC1101_FSCAL2 0x0A // 4 0 VCO current result/override
-
449 
-
450 // RADIOLIB_CC1101_REG_FSCAL1
-
451 #define RADIOLIB_CC1101_FSCAL1 0x20 // 5 0 capacitor array setting for coarse VCO tuning
-
452 
-
453 // RADIOLIB_CC1101_REG_FSCAL0
-
454 #define RADIOLIB_CC1101_FSCAL0 0x0D // 6 0 frequency synthesizer calibration setting
-
455 
-
456 // RADIOLIB_CC1101_REG_RCCTRL1
-
457 #define RADIOLIB_CC1101_RCCTRL1 0x41 // 6 0 RC oscillator configuration
-
458 
-
459 // RADIOLIB_CC1101_REG_RCCTRL0
-
460 #define RADIOLIB_CC1101_RCCTRL0 0x00 // 6 0 RC oscillator configuration
-
461 
-
462 // RADIOLIB_CC1101_REG_PTEST
-
463 #define RADIOLIB_CC1101_TEMP_SENS_IDLE_OFF 0x7F // 7 0 temperature sensor will not be available in idle mode (default)
-
464 #define RADIOLIB_CC1101_TEMP_SENS_IDLE_ON 0xBF // 7 0 temperature sensor will be available in idle mode
-
465 
-
466 // RADIOLIB_CC1101_REG_TEST0
-
467 #define RADIOLIB_CC1101_VCO_SEL_CAL_OFF 0b00000000 // 1 1 disable VCO selection calibration stage
-
468 #define RADIOLIB_CC1101_VCO_SEL_CAL_ON 0b00000010 // 1 1 enable VCO selection calibration stage
-
469 
-
470 // RADIOLIB_CC1101_REG_PARTNUM
-
471 #define RADIOLIB_CC1101_PARTNUM 0x00
-
472 
-
473 // RADIOLIB_CC1101_REG_VERSION
-
474 #define RADIOLIB_CC1101_VERSION_CURRENT 0x14
-
475 #define RADIOLIB_CC1101_VERSION_LEGACY 0x04
-
476 #define RADIOLIB_CC1101_VERSION_CLONE 0x17
-
477 
-
478 // RADIOLIB_CC1101_REG_MARCSTATE
-
479 #define RADIOLIB_CC1101_MARC_STATE_SLEEP 0x00 // 4 0 main radio control state: sleep
-
480 #define RADIOLIB_CC1101_MARC_STATE_IDLE 0x01 // 4 0 idle
-
481 #define RADIOLIB_CC1101_MARC_STATE_XOFF 0x02 // 4 0 XOFF
-
482 #define RADIOLIB_CC1101_MARC_STATE_VCOON_MC 0x03 // 4 0 VCOON_MC
-
483 #define RADIOLIB_CC1101_MARC_STATE_REGON_MC 0x04 // 4 0 REGON_MC
-
484 #define RADIOLIB_CC1101_MARC_STATE_MANCAL 0x05 // 4 0 MANCAL
-
485 #define RADIOLIB_CC1101_MARC_STATE_VCOON 0x06 // 4 0 VCOON
-
486 #define RADIOLIB_CC1101_MARC_STATE_REGON 0x07 // 4 0 REGON
-
487 #define RADIOLIB_CC1101_MARC_STATE_STARTCAL 0x08 // 4 0 STARTCAL
-
488 #define RADIOLIB_CC1101_MARC_STATE_BWBOOST 0x09 // 4 0 BWBOOST
-
489 #define RADIOLIB_CC1101_MARC_STATE_FS_LOCK 0x0A // 4 0 FS_LOCK
-
490 #define RADIOLIB_CC1101_MARC_STATE_IFADCON 0x0B // 4 0 IFADCON
-
491 #define RADIOLIB_CC1101_MARC_STATE_ENDCAL 0x0C // 4 0 ENDCAL
-
492 #define RADIOLIB_CC1101_MARC_STATE_RX 0x0D // 4 0 RX
-
493 #define RADIOLIB_CC1101_MARC_STATE_RX_END 0x0E // 4 0 RX_END
-
494 #define RADIOLIB_CC1101_MARC_STATE_RX_RST 0x0F // 4 0 RX_RST
-
495 #define RADIOLIB_CC1101_MARC_STATE_TXRX_SWITCH 0x10 // 4 0 TXRX_SWITCH
-
496 #define RADIOLIB_CC1101_MARC_STATE_RXFIFO_OVERFLOW 0x11 // 4 0 RXFIFO_OVERFLOW
-
497 #define RADIOLIB_CC1101_MARC_STATE_FSTXON 0x12 // 4 0 FSTXON
-
498 #define RADIOLIB_CC1101_MARC_STATE_TX 0x13 // 4 0 TX
-
499 #define RADIOLIB_CC1101_MARC_STATE_TX_END 0x14 // 4 0 TX_END
-
500 #define RADIOLIB_CC1101_MARC_STATE_RXTX_SWITCH 0x15 // 4 0 RXTX_SWITCH
-
501 #define RADIOLIB_CC1101_MARC_STATE_TXFIFO_UNDERFLOW 0x16 // 4 0 TXFIFO_UNDERFLOW
-
502 
-
503 // RADIOLIB_CC1101_REG_WORTIME1 + REG_WORTIME0
-
504 #define RADIOLIB_CC1101_WORTIME_MSB 0x00 // 7 0 WOR timer value
-
505 #define RADIOLIB_CC1101_WORTIME_LSB 0x00 // 7 0
-
506 
-
507 // RADIOLIB_CC1101_REG_PKTSTATUS
-
508 #define RADIOLIB_CC1101_CRC_OK 0b10000000 // 7 7 CRC check passed
-
509 #define RADIOLIB_CC1101_CRC_ERROR 0b00000000 // 7 7 CRC check failed
-
510 #define RADIOLIB_CC1101_CS 0b01000000 // 6 6 carrier sense
-
511 #define RADIOLIB_CC1101_PQT_REACHED 0b00100000 // 5 5 preamble quality reached
-
512 #define RADIOLIB_CC1101_CCA 0b00010000 // 4 4 channel clear
-
513 #define RADIOLIB_CC1101_SFD 0b00001000 // 3 3 start of frame delimiter - sync word received
-
514 #define RADIOLIB_CC1101_GDO2_ACTIVE 0b00000100 // 2 2 GDO2 is active/asserted
-
515 #define RADIOLIB_CC1101_GDO0_ACTIVE 0b00000001 // 0 0 GDO0 is active/asserted
-
516 
-
517 // RadioLib defaults
-
518 #define RADIOLIB_CC1101_DEFAULT_FREQ 434.0
-
519 #define RADIOLIB_CC1101_DEFAULT_BR 4.8
-
520 #define RADIOLIB_CC1101_DEFAULT_FREQDEV 5.0
-
521 #define RADIOLIB_CC1101_DEFAULT_RXBW 135.0
-
522 #define RADIOLIB_CC1101_DEFAULT_POWER 10
-
523 #define RADIOLIB_CC1101_DEFAULT_PREAMBLELEN 16
-
524 #define RADIOLIB_CC1101_DEFAULT_SW {0x12, 0xAD}
-
525 #define RADIOLIB_CC1101_DEFAULT_SW_LEN 2
-
526 
-
531 class CC1101: public PhysicalLayer {
-
532  public:
-
533  // introduce PhysicalLayer overloads
-
534  using PhysicalLayer::transmit;
-
535  using PhysicalLayer::receive;
-
536  using PhysicalLayer::startTransmit;
-
537  using PhysicalLayer::readData;
-
538 
-
543  CC1101(Module* module);
-
544 
-
545  Module* getMod();
-
546 
-
547  // basic methods
-
548 
-
559  int16_t begin(
-
560  float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
-
561  float br = RADIOLIB_CC1101_DEFAULT_BR,
-
562  float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
-
563  float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
-
564  int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
-
565  uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
-
566 
-
570  void reset();
-
571 
-
580  int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
-
581 
-
589  int16_t receive(uint8_t* data, size_t len) override;
-
590 
-
595  int16_t standby() override;
-
596 
-
602  int16_t standby(uint8_t mode) override;
-
603 
-
609  int16_t transmitDirect(uint32_t frf = 0) override;
-
610 
-
615  int16_t receiveDirect() override;
-
616 
-
622  int16_t transmitDirectAsync(uint32_t frf = 0);
-
623 
-
628  int16_t receiveDirectAsync();
-
629 
-
634  int16_t packetMode();
-
635 
-
636  // interrupt methods
-
637 
-
643  void setGdo0Action(void (*func)(void), uint32_t dir);
-
644 
-
648  void clearGdo0Action();
-
649 
-
655  void setGdo2Action(void (*func)(void), uint32_t dir);
-
656 
-
660  void clearGdo2Action();
-
661 
-
666  void setPacketReceivedAction(void (*func)(void));
-
667 
-
671  void clearPacketReceivedAction();
-
672 
-
677  void setPacketSentAction(void (*func)(void));
-
678 
-
682  void clearPacketSentAction();
-
683 
-
692  int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
-
693 
-
698  int16_t finishTransmit() override;
-
699 
-
704  int16_t startReceive();
-
705 
-
714  int16_t startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask, size_t len);
-
715 
-
724  int16_t readData(uint8_t* data, size_t len) override;
-
725 
-
726  // configuration methods
-
727 
-
734  int16_t setFrequency(float freq);
-
735 
-
741  int16_t setBitRate(float br);
-
742 
-
748  int16_t setRxBandwidth(float rxBw);
-
749 
-
755  int16_t setFrequencyDeviation(float freqDev) override;
-
756 
-
762  int16_t getFrequencyDeviation(float *freqDev);
-
763 
-
769  int16_t setOutputPower(int8_t pwr);
-
770 
-
779  int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
780 
-
789  int16_t setSyncWord(uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
790 
-
796  int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold);
-
797 
-
805  int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
-
806 
-
811  int16_t disableAddressFiltering();
-
812 
-
818  int16_t setOOK(bool enableOOK);
-
819 
-
825  float getRSSI();
-
826 
-
831  uint8_t getLQI() const;
-
832 
-
838  size_t getPacketLength(bool update = true) override;
-
839 
-
845  int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
-
846 
-
852  int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
-
853 
-
860  int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
861 
-
867  int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
-
868 
-
874  int16_t setCrcFiltering(bool enable = true);
-
875 
-
881  int16_t setPromiscuousMode(bool enable = true);
-
882 
-
888  bool getPromiscuousMode();
-
889 
-
896  int16_t setDataShaping(uint8_t sh) override;
-
897 
-
904  int16_t setEncoding(uint8_t encoding) override;
-
905 
-
907  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
-
908 
-
910  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
-
911 
-
916  uint8_t randomByte();
-
917 
-
923  int16_t getChipVersion();
-
924 
-
925  #if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
-
930  void setDirectAction(void (*func)(void));
-
931 
-
936  void readBit(uint32_t pin);
-
937  #endif
-
938 
-
945  int16_t setDIOMapping(uint32_t pin, uint32_t value);
-
946 
-
947  #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
-
948  protected:
-
949  #endif
-
950  Module* mod;
-
951 
-
952  // SPI read overrides to set bit for burst write and status registers access
-
953  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
-
954  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
-
955  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
-
956  uint8_t SPIreadRegister(uint8_t reg);
-
957  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, size_t len);
-
958  void SPIwriteRegister(uint8_t reg, uint8_t data);
-
959 
-
960  void SPIsendCommand(uint8_t cmd);
-
961 
-
962  #if !defined(RADIOLIB_GODMODE)
-
963  protected:
-
964  #endif
-
965 
-
966  float frequency = RADIOLIB_CC1101_DEFAULT_FREQ;
-
967  float bitRate = RADIOLIB_CC1101_DEFAULT_BR;
-
968  uint8_t rawRSSI = 0;
-
969  uint8_t rawLQI = 0;
-
970  uint8_t modulation = RADIOLIB_CC1101_MOD_FORMAT_2_FSK;
-
971 
-
972  size_t packetLength = 0;
-
973  bool packetLengthQueried = false;
-
974  uint8_t packetLengthConfig = RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE;
-
975 
-
976  bool promiscuous = false;
-
977  bool crcOn = true;
-
978  bool directModeEnabled = true;
-
979 
-
980  int8_t power = RADIOLIB_CC1101_DEFAULT_POWER;
-
981 
-
982  int16_t config();
-
983  int16_t transmitDirect(bool sync, uint32_t frf);
-
984  int16_t receiveDirect(bool sync);
-
985  int16_t directMode(bool sync);
-
986  static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
-
987  int16_t setPacketMode(uint8_t mode, uint16_t len);
-
988 };
-
989 
-
990 #endif
-
CC1101
Control class for CC1101 module.
Definition: CC1101.h:531
-
CC1101::setDIOMapping
int16_t setDIOMapping(uint32_t pin, uint32_t value)
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition: CC1101.cpp:1028
-
CC1101::setPromiscuousMode
int16_t setPromiscuousMode(bool enable=true)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition: CC1101.cpp:907
-
CC1101::setFrequencyDeviation
int16_t setFrequencyDeviation(float freqDev) override
Sets frequency deviation. Allowed values range from 1.587 to 380.8 kHz.
Definition: CC1101.cpp:562
-
CC1101::getPacketLength
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: CC1101.cpp:837
+
14 
+
15 // CC1101 SPI commands
+
16 #define RADIOLIB_CC1101_CMD_READ 0b10000000
+
17 #define RADIOLIB_CC1101_CMD_WRITE 0b00000000
+
18 #define RADIOLIB_CC1101_CMD_BURST 0b01000000
+
19 #define RADIOLIB_CC1101_CMD_ACCESS_STATUS_REG 0b01000000
+
20 #define RADIOLIB_CC1101_CMD_FIFO_RX 0b10000000
+
21 #define RADIOLIB_CC1101_CMD_FIFO_TX 0b00000000
+
22 #define RADIOLIB_CC1101_CMD_RESET 0x30
+
23 #define RADIOLIB_CC1101_CMD_FSTXON 0x31
+
24 #define RADIOLIB_CC1101_CMD_XOFF 0x32
+
25 #define RADIOLIB_CC1101_CMD_CAL 0x33
+
26 #define RADIOLIB_CC1101_CMD_RX 0x34
+
27 #define RADIOLIB_CC1101_CMD_TX 0x35
+
28 #define RADIOLIB_CC1101_CMD_IDLE 0x36
+
29 #define RADIOLIB_CC1101_CMD_WOR 0x38
+
30 #define RADIOLIB_CC1101_CMD_POWER_DOWN 0x39
+
31 #define RADIOLIB_CC1101_CMD_FLUSH_RX 0x3A
+
32 #define RADIOLIB_CC1101_CMD_FLUSH_TX 0x3B
+
33 #define RADIOLIB_CC1101_CMD_WOR_RESET 0x3C
+
34 #define RADIOLIB_CC1101_CMD_NOP 0x3D
+
35 
+
36 // CC1101 register map
+
37 #define RADIOLIB_CC1101_REG_IOCFG2 0x00
+
38 #define RADIOLIB_CC1101_REG_IOCFG1 0x01
+
39 #define RADIOLIB_CC1101_REG_IOCFG0 0x02
+
40 #define RADIOLIB_CC1101_REG_FIFOTHR 0x03
+
41 #define RADIOLIB_CC1101_REG_SYNC1 0x04
+
42 #define RADIOLIB_CC1101_REG_SYNC0 0x05
+
43 #define RADIOLIB_CC1101_REG_PKTLEN 0x06
+
44 #define RADIOLIB_CC1101_REG_PKTCTRL1 0x07
+
45 #define RADIOLIB_CC1101_REG_PKTCTRL0 0x08
+
46 #define RADIOLIB_CC1101_REG_ADDR 0x09
+
47 #define RADIOLIB_CC1101_REG_CHANNR 0x0A
+
48 #define RADIOLIB_CC1101_REG_FSCTRL1 0x0B
+
49 #define RADIOLIB_CC1101_REG_FSCTRL0 0x0C
+
50 #define RADIOLIB_CC1101_REG_FREQ2 0x0D
+
51 #define RADIOLIB_CC1101_REG_FREQ1 0x0E
+
52 #define RADIOLIB_CC1101_REG_FREQ0 0x0F
+
53 #define RADIOLIB_CC1101_REG_MDMCFG4 0x10
+
54 #define RADIOLIB_CC1101_REG_MDMCFG3 0x11
+
55 #define RADIOLIB_CC1101_REG_MDMCFG2 0x12
+
56 #define RADIOLIB_CC1101_REG_MDMCFG1 0x13
+
57 #define RADIOLIB_CC1101_REG_MDMCFG0 0x14
+
58 #define RADIOLIB_CC1101_REG_DEVIATN 0x15
+
59 #define RADIOLIB_CC1101_REG_MCSM2 0x16
+
60 #define RADIOLIB_CC1101_REG_MCSM1 0x17
+
61 #define RADIOLIB_CC1101_REG_MCSM0 0x18
+
62 #define RADIOLIB_CC1101_REG_FOCCFG 0x19
+
63 #define RADIOLIB_CC1101_REG_BSCFG 0x1A
+
64 #define RADIOLIB_CC1101_REG_AGCCTRL2 0x1B
+
65 #define RADIOLIB_CC1101_REG_AGCCTRL1 0x1C
+
66 #define RADIOLIB_CC1101_REG_AGCCTRL0 0x1D
+
67 #define RADIOLIB_CC1101_REG_WOREVT1 0x1E
+
68 #define RADIOLIB_CC1101_REG_WOREVT0 0x1F
+
69 #define RADIOLIB_CC1101_REG_WORCTRL 0x20
+
70 #define RADIOLIB_CC1101_REG_FREND1 0x21
+
71 #define RADIOLIB_CC1101_REG_FREND0 0x22
+
72 #define RADIOLIB_CC1101_REG_FSCAL3 0x23
+
73 #define RADIOLIB_CC1101_REG_FSCAL2 0x24
+
74 #define RADIOLIB_CC1101_REG_FSCAL1 0x25
+
75 #define RADIOLIB_CC1101_REG_FSCAL0 0x26
+
76 #define RADIOLIB_CC1101_REG_RCCTRL1 0x27
+
77 #define RADIOLIB_CC1101_REG_RCCTRL0 0x28
+
78 #define RADIOLIB_CC1101_REG_FSTEST 0x29
+
79 #define RADIOLIB_CC1101_REG_PTEST 0x2A
+
80 #define RADIOLIB_CC1101_REG_AGCTEST 0x2B
+
81 #define RADIOLIB_CC1101_REG_TEST2 0x2C
+
82 #define RADIOLIB_CC1101_REG_TEST1 0x2D
+
83 #define RADIOLIB_CC1101_REG_TEST0 0x2E
+
84 #define RADIOLIB_CC1101_REG_PARTNUM 0x30
+
85 #define RADIOLIB_CC1101_REG_VERSION 0x31
+
86 #define RADIOLIB_CC1101_REG_FREQEST 0x32
+
87 #define RADIOLIB_CC1101_REG_LQI 0x33
+
88 #define RADIOLIB_CC1101_REG_RSSI 0x34
+
89 #define RADIOLIB_CC1101_REG_MARCSTATE 0x35
+
90 #define RADIOLIB_CC1101_REG_WORTIME1 0x36
+
91 #define RADIOLIB_CC1101_REG_WORTIME0 0x37
+
92 #define RADIOLIB_CC1101_REG_PKTSTATUS 0x38
+
93 #define RADIOLIB_CC1101_REG_VCO_VC_DAC 0x39
+
94 #define RADIOLIB_CC1101_REG_TXBYTES 0x3A
+
95 #define RADIOLIB_CC1101_REG_RXBYTES 0x3B
+
96 #define RADIOLIB_CC1101_REG_RCCTRL1_STATUS 0x3C
+
97 #define RADIOLIB_CC1101_REG_RCCTRL0_STATUS 0x3D
+
98 #define RADIOLIB_CC1101_REG_PATABLE 0x3E
+
99 #define RADIOLIB_CC1101_REG_FIFO 0x3F
+
100 
+
101 // status byte (returned during SPI transactions) MSB LSB DESCRIPTION
+
102 #define RADIOLIB_CC1101_STATUS_CHIP_READY 0b00000000 // 7 7 chip ready
+
103 #define RADIOLIB_CC1101_STATUS_CHIP_NOT_READY 0b10000000 // 7 7 chip not ready (power/crystal not stable)
+
104 #define RADIOLIB_CC1101_STATUS_IDLE 0b00000000 // 6 4 idle
+
105 #define RADIOLIB_CC1101_STATUS_RX 0b00010000 // 6 4 Rx
+
106 #define RADIOLIB_CC1101_STATUS_TX 0b00100000 // 6 4 Tx
+
107 #define RADIOLIB_CC1101_STATUS_FSTXON 0b00110000 // 6 4 Fast Tx ready
+
108 #define RADIOLIB_CC1101_STATUS_CALIBRATE 0b01000000 // 6 4 synthesizer calibration running
+
109 #define RADIOLIB_CC1101_STATUS_SETTLING 0b01010000 // 6 4 PLL settling
+
110 #define RADIOLIB_CC1101_STATUS_RXFIFO_OVERFLOW 0b01100000 // 6 4 Rx FIFO overflow
+
111 #define RADIOLIB_CC1101_STATUS_TXFIFO_UNDERFLOW 0b01110000 // 6 4 Tx FIFO underflow
+
112 
+
113 // RADIOLIB_CC1101_REG_IOCFG2
+
114 #define RADIOLIB_CC1101_GDO2_NORM 0b00000000 // 6 6 GDO2 output: active high (default)
+
115 #define RADIOLIB_CC1101_GDO2_INV 0b01000000 // 6 6 active low
+
116 
+
117 // RADIOLIB_CC1101_REG_IOCFG1
+
118 #define RADIOLIB_CC1101_GDO_DS_LOW 0b00000000 // 7 7 GDOx output drive strength: low (default)
+
119 #define RADIOLIB_CC1101_GDO_DS_HIGH 0b10000000 // 7 7 high
+
120 #define RADIOLIB_CC1101_GDO1_NORM 0b00000000 // 6 6 GDO1 output: active high (default)
+
121 #define RADIOLIB_CC1101_GDO1_INV 0b01000000 // 6 6 active low
+
122 
+
123 // RADIOLIB_CC1101_REG_IOCFG0
+
124 #define RADIOLIB_CC1101_GDO0_TEMP_SENSOR_OFF 0b00000000 // 7 7 analog temperature sensor output: disabled (default)
+
125 #define RADIOLIB_CC1101_GDO0_TEMP_SENSOR_ON 0b10000000 // 7 7 enabled
+
126 #define RADIOLIB_CC1101_GDO0_NORM 0b00000000 // 6 6 GDO0 output: active high (default)
+
127 #define RADIOLIB_CC1101_GDO0_INV 0b01000000 // 6 6 active low
+
128 
+
129 // RADIOLIB_CC1101_REG_IOCFG2 + REG_IOCFG1 + REG_IOCFG0
+
130 #define RADIOLIB_CC1101_GDOX_RX_FIFO_FULL 0x00 // 5 0 Rx FIFO full or above threshold
+
131 #define RADIOLIB_CC1101_GDOX_RX_FIFO_FULL_OR_PKT_END 0x01 // 5 0 Rx FIFO full or above threshold or reached packet end
+
132 #define RADIOLIB_CC1101_GDOX_TX_FIFO_ABOVE_THR 0x02 // 5 0 Tx FIFO above threshold
+
133 #define RADIOLIB_CC1101_GDOX_TX_FIFO_FULL 0x03 // 5 0 Tx FIFO full
+
134 #define RADIOLIB_CC1101_GDOX_RX_FIFO_OVERFLOW 0x04 // 5 0 Rx FIFO overflowed
+
135 #define RADIOLIB_CC1101_GDOX_TX_FIFO_UNDERFLOW 0x05 // 5 0 Tx FIFO underflowed
+
136 #define RADIOLIB_CC1101_GDOX_SYNC_WORD_SENT_OR_PKT_RECEIVED 0x06 // 5 0 sync word was sent or packet was received
+
137 #define RADIOLIB_CC1101_GDOX_PKT_RECEIVED_CRC_OK 0x07 // 5 0 packet received and CRC check passed
+
138 #define RADIOLIB_CC1101_GDOX_PREAMBLE_QUALITY_REACHED 0x08 // 5 0 received preamble quality is above threshold
+
139 #define RADIOLIB_CC1101_GDOX_CHANNEL_CLEAR 0x09 // 5 0 RSSI level below threshold (channel is clear)
+
140 #define RADIOLIB_CC1101_GDOX_PLL_LOCKED 0x0A // 5 0 PLL is locked
+
141 #define RADIOLIB_CC1101_GDOX_SERIAL_CLOCK 0x0B // 5 0 serial data clock
+
142 #define RADIOLIB_CC1101_GDOX_SERIAL_DATA_SYNC 0x0C // 5 0 serial data output in: synchronous mode
+
143 #define RADIOLIB_CC1101_GDOX_SERIAL_DATA_ASYNC 0x0D // 5 0 asynchronous mode
+
144 #define RADIOLIB_CC1101_GDOX_CARRIER_SENSE 0x0E // 5 0 RSSI above threshold
+
145 #define RADIOLIB_CC1101_GDOX_CRC_OK 0x0F // 5 0 CRC check passed
+
146 #define RADIOLIB_CC1101_GDOX_RX_HARD_DATA1 0x16 // 5 0 direct access to demodulated data
+
147 #define RADIOLIB_CC1101_GDOX_RX_HARD_DATA0 0x17 // 5 0 direct access to demodulated data
+
148 #define RADIOLIB_CC1101_GDOX_PA_PD 0x1B // 5 0 power amplifier circuit is powered down
+
149 #define RADIOLIB_CC1101_GDOX_LNA_PD 0x1C // 5 0 low-noise amplifier circuit is powered down
+
150 #define RADIOLIB_CC1101_GDOX_RX_SYMBOL_TICK 0x1D // 5 0 direct access to symbol tick of received data
+
151 #define RADIOLIB_CC1101_GDOX_WOR_EVNT0 0x24 // 5 0 wake-on-radio event 0
+
152 #define RADIOLIB_CC1101_GDOX_WOR_EVNT1 0x25 // 5 0 wake-on-radio event 1
+
153 #define RADIOLIB_CC1101_GDOX_CLK_256 0x26 // 5 0 256 Hz clock
+
154 #define RADIOLIB_CC1101_GDOX_CLK_32K 0x27 // 5 0 32 kHz clock
+
155 #define RADIOLIB_CC1101_GDOX_CHIP_RDYN 0x29 // 5 0 (default for GDO2)
+
156 #define RADIOLIB_CC1101_GDOX_XOSC_STABLE 0x2B // 5 0
+
157 #define RADIOLIB_CC1101_GDOX_HIGH_Z 0x2E // 5 0 high impedance state (default for GDO1)
+
158 #define RADIOLIB_CC1101_GDOX_HW_TO_0 0x2F // 5 0
+
159 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_1 0x30 // 5 0 crystal oscillator clock: f = f(XOSC)/1
+
160 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_1_5 0x31 // 5 0 f = f(XOSC)/1.5
+
161 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_2 0x32 // 5 0 f = f(XOSC)/2
+
162 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_3 0x33 // 5 0 f = f(XOSC)/3
+
163 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_4 0x34 // 5 0 f = f(XOSC)/4
+
164 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_6 0x35 // 5 0 f = f(XOSC)/6
+
165 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_8 0x36 // 5 0 f = f(XOSC)/8
+
166 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_12 0x37 // 5 0 f = f(XOSC)/12
+
167 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_16 0x38 // 5 0 f = f(XOSC)/16
+
168 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_24 0x39 // 5 0 f = f(XOSC)/24
+
169 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_32 0x3A // 5 0 f = f(XOSC)/32
+
170 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_48 0x3B // 5 0 f = f(XOSC)/48
+
171 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_64 0x3C // 5 0 f = f(XOSC)/64
+
172 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_96 0x3D // 5 0 f = f(XOSC)/96
+
173 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_128 0x3E // 5 0 f = f(XOSC)/128
+
174 #define RADIOLIB_CC1101_GDOX_CLOCK_XOSC_192 0x3F // 5 0 f = f(XOSC)/192 (default for GDO0)
+
175 
+
176 // RADIOLIB_CC1101_REG_FIFOTHR
+
177 #define RADIOLIB_CC1101_ADC_RETENTION_OFF 0b00000000 // 6 6 do not retain ADC settings in sleep mode (default)
+
178 #define RADIOLIB_CC1101_ADC_RETENTION_ON 0b01000000 // 6 6 retain ADC settings in sleep mode
+
179 #define RADIOLIB_CC1101_RX_ATTEN_0_DB 0b00000000 // 5 4 Rx attenuation: 0 dB (default)
+
180 #define RADIOLIB_CC1101_RX_ATTEN_6_DB 0b00010000 // 5 4 6 dB
+
181 #define RADIOLIB_CC1101_RX_ATTEN_12_DB 0b00100000 // 5 4 12 dB
+
182 #define RADIOLIB_CC1101_RX_ATTEN_18_DB 0b00110000 // 5 4 18 dB
+
183 #define RADIOLIB_CC1101_FIFO_THR_TX_61_RX_4 0b00000000 // 3 0 TX fifo threshold: 61, RX fifo threshold: 4
+
184 #define RADIOLIB_CC1101_FIFO_THR_TX_33_RX_32 0b00000111 // 3 0 TX fifo threshold: 33, RX fifo threshold: 32
+
185 #define RADIOLIB_CC1101_FIFO_THRESH_TX 33
+
186 #define RADIOLIB_CC1101_FIFO_THRESH_RX 32
+
187 
+
188 // RADIOLIB_CC1101_REG_SYNC1
+
189 #define RADIOLIB_CC1101_SYNC_WORD_MSB 0xD3 // 7 0 sync word MSB
+
190 
+
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
+
220 
+
221 // RADIOLIB_CC1101_REG_ADDR
+
222 #define RADIOLIB_CC1101_DEVICE_ADDR 0x00 // 7 0 device address
+
223 
+
224 // RADIOLIB_CC1101_REG_CHANNR
+
225 #define RADIOLIB_CC1101_CHAN 0x00 // 7 0 channel number
+
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
+
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]
+
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]
+
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
+
448 
+
449 // RADIOLIB_CC1101_REG_FSCAL1
+
450 #define RADIOLIB_CC1101_FSCAL1 0x20 // 5 0 capacitor array setting for coarse VCO tuning
+
451 
+
452 // RADIOLIB_CC1101_REG_FSCAL0
+
453 #define RADIOLIB_CC1101_FSCAL0 0x0D // 6 0 frequency synthesizer calibration setting
+
454 
+
455 // RADIOLIB_CC1101_REG_RCCTRL1
+
456 #define RADIOLIB_CC1101_RCCTRL1 0x41 // 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
+
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  CC1101(Module* module);
+
543 
+
544  Module* getMod();
+
545 
+
546  // basic methods
+
547 
+
558  int16_t begin(
+
559  float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
+
560  float br = RADIOLIB_CC1101_DEFAULT_BR,
+
561  float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
+
562  float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
+
563  int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
+
564  uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
+
565 
+
569  void reset();
+
570 
+
579  int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
+
580 
+
588  int16_t receive(uint8_t* data, size_t len) override;
+
589 
+
594  int16_t standby() override;
+
595 
+
601  int16_t standby(uint8_t mode) override;
+
602 
+
608  int16_t transmitDirect(uint32_t frf = 0) override;
+
609 
+
614  int16_t receiveDirect() override;
+
615 
+
621  int16_t transmitDirectAsync(uint32_t frf = 0);
+
622 
+
627  int16_t receiveDirectAsync();
+
628 
+
633  int16_t packetMode();
+
634 
+
635  // interrupt methods
+
636 
+
642  void setGdo0Action(void (*func)(void), uint32_t dir);
+
643 
+
647  void clearGdo0Action();
+
648 
+
654  void setGdo2Action(void (*func)(void), uint32_t dir);
+
655 
+
659  void clearGdo2Action();
+
660 
+
665  void setPacketReceivedAction(void (*func)(void));
+
666 
+
670  void clearPacketReceivedAction();
+
671 
+
676  void setPacketSentAction(void (*func)(void));
+
677 
+
681  void clearPacketSentAction();
+
682 
+
691  int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
+
692 
+
697  int16_t finishTransmit() override;
+
698 
+
703  int16_t startReceive();
+
704 
+
713  int16_t startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask, size_t len);
+
714 
+
723  int16_t readData(uint8_t* data, size_t len) override;
+
724 
+
725  // configuration methods
+
726 
+
733  int16_t setFrequency(float freq);
+
734 
+
740  int16_t setBitRate(float br);
+
741 
+
747  int16_t setRxBandwidth(float rxBw);
+
748 
+
754  int16_t setFrequencyDeviation(float freqDev) override;
+
755 
+
761  int16_t getFrequencyDeviation(float *freqDev);
+
762 
+
768  int16_t setOutputPower(int8_t pwr);
+
769 
+
778  int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
779 
+
788  int16_t setSyncWord(uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
789 
+
795  int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold);
+
796 
+
804  int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
+
805 
+
810  int16_t disableAddressFiltering();
+
811 
+
817  int16_t setOOK(bool enableOOK);
+
818 
+
824  float getRSSI();
+
825 
+
830  uint8_t getLQI() const;
+
831 
+
837  size_t getPacketLength(bool update = true) override;
+
838 
+
844  int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
+
845 
+
851  int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
+
852 
+
859  int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
860 
+
866  int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
+
867 
+
873  int16_t setCrcFiltering(bool enable = true);
+
874 
+
880  int16_t setPromiscuousMode(bool enable = true);
+
881 
+
887  bool getPromiscuousMode();
+
888 
+
895  int16_t setDataShaping(uint8_t sh) override;
+
896 
+
903  int16_t setEncoding(uint8_t encoding) override;
+
904 
+
906  void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
+
907 
+
909  void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
+
910 
+
915  uint8_t randomByte();
+
916 
+
922  int16_t getChipVersion();
+
923 
+
924  #if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
+
929  void setDirectAction(void (*func)(void));
+
930 
+
935  void readBit(uint32_t pin);
+
936  #endif
+
937 
+
944  int16_t setDIOMapping(uint32_t pin, uint32_t value);
+
945 
+
946  #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
+
947  protected:
+
948  #endif
+
949  Module* mod;
+
950 
+
951  // SPI read overrides to set bit for burst write and status registers access
+
952  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
+
953  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
+
954  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
+
955  uint8_t SPIreadRegister(uint8_t reg);
+
956  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, size_t len);
+
957  void SPIwriteRegister(uint8_t reg, uint8_t data);
+
958 
+
959  void SPIsendCommand(uint8_t cmd);
+
960 
+
961  #if !defined(RADIOLIB_GODMODE)
+
962  protected:
+
963  #endif
+
964 
+
965  float frequency = RADIOLIB_CC1101_DEFAULT_FREQ;
+
966  float bitRate = RADIOLIB_CC1101_DEFAULT_BR;
+
967  uint8_t rawRSSI = 0;
+
968  uint8_t rawLQI = 0;
+
969  uint8_t modulation = RADIOLIB_CC1101_MOD_FORMAT_2_FSK;
+
970 
+
971  size_t packetLength = 0;
+
972  bool packetLengthQueried = false;
+
973  uint8_t packetLengthConfig = RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE;
+
974 
+
975  bool promiscuous = false;
+
976  bool crcOn = true;
+
977  bool directModeEnabled = true;
+
978 
+
979  int8_t power = RADIOLIB_CC1101_DEFAULT_POWER;
+
980 
+
981  int16_t config();
+
982  int16_t transmitDirect(bool sync, uint32_t frf);
+
983  int16_t receiveDirect(bool sync);
+
984  int16_t directMode(bool sync);
+
985  static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
+
986  int16_t setPacketMode(uint8_t mode, uint16_t len);
+
987 };
+
988 
+
989 #endif
+
CC1101
Control class for CC1101 module.
Definition: CC1101.h:530
+
CC1101::setDIOMapping
int16_t setDIOMapping(uint32_t pin, uint32_t value)
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition: CC1101.cpp:941
+
CC1101::setPromiscuousMode
int16_t setPromiscuousMode(bool enable=true)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition: CC1101.cpp:820
+
CC1101::setFrequencyDeviation
int16_t setFrequencyDeviation(float freqDev) override
Sets frequency deviation. Allowed values range from 1.587 to 380.8 kHz.
Definition: CC1101.cpp:483
+
CC1101::getPacketLength
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: CC1101.cpp:758
CC1101::reset
void reset()
Reset method - resets the chip using manual reset sequence (without RESET pin).
Definition: CC1101.cpp:94
-
CC1101::readBit
void readBit(uint32_t pin)
Function to read and process data bit in direct reception mode.
Definition: CC1101.cpp:1023
-
CC1101::transmitDirect
int16_t transmitDirect(uint32_t frf=0) override
Starts direct mode transmission.
Definition: CC1101.cpp:176
-
CC1101::getChipVersion
int16_t getChipVersion()
Read version SPI register. Should return CC1101_VERSION_LEGACY (0x04) or CC1101_VERSION_CURRENT (0x14...
Definition: CC1101.cpp:1014
+
CC1101::readBit
void readBit(uint32_t pin)
Function to read and process data bit in direct reception mode.
Definition: CC1101.cpp:936
+
CC1101::transmitDirect
int16_t transmitDirect(uint32_t frf=0) override
Starts direct mode transmission.
Definition: CC1101.cpp:186
+
CC1101::getChipVersion
int16_t getChipVersion()
Read version SPI register. Should return CC1101_VERSION_LEGACY (0x04) or CC1101_VERSION_CURRENT (0x14...
Definition: CC1101.cpp:927
CC1101::readData
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
-
CC1101::setRxBandwidth
int16_t setRxBandwidth(float rxBw)
Sets receiver bandwidth. Allowed values range from 58.0 to 812.0 kHz.
Definition: CC1101.cpp:541
-
CC1101::packetMode
int16_t packetMode()
Stops direct mode. It is required to call this method to switch from direct transmissions to packet-b...
Definition: CC1101.cpp:227
-
CC1101::setSyncWord
int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits=0, bool requireCarrierSense=false)
Sets 16-bit sync word as a two byte value.
Definition: CC1101.cpp:713
-
CC1101::getRSSI
float getRSSI()
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. In asynchronous direct mo...
Definition: CC1101.cpp:810
+
CC1101::setRxBandwidth
int16_t setRxBandwidth(float rxBw)
Sets receiver bandwidth. Allowed values range from 58.0 to 812.0 kHz.
Definition: CC1101.cpp:462
+
CC1101::packetMode
int16_t packetMode()
Stops direct mode. It is required to call this method to switch from direct transmissions to packet-b...
Definition: CC1101.cpp:237
+
CC1101::setSyncWord
int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits=0, bool requireCarrierSense=false)
Sets 16-bit sync word as a two byte value.
Definition: CC1101.cpp:634
+
CC1101::getRSSI
float getRSSI()
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. In asynchronous direct mo...
Definition: CC1101.cpp:731
CC1101::transmit
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
-
CC1101::disableSyncWordFiltering
int16_t disableSyncWordFiltering(bool requireCarrierSense=false)
Disable preamble and sync word filtering and generation.
Definition: CC1101.cpp:892
-
CC1101::setPacketReceivedAction
void setPacketReceivedAction(void(*func)(void))
Sets interrupt service routine to call when a packet is received.
Definition: CC1101.cpp:242
-
CC1101::setOutputPower
int16_t setOutputPower(int8_t pwr)
Sets output power. Allowed values are -30, -20, -15, -10, 0, 5, 7 or 10 dBm.
Definition: CC1101.cpp:614
-
CC1101::variablePacketLengthMode
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition: CC1101.cpp:869
-
CC1101::setDirectAction
void setDirectAction(void(*func)(void))
Set interrupt service routine function to call when data bit is receveid in direct mode.
Definition: CC1101.cpp:1019
-
CC1101::getLQI
uint8_t getLQI() const
Gets LQI (Link Quality Indicator) of the last received packet.
Definition: CC1101.cpp:833
-
CC1101::setRfSwitchPins
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: CC1101.cpp:986
-
CC1101::setCrcFiltering
int16_t setCrcFiltering(bool enable=true)
Enable CRC filtering and generation.
Definition: CC1101.cpp:897
+
CC1101::disableSyncWordFiltering
int16_t disableSyncWordFiltering(bool requireCarrierSense=false)
Disable preamble and sync word filtering and generation.
Definition: CC1101.cpp:805
+
CC1101::setPacketReceivedAction
void setPacketReceivedAction(void(*func)(void))
Sets interrupt service routine to call when a packet is received.
Definition: CC1101.cpp:252
+
CC1101::setOutputPower
int16_t setOutputPower(int8_t pwr)
Sets output power. Allowed values are -30, -20, -15, -10, 0, 5, 7 or 10 dBm.
Definition: CC1101.cpp:535
+
CC1101::variablePacketLengthMode
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition: CC1101.cpp:782
+
CC1101::setDirectAction
void setDirectAction(void(*func)(void))
Set interrupt service routine function to call when data bit is receveid in direct mode.
Definition: CC1101.cpp:932
+
CC1101::getLQI
uint8_t getLQI() const
Gets LQI (Link Quality Indicator) of the last received packet.
Definition: CC1101.cpp:754
+
CC1101::setRfSwitchPins
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: CC1101.cpp:899
+
CC1101::setCrcFiltering
int16_t setCrcFiltering(bool enable=true)
Enable CRC filtering and generation.
Definition: CC1101.cpp:810
CC1101::CC1101
CC1101(Module *module)
Default constructor.
Definition: CC1101.cpp:5
-
CC1101::setNodeAddress
int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs=0)
Sets node and broadcast addresses. Calling this method will also enable address filtering.
Definition: CC1101.cpp:760
-
CC1101::enableSyncWordFiltering
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0, bool requireCarrierSense=false)
Enable sync word filtering and generation.
Definition: CC1101.cpp:873
-
CC1101::clearPacketSentAction
void clearPacketSentAction()
Clears interrupt service routine to call when a packet is sent.
Definition: CC1101.cpp:254
-
CC1101::clearPacketReceivedAction
void clearPacketReceivedAction()
Clears interrupt service routine to call when a packet is received.
Definition: CC1101.cpp:246
+
CC1101::setNodeAddress
int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs=0)
Sets node and broadcast addresses. Calling this method will also enable address filtering.
Definition: CC1101.cpp:681
+
CC1101::enableSyncWordFiltering
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0, bool requireCarrierSense=false)
Enable sync word filtering and generation.
Definition: CC1101.cpp:786
+
CC1101::clearPacketSentAction
void clearPacketSentAction()
Clears interrupt service routine to call when a packet is sent.
Definition: CC1101.cpp:264
+
CC1101::clearPacketReceivedAction
void clearPacketReceivedAction()
Clears interrupt service routine to call when a packet is received.
Definition: CC1101.cpp:256
CC1101::standby
int16_t standby() override
Sets the module to standby mode.
Definition: CC1101.cpp:162
-
CC1101::setRfSwitchTable
void setRfSwitchTable(const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: CC1101.cpp:990
-
CC1101::randomByte
uint8_t randomByte()
Get one truly random byte from RSSI noise.
Definition: CC1101.cpp:994
+
CC1101::setRfSwitchTable
void setRfSwitchTable(const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: CC1101.cpp:903
+
CC1101::randomByte
uint8_t randomByte()
Get one truly random byte from RSSI noise.
Definition: CC1101.cpp:907
CC1101::startTransmit
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:149
-
CC1101::setFrequency
int16_t setFrequency(float freq)
Sets carrier frequency. Allowed values are in bands 300.0 to 348.0 MHz, 387.0 to 464....
Definition: CC1101.cpp:495
-
CC1101::disableAddressFiltering
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition: CC1101.cpp:771
-
CC1101::setGdo0Action
void setGdo0Action(void(*func)(void), uint32_t dir)
Sets interrupt service routine to call when GDO0 activates.
Definition: CC1101.cpp:234
-
CC1101::receiveDirectAsync
int16_t receiveDirectAsync()
Starts asynchronous direct mode reception.
Definition: CC1101.cpp:210
-
CC1101::setBitRate
int16_t setBitRate(float br)
Sets bit rate. Allowed values range from 0.025 to 600.0 kbps.
Definition: CC1101.cpp:521
-
CC1101::receiveDirect
int16_t receiveDirect() override
Starts direct mode reception.
Definition: CC1101.cpp:206
-
CC1101::setEncoding
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER,...
Definition: CC1101.cpp:962
-
CC1101::clearGdo0Action
void clearGdo0Action()
Clears interrupt service routine to call when GDO0 activates.
Definition: CC1101.cpp:238
+
CC1101::setFrequency
int16_t setFrequency(float freq)
Sets carrier frequency. Allowed values are in bands 300.0 to 348.0 MHz, 387.0 to 464....
Definition: CC1101.cpp:416
+
CC1101::disableAddressFiltering
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition: CC1101.cpp:692
+
CC1101::setGdo0Action
void setGdo0Action(void(*func)(void), uint32_t dir)
Sets interrupt service routine to call when GDO0 activates.
Definition: CC1101.cpp:244
+
CC1101::receiveDirectAsync
int16_t receiveDirectAsync()
Starts asynchronous direct mode reception.
Definition: CC1101.cpp:220
+
CC1101::setBitRate
int16_t setBitRate(float br)
Sets bit rate. Allowed values range from 0.025 to 600.0 kbps.
Definition: CC1101.cpp:442
+
CC1101::receiveDirect
int16_t receiveDirect() override
Starts direct mode reception.
Definition: CC1101.cpp:216
+
CC1101::setEncoding
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER,...
Definition: CC1101.cpp:875
+
CC1101::clearGdo0Action
void clearGdo0Action()
Clears interrupt service routine to call when GDO0 activates.
Definition: CC1101.cpp:248
CC1101::receive
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
-
CC1101::getFrequencyDeviation
int16_t getFrequencyDeviation(float *freqDev)
Gets frequency deviation.
Definition: CC1101.cpp:589
-
CC1101::clearGdo2Action
void clearGdo2Action()
Clears interrupt service routine to call when GDO0 activates.
Definition: CC1101.cpp:266
-
CC1101::fixedPacketLengthMode
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition: CC1101.cpp:859
-
CC1101::setGdo2Action
void setGdo2Action(void(*func)(void), uint32_t dir)
Sets interrupt service routine to call when GDO2 activates.
Definition: CC1101.cpp:258
+
CC1101::getFrequencyDeviation
int16_t getFrequencyDeviation(float *freqDev)
Gets frequency deviation.
Definition: CC1101.cpp:510
+
CC1101::clearGdo2Action
void clearGdo2Action()
Clears interrupt service routine to call when GDO0 activates.
Definition: CC1101.cpp:276
+
CC1101::fixedPacketLengthMode
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition: CC1101.cpp:772
+
CC1101::setGdo2Action
void setGdo2Action(void(*func)(void), uint32_t dir)
Sets interrupt service routine to call when GDO2 activates.
Definition: CC1101.cpp:268
CC1101::begin
int16_t begin(float freq=RADIOLIB_CC1101_DEFAULT_FREQ, float br=RADIOLIB_CC1101_DEFAULT_BR, float freqDev=RADIOLIB_CC1101_DEFAULT_FREQDEV, float rxBw=RADIOLIB_CC1101_DEFAULT_RXBW, int8_t pwr=RADIOLIB_CC1101_DEFAULT_POWER, uint8_t preambleLength=RADIOLIB_CC1101_DEFAULT_PREAMBLELEN)
Initialization method.
Definition: CC1101.cpp:13
-
CC1101::setDataShaping
int16_t setDataShaping(uint8_t sh) override
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Allowed value is RADI...
Definition: CC1101.cpp:943
-
CC1101::setPreambleLength
int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold)
Sets preamble length.
Definition: CC1101.cpp:718
-
CC1101::getPromiscuousMode
bool getPromiscuousMode()
Get whether the modem is in promiscuous mode: no packet filtering (e.g., no preamble,...
Definition: CC1101.cpp:939
-
CC1101::transmitDirectAsync
int16_t transmitDirectAsync(uint32_t frf=0)
Starts asynchronous direct mode transmission.
Definition: CC1101.cpp:180
-
CC1101::finishTransmit
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: CC1101.cpp:364
-
CC1101::startReceive
int16_t startReceive()
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Definition: CC1101.cpp:375
-
CC1101::setOOK
int16_t setOOK(bool enableOOK)
Enables/disables OOK modulation instead of FSK.
Definition: CC1101.cpp:781
-
CC1101::setPacketSentAction
void setPacketSentAction(void(*func)(void))
Sets interrupt service routine to call when a packet is sent.
Definition: CC1101.cpp:250
+
CC1101::setDataShaping
int16_t setDataShaping(uint8_t sh) override
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Allowed value is RADI...
Definition: CC1101.cpp:856
+
CC1101::setPreambleLength
int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold)
Sets preamble length.
Definition: CC1101.cpp:639
+
CC1101::getPromiscuousMode
bool getPromiscuousMode()
Get whether the modem is in promiscuous mode: no packet filtering (e.g., no preamble,...
Definition: CC1101.cpp:852
+
CC1101::transmitDirectAsync
int16_t transmitDirectAsync(uint32_t frf=0)
Starts asynchronous direct mode transmission.
Definition: CC1101.cpp:190
+
CC1101::finishTransmit
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: CC1101.cpp:322
+
CC1101::startReceive
int16_t startReceive()
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Definition: CC1101.cpp:333
+
CC1101::setOOK
int16_t setOOK(bool enableOOK)
Enables/disables OOK modulation instead of FSK.
Definition: CC1101.cpp:702
+
CC1101::setPacketSentAction
void setPacketSentAction(void(*func)(void))
Sets interrupt service routine to call when a packet is sent.
Definition: CC1101.cpp:260
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:31
Module::RFSWITCH_MAX_PINS
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code.
Definition: Module.h:42
PhysicalLayer
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:33