diff --git a/_c_c1101_8h_source.html b/_c_c1101_8h_source.html index 6e2ad09c..a088b871 100644 --- a/_c_c1101_8h_source.html +++ b/_c_c1101_8h_source.html @@ -108,776 +108,777 @@ $(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 64
-
12#define RADIOLIB_CC1101_CRYSTAL_FREQ 26.0f
-
13#define RADIOLIB_CC1101_DIV_EXPONENT 16
-
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_PKTCTRL1
-
195#define RADIOLIB_CC1101_PQT 0x00 // 7 5 preamble quality threshold
-
196#define RADIOLIB_CC1101_CRC_AUTOFLUSH_OFF 0b00000000 // 3 3 automatic Rx FIFO flush on CRC check fail: disabled (default)
-
197#define RADIOLIB_CC1101_CRC_AUTOFLUSH_ON 0b00001000 // 3 3 enabled
-
198#define RADIOLIB_CC1101_APPEND_STATUS_OFF 0b00000000 // 2 2 append 2 status bytes to packet: disabled
-
199#define RADIOLIB_CC1101_APPEND_STATUS_ON 0b00000100 // 2 2 enabled (default)
-
200#define RADIOLIB_CC1101_ADR_CHK_NONE 0b00000000 // 1 0 address check: none (default)
-
201#define RADIOLIB_CC1101_ADR_CHK_NO_BROADCAST 0b00000001 // 1 0 without broadcast
-
202#define RADIOLIB_CC1101_ADR_CHK_SINGLE_BROADCAST 0b00000010 // 1 0 broadcast address 0x00
-
203#define RADIOLIB_CC1101_ADR_CHK_DOUBLE_BROADCAST 0b00000011 // 1 0 broadcast addresses 0x00 and 0xFF
-
204
-
205// RADIOLIB_CC1101_REG_PKTCTRL0
-
206#define RADIOLIB_CC1101_WHITE_DATA_OFF 0b00000000 // 6 6 data whitening: disabled
-
207#define RADIOLIB_CC1101_WHITE_DATA_ON 0b01000000 // 6 6 enabled (default)
-
208#define RADIOLIB_CC1101_PKT_FORMAT_NORMAL 0b00000000 // 5 4 packet format: normal (FIFOs)
-
209#define RADIOLIB_CC1101_PKT_FORMAT_SYNCHRONOUS 0b00010000 // 5 4 synchronous serial
-
210#define RADIOLIB_CC1101_PKT_FORMAT_RANDOM 0b00100000 // 5 4 random transmissions
-
211#define RADIOLIB_CC1101_PKT_FORMAT_ASYNCHRONOUS 0b00110000 // 5 4 asynchronous serial
-
212#define RADIOLIB_CC1101_CRC_OFF 0b00000000 // 2 2 CRC disabled
-
213#define RADIOLIB_CC1101_CRC_ON 0b00000100 // 2 2 CRC enabled (default)
-
214#define RADIOLIB_CC1101_LENGTH_CONFIG_FIXED 0b00000000 // 1 0 packet length: fixed
-
215#define RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE 0b00000001 // 1 0 variable (default)
-
216#define RADIOLIB_CC1101_LENGTH_CONFIG_INFINITE 0b00000010 // 1 0 infinite
-
217
-
218// RADIOLIB_CC1101_REG_ADDR
-
219#define RADIOLIB_CC1101_DEVICE_ADDR 0x00 // 7 0 device address
-
220
-
221// RADIOLIB_CC1101_REG_CHANNR
-
222#define RADIOLIB_CC1101_CHAN 0x00 // 7 0 channel number
-
223
-
224// RADIOLIB_CC1101_REG_FSCTRL1
-
225#define RADIOLIB_CC1101_FREQ_IF 0x0F // 4 0 IF frequency setting; f_IF = (f(XOSC) / 2^10) * CC1101_FREQ_IF
-
226
-
227// CC1101_REG_FSCTRL0
-
228#define RADIOLIB_CC1101_FREQOFF 0x00 // 7 0 base frequency offset (2s-compliment)
-
229
-
230// RADIOLIB_CC1101_REG_FREQ2 + REG_FREQ1 + REG_FREQ0
-
231#define RADIOLIB_CC1101_FREQ_MSB 0x1E // 5 0 base frequency setting: f_carrier = (f(XOSC) / 2^16) * FREQ
-
232#define RADIOLIB_CC1101_FREQ_MID 0xC4 // 7 0 where f(XOSC) = 26 MHz
-
233#define RADIOLIB_CC1101_FREQ_LSB 0xEC // 7 0 FREQ = 3-byte value of FREQ registers
-
234
-
235// RADIOLIB_CC1101_REG_MDMCFG4
-
236#define RADIOLIB_CC1101_CHANBW_E 0b10000000 // 7 6 channel bandwidth: BW_channel = f(XOSC) / (8 * (4 + CHANBW_M)*2^CHANBW_E) [Hz]
-
237#define RADIOLIB_CC1101_CHANBW_M 0b00000000 // 5 4 default value for 26 MHz crystal: 203 125 Hz
-
238#define RADIOLIB_CC1101_DRATE_E 0x0C // 3 0 symbol rate: R_data = (((256 + DRATE_M) * 2^DRATE_E) / 2^28) * f(XOSC) [Baud]
-
239
-
240// RADIOLIB_CC1101_REG_MDMCFG3
-
241#define RADIOLIB_CC1101_DRATE_M 0x22 // 7 0 default value for 26 MHz crystal: 115 051 Baud
-
242
-
243// RADIOLIB_CC1101_REG_MDMCFG2
-
244#define RADIOLIB_CC1101_DEM_DCFILT_OFF 0b10000000 // 7 7 digital DC filter: disabled
-
245#define RADIOLIB_CC1101_DEM_DCFILT_ON 0b00000000 // 7 7 enabled - only for data rates above 250 kBaud (default)
-
246#define RADIOLIB_CC1101_MOD_FORMAT_2_FSK 0b00000000 // 6 4 modulation format: 2-FSK (default)
-
247#define RADIOLIB_CC1101_MOD_FORMAT_GFSK 0b00010000 // 6 4 GFSK
-
248#define RADIOLIB_CC1101_MOD_FORMAT_ASK_OOK 0b00110000 // 6 4 ASK/OOK
-
249#define RADIOLIB_CC1101_MOD_FORMAT_4_FSK 0b01000000 // 6 4 4-FSK
-
250#define RADIOLIB_CC1101_MOD_FORMAT_MFSK 0b01110000 // 6 4 MFSK - only for data rates above 26 kBaud
-
251#define RADIOLIB_CC1101_MANCHESTER_EN_OFF 0b00000000 // 3 3 Manchester encoding: disabled (default)
-
252#define RADIOLIB_CC1101_MANCHESTER_EN_ON 0b00001000 // 3 3 enabled
-
253#define RADIOLIB_CC1101_SYNC_MODE_NONE 0b00000000 // 2 0 synchronization: no preamble/sync
-
254#define RADIOLIB_CC1101_SYNC_MODE_15_16 0b00000001 // 2 0 15/16 sync word bits
-
255#define RADIOLIB_CC1101_SYNC_MODE_16_16 0b00000010 // 2 0 16/16 sync word bits (default)
-
256#define RADIOLIB_CC1101_SYNC_MODE_30_32 0b00000011 // 2 0 30/32 sync word bits
-
257#define RADIOLIB_CC1101_SYNC_MODE_NONE_THR 0b00000100 // 2 0 no preamble sync, carrier sense above threshold
-
258#define RADIOLIB_CC1101_SYNC_MODE_15_16_THR 0b00000101 // 2 0 15/16 sync word bits, carrier sense above threshold
-
259#define RADIOLIB_CC1101_SYNC_MODE_16_16_THR 0b00000110 // 2 0 16/16 sync word bits, carrier sense above threshold
-
260#define RADIOLIB_CC1101_SYNC_MODE_30_32_THR 0b00000111 // 2 0 30/32 sync word bits, carrier sense above threshold
-
261
-
262// RADIOLIB_CC1101_REG_MDMCFG1
-
263#define RADIOLIB_CC1101_FEC_OFF 0b00000000 // 7 7 forward error correction: disabled (default)
-
264#define RADIOLIB_CC1101_FEC_ON 0b10000000 // 7 7 enabled - only for fixed packet length
-
265#define RADIOLIB_CC1101_NUM_PREAMBLE_2 0b00000000 // 6 4 number of preamble bytes: 2
-
266#define RADIOLIB_CC1101_NUM_PREAMBLE_3 0b00010000 // 6 4 3
-
267#define RADIOLIB_CC1101_NUM_PREAMBLE_4 0b00100000 // 6 4 4 (default)
-
268#define RADIOLIB_CC1101_NUM_PREAMBLE_6 0b00110000 // 6 4 6
-
269#define RADIOLIB_CC1101_NUM_PREAMBLE_8 0b01000000 // 6 4 8
-
270#define RADIOLIB_CC1101_NUM_PREAMBLE_12 0b01010000 // 6 4 12
-
271#define RADIOLIB_CC1101_NUM_PREAMBLE_16 0b01100000 // 6 4 16
-
272#define RADIOLIB_CC1101_NUM_PREAMBLE_24 0b01110000 // 6 4 24
-
273#define RADIOLIB_CC1101_CHANSPC_E 0x02 // 1 0 channel spacing: df_channel = (f(XOSC) / 2^18) * (256 + CHANSPC_M) * 2^CHANSPC_E [Hz]
-
274
-
275// RADIOLIB_CC1101_REG_MDMCFG0
-
276#define RADIOLIB_CC1101_CHANSPC_M 0xF8 // 7 0 default value for 26 MHz crystal: 199 951 kHz
-
277
-
278// RADIOLIB_CC1101_REG_DEVIATN
-
279#define RADIOLIB_CC1101_DEVIATION_E 0b01000000 // 6 4 frequency deviation: f_dev = (f(XOSC) / 2^17) * (8 + DEVIATION_M) * 2^DEVIATION_E [Hz]
-
280#define RADIOLIB_CC1101_DEVIATION_M 0b00000111 // 2 0 default value for 26 MHz crystal: +- 47 607 Hz
-
281#define RADIOLIB_CC1101_MSK_PHASE_CHANGE_PERIOD 0x07 // 2 0 phase change symbol period fraction: 1 / (MSK_PHASE_CHANGE_PERIOD + 1)
-
282
-
283// RADIOLIB_CC1101_REG_MCSM2
-
284#define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_OFF 0b00000000 // 4 4 Rx timeout based on RSSI value: disabled (default)
-
285#define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_ON 0b00010000 // 4 4 enabled
-
286#define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_OFF 0b00000000 // 3 3 check for sync word on Rx timeout
-
287#define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_ON 0b00001000 // 3 3 check for PQI set on Rx timeout
-
288#define RADIOLIB_CC1101_RX_TIMEOUT_OFF 0b00000111 // 2 0 Rx timeout: disabled (default)
-
289#define RADIOLIB_CC1101_RX_TIMEOUT_MAX 0b00000000 // 2 0 max value (actual value depends on WOR_RES, EVENT0 and f(XOSC))
-
290
-
291// RADIOLIB_CC1101_REG_MCSM1
-
292#define RADIOLIB_CC1101_CCA_MODE_ALWAYS 0b00000000 // 5 4 clear channel indication: always
-
293#define RADIOLIB_CC1101_CCA_MODE_RSSI_THR 0b00010000 // 5 4 RSSI below threshold
-
294#define RADIOLIB_CC1101_CCA_MODE_RX_PKT 0b00100000 // 5 4 unless receiving packet
-
295#define RADIOLIB_CC1101_CCA_MODE_RSSI_THR_RX_PKT 0b00110000 // 5 4 RSSI below threshold unless receiving packet (default)
-
296#define RADIOLIB_CC1101_RXOFF_IDLE 0b00000000 // 3 2 next mode after packet reception: idle (default)
-
297#define RADIOLIB_CC1101_RXOFF_FSTXON 0b00000100 // 3 2 FSTxOn
-
298#define RADIOLIB_CC1101_RXOFF_TX 0b00001000 // 3 2 Tx
-
299#define RADIOLIB_CC1101_RXOFF_RX 0b00001100 // 3 2 Rx
-
300#define RADIOLIB_CC1101_TXOFF_IDLE 0b00000000 // 1 0 next mode after packet transmission: idle (default)
-
301#define RADIOLIB_CC1101_TXOFF_FSTXON 0b00000001 // 1 0 FSTxOn
-
302#define RADIOLIB_CC1101_TXOFF_TX 0b00000010 // 1 0 Tx
-
303#define RADIOLIB_CC1101_TXOFF_RX 0b00000011 // 1 0 Rx
-
304
-
305// RADIOLIB_CC1101_REG_MCSM0
-
306#define RADIOLIB_CC1101_FS_AUTOCAL_NEVER 0b00000000 // 5 4 automatic calibration: never (default)
-
307#define RADIOLIB_CC1101_FS_AUTOCAL_IDLE_TO_RXTX 0b00010000 // 5 4 every transition from idle to Rx/Tx
-
308#define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE 0b00100000 // 5 4 every transition from Rx/Tx to idle
-
309#define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE_4TH 0b00110000 // 5 4 every 4th transition from Rx/Tx to idle
-
310#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_1 0b00000000 // 3 2 number of counter expirations before CHP_RDYN goes low: 1 (default)
-
311#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_16 0b00000100 // 3 2 16
-
312#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_64 0b00001000 // 3 2 64
-
313#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_256 0b00001100 // 3 2 256
-
314#define RADIOLIB_CC1101_PIN_CTRL_OFF 0b00000000 // 1 1 pin radio control: disabled (default)
-
315#define RADIOLIB_CC1101_PIN_CTRL_ON 0b00000010 // 1 1 enabled
-
316#define RADIOLIB_CC1101_XOSC_FORCE_OFF 0b00000000 // 0 0 do not force XOSC to remain on in sleep (default)
-
317#define RADIOLIB_CC1101_XOSC_FORCE_ON 0b00000001 // 0 0 force XOSC to remain on in sleep
-
318
-
319// RADIOLIB_CC1101_REG_FOCCFG
-
320#define RADIOLIB_CC1101_FOC_BS_CS_GATE_OFF 0b00000000 // 5 5 do not freeze frequency compensation until CS goes high
-
321#define RADIOLIB_CC1101_FOC_BS_CS_GATE_ON 0b00100000 // 5 5 freeze frequency compensation until CS goes high (default)
-
322#define RADIOLIB_CC1101_FOC_PRE_K 0b00000000 // 4 3 frequency compensation loop gain before sync word: K
-
323#define RADIOLIB_CC1101_FOC_PRE_2K 0b00001000 // 4 3 2K
-
324#define RADIOLIB_CC1101_FOC_PRE_3K 0b00010000 // 4 3 3K (default)
-
325#define RADIOLIB_CC1101_FOC_PRE_4K 0b00011000 // 4 3 4K
-
326#define RADIOLIB_CC1101_FOC_POST_K 0b00000000 // 2 2 frequency compensation loop gain after sync word: same as FOC_PRE
-
327#define RADIOLIB_CC1101_FOC_POST_K_2 0b00000100 // 2 2 K/2 (default)
-
328#define RADIOLIB_CC1101_FOC_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 frequency compensation saturation point: no compensation - required for ASK/OOK
-
329#define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_8 0b00000001 // 1 0 +- BW_chan/8
-
330#define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_4 0b00000010 // 1 0 +- BW_chan/4 (default)
-
331#define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_2 0b00000011 // 1 0 +- BW_chan/2
-
332
-
333// RADIOLIB_CC1101_REG_BSCFG
-
334#define RADIOLIB_CC1101_BS_PRE_KI 0b00000000 // 7 6 clock recovery integral gain before sync word: Ki
-
335#define RADIOLIB_CC1101_BS_PRE_2KI 0b01000000 // 7 6 2Ki (default)
-
336#define RADIOLIB_CC1101_BS_PRE_3KI 0b10000000 // 7 6 3Ki
-
337#define RADIOLIB_CC1101_BS_PRE_4KI 0b11000000 // 7 6 4Ki
-
338#define RADIOLIB_CC1101_BS_PRE_KP 0b00000000 // 5 4 clock recovery proportional gain before sync word: Kp
-
339#define RADIOLIB_CC1101_BS_PRE_2KP 0b00010000 // 5 4 2Kp
-
340#define RADIOLIB_CC1101_BS_PRE_3KP 0b00100000 // 5 4 3Kp (default)
-
341#define RADIOLIB_CC1101_BS_PRE_4KP 0b00110000 // 5 4 4Kp
-
342#define RADIOLIB_CC1101_BS_POST_KI 0b00000000 // 3 3 clock recovery integral gain after sync word: same as BS_PRE
-
343#define RADIOLIB_CC1101_BS_POST_KI_2 0b00001000 // 3 3 Ki/2 (default)
-
344#define RADIOLIB_CC1101_BS_POST_KP 0b00000000 // 2 2 clock recovery proportional gain after sync word: same as BS_PRE
-
345#define RADIOLIB_CC1101_BS_POST_KP_1 0b00000100 // 2 2 Kp (default)
-
346#define RADIOLIB_CC1101_BS_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 data rate compensation saturation point: no compensation
-
347#define RADIOLIB_CC1101_BS_LIMIT_3_125 0b00000001 // 1 0 +- 3.125 %
-
348#define RADIOLIB_CC1101_BS_LIMIT_6_25 0b00000010 // 1 0 +- 6.25 %
-
349#define RADIOLIB_CC1101_BS_LIMIT_12_5 0b00000011 // 1 0 +- 12.5 %
-
350
-
351// RADIOLIB_CC1101_REG_AGCCTRL2
-
352#define RADIOLIB_CC1101_MAX_DVGA_GAIN_0 0b00000000 // 7 6 reduce maximum available DVGA gain: no reduction (default)
-
353#define RADIOLIB_CC1101_MAX_DVGA_GAIN_1 0b01000000 // 7 6 disable top gain setting
-
354#define RADIOLIB_CC1101_MAX_DVGA_GAIN_2 0b10000000 // 7 6 disable top two gain setting
-
355#define RADIOLIB_CC1101_MAX_DVGA_GAIN_3 0b11000000 // 7 6 disable top three gain setting
-
356#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_0_DB 0b00000000 // 5 3 reduce maximum LNA gain by: 0 dB (default)
-
357#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_2_6_DB 0b00001000 // 5 3 2.6 dB
-
358#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_6_1_DB 0b00010000 // 5 3 6.1 dB
-
359#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_7_4_DB 0b00011000 // 5 3 7.4 dB
-
360#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_9_2_DB 0b00100000 // 5 3 9.2 dB
-
361#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_11_5_DB 0b00101000 // 5 3 11.5 dB
-
362#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_14_6_DB 0b00110000 // 5 3 14.6 dB
-
363#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_17_1_DB 0b00111000 // 5 3 17.1 dB
-
364#define RADIOLIB_CC1101_MAGN_TARGET_24_DB 0b00000000 // 2 0 average amplitude target for filter: 24 dB
-
365#define RADIOLIB_CC1101_MAGN_TARGET_27_DB 0b00000001 // 2 0 27 dB
-
366#define RADIOLIB_CC1101_MAGN_TARGET_30_DB 0b00000010 // 2 0 30 dB
-
367#define RADIOLIB_CC1101_MAGN_TARGET_33_DB 0b00000011 // 2 0 33 dB (default)
-
368#define RADIOLIB_CC1101_MAGN_TARGET_36_DB 0b00000100 // 2 0 36 dB
-
369#define RADIOLIB_CC1101_MAGN_TARGET_38_DB 0b00000101 // 2 0 38 dB
-
370#define RADIOLIB_CC1101_MAGN_TARGET_40_DB 0b00000110 // 2 0 40 dB
-
371#define RADIOLIB_CC1101_MAGN_TARGET_42_DB 0b00000111 // 2 0 42 dB
-
372
-
373// RADIOLIB_CC1101_REG_AGCCTRL1
-
374#define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA2 0b00000000 // 6 6 LNA priority setting: LNA2 first
-
375#define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA 0b01000000 // 6 6 LNA first (default)
-
376#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_OFF 0b00000000 // 5 4 RSSI relative change to assert carrier sense: disabled (default)
-
377#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_6_DB 0b00010000 // 5 4 6 dB
-
378#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_10_DB 0b00100000 // 5 4 10 dB
-
379#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_14_DB 0b00110000 // 5 4 14 dB
-
380#define RADIOLIB_CC1101_CARRIER_SENSE_ABS_THR 0x00 // 3 0 RSSI threshold to assert carrier sense in 2s compliment, Thr = MAGN_TARGET + CARRIER_SENSE_ABS_TH [dB]
-
381
-
382// RADIOLIB_CC1101_REG_AGCCTRL0
-
383#define RADIOLIB_CC1101_HYST_LEVEL_NONE 0b00000000 // 7 6 AGC hysteresis level: none
-
384#define RADIOLIB_CC1101_HYST_LEVEL_LOW 0b01000000 // 7 6 low
-
385#define RADIOLIB_CC1101_HYST_LEVEL_MEDIUM 0b10000000 // 7 6 medium (default)
-
386#define RADIOLIB_CC1101_HYST_LEVEL_HIGH 0b11000000 // 7 6 high
-
387#define RADIOLIB_CC1101_WAIT_TIME_8_SAMPLES 0b00000000 // 5 4 AGC wait time: 8 samples
-
388#define RADIOLIB_CC1101_WAIT_TIME_16_SAMPLES 0b00010000 // 5 4 16 samples (default)
-
389#define RADIOLIB_CC1101_WAIT_TIME_24_SAMPLES 0b00100000 // 5 4 24 samples
-
390#define RADIOLIB_CC1101_WAIT_TIME_32_SAMPLES 0b00110000 // 5 4 32 samples
-
391#define RADIOLIB_CC1101_AGC_FREEZE_NEVER 0b00000000 // 3 2 freeze AGC gain: never (default)
-
392#define RADIOLIB_CC1101_AGC_FREEZE_SYNC_WORD 0b00000100 // 3 2 when sync word is found
-
393#define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_A 0b00001000 // 3 2 manually freeze analog control
-
394#define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_AD 0b00001100 // 3 2 manually freeze analog and digital control
-
395#define RADIOLIB_CC1101_FILTER_LENGTH_8 0b00000000 // 1 0 averaging length for channel filter: 8 samples
-
396#define RADIOLIB_CC1101_FILTER_LENGTH_16 0b00000001 // 1 0 16 samples (default)
-
397#define RADIOLIB_CC1101_FILTER_LENGTH_32 0b00000010 // 1 0 32 samples
-
398#define RADIOLIB_CC1101_FILTER_LENGTH_64 0b00000011 // 1 0 64 samples
-
399#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_4_DB 0b00000000 // 1 0 ASK/OOK decision boundary: 4 dB
-
400#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_8_DB 0b00000001 // 1 0 8 dB (default)
-
401#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_12_DB 0b00000010 // 1 0 12 dB
-
402#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_16_DB 0b00000011 // 1 0 16 dB
-
403
-
404// RADIOLIB_CC1101_REG_WOREVT1 + REG_WOREVT0
-
405#define RADIOLIB_CC1101_EVENT0_TIMEOUT_MSB 0x87 // 7 0 EVENT0 timeout: t_event0 = (750 / f(XOSC)) * EVENT0_TIMEOUT * 2^(5 * WOR_RES) [s]
-
406#define RADIOLIB_CC1101_EVENT0_TIMEOUT_LSB 0x6B // 7 0 default value for 26 MHz crystal: 1.0 s
-
407
-
408// RADIOLIB_CC1101_REG_WORCTRL
-
409#define RADIOLIB_CC1101_RC_POWER_UP 0b00000000 // 7 7 power up RC oscillator
-
410#define RADIOLIB_CC1101_RC_POWER_DOWN 0b10000000 // 7 7 power down RC oscillator
-
411#define RADIOLIB_CC1101_EVENT1_TIMEOUT_4 0b00000000 // 6 4 EVENT1 timeout: 4 RC periods
-
412#define RADIOLIB_CC1101_EVENT1_TIMEOUT_6 0b00010000 // 6 4 6 RC periods
-
413#define RADIOLIB_CC1101_EVENT1_TIMEOUT_8 0b00100000 // 6 4 8 RC periods
-
414#define RADIOLIB_CC1101_EVENT1_TIMEOUT_12 0b00110000 // 6 4 12 RC periods
-
415#define RADIOLIB_CC1101_EVENT1_TIMEOUT_16 0b01000000 // 6 4 16 RC periods
-
416#define RADIOLIB_CC1101_EVENT1_TIMEOUT_24 0b01010000 // 6 4 24 RC periods
-
417#define RADIOLIB_CC1101_EVENT1_TIMEOUT_32 0b01100000 // 6 4 32 RC periods
-
418#define RADIOLIB_CC1101_EVENT1_TIMEOUT_48 0b01110000 // 6 4 48 RC periods (default)
-
419#define RADIOLIB_CC1101_RC_CAL_OFF 0b00000000 // 3 3 disable RC oscillator calibration
-
420#define RADIOLIB_CC1101_RC_CAL_ON 0b00001000 // 3 3 enable RC oscillator calibration (default)
-
421#define RADIOLIB_CC1101_WOR_RES_1 0b00000000 // 1 0 EVENT0 resolution: 1 period (default)
-
422#define RADIOLIB_CC1101_WOR_RES_2_5 0b00000001 // 1 0 2^5 periods
-
423#define RADIOLIB_CC1101_WOR_RES_2_10 0b00000010 // 1 0 2^10 periods
-
424#define RADIOLIB_CC1101_WOR_RES_2_15 0b00000011 // 1 0 2^15 periods
-
425
-
426// RADIOLIB_CC1101_REG_FREND1
-
427#define RADIOLIB_CC1101_LNA_CURRENT 0x01 // 7 6 front-end LNA PTAT current output adjustment
-
428#define RADIOLIB_CC1101_LNA2MIX_CURRENT 0x01 // 5 4 front-end PTAT output adjustment
-
429#define RADIOLIB_CC1101_LODIV_BUF_CURRENT_RX 0x01 // 3 2 Rx LO buffer current adjustment
-
430#define RADIOLIB_CC1101_MIX_CURRENT 0x02 // 1 0 mixer current adjustment
-
431
-
432// RADIOLIB_CC1101_REG_FREND0
-
433#define RADIOLIB_CC1101_LODIV_BUF_CURRENT_TX 0x01 // 5 4 Tx LO buffer current adjustment
-
434#define RADIOLIB_CC1101_PA_POWER 0x00 // 2 0 set power amplifier power according to PATABLE
-
435
-
436// RADIOLIB_CC1101_REG_FSCAL3
-
437#define RADIOLIB_CC1101_CHP_CURR_CAL_OFF 0b00000000 // 5 4 disable charge pump calibration
-
438#define RADIOLIB_CC1101_CHP_CURR_CAL_ON 0b00100000 // 5 4 enable charge pump calibration (default)
-
439#define RADIOLIB_CC1101_FSCAL3 0x09 // 3 0 charge pump output current: I_out = I_0 * 2^(FSCAL3/4) [A]
-
440
-
441// RADIOLIB_CC1101_REG_FSCAL2
-
442#define RADIOLIB_CC1101_VCO_CORE_LOW 0b00000000 // 5 5 VCO: low (default)
-
443#define RADIOLIB_CC1101_VCO_CORE_HIGH 0b00100000 // 5 5 high
-
444#define RADIOLIB_CC1101_FSCAL2 0x0A // 4 0 VCO current result/override
-
445
-
446// RADIOLIB_CC1101_REG_FSCAL1
-
447#define RADIOLIB_CC1101_FSCAL1 0x20 // 5 0 capacitor array setting for coarse VCO tuning
-
448
-
449// RADIOLIB_CC1101_REG_FSCAL0
-
450#define RADIOLIB_CC1101_FSCAL0 0x0D // 6 0 frequency synthesizer calibration setting
-
451
-
452// RADIOLIB_CC1101_REG_RCCTRL1
-
453#define RADIOLIB_CC1101_RCCTRL1 0x41 // 6 0 RC oscillator configuration
-
454
-
455// RADIOLIB_CC1101_REG_RCCTRL0
-
456#define RADIOLIB_CC1101_RCCTRL0 0x00 // 6 0 RC oscillator configuration
-
457
-
458// RADIOLIB_CC1101_REG_PTEST
-
459#define RADIOLIB_CC1101_TEMP_SENS_IDLE_OFF 0x7F // 7 0 temperature sensor will not be available in idle mode (default)
-
460#define RADIOLIB_CC1101_TEMP_SENS_IDLE_ON 0xBF // 7 0 temperature sensor will be available in idle mode
-
461
-
462// RADIOLIB_CC1101_REG_TEST0
-
463#define RADIOLIB_CC1101_VCO_SEL_CAL_OFF 0b00000000 // 1 1 disable VCO selection calibration stage
-
464#define RADIOLIB_CC1101_VCO_SEL_CAL_ON 0b00000010 // 1 1 enable VCO selection calibration stage
-
465
-
466// RADIOLIB_CC1101_REG_PARTNUM
-
467#define RADIOLIB_CC1101_PARTNUM 0x00
-
468
-
469// RADIOLIB_CC1101_REG_VERSION
-
470#define RADIOLIB_CC1101_VERSION_CURRENT 0x14
-
471#define RADIOLIB_CC1101_VERSION_LEGACY 0x04
-
472#define RADIOLIB_CC1101_VERSION_CLONE 0x17
-
473
-
474// RADIOLIB_CC1101_REG_MARCSTATE
-
475#define RADIOLIB_CC1101_MARC_STATE_SLEEP 0x00 // 4 0 main radio control state: sleep
-
476#define RADIOLIB_CC1101_MARC_STATE_IDLE 0x01 // 4 0 idle
-
477#define RADIOLIB_CC1101_MARC_STATE_XOFF 0x02 // 4 0 XOFF
-
478#define RADIOLIB_CC1101_MARC_STATE_VCOON_MC 0x03 // 4 0 VCOON_MC
-
479#define RADIOLIB_CC1101_MARC_STATE_REGON_MC 0x04 // 4 0 REGON_MC
-
480#define RADIOLIB_CC1101_MARC_STATE_MANCAL 0x05 // 4 0 MANCAL
-
481#define RADIOLIB_CC1101_MARC_STATE_VCOON 0x06 // 4 0 VCOON
-
482#define RADIOLIB_CC1101_MARC_STATE_REGON 0x07 // 4 0 REGON
-
483#define RADIOLIB_CC1101_MARC_STATE_STARTCAL 0x08 // 4 0 STARTCAL
-
484#define RADIOLIB_CC1101_MARC_STATE_BWBOOST 0x09 // 4 0 BWBOOST
-
485#define RADIOLIB_CC1101_MARC_STATE_FS_LOCK 0x0A // 4 0 FS_LOCK
-
486#define RADIOLIB_CC1101_MARC_STATE_IFADCON 0x0B // 4 0 IFADCON
-
487#define RADIOLIB_CC1101_MARC_STATE_ENDCAL 0x0C // 4 0 ENDCAL
-
488#define RADIOLIB_CC1101_MARC_STATE_RX 0x0D // 4 0 RX
-
489#define RADIOLIB_CC1101_MARC_STATE_RX_END 0x0E // 4 0 RX_END
-
490#define RADIOLIB_CC1101_MARC_STATE_RX_RST 0x0F // 4 0 RX_RST
-
491#define RADIOLIB_CC1101_MARC_STATE_TXRX_SWITCH 0x10 // 4 0 TXRX_SWITCH
-
492#define RADIOLIB_CC1101_MARC_STATE_RXFIFO_OVERFLOW 0x11 // 4 0 RXFIFO_OVERFLOW
-
493#define RADIOLIB_CC1101_MARC_STATE_FSTXON 0x12 // 4 0 FSTXON
-
494#define RADIOLIB_CC1101_MARC_STATE_TX 0x13 // 4 0 TX
-
495#define RADIOLIB_CC1101_MARC_STATE_TX_END 0x14 // 4 0 TX_END
-
496#define RADIOLIB_CC1101_MARC_STATE_RXTX_SWITCH 0x15 // 4 0 RXTX_SWITCH
-
497#define RADIOLIB_CC1101_MARC_STATE_TXFIFO_UNDERFLOW 0x16 // 4 0 TXFIFO_UNDERFLOW
-
498
-
499// RADIOLIB_CC1101_REG_WORTIME1 + REG_WORTIME0
-
500#define RADIOLIB_CC1101_WORTIME_MSB 0x00 // 7 0 WOR timer value
-
501#define RADIOLIB_CC1101_WORTIME_LSB 0x00 // 7 0
-
502
-
503// RADIOLIB_CC1101_REG_PKTSTATUS
-
504#define RADIOLIB_CC1101_CRC_OK 0b10000000 // 7 7 CRC check passed
-
505#define RADIOLIB_CC1101_CRC_ERROR 0b00000000 // 7 7 CRC check failed
-
506#define RADIOLIB_CC1101_CS 0b01000000 // 6 6 carrier sense
-
507#define RADIOLIB_CC1101_PQT_REACHED 0b00100000 // 5 5 preamble quality reached
-
508#define RADIOLIB_CC1101_CCA 0b00010000 // 4 4 channel clear
-
509#define RADIOLIB_CC1101_SFD 0b00001000 // 3 3 start of frame delimiter - sync word received
-
510#define RADIOLIB_CC1101_GDO2_ACTIVE 0b00000100 // 2 2 GDO2 is active/asserted
-
511#define RADIOLIB_CC1101_GDO0_ACTIVE 0b00000001 // 0 0 GDO0 is active/asserted
-
512
-
513// RadioLib defaults
-
514#define RADIOLIB_CC1101_DEFAULT_FREQ 434.0
-
515#define RADIOLIB_CC1101_DEFAULT_BR 4.8
-
516#define RADIOLIB_CC1101_DEFAULT_FREQDEV 5.0
-
517#define RADIOLIB_CC1101_DEFAULT_RXBW 58.0
-
518#define RADIOLIB_CC1101_DEFAULT_POWER 10
-
519#define RADIOLIB_CC1101_DEFAULT_PREAMBLELEN 16
-
520#define RADIOLIB_CC1101_DEFAULT_SW {0x12, 0xAD}
-
521#define RADIOLIB_CC1101_DEFAULT_SW_LEN 2
-
522
-
-
527class CC1101: public PhysicalLayer {
-
528 public:
-
529 // introduce PhysicalLayer overloads
-
530 using PhysicalLayer::transmit;
-
531 using PhysicalLayer::receive;
-
532 using PhysicalLayer::startTransmit;
-
533 using PhysicalLayer::readData;
-
534
-
539 // cppcheck-suppress noExplicitConstructor
-
540 CC1101(Module* module);
-
541
-
542 // basic methods
-
543
-
554 int16_t begin(
-
555 float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
-
556 float br = RADIOLIB_CC1101_DEFAULT_BR,
-
557 float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
-
558 float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
-
559 int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
-
560 uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
-
561
-
572 int16_t beginFSK4(
-
573 float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
-
574 float br = RADIOLIB_CC1101_DEFAULT_BR,
-
575 float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
-
576 float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
-
577 int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
-
578 uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
-
579
-
583 void reset();
-
584
-
593 int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
-
594
-
602 int16_t receive(uint8_t* data, size_t len) override;
-
603
-
608 int16_t standby() override;
-
609
-
615 int16_t standby(uint8_t mode) override;
-
616
-
621 int16_t sleep() override;
-
622
-
628 int16_t transmitDirect(uint32_t frf = 0) override;
-
629
-
634 int16_t receiveDirect() override;
-
635
-
641 int16_t transmitDirectAsync(uint32_t frf = 0);
-
642
-
647 int16_t receiveDirectAsync();
-
648
-
653 int16_t packetMode();
-
654
-
655 // interrupt methods
-
656
-
662 void setGdo0Action(void (*func)(void), uint32_t dir);
-
663
-
667 void clearGdo0Action();
-
668
-
674 void setGdo2Action(void (*func)(void), uint32_t dir);
-
675
-
679 void clearGdo2Action();
-
680
-
685 void setPacketReceivedAction(void (*func)(void)) override;
-
686
-
690 void clearPacketReceivedAction() override;
-
691
-
696 void setPacketSentAction(void (*func)(void)) override;
-
697
-
701 void clearPacketSentAction() override;
-
702
-
711 int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
-
712
-
717 int16_t finishTransmit() override;
-
718
-
723 int16_t startReceive() override;
-
724
-
733 int16_t startReceive(uint32_t timeout, uint32_t irqFlags, uint32_t irqMask, size_t len) override;
-
734
-
743 int16_t readData(uint8_t* data, size_t len) override;
-
744
-
745 // configuration methods
-
746
-
753 int16_t setFrequency(float freq) override;
-
754
-
760 int16_t setBitRate(float br) override;
-
761
-
767 int16_t setBitRateTolerance(uint8_t brt);
-
768
-
775 int16_t setRxBandwidth(float rxBw);
-
776
-
783 int16_t autoSetRxBandwidth();
-
784
-
790 int16_t setFrequencyDeviation(float freqDev) override;
-
791
-
797 int16_t getFrequencyDeviation(float *freqDev);
-
798
-
804 int16_t setOutputPower(int8_t pwr) override;
-
805
-
813 int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
-
814
-
822 int16_t checkOutputPower(int8_t power, int8_t* clipped, uint8_t* raw);
-
823
-
832 int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
833
-
842 int16_t setSyncWord(const uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
843
-
850 int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold);
-
851
-
859 int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
-
860
-
865 int16_t disableAddressFiltering();
-
866
-
872 int16_t setOOK(bool enableOOK);
-
873
-
879 float getRSSI() override;
-
880
-
885 uint8_t getLQI() const;
-
886
-
892 size_t getPacketLength(bool update = true) override;
-
893
-
899 int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
-
900
-
906 int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
-
907
-
914 int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
915
-
921 int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
-
922
-
928 int16_t setCrcFiltering(bool enable = true);
-
929
-
936 int16_t setPromiscuousMode(bool enable = true, bool requireCarrierSense = false);
-
937
-
943 bool getPromiscuousMode();
-
944
-
951 int16_t setDataShaping(uint8_t sh) override;
-
952
-
959 int16_t setEncoding(uint8_t encoding) override;
-
960
-
962 void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
-
963
-
965 void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
-
966
-
971 uint8_t randomByte() override;
-
972
-
978 int16_t getChipVersion();
-
979
-
980 #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
-
985 void setDirectAction(void (*func)(void)) override;
-
986
-
991 void readBit(uint32_t pin) override;
-
992 #endif
-
993
-
1000 int16_t setDIOMapping(uint32_t pin, uint32_t value) override;
-
1001
-
1002 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
-
1003 protected:
-
1004 #endif
-
1005 Module* getMod() override;
-
1006
-
1007 // SPI read overrides to set bit for burst write and status registers access
-
1008 int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
-
1009 int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
-
1010 void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
-
1011 uint8_t SPIreadRegister(uint8_t reg);
-
1012 void SPIwriteRegisterBurst(uint8_t reg, const uint8_t* data, size_t len);
-
1013 void SPIwriteRegister(uint8_t reg, uint8_t data);
-
1014
-
1015 void SPIsendCommand(uint8_t cmd);
-
1016
-
1017 #if !RADIOLIB_GODMODE
-
1018 private:
-
1019 #endif
-
1020 Module* mod;
-
1021
-
1022 float frequency = RADIOLIB_CC1101_DEFAULT_FREQ;
-
1023 float bitRate = RADIOLIB_CC1101_DEFAULT_BR;
-
1024 uint8_t rawRSSI = 0;
-
1025 uint8_t rawLQI = 0;
-
1026 uint8_t modulation = RADIOLIB_CC1101_MOD_FORMAT_2_FSK;
-
1027
-
1028 size_t packetLength = 0;
-
1029 bool packetLengthQueried = false;
-
1030 uint8_t packetLengthConfig = RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE;
+
11#define RADIOLIB_CC1101_MAX_PACKET_LENGTH 255
+
12#define RADIOLIB_CC1101_FIFO_SIZE 64
+
13#define RADIOLIB_CC1101_CRYSTAL_FREQ 26.0f
+
14#define RADIOLIB_CC1101_DIV_EXPONENT 16
+
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_GDO_DS_LOW 0b00000000 // 7 7 GDOx output drive strength: low (default)
+
120#define RADIOLIB_CC1101_GDO_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_PKTCTRL1
+
196#define RADIOLIB_CC1101_PQT 0x00 // 7 5 preamble quality threshold
+
197#define RADIOLIB_CC1101_CRC_AUTOFLUSH_OFF 0b00000000 // 3 3 automatic Rx FIFO flush on CRC check fail: disabled (default)
+
198#define RADIOLIB_CC1101_CRC_AUTOFLUSH_ON 0b00001000 // 3 3 enabled
+
199#define RADIOLIB_CC1101_APPEND_STATUS_OFF 0b00000000 // 2 2 append 2 status bytes to packet: disabled
+
200#define RADIOLIB_CC1101_APPEND_STATUS_ON 0b00000100 // 2 2 enabled (default)
+
201#define RADIOLIB_CC1101_ADR_CHK_NONE 0b00000000 // 1 0 address check: none (default)
+
202#define RADIOLIB_CC1101_ADR_CHK_NO_BROADCAST 0b00000001 // 1 0 without broadcast
+
203#define RADIOLIB_CC1101_ADR_CHK_SINGLE_BROADCAST 0b00000010 // 1 0 broadcast address 0x00
+
204#define RADIOLIB_CC1101_ADR_CHK_DOUBLE_BROADCAST 0b00000011 // 1 0 broadcast addresses 0x00 and 0xFF
+
205
+
206// RADIOLIB_CC1101_REG_PKTCTRL0
+
207#define RADIOLIB_CC1101_WHITE_DATA_OFF 0b00000000 // 6 6 data whitening: disabled
+
208#define RADIOLIB_CC1101_WHITE_DATA_ON 0b01000000 // 6 6 enabled (default)
+
209#define RADIOLIB_CC1101_PKT_FORMAT_NORMAL 0b00000000 // 5 4 packet format: normal (FIFOs)
+
210#define RADIOLIB_CC1101_PKT_FORMAT_SYNCHRONOUS 0b00010000 // 5 4 synchronous serial
+
211#define RADIOLIB_CC1101_PKT_FORMAT_RANDOM 0b00100000 // 5 4 random transmissions
+
212#define RADIOLIB_CC1101_PKT_FORMAT_ASYNCHRONOUS 0b00110000 // 5 4 asynchronous serial
+
213#define RADIOLIB_CC1101_CRC_OFF 0b00000000 // 2 2 CRC disabled
+
214#define RADIOLIB_CC1101_CRC_ON 0b00000100 // 2 2 CRC enabled (default)
+
215#define RADIOLIB_CC1101_LENGTH_CONFIG_FIXED 0b00000000 // 1 0 packet length: fixed
+
216#define RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE 0b00000001 // 1 0 variable (default)
+
217#define RADIOLIB_CC1101_LENGTH_CONFIG_INFINITE 0b00000010 // 1 0 infinite
+
218
+
219// RADIOLIB_CC1101_REG_ADDR
+
220#define RADIOLIB_CC1101_DEVICE_ADDR 0x00 // 7 0 device address
+
221
+
222// RADIOLIB_CC1101_REG_CHANNR
+
223#define RADIOLIB_CC1101_CHAN 0x00 // 7 0 channel number
+
224
+
225// RADIOLIB_CC1101_REG_FSCTRL1
+
226#define RADIOLIB_CC1101_FREQ_IF 0x0F // 4 0 IF frequency setting; f_IF = (f(XOSC) / 2^10) * CC1101_FREQ_IF
+
227
+
228// CC1101_REG_FSCTRL0
+
229#define RADIOLIB_CC1101_FREQOFF 0x00 // 7 0 base frequency offset (2s-compliment)
+
230
+
231// RADIOLIB_CC1101_REG_FREQ2 + REG_FREQ1 + REG_FREQ0
+
232#define RADIOLIB_CC1101_FREQ_MSB 0x1E // 5 0 base frequency setting: f_carrier = (f(XOSC) / 2^16) * FREQ
+
233#define RADIOLIB_CC1101_FREQ_MID 0xC4 // 7 0 where f(XOSC) = 26 MHz
+
234#define RADIOLIB_CC1101_FREQ_LSB 0xEC // 7 0 FREQ = 3-byte value of FREQ registers
+
235
+
236// RADIOLIB_CC1101_REG_MDMCFG4
+
237#define RADIOLIB_CC1101_CHANBW_E 0b10000000 // 7 6 channel bandwidth: BW_channel = f(XOSC) / (8 * (4 + CHANBW_M)*2^CHANBW_E) [Hz]
+
238#define RADIOLIB_CC1101_CHANBW_M 0b00000000 // 5 4 default value for 26 MHz crystal: 203 125 Hz
+
239#define RADIOLIB_CC1101_DRATE_E 0x0C // 3 0 symbol rate: R_data = (((256 + DRATE_M) * 2^DRATE_E) / 2^28) * f(XOSC) [Baud]
+
240
+
241// RADIOLIB_CC1101_REG_MDMCFG3
+
242#define RADIOLIB_CC1101_DRATE_M 0x22 // 7 0 default value for 26 MHz crystal: 115 051 Baud
+
243
+
244// RADIOLIB_CC1101_REG_MDMCFG2
+
245#define RADIOLIB_CC1101_DEM_DCFILT_OFF 0b10000000 // 7 7 digital DC filter: disabled
+
246#define RADIOLIB_CC1101_DEM_DCFILT_ON 0b00000000 // 7 7 enabled - only for data rates above 250 kBaud (default)
+
247#define RADIOLIB_CC1101_MOD_FORMAT_2_FSK 0b00000000 // 6 4 modulation format: 2-FSK (default)
+
248#define RADIOLIB_CC1101_MOD_FORMAT_GFSK 0b00010000 // 6 4 GFSK
+
249#define RADIOLIB_CC1101_MOD_FORMAT_ASK_OOK 0b00110000 // 6 4 ASK/OOK
+
250#define RADIOLIB_CC1101_MOD_FORMAT_4_FSK 0b01000000 // 6 4 4-FSK
+
251#define RADIOLIB_CC1101_MOD_FORMAT_MFSK 0b01110000 // 6 4 MFSK - only for data rates above 26 kBaud
+
252#define RADIOLIB_CC1101_MANCHESTER_EN_OFF 0b00000000 // 3 3 Manchester encoding: disabled (default)
+
253#define RADIOLIB_CC1101_MANCHESTER_EN_ON 0b00001000 // 3 3 enabled
+
254#define RADIOLIB_CC1101_SYNC_MODE_NONE 0b00000000 // 2 0 synchronization: no preamble/sync
+
255#define RADIOLIB_CC1101_SYNC_MODE_15_16 0b00000001 // 2 0 15/16 sync word bits
+
256#define RADIOLIB_CC1101_SYNC_MODE_16_16 0b00000010 // 2 0 16/16 sync word bits (default)
+
257#define RADIOLIB_CC1101_SYNC_MODE_30_32 0b00000011 // 2 0 30/32 sync word bits
+
258#define RADIOLIB_CC1101_SYNC_MODE_NONE_THR 0b00000100 // 2 0 no preamble sync, carrier sense above threshold
+
259#define RADIOLIB_CC1101_SYNC_MODE_15_16_THR 0b00000101 // 2 0 15/16 sync word bits, carrier sense above threshold
+
260#define RADIOLIB_CC1101_SYNC_MODE_16_16_THR 0b00000110 // 2 0 16/16 sync word bits, carrier sense above threshold
+
261#define RADIOLIB_CC1101_SYNC_MODE_30_32_THR 0b00000111 // 2 0 30/32 sync word bits, carrier sense above threshold
+
262
+
263// RADIOLIB_CC1101_REG_MDMCFG1
+
264#define RADIOLIB_CC1101_FEC_OFF 0b00000000 // 7 7 forward error correction: disabled (default)
+
265#define RADIOLIB_CC1101_FEC_ON 0b10000000 // 7 7 enabled - only for fixed packet length
+
266#define RADIOLIB_CC1101_NUM_PREAMBLE_2 0b00000000 // 6 4 number of preamble bytes: 2
+
267#define RADIOLIB_CC1101_NUM_PREAMBLE_3 0b00010000 // 6 4 3
+
268#define RADIOLIB_CC1101_NUM_PREAMBLE_4 0b00100000 // 6 4 4 (default)
+
269#define RADIOLIB_CC1101_NUM_PREAMBLE_6 0b00110000 // 6 4 6
+
270#define RADIOLIB_CC1101_NUM_PREAMBLE_8 0b01000000 // 6 4 8
+
271#define RADIOLIB_CC1101_NUM_PREAMBLE_12 0b01010000 // 6 4 12
+
272#define RADIOLIB_CC1101_NUM_PREAMBLE_16 0b01100000 // 6 4 16
+
273#define RADIOLIB_CC1101_NUM_PREAMBLE_24 0b01110000 // 6 4 24
+
274#define RADIOLIB_CC1101_CHANSPC_E 0x02 // 1 0 channel spacing: df_channel = (f(XOSC) / 2^18) * (256 + CHANSPC_M) * 2^CHANSPC_E [Hz]
+
275
+
276// RADIOLIB_CC1101_REG_MDMCFG0
+
277#define RADIOLIB_CC1101_CHANSPC_M 0xF8 // 7 0 default value for 26 MHz crystal: 199 951 kHz
+
278
+
279// RADIOLIB_CC1101_REG_DEVIATN
+
280#define RADIOLIB_CC1101_DEVIATION_E 0b01000000 // 6 4 frequency deviation: f_dev = (f(XOSC) / 2^17) * (8 + DEVIATION_M) * 2^DEVIATION_E [Hz]
+
281#define RADIOLIB_CC1101_DEVIATION_M 0b00000111 // 2 0 default value for 26 MHz crystal: +- 47 607 Hz
+
282#define RADIOLIB_CC1101_MSK_PHASE_CHANGE_PERIOD 0x07 // 2 0 phase change symbol period fraction: 1 / (MSK_PHASE_CHANGE_PERIOD + 1)
+
283
+
284// RADIOLIB_CC1101_REG_MCSM2
+
285#define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_OFF 0b00000000 // 4 4 Rx timeout based on RSSI value: disabled (default)
+
286#define RADIOLIB_CC1101_RX_TIMEOUT_RSSI_ON 0b00010000 // 4 4 enabled
+
287#define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_OFF 0b00000000 // 3 3 check for sync word on Rx timeout
+
288#define RADIOLIB_CC1101_RX_TIMEOUT_QUAL_ON 0b00001000 // 3 3 check for PQI set on Rx timeout
+
289#define RADIOLIB_CC1101_RX_TIMEOUT_OFF 0b00000111 // 2 0 Rx timeout: disabled (default)
+
290#define RADIOLIB_CC1101_RX_TIMEOUT_MAX 0b00000000 // 2 0 max value (actual value depends on WOR_RES, EVENT0 and f(XOSC))
+
291
+
292// RADIOLIB_CC1101_REG_MCSM1
+
293#define RADIOLIB_CC1101_CCA_MODE_ALWAYS 0b00000000 // 5 4 clear channel indication: always
+
294#define RADIOLIB_CC1101_CCA_MODE_RSSI_THR 0b00010000 // 5 4 RSSI below threshold
+
295#define RADIOLIB_CC1101_CCA_MODE_RX_PKT 0b00100000 // 5 4 unless receiving packet
+
296#define RADIOLIB_CC1101_CCA_MODE_RSSI_THR_RX_PKT 0b00110000 // 5 4 RSSI below threshold unless receiving packet (default)
+
297#define RADIOLIB_CC1101_RXOFF_IDLE 0b00000000 // 3 2 next mode after packet reception: idle (default)
+
298#define RADIOLIB_CC1101_RXOFF_FSTXON 0b00000100 // 3 2 FSTxOn
+
299#define RADIOLIB_CC1101_RXOFF_TX 0b00001000 // 3 2 Tx
+
300#define RADIOLIB_CC1101_RXOFF_RX 0b00001100 // 3 2 Rx
+
301#define RADIOLIB_CC1101_TXOFF_IDLE 0b00000000 // 1 0 next mode after packet transmission: idle (default)
+
302#define RADIOLIB_CC1101_TXOFF_FSTXON 0b00000001 // 1 0 FSTxOn
+
303#define RADIOLIB_CC1101_TXOFF_TX 0b00000010 // 1 0 Tx
+
304#define RADIOLIB_CC1101_TXOFF_RX 0b00000011 // 1 0 Rx
+
305
+
306// RADIOLIB_CC1101_REG_MCSM0
+
307#define RADIOLIB_CC1101_FS_AUTOCAL_NEVER 0b00000000 // 5 4 automatic calibration: never (default)
+
308#define RADIOLIB_CC1101_FS_AUTOCAL_IDLE_TO_RXTX 0b00010000 // 5 4 every transition from idle to Rx/Tx
+
309#define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE 0b00100000 // 5 4 every transition from Rx/Tx to idle
+
310#define RADIOLIB_CC1101_FS_AUTOCAL_RXTX_TO_IDLE_4TH 0b00110000 // 5 4 every 4th transition from Rx/Tx to idle
+
311#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_1 0b00000000 // 3 2 number of counter expirations before CHP_RDYN goes low: 1 (default)
+
312#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_16 0b00000100 // 3 2 16
+
313#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_64 0b00001000 // 3 2 64
+
314#define RADIOLIB_CC1101_PO_TIMEOUT_COUNT_256 0b00001100 // 3 2 256
+
315#define RADIOLIB_CC1101_PIN_CTRL_OFF 0b00000000 // 1 1 pin radio control: disabled (default)
+
316#define RADIOLIB_CC1101_PIN_CTRL_ON 0b00000010 // 1 1 enabled
+
317#define RADIOLIB_CC1101_XOSC_FORCE_OFF 0b00000000 // 0 0 do not force XOSC to remain on in sleep (default)
+
318#define RADIOLIB_CC1101_XOSC_FORCE_ON 0b00000001 // 0 0 force XOSC to remain on in sleep
+
319
+
320// RADIOLIB_CC1101_REG_FOCCFG
+
321#define RADIOLIB_CC1101_FOC_BS_CS_GATE_OFF 0b00000000 // 5 5 do not freeze frequency compensation until CS goes high
+
322#define RADIOLIB_CC1101_FOC_BS_CS_GATE_ON 0b00100000 // 5 5 freeze frequency compensation until CS goes high (default)
+
323#define RADIOLIB_CC1101_FOC_PRE_K 0b00000000 // 4 3 frequency compensation loop gain before sync word: K
+
324#define RADIOLIB_CC1101_FOC_PRE_2K 0b00001000 // 4 3 2K
+
325#define RADIOLIB_CC1101_FOC_PRE_3K 0b00010000 // 4 3 3K (default)
+
326#define RADIOLIB_CC1101_FOC_PRE_4K 0b00011000 // 4 3 4K
+
327#define RADIOLIB_CC1101_FOC_POST_K 0b00000000 // 2 2 frequency compensation loop gain after sync word: same as FOC_PRE
+
328#define RADIOLIB_CC1101_FOC_POST_K_2 0b00000100 // 2 2 K/2 (default)
+
329#define RADIOLIB_CC1101_FOC_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 frequency compensation saturation point: no compensation - required for ASK/OOK
+
330#define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_8 0b00000001 // 1 0 +- BW_chan/8
+
331#define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_4 0b00000010 // 1 0 +- BW_chan/4 (default)
+
332#define RADIOLIB_CC1101_FOC_LIMIT_BW_CHAN_2 0b00000011 // 1 0 +- BW_chan/2
+
333
+
334// RADIOLIB_CC1101_REG_BSCFG
+
335#define RADIOLIB_CC1101_BS_PRE_KI 0b00000000 // 7 6 clock recovery integral gain before sync word: Ki
+
336#define RADIOLIB_CC1101_BS_PRE_2KI 0b01000000 // 7 6 2Ki (default)
+
337#define RADIOLIB_CC1101_BS_PRE_3KI 0b10000000 // 7 6 3Ki
+
338#define RADIOLIB_CC1101_BS_PRE_4KI 0b11000000 // 7 6 4Ki
+
339#define RADIOLIB_CC1101_BS_PRE_KP 0b00000000 // 5 4 clock recovery proportional gain before sync word: Kp
+
340#define RADIOLIB_CC1101_BS_PRE_2KP 0b00010000 // 5 4 2Kp
+
341#define RADIOLIB_CC1101_BS_PRE_3KP 0b00100000 // 5 4 3Kp (default)
+
342#define RADIOLIB_CC1101_BS_PRE_4KP 0b00110000 // 5 4 4Kp
+
343#define RADIOLIB_CC1101_BS_POST_KI 0b00000000 // 3 3 clock recovery integral gain after sync word: same as BS_PRE
+
344#define RADIOLIB_CC1101_BS_POST_KI_2 0b00001000 // 3 3 Ki/2 (default)
+
345#define RADIOLIB_CC1101_BS_POST_KP 0b00000000 // 2 2 clock recovery proportional gain after sync word: same as BS_PRE
+
346#define RADIOLIB_CC1101_BS_POST_KP_1 0b00000100 // 2 2 Kp (default)
+
347#define RADIOLIB_CC1101_BS_LIMIT_NO_COMPENSATION 0b00000000 // 1 0 data rate compensation saturation point: no compensation
+
348#define RADIOLIB_CC1101_BS_LIMIT_3_125 0b00000001 // 1 0 +- 3.125 %
+
349#define RADIOLIB_CC1101_BS_LIMIT_6_25 0b00000010 // 1 0 +- 6.25 %
+
350#define RADIOLIB_CC1101_BS_LIMIT_12_5 0b00000011 // 1 0 +- 12.5 %
+
351
+
352// RADIOLIB_CC1101_REG_AGCCTRL2
+
353#define RADIOLIB_CC1101_MAX_DVGA_GAIN_0 0b00000000 // 7 6 reduce maximum available DVGA gain: no reduction (default)
+
354#define RADIOLIB_CC1101_MAX_DVGA_GAIN_1 0b01000000 // 7 6 disable top gain setting
+
355#define RADIOLIB_CC1101_MAX_DVGA_GAIN_2 0b10000000 // 7 6 disable top two gain setting
+
356#define RADIOLIB_CC1101_MAX_DVGA_GAIN_3 0b11000000 // 7 6 disable top three gain setting
+
357#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_0_DB 0b00000000 // 5 3 reduce maximum LNA gain by: 0 dB (default)
+
358#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_2_6_DB 0b00001000 // 5 3 2.6 dB
+
359#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_6_1_DB 0b00010000 // 5 3 6.1 dB
+
360#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_7_4_DB 0b00011000 // 5 3 7.4 dB
+
361#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_9_2_DB 0b00100000 // 5 3 9.2 dB
+
362#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_11_5_DB 0b00101000 // 5 3 11.5 dB
+
363#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_14_6_DB 0b00110000 // 5 3 14.6 dB
+
364#define RADIOLIB_CC1101_LNA_GAIN_REDUCE_17_1_DB 0b00111000 // 5 3 17.1 dB
+
365#define RADIOLIB_CC1101_MAGN_TARGET_24_DB 0b00000000 // 2 0 average amplitude target for filter: 24 dB
+
366#define RADIOLIB_CC1101_MAGN_TARGET_27_DB 0b00000001 // 2 0 27 dB
+
367#define RADIOLIB_CC1101_MAGN_TARGET_30_DB 0b00000010 // 2 0 30 dB
+
368#define RADIOLIB_CC1101_MAGN_TARGET_33_DB 0b00000011 // 2 0 33 dB (default)
+
369#define RADIOLIB_CC1101_MAGN_TARGET_36_DB 0b00000100 // 2 0 36 dB
+
370#define RADIOLIB_CC1101_MAGN_TARGET_38_DB 0b00000101 // 2 0 38 dB
+
371#define RADIOLIB_CC1101_MAGN_TARGET_40_DB 0b00000110 // 2 0 40 dB
+
372#define RADIOLIB_CC1101_MAGN_TARGET_42_DB 0b00000111 // 2 0 42 dB
+
373
+
374// RADIOLIB_CC1101_REG_AGCCTRL1
+
375#define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA2 0b00000000 // 6 6 LNA priority setting: LNA2 first
+
376#define RADIOLIB_CC1101_AGC_LNA_PRIORITY_LNA 0b01000000 // 6 6 LNA first (default)
+
377#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_OFF 0b00000000 // 5 4 RSSI relative change to assert carrier sense: disabled (default)
+
378#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_6_DB 0b00010000 // 5 4 6 dB
+
379#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_10_DB 0b00100000 // 5 4 10 dB
+
380#define RADIOLIB_CC1101_CARRIER_SENSE_REL_THR_14_DB 0b00110000 // 5 4 14 dB
+
381#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]
+
382
+
383// RADIOLIB_CC1101_REG_AGCCTRL0
+
384#define RADIOLIB_CC1101_HYST_LEVEL_NONE 0b00000000 // 7 6 AGC hysteresis level: none
+
385#define RADIOLIB_CC1101_HYST_LEVEL_LOW 0b01000000 // 7 6 low
+
386#define RADIOLIB_CC1101_HYST_LEVEL_MEDIUM 0b10000000 // 7 6 medium (default)
+
387#define RADIOLIB_CC1101_HYST_LEVEL_HIGH 0b11000000 // 7 6 high
+
388#define RADIOLIB_CC1101_WAIT_TIME_8_SAMPLES 0b00000000 // 5 4 AGC wait time: 8 samples
+
389#define RADIOLIB_CC1101_WAIT_TIME_16_SAMPLES 0b00010000 // 5 4 16 samples (default)
+
390#define RADIOLIB_CC1101_WAIT_TIME_24_SAMPLES 0b00100000 // 5 4 24 samples
+
391#define RADIOLIB_CC1101_WAIT_TIME_32_SAMPLES 0b00110000 // 5 4 32 samples
+
392#define RADIOLIB_CC1101_AGC_FREEZE_NEVER 0b00000000 // 3 2 freeze AGC gain: never (default)
+
393#define RADIOLIB_CC1101_AGC_FREEZE_SYNC_WORD 0b00000100 // 3 2 when sync word is found
+
394#define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_A 0b00001000 // 3 2 manually freeze analog control
+
395#define RADIOLIB_CC1101_AGC_FREEZE_MANUAL_AD 0b00001100 // 3 2 manually freeze analog and digital control
+
396#define RADIOLIB_CC1101_FILTER_LENGTH_8 0b00000000 // 1 0 averaging length for channel filter: 8 samples
+
397#define RADIOLIB_CC1101_FILTER_LENGTH_16 0b00000001 // 1 0 16 samples (default)
+
398#define RADIOLIB_CC1101_FILTER_LENGTH_32 0b00000010 // 1 0 32 samples
+
399#define RADIOLIB_CC1101_FILTER_LENGTH_64 0b00000011 // 1 0 64 samples
+
400#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_4_DB 0b00000000 // 1 0 ASK/OOK decision boundary: 4 dB
+
401#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_8_DB 0b00000001 // 1 0 8 dB (default)
+
402#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_12_DB 0b00000010 // 1 0 12 dB
+
403#define RADIOLIB_CC1101_ASK_OOK_BOUNDARY_16_DB 0b00000011 // 1 0 16 dB
+
404
+
405// RADIOLIB_CC1101_REG_WOREVT1 + REG_WOREVT0
+
406#define RADIOLIB_CC1101_EVENT0_TIMEOUT_MSB 0x87 // 7 0 EVENT0 timeout: t_event0 = (750 / f(XOSC)) * EVENT0_TIMEOUT * 2^(5 * WOR_RES) [s]
+
407#define RADIOLIB_CC1101_EVENT0_TIMEOUT_LSB 0x6B // 7 0 default value for 26 MHz crystal: 1.0 s
+
408
+
409// RADIOLIB_CC1101_REG_WORCTRL
+
410#define RADIOLIB_CC1101_RC_POWER_UP 0b00000000 // 7 7 power up RC oscillator
+
411#define RADIOLIB_CC1101_RC_POWER_DOWN 0b10000000 // 7 7 power down RC oscillator
+
412#define RADIOLIB_CC1101_EVENT1_TIMEOUT_4 0b00000000 // 6 4 EVENT1 timeout: 4 RC periods
+
413#define RADIOLIB_CC1101_EVENT1_TIMEOUT_6 0b00010000 // 6 4 6 RC periods
+
414#define RADIOLIB_CC1101_EVENT1_TIMEOUT_8 0b00100000 // 6 4 8 RC periods
+
415#define RADIOLIB_CC1101_EVENT1_TIMEOUT_12 0b00110000 // 6 4 12 RC periods
+
416#define RADIOLIB_CC1101_EVENT1_TIMEOUT_16 0b01000000 // 6 4 16 RC periods
+
417#define RADIOLIB_CC1101_EVENT1_TIMEOUT_24 0b01010000 // 6 4 24 RC periods
+
418#define RADIOLIB_CC1101_EVENT1_TIMEOUT_32 0b01100000 // 6 4 32 RC periods
+
419#define RADIOLIB_CC1101_EVENT1_TIMEOUT_48 0b01110000 // 6 4 48 RC periods (default)
+
420#define RADIOLIB_CC1101_RC_CAL_OFF 0b00000000 // 3 3 disable RC oscillator calibration
+
421#define RADIOLIB_CC1101_RC_CAL_ON 0b00001000 // 3 3 enable RC oscillator calibration (default)
+
422#define RADIOLIB_CC1101_WOR_RES_1 0b00000000 // 1 0 EVENT0 resolution: 1 period (default)
+
423#define RADIOLIB_CC1101_WOR_RES_2_5 0b00000001 // 1 0 2^5 periods
+
424#define RADIOLIB_CC1101_WOR_RES_2_10 0b00000010 // 1 0 2^10 periods
+
425#define RADIOLIB_CC1101_WOR_RES_2_15 0b00000011 // 1 0 2^15 periods
+
426
+
427// RADIOLIB_CC1101_REG_FREND1
+
428#define RADIOLIB_CC1101_LNA_CURRENT 0x01 // 7 6 front-end LNA PTAT current output adjustment
+
429#define RADIOLIB_CC1101_LNA2MIX_CURRENT 0x01 // 5 4 front-end PTAT output adjustment
+
430#define RADIOLIB_CC1101_LODIV_BUF_CURRENT_RX 0x01 // 3 2 Rx LO buffer current adjustment
+
431#define RADIOLIB_CC1101_MIX_CURRENT 0x02 // 1 0 mixer current adjustment
+
432
+
433// RADIOLIB_CC1101_REG_FREND0
+
434#define RADIOLIB_CC1101_LODIV_BUF_CURRENT_TX 0x01 // 5 4 Tx LO buffer current adjustment
+
435#define RADIOLIB_CC1101_PA_POWER 0x00 // 2 0 set power amplifier power according to PATABLE
+
436
+
437// RADIOLIB_CC1101_REG_FSCAL3
+
438#define RADIOLIB_CC1101_CHP_CURR_CAL_OFF 0b00000000 // 5 4 disable charge pump calibration
+
439#define RADIOLIB_CC1101_CHP_CURR_CAL_ON 0b00100000 // 5 4 enable charge pump calibration (default)
+
440#define RADIOLIB_CC1101_FSCAL3 0x09 // 3 0 charge pump output current: I_out = I_0 * 2^(FSCAL3/4) [A]
+
441
+
442// RADIOLIB_CC1101_REG_FSCAL2
+
443#define RADIOLIB_CC1101_VCO_CORE_LOW 0b00000000 // 5 5 VCO: low (default)
+
444#define RADIOLIB_CC1101_VCO_CORE_HIGH 0b00100000 // 5 5 high
+
445#define RADIOLIB_CC1101_FSCAL2 0x0A // 4 0 VCO current result/override
+
446
+
447// RADIOLIB_CC1101_REG_FSCAL1
+
448#define RADIOLIB_CC1101_FSCAL1 0x20 // 5 0 capacitor array setting for coarse VCO tuning
+
449
+
450// RADIOLIB_CC1101_REG_FSCAL0
+
451#define RADIOLIB_CC1101_FSCAL0 0x0D // 6 0 frequency synthesizer calibration setting
+
452
+
453// RADIOLIB_CC1101_REG_RCCTRL1
+
454#define RADIOLIB_CC1101_RCCTRL1 0x41 // 6 0 RC oscillator configuration
+
455
+
456// RADIOLIB_CC1101_REG_RCCTRL0
+
457#define RADIOLIB_CC1101_RCCTRL0 0x00 // 6 0 RC oscillator configuration
+
458
+
459// RADIOLIB_CC1101_REG_PTEST
+
460#define RADIOLIB_CC1101_TEMP_SENS_IDLE_OFF 0x7F // 7 0 temperature sensor will not be available in idle mode (default)
+
461#define RADIOLIB_CC1101_TEMP_SENS_IDLE_ON 0xBF // 7 0 temperature sensor will be available in idle mode
+
462
+
463// RADIOLIB_CC1101_REG_TEST0
+
464#define RADIOLIB_CC1101_VCO_SEL_CAL_OFF 0b00000000 // 1 1 disable VCO selection calibration stage
+
465#define RADIOLIB_CC1101_VCO_SEL_CAL_ON 0b00000010 // 1 1 enable VCO selection calibration stage
+
466
+
467// RADIOLIB_CC1101_REG_PARTNUM
+
468#define RADIOLIB_CC1101_PARTNUM 0x00
+
469
+
470// RADIOLIB_CC1101_REG_VERSION
+
471#define RADIOLIB_CC1101_VERSION_CURRENT 0x14
+
472#define RADIOLIB_CC1101_VERSION_LEGACY 0x04
+
473#define RADIOLIB_CC1101_VERSION_CLONE 0x17
+
474
+
475// RADIOLIB_CC1101_REG_MARCSTATE
+
476#define RADIOLIB_CC1101_MARC_STATE_SLEEP 0x00 // 4 0 main radio control state: sleep
+
477#define RADIOLIB_CC1101_MARC_STATE_IDLE 0x01 // 4 0 idle
+
478#define RADIOLIB_CC1101_MARC_STATE_XOFF 0x02 // 4 0 XOFF
+
479#define RADIOLIB_CC1101_MARC_STATE_VCOON_MC 0x03 // 4 0 VCOON_MC
+
480#define RADIOLIB_CC1101_MARC_STATE_REGON_MC 0x04 // 4 0 REGON_MC
+
481#define RADIOLIB_CC1101_MARC_STATE_MANCAL 0x05 // 4 0 MANCAL
+
482#define RADIOLIB_CC1101_MARC_STATE_VCOON 0x06 // 4 0 VCOON
+
483#define RADIOLIB_CC1101_MARC_STATE_REGON 0x07 // 4 0 REGON
+
484#define RADIOLIB_CC1101_MARC_STATE_STARTCAL 0x08 // 4 0 STARTCAL
+
485#define RADIOLIB_CC1101_MARC_STATE_BWBOOST 0x09 // 4 0 BWBOOST
+
486#define RADIOLIB_CC1101_MARC_STATE_FS_LOCK 0x0A // 4 0 FS_LOCK
+
487#define RADIOLIB_CC1101_MARC_STATE_IFADCON 0x0B // 4 0 IFADCON
+
488#define RADIOLIB_CC1101_MARC_STATE_ENDCAL 0x0C // 4 0 ENDCAL
+
489#define RADIOLIB_CC1101_MARC_STATE_RX 0x0D // 4 0 RX
+
490#define RADIOLIB_CC1101_MARC_STATE_RX_END 0x0E // 4 0 RX_END
+
491#define RADIOLIB_CC1101_MARC_STATE_RX_RST 0x0F // 4 0 RX_RST
+
492#define RADIOLIB_CC1101_MARC_STATE_TXRX_SWITCH 0x10 // 4 0 TXRX_SWITCH
+
493#define RADIOLIB_CC1101_MARC_STATE_RXFIFO_OVERFLOW 0x11 // 4 0 RXFIFO_OVERFLOW
+
494#define RADIOLIB_CC1101_MARC_STATE_FSTXON 0x12 // 4 0 FSTXON
+
495#define RADIOLIB_CC1101_MARC_STATE_TX 0x13 // 4 0 TX
+
496#define RADIOLIB_CC1101_MARC_STATE_TX_END 0x14 // 4 0 TX_END
+
497#define RADIOLIB_CC1101_MARC_STATE_RXTX_SWITCH 0x15 // 4 0 RXTX_SWITCH
+
498#define RADIOLIB_CC1101_MARC_STATE_TXFIFO_UNDERFLOW 0x16 // 4 0 TXFIFO_UNDERFLOW
+
499
+
500// RADIOLIB_CC1101_REG_WORTIME1 + REG_WORTIME0
+
501#define RADIOLIB_CC1101_WORTIME_MSB 0x00 // 7 0 WOR timer value
+
502#define RADIOLIB_CC1101_WORTIME_LSB 0x00 // 7 0
+
503
+
504// RADIOLIB_CC1101_REG_PKTSTATUS
+
505#define RADIOLIB_CC1101_CRC_OK 0b10000000 // 7 7 CRC check passed
+
506#define RADIOLIB_CC1101_CRC_ERROR 0b00000000 // 7 7 CRC check failed
+
507#define RADIOLIB_CC1101_CS 0b01000000 // 6 6 carrier sense
+
508#define RADIOLIB_CC1101_PQT_REACHED 0b00100000 // 5 5 preamble quality reached
+
509#define RADIOLIB_CC1101_CCA 0b00010000 // 4 4 channel clear
+
510#define RADIOLIB_CC1101_SFD 0b00001000 // 3 3 start of frame delimiter - sync word received
+
511#define RADIOLIB_CC1101_GDO2_ACTIVE 0b00000100 // 2 2 GDO2 is active/asserted
+
512#define RADIOLIB_CC1101_GDO0_ACTIVE 0b00000001 // 0 0 GDO0 is active/asserted
+
513
+
514// RadioLib defaults
+
515#define RADIOLIB_CC1101_DEFAULT_FREQ 434.0
+
516#define RADIOLIB_CC1101_DEFAULT_BR 4.8
+
517#define RADIOLIB_CC1101_DEFAULT_FREQDEV 5.0
+
518#define RADIOLIB_CC1101_DEFAULT_RXBW 58.0
+
519#define RADIOLIB_CC1101_DEFAULT_POWER 10
+
520#define RADIOLIB_CC1101_DEFAULT_PREAMBLELEN 16
+
521#define RADIOLIB_CC1101_DEFAULT_SW {0x12, 0xAD}
+
522#define RADIOLIB_CC1101_DEFAULT_SW_LEN 2
+
523
+
+
528class CC1101: public PhysicalLayer {
+
529 public:
+
530 // introduce PhysicalLayer overloads
+ + + + +
535
+
540 // cppcheck-suppress noExplicitConstructor
+
541 CC1101(Module* module);
+
542
+
543 // basic methods
+
544
+
555 int16_t begin(
+
556 float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
+
557 float br = RADIOLIB_CC1101_DEFAULT_BR,
+
558 float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
+
559 float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
+
560 int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
+
561 uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
+
562
+
573 int16_t beginFSK4(
+
574 float freq = RADIOLIB_CC1101_DEFAULT_FREQ,
+
575 float br = RADIOLIB_CC1101_DEFAULT_BR,
+
576 float freqDev = RADIOLIB_CC1101_DEFAULT_FREQDEV,
+
577 float rxBw = RADIOLIB_CC1101_DEFAULT_RXBW,
+
578 int8_t pwr = RADIOLIB_CC1101_DEFAULT_POWER,
+
579 uint8_t preambleLength = RADIOLIB_CC1101_DEFAULT_PREAMBLELEN);
+
580
+
584 void reset();
+
585
+
594 int16_t transmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
+
595
+
603 int16_t receive(uint8_t* data, size_t len) override;
+
604
+
609 int16_t standby() override;
+
610
+
616 int16_t standby(uint8_t mode) override;
+
617
+
622 int16_t sleep() override;
+
623
+
629 int16_t transmitDirect(uint32_t frf = 0) override;
+
630
+
635 int16_t receiveDirect() override;
+
636
+
642 int16_t transmitDirectAsync(uint32_t frf = 0);
+
643
+
648 int16_t receiveDirectAsync();
+
649
+
654 int16_t packetMode();
+
655
+
656 // interrupt methods
+
657
+
663 void setGdo0Action(void (*func)(void), uint32_t dir);
+
664
+
668 void clearGdo0Action();
+
669
+
675 void setGdo2Action(void (*func)(void), uint32_t dir);
+
676
+
680 void clearGdo2Action();
+
681
+
686 void setPacketReceivedAction(void (*func)(void)) override;
+
687
+
691 void clearPacketReceivedAction() override;
+
692
+
697 void setPacketSentAction(void (*func)(void)) override;
+
698
+
702 void clearPacketSentAction() override;
+
703
+
715 int16_t startTransmit(const uint8_t* data, size_t len, uint8_t addr = 0) override;
+
716
+
721 int16_t finishTransmit() override;
+
722
+
727 int16_t startReceive() override;
+
728
+
737 int16_t startReceive(uint32_t timeout, uint32_t irqFlags, uint32_t irqMask, size_t len) override;
+
738
+
747 int16_t readData(uint8_t* data, size_t len) override;
+
748
+
749 // configuration methods
+
750
+
757 int16_t setFrequency(float freq) override;
+
758
+
764 int16_t setBitRate(float br) override;
+
765
+
771 int16_t setBitRateTolerance(uint8_t brt);
+
772
+
779 int16_t setRxBandwidth(float rxBw);
+
780
+
787 int16_t autoSetRxBandwidth();
+
788
+
794 int16_t setFrequencyDeviation(float freqDev) override;
+
795
+
801 int16_t getFrequencyDeviation(float *freqDev);
+
802
+
808 int16_t setOutputPower(int8_t pwr) override;
+
809
+
817 int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
+
818
+
826 int16_t checkOutputPower(int8_t power, int8_t* clipped, uint8_t* raw);
+
827
+
836 int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
837
+
846 int16_t setSyncWord(const uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
847
+
854 int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold);
+
855
+
863 int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
+
864
+
869 int16_t disableAddressFiltering();
+
870
+
876 int16_t setOOK(bool enableOOK);
+
877
+
883 float getRSSI() override;
+
884
+
889 uint8_t getLQI() const;
+
890
+
896 size_t getPacketLength(bool update = true) override;
+
897
+
903 int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
+
904
+
910 int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_CC1101_MAX_PACKET_LENGTH);
+
911
+
918 int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
919
+
925 int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
+
926
+
932 int16_t setCrcFiltering(bool enable = true);
+
933
+
940 int16_t setPromiscuousMode(bool enable = true, bool requireCarrierSense = false);
+
941
+
947 bool getPromiscuousMode();
+
948
+
955 int16_t setDataShaping(uint8_t sh) override;
+
956
+
963 int16_t setEncoding(uint8_t encoding) override;
+
964
+
966 void setRfSwitchPins(uint32_t rxEn, uint32_t txEn);
+
967
+
969 void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
+
970
+
975 uint8_t randomByte() override;
+
976
+
982 int16_t getChipVersion();
+
983
+
984 #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
+
989 void setDirectAction(void (*func)(void)) override;
+
990
+
995 void readBit(uint32_t pin) override;
+
996 #endif
+
997
+
1004 int16_t setDIOMapping(uint32_t pin, uint32_t value) override;
+
1005
+
1006 #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
+
1007 protected:
+
1008 #endif
+
1009 Module* getMod() override;
+
1010
+
1011 // SPI read overrides to set bit for burst write and status registers access
+
1012 int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
+
1013 int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
+
1014 void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
+
1015 uint8_t SPIreadRegister(uint8_t reg);
+
1016 void SPIwriteRegisterBurst(uint8_t reg, const uint8_t* data, size_t len);
+
1017 void SPIwriteRegister(uint8_t reg, uint8_t data);
+
1018
+
1019 void SPIsendCommand(uint8_t cmd);
+
1020
+
1021 #if !RADIOLIB_GODMODE
+
1022 private:
+
1023 #endif
+
1024 Module* mod;
+
1025
+
1026 float frequency = RADIOLIB_CC1101_DEFAULT_FREQ;
+
1027 float bitRate = RADIOLIB_CC1101_DEFAULT_BR;
+
1028 uint8_t rawRSSI = 0;
+
1029 uint8_t rawLQI = 0;
+
1030 uint8_t modulation = RADIOLIB_CC1101_MOD_FORMAT_2_FSK;
1031
-
1032 bool promiscuous = false;
-
1033 bool crcOn = true;
-
1034 bool directModeEnabled = false;
+
1032 size_t packetLength = 0;
+
1033 bool packetLengthQueried = false;
+
1034 uint8_t packetLengthConfig = RADIOLIB_CC1101_LENGTH_CONFIG_VARIABLE;
1035
-
1036 int8_t power = RADIOLIB_CC1101_DEFAULT_POWER;
-
1037
-
1038 int16_t beginCommon(float freq, float br, float freqDev, float rxBw, int8_t pwr, uint8_t preambleLength);
-
1039 int16_t config();
-
1040 int16_t transmitDirect(bool sync, uint32_t frf);
-
1041 int16_t receiveDirect(bool sync);
-
1042 int16_t directMode(bool sync);
-
1043 static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
-
1044 int16_t setPacketMode(uint8_t mode, uint16_t len);
-
1045};
+
1036 bool promiscuous = false;
+
1037 bool crcOn = true;
+
1038 bool directModeEnabled = false;
+
1039
+
1040 int8_t power = RADIOLIB_CC1101_DEFAULT_POWER;
+
1041
+
1042 int16_t beginCommon(float freq, float br, float freqDev, float rxBw, int8_t pwr, uint8_t preambleLength);
+
1043 int16_t config();
+
1044 int16_t transmitDirect(bool sync, uint32_t frf);
+
1045 int16_t receiveDirect(bool sync);
+
1046 int16_t directMode(bool sync);
+
1047 static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
+
1048 int16_t setPacketMode(uint8_t mode, uint16_t len);
+
1049};
-
1046
-
1047#endif
-
Control class for CC1101 module.
Definition CC1101.h:527
+
1050
+
1051#endif
+
Control class for CC1101 module.
Definition CC1101.h:528
void clearPacketReceivedAction() override
Clears interrupt service routine to call when a packet is received.
Definition CC1101.cpp:200
-
int16_t setFrequencyDeviation(float freqDev) override
Sets frequency deviation. Allowed values range from 1.587 to 380.8 kHz.
Definition CC1101.cpp:456
+
int16_t setFrequencyDeviation(float freqDev) override
Sets frequency deviation. Allowed values range from 1.587 to 380.8 kHz.
Definition CC1101.cpp:511
int16_t sleep() override
Sets the module to sleep mode.
Definition CC1101.cpp:119
-
void readBit(uint32_t pin) override
Function to read and process data bit in direct reception mode.
Definition CC1101.cpp:927
-
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition CC1101.cpp:745
-
uint8_t randomByte() override
Get one truly random byte from RSSI noise.
Definition CC1101.cpp:899
+
void readBit(uint32_t pin) override
Function to read and process data bit in direct reception mode.
Definition CC1101.cpp:982
+
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition CC1101.cpp:800
+
uint8_t randomByte() override
Get one truly random byte from RSSI noise.
Definition CC1101.cpp:954
void reset()
Reset method - resets the chip using manual reset sequence (without RESET pin).
Definition CC1101.cpp:21
int16_t transmitDirect(uint32_t frf=0) override
Starts synchronous direct mode transmission.
Definition CC1101.cpp:125
-
void setDirectAction(void(*func)(void)) override
Set interrupt service routine function to call when data bit is receveid in direct mode.
Definition CC1101.cpp:923
+
void setDirectAction(void(*func)(void)) override
Set interrupt service routine function to call when data bit is receveid in direct mode.
Definition CC1101.cpp:978
void clearPacketSentAction() override
Clears interrupt service routine to call when a packet is sent.
Definition CC1101.cpp:208
void setPacketReceivedAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is received.
Definition CC1101.cpp:196
-
int16_t getChipVersion()
Read version SPI register. Should return CC1101_VERSION_LEGACY (0x04) or CC1101_VERSION_CURRENT (0x14...
Definition CC1101.cpp:918
+
int16_t getChipVersion()
Read version SPI register. Should return CC1101_VERSION_LEGACY (0x04) or CC1101_VERSION_CURRENT (0x14...
Definition CC1101.cpp:973
void setPacketSentAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is sent.
Definition CC1101.cpp:204
-
int16_t setRxBandwidth(float rxBw)
Sets receiver bandwidth. Allowed values are 58, 68, 81, 102, 116, 135, 162, 203, 232,...
Definition CC1101.cpp:417
+
int16_t setRxBandwidth(float rxBw)
Sets receiver bandwidth. Allowed values are 58, 68, 81, 102, 116, 135, 162, 203, 232,...
Definition CC1101.cpp:472
int16_t packetMode()
Stops direct mode. It is required to call this method to switch from direct transmissions to packet-b...
Definition CC1101.cpp:181
-
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:624
-
int16_t autoSetRxBandwidth()
calculates and sets Rx bandwidth based on the freq, baud and freq uncertainty. Reimplement of atlas0f...
Definition CC1101.cpp:438
-
int16_t disableSyncWordFiltering(bool requireCarrierSense=false)
Disable preamble and sync word filtering and generation.
Definition CC1101.cpp:792
+
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:679
+
int16_t autoSetRxBandwidth()
calculates and sets Rx bandwidth based on the freq, baud and freq uncertainty. Reimplement of atlas0f...
Definition CC1101.cpp:493
+
int16_t disableSyncWordFiltering(bool requireCarrierSense=false)
Disable preamble and sync word filtering and generation.
Definition CC1101.cpp:847
int16_t transmit(const uint8_t *data, size_t len, uint8_t addr=0) override
Blocking binary transmit method. Overloads for string-based transmissions are implemented in Physical...
Definition CC1101.cpp:26
-
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition CC1101.cpp:769
-
int16_t setDIOMapping(uint32_t pin, uint32_t value) override
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition CC1101.cpp:932
-
uint8_t getLQI() const
Gets LQI (Link Quality Indicator) of the last received packet.
Definition CC1101.cpp:741
-
int16_t setOutputPower(int8_t pwr) override
Sets output power. Allowed values are -30, -20, -15, -10, 0, 5, 7 or 10 dBm.
Definition CC1101.cpp:508
-
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:891
-
int16_t setCrcFiltering(bool enable=true)
Enable CRC filtering and generation.
Definition CC1101.cpp:797
-
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:671
-
int16_t setBitRate(float br) override
Sets bit rate. Allowed values range from 0.025 to 600.0 kbps.
Definition CC1101.cpp:388
-
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0, bool requireCarrierSense=false)
Enable sync word filtering and generation.
Definition CC1101.cpp:773
-
int16_t startTransmit(const uint8_t *data, size_t len, uint8_t addr=0) override
Interrupt-driven binary transmit method. Overloads for string-based transmissions are implemented in ...
Definition CC1101.cpp:227
+
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition CC1101.cpp:824
+
int16_t setDIOMapping(uint32_t pin, uint32_t value) override
Configure DIO pin mapping to get a given signal on a DIO pin (if available).
Definition CC1101.cpp:987
+
uint8_t getLQI() const
Gets LQI (Link Quality Indicator) of the last received packet.
Definition CC1101.cpp:796
+
int16_t setOutputPower(int8_t pwr) override
Sets output power. Allowed values are -30, -20, -15, -10, 0, 5, 7 or 10 dBm.
Definition CC1101.cpp:563
+
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:946
+
int16_t setCrcFiltering(bool enable=true)
Enable CRC filtering and generation.
Definition CC1101.cpp:852
+
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:726
+
int16_t setBitRate(float br) override
Sets bit rate. Allowed values range from 0.025 to 600.0 kbps.
Definition CC1101.cpp:443
+
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0, bool requireCarrierSense=false)
Enable sync word filtering and generation.
Definition CC1101.cpp:828
+
int16_t startTransmit(const uint8_t *data, size_t len, uint8_t addr=0) override
Interrupt-driven binary transmit method for packets less than 64 bytes. Method blocks for packets lon...
Definition CC1101.cpp:227
int16_t standby() override
Sets the module to standby mode.
Definition CC1101.cpp:95
-
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:895
-
int16_t readData(uint8_t *data, size_t len) override
Reads data received after calling startReceive method. When the packet length is not known in advance...
Definition CC1101.cpp:307
-
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition CC1101.cpp:682
+
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:950
+
int16_t readData(uint8_t *data, size_t len) override
Reads data received after calling startReceive method. When the packet length is not known in advance...
Definition CC1101.cpp:362
+
int16_t disableAddressFiltering()
Disables address filtering. Calling this method will also erase previously set addresses.
Definition CC1101.cpp:737
void setGdo0Action(void(*func)(void), uint32_t dir)
Sets interrupt service routine to call when GDO0 activates.
Definition CC1101.cpp:188
int16_t receiveDirectAsync()
Starts asynchronous direct mode reception.
Definition CC1101.cpp:160
int16_t receiveDirect() override
Starts synchronous direct mode reception.
Definition CC1101.cpp:156
-
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER,...
Definition CC1101.cpp:867
-
int16_t checkOutputPower(int8_t power, int8_t *clipped) override
Check if output power is configurable. This method is needed for compatibility with PhysicalLayer::ch...
Definition CC1101.cpp:533
+
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER,...
Definition CC1101.cpp:922
+
int16_t checkOutputPower(int8_t power, int8_t *clipped) override
Check if output power is configurable. This method is needed for compatibility with PhysicalLayer::ch...
Definition CC1101.cpp:588
void clearGdo0Action()
Clears interrupt service routine to call when GDO0 activates.
Definition CC1101.cpp:192
-
float getRSSI() override
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. In direct or asynchronous...
Definition CC1101.cpp:721
-
int16_t getFrequencyDeviation(float *freqDev)
Gets frequency deviation.
Definition CC1101.cpp:483
-
int16_t setPromiscuousMode(bool enable=true, bool requireCarrierSense=false)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition CC1101.cpp:807
+
float getRSSI() override
Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. In direct or asynchronous...
Definition CC1101.cpp:776
+
int16_t getFrequencyDeviation(float *freqDev)
Gets frequency deviation.
Definition CC1101.cpp:538
+
int16_t setPromiscuousMode(bool enable=true, bool requireCarrierSense=false)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition CC1101.cpp:862
void clearGdo2Action()
Clears interrupt service routine to call when GDO0 activates.
Definition CC1101.cpp:220
-
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition CC1101.cpp:759
-
int16_t setFrequency(float freq) override
Sets carrier frequency. Allowed values are in bands 300.0 to 348.0 MHz, 387.0 to 464....
Definition CC1101.cpp:360
+
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_CC1101_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition CC1101.cpp:814
+
int16_t setFrequency(float freq) override
Sets carrier frequency. Allowed values are in bands 300.0 to 348.0 MHz, 387.0 to 464....
Definition CC1101.cpp:415
void setGdo2Action(void(*func)(void), uint32_t dir)
Sets interrupt service routine to call when GDO2 activates.
Definition CC1101.cpp:212
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:9
-
int16_t setBitRateTolerance(uint8_t brt)
Sets bit rate tolerance in BSCFG register. Allowed values are 0:(0%), 1(3,125%), 2:(6,...
Definition CC1101.cpp:408
-
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:848
-
int16_t startReceive() override
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Definition CC1101.cpp:277
-
int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold)
Sets preamble length.
Definition CC1101.cpp:629
+
int16_t setBitRateTolerance(uint8_t brt)
Sets bit rate tolerance in BSCFG register. Allowed values are 0:(0%), 1(3,125%), 2:(6,...
Definition CC1101.cpp:463
+
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:903
+
int16_t startReceive() override
Interrupt-driven receive method. GDO0 will be activated when full packet is received.
Definition CC1101.cpp:332
+
int16_t setPreambleLength(uint8_t preambleLength, uint8_t qualityThreshold)
Sets preamble length.
Definition CC1101.cpp:684
int16_t receive(uint8_t *data, size_t len) override
Blocking binary receive method. Overloads for string-based transmissions are implemented in PhysicalL...
Definition CC1101.cpp:59
-
bool getPromiscuousMode()
Get whether the modem is in promiscuous mode: no packet filtering (e.g., no preamble,...
Definition CC1101.cpp:844
+
bool getPromiscuousMode()
Get whether the modem is in promiscuous mode: no packet filtering (e.g., no preamble,...
Definition CC1101.cpp:899
int16_t transmitDirectAsync(uint32_t frf=0)
Starts asynchronous direct mode transmission.
Definition CC1101.cpp:129
-
int16_t finishTransmit() override
Clean up after transmission is done.
Definition CC1101.cpp:266
-
int16_t setOOK(bool enableOOK)
Enables/disables OOK modulation instead of FSK.
Definition CC1101.cpp:692
+
int16_t finishTransmit() override
Clean up after transmission is done.
Definition CC1101.cpp:310
+
int16_t setOOK(bool enableOOK)
Enables/disables OOK modulation instead of FSK.
Definition CC1101.cpp:747
int16_t beginFSK4(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 for 4-FSK modulation.
Definition CC1101.cpp:15
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition Module.h:73
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code. Note: It is not recommended to use this c...
Definition Module.h:82
diff --git a/class_c_c1101.html b/class_c_c1101.html index a998af54..8038a841 100644 --- a/class_c_c1101.html +++ b/class_c_c1101.html @@ -184,7 +184,7 @@ void clearGdo2Action (  Clears interrupt service routine to call when a packet is sent.
  int16_t startTransmit (const uint8_t *data, size_t len, uint8_t addr=0) override - Interrupt-driven binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer.
+ Interrupt-driven binary transmit method for packets less than 64 bytes. Method blocks for packets longer than 64 bytes up to a 255 byte limit, until the last bytes are placed in the FIFO. Some limitations and issues apply; see discussion: https://github.com/jgromes/RadioLib/discussions/1138 Overloads for string-based transmissions are implemented in PhysicalLayer.
  int16_t finishTransmit () override  Clean up after transmission is done.
@@ -2575,7 +2575,7 @@ void dropSync ()<
-

Interrupt-driven binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer.

+

Interrupt-driven binary transmit method for packets less than 64 bytes. Method blocks for packets longer than 64 bytes up to a 255 byte limit, until the last bytes are placed in the FIFO. Some limitations and issues apply; see discussion: https://github.com/jgromes/RadioLib/discussions/1138 Overloads for string-based transmissions are implemented in PhysicalLayer.

Parameters
diff --git a/coverage/amber.png b/coverage/amber.png deleted file mode 100644 index 2cab170d..00000000 Binary files a/coverage/amber.png and /dev/null differ diff --git a/coverage/emerald.png b/coverage/emerald.png deleted file mode 100644 index 38ad4f40..00000000 Binary files a/coverage/emerald.png and /dev/null differ diff --git a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func-sort-c.html b/coverage/extras/test/unit/include/HardwareEmulation.hpp.func-sort-c.html deleted file mode 100644 index 6c11e719..00000000 --- a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func-sort-c.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include/HardwareEmulation.hpp - functions - - - - - -
dataBinary data to be sent.
- - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/include - HardwareEmulation.hpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:1414100.0 %
Date:2025-02-11 19:19:31Functions:33100.0 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN13EmulatedRadio7connectEP13EmulatedPin_tS1_S1_S1_4
_ZN13EmulatedRadio10HandleGPIOEv2932
_ZN13EmulatedRadio9HandleSPIEh4192
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func.html b/coverage/extras/test/unit/include/HardwareEmulation.hpp.func.html deleted file mode 100644 index eb79ebd0..00000000 --- a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include/HardwareEmulation.hpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/include - HardwareEmulation.hpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:1414100.0 %
Date:2025-02-11 19:19:31Functions:33100.0 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN13EmulatedRadio10HandleGPIOEv2932
_ZN13EmulatedRadio7connectEP13EmulatedPin_tS1_S1_S1_4
_ZN13EmulatedRadio9HandleSPIEh4192
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/HardwareEmulation.hpp.gcov.html b/coverage/extras/test/unit/include/HardwareEmulation.hpp.gcov.html deleted file mode 100644 index 8e47f93b..00000000 --- a/coverage/extras/test/unit/include/HardwareEmulation.hpp.gcov.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include/HardwareEmulation.hpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/include - HardwareEmulation.hpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:1414100.0 %
Date:2025-02-11 19:19:31Functions:33100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef HARDWARE_EMULATION_HPP
-       2             : #define HARDWARE_EMULATION_HPP
-       3             : 
-       4             : #include <stdint.h>
-       5             : 
-       6             : // value that is returned by the emualted radio class when performing SPI transfer to it
-       7             : #define EMULATED_RADIO_SPI_RETURN (0xFF)
-       8             : 
-       9             : // pin indexes
-      10             : #define EMULATED_RADIO_NSS_PIN    (1)
-      11             : #define EMULATED_RADIO_IRQ_PIN    (2)
-      12             : #define EMULATED_RADIO_RST_PIN    (3)
-      13             : #define EMULATED_RADIO_GPIO_PIN   (4)
-      14             : 
-      15             : enum PinFunction_t {
-      16             :   PIN_UNASSIGNED = 0,
-      17             :   PIN_CS,
-      18             :   PIN_IRQ,
-      19             :   PIN_RST,
-      20             :   PIN_GPIO,
-      21             : };
-      22             : 
-      23             : // structure for emulating GPIO pins
-      24             : struct EmulatedPin_t {
-      25             :   uint32_t mode;
-      26             :   uint32_t value;
-      27             :   bool event;
-      28             :   PinFunction_t func; 
-      29             : };
-      30             : 
-      31             : // structure for emulating SPI registers
-      32             : struct EmulatedRegister_t {
-      33             :   uint8_t value;
-      34             :   uint8_t readOnlyBitFlags;
-      35             :   bool bufferAccess;
-      36             : };
-      37             : 
-      38             : // base class for emulated radio modules (SX126x etc.)
-      39             : class EmulatedRadio {
-      40             :   public:
-      41           4 :     void connect(EmulatedPin_t* csPin, EmulatedPin_t* irqPin, EmulatedPin_t* rstPin, EmulatedPin_t* gpioPin) {
-      42           4 :       this->cs = csPin;
-      43           4 :       this->cs->func = PIN_CS;
-      44           4 :       this->irq = irqPin;
-      45           4 :       this->irq->func = PIN_IRQ;
-      46           4 :       this->rst = rstPin;
-      47           4 :       this->rst->func = PIN_RST;
-      48           4 :       this->gpio = gpioPin;
-      49           4 :       this->gpio->func = PIN_GPIO;
-      50           4 :     }
-      51             : 
-      52        4192 :     virtual uint8_t HandleSPI(uint8_t b) {
-      53             :       (void)b;
-      54             :       // handle the SPI input and generate output here
-      55        4192 :       return(EMULATED_RADIO_SPI_RETURN);
-      56             :     }
-      57             : 
-      58        2932 :     virtual void HandleGPIO() {
-      59             :       // handle discrete GPIO signals here (e.g. reset state machine on NSS falling edge)
-      60        2932 :     }
-      61             :   
-      62             :   protected:
-      63             :     // pointers to emulated GPIO pins
-      64             :     // this is done via pointers so that the same GPIO entity is shared, like with a real hardware
-      65             :     EmulatedPin_t* cs;
-      66             :     EmulatedPin_t* irq;
-      67             :     EmulatedPin_t* rst;
-      68             :     EmulatedPin_t* gpio;
-      69             : };
-      70             : 
-      71             : #endif
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/TestHal.hpp.func-sort-c.html b/coverage/extras/test/unit/include/TestHal.hpp.func-sort-c.html deleted file mode 100644 index ff8a985a..00000000 --- a/coverage/extras/test/unit/include/TestHal.hpp.func-sort-c.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include/TestHal.hpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/include - TestHal.hpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:699175.8 %
Date:2025-02-11 19:19:31Functions:152462.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7TestHal15attachInterruptEjPFvvEj0
_ZN7TestHal15detachInterruptEj0
_ZN7TestHal4toneEjjm0
_ZN7TestHal5delayEm0
_ZN7TestHal5yieldEv0
_ZN7TestHal6noToneEj0
_ZN7TestHal6spiEndEv0
_ZN7TestHal7pulseInEjjm0
_ZN7TestHal8spiBeginEv0
_ZN7TestHal12connectRadioEP13EmulatedRadio4
_ZN7TestHal4initEv4
_ZN7TestHal4termEv4
_ZN7TestHal7pinModeEjj4
_ZN7TestHalC2Ev4
_ZN7TestHal12spiLogMemcmpEPKvm12
_ZN7TestHal10spiLogWipeEv16
_ZN7TestHal11digitalReadEj846
_ZN7TestHal6millisEv846
_ZN7TestHal6microsEv1462
_ZN7TestHal11spiTransferEPhmS0_1464
_ZN7TestHal17spiEndTransactionEv1464
_ZN7TestHal19spiBeginTransactionEv1464
_ZN7TestHal12digitalWriteEjj2932
_ZN7TestHal17delayMicrosecondsEm4615
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/TestHal.hpp.func.html b/coverage/extras/test/unit/include/TestHal.hpp.func.html deleted file mode 100644 index a03674b2..00000000 --- a/coverage/extras/test/unit/include/TestHal.hpp.func.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include/TestHal.hpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/include - TestHal.hpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:699175.8 %
Date:2025-02-11 19:19:31Functions:152462.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7TestHal10spiLogWipeEv16
_ZN7TestHal11digitalReadEj846
_ZN7TestHal11spiTransferEPhmS0_1464
_ZN7TestHal12connectRadioEP13EmulatedRadio4
_ZN7TestHal12digitalWriteEjj2932
_ZN7TestHal12spiLogMemcmpEPKvm12
_ZN7TestHal15attachInterruptEjPFvvEj0
_ZN7TestHal15detachInterruptEj0
_ZN7TestHal17delayMicrosecondsEm4615
_ZN7TestHal17spiEndTransactionEv1464
_ZN7TestHal19spiBeginTransactionEv1464
_ZN7TestHal4initEv4
_ZN7TestHal4termEv4
_ZN7TestHal4toneEjjm0
_ZN7TestHal5delayEm0
_ZN7TestHal5yieldEv0
_ZN7TestHal6microsEv1462
_ZN7TestHal6millisEv846
_ZN7TestHal6noToneEj0
_ZN7TestHal6spiEndEv0
_ZN7TestHal7pinModeEjj4
_ZN7TestHal7pulseInEjjm0
_ZN7TestHal8spiBeginEv0
_ZN7TestHalC2Ev4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/TestHal.hpp.gcov.html b/coverage/extras/test/unit/include/TestHal.hpp.gcov.html deleted file mode 100644 index 2bcb1721..00000000 --- a/coverage/extras/test/unit/include/TestHal.hpp.gcov.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include/TestHal.hpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/include - TestHal.hpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:699175.8 %
Date:2025-02-11 19:19:31Functions:152462.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef TEST_HAL_HPP
-       2             : #define TEST_HAL_HPP
-       3             : 
-       4             : #include <chrono>
-       5             : #include <thread>
-       6             : #include <fmt/format.h>
-       7             : 
-       8             : #include <RadioLib.h>
-       9             : 
-      10             : #include <boost/log/trivial.hpp>
-      11             : #include <boost/format.hpp>
-      12             : 
-      13             : #if defined(TEST_HAL_LOG)
-      14             : #define HAL_LOG(...) BOOST_TEST_MESSAGE(__VA_ARGS__)
-      15             : #else
-      16             : #define HAL_LOG(...) {}
-      17             : #endif
-      18             : 
-      19             : #include "HardwareEmulation.hpp"
-      20             : 
-      21             : #define TEST_HAL_INPUT          (0)
-      22             : #define TEST_HAL_OUTPUT         (1)
-      23             : #define TEST_HAL_LOW            (0)
-      24             : #define TEST_HAL_HIGH           (1)
-      25             : #define TEST_HAL_RISING         (0)
-      26             : #define TEST_HAL_FALLING        (1)
-      27             : 
-      28             : // number of emulated GPIO pins
-      29             : #define TEST_HAL_NUM_GPIO_PINS  (32)
-      30             : 
-      31             : #define TEST_HAL_SPI_LOG_LENGTH (512)
-      32             : 
-      33             : class TestHal : public RadioLibHal {
-      34             :   public:
-      35           4 :     TestHal() : RadioLibHal(TEST_HAL_INPUT, TEST_HAL_OUTPUT, TEST_HAL_LOW, TEST_HAL_HIGH, TEST_HAL_RISING, TEST_HAL_FALLING) { }
-      36             : 
-      37           4 :     void init() override {
-      38             :       HAL_LOG("TestHal::init()");
-      39             : 
-      40             :       // save program start timestamp
-      41           4 :       start = std::chrono::high_resolution_clock::now();
-      42             : 
-      43             :       // init emulated GPIO
-      44         132 :       for(int i = 0; i < TEST_HAL_NUM_GPIO_PINS; i++) {
-      45         128 :         this->gpio[i].mode = 0;
-      46         128 :         this->gpio[i].value = 0;
-      47         128 :         this->gpio[i].event = false;
-      48         128 :         this->gpio[i].func = PIN_UNASSIGNED;
-      49             :       }
-      50             : 
-      51             :       // wipe history log
-      52           4 :       this->spiLogWipe();
-      53           4 :     }
-      54             : 
-      55           4 :     void term() override {
-      56             :       HAL_LOG("TestHal::term()");
-      57           4 :     }
-      58             : 
-      59           4 :     void pinMode(uint32_t pin, uint32_t mode) override {
-      60             :       HAL_LOG("TestHal::pinMode(pin=" << pin << ", mode=" << mode << " [" << ((mode == TEST_HAL_INPUT) ? "INPUT" : "OUTPUT") << "])");
-      61             :       
-      62             :       // check the range
-      63           4 :       BOOST_ASSERT_MSG(pin < TEST_HAL_NUM_GPIO_PINS, "Pin number out of range");
-      64             : 
-      65             :       // check known modes
-      66           4 :       BOOST_ASSERT_MSG(((mode == TEST_HAL_INPUT) || (mode == TEST_HAL_OUTPUT)), "Invalid pin mode");
-      67             : 
-      68             :       // set mode
-      69           4 :       this->gpio[pin].mode = mode;
-      70           4 :     }
-      71             : 
-      72        2932 :     void digitalWrite(uint32_t pin, uint32_t value) override {
-      73             :       HAL_LOG("TestHal::digitalWrite(pin=" << pin << ", value=" << value << " [" << ((value == TEST_HAL_LOW) ? "LOW" : "HIGH") << "])");
-      74             : 
-      75             :       // check the range
-      76        2932 :       BOOST_ASSERT_MSG(pin < TEST_HAL_NUM_GPIO_PINS, "Pin number out of range");
-      77             : 
-      78             :       // check it is output
-      79        2932 :       BOOST_ASSERT_MSG(this->gpio[pin].mode == TEST_HAL_OUTPUT, "GPIO is not output!");
-      80             : 
-      81             :       // check known values
-      82        2932 :       BOOST_ASSERT_MSG(((value == TEST_HAL_LOW) || (value == TEST_HAL_HIGH)), "Invalid output value");
-      83             : 
-      84             :       // set value
-      85        2932 :       this->gpio[pin].value = value;
-      86        2932 :       this->gpio[pin].event = true;
-      87        2932 :       if(radio) {
-      88        2932 :         this->radio->HandleGPIO();
-      89             :       }
-      90        2932 :       this->gpio[pin].event = false;
-      91        2932 :     }
-      92             : 
-      93         846 :     uint32_t digitalRead(uint32_t pin) override {
-      94             :       HAL_LOG("TestHal::digitalRead(pin=" << pin << ")");
-      95             : 
-      96             :       // check the range
-      97         846 :       BOOST_ASSERT_MSG(pin < TEST_HAL_NUM_GPIO_PINS, "Pin number out of range");
-      98             : 
-      99             :       // check it is input
-     100         846 :       BOOST_ASSERT_MSG(this->gpio[pin].mode == TEST_HAL_INPUT, "GPIO is not input");
-     101             : 
-     102             :       // read the value
-     103         846 :       uint32_t value = this->gpio[pin].value;
-     104             :       HAL_LOG("TestHal::digitalRead(pin=" << pin << ")=" << value << " [" << ((value == TEST_HAL_LOW) ? "LOW" : "HIGH") << "]");
-     105         846 :       return(value);
-     106             :     }
-     107             : 
-     108           0 :     void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) override {
-     109             :       HAL_LOG("TestHal::attachInterrupt(interruptNum=" << interruptNum << ", interruptCb=" << interruptCb << ", mode=" << mode << ")");
-     110             : 
-     111             :       // TODO implement
-     112             :       (void)interruptNum;
-     113             :       (void)interruptCb;
-     114             :       (void)mode;
-     115           0 :     }
-     116             : 
-     117           0 :     void detachInterrupt(uint32_t interruptNum) override {
-     118             :       HAL_LOG("TestHal::detachInterrupt(interruptNum=" << interruptNum << ")");
-     119             : 
-     120             :       // TODO implement
-     121             :       (void)interruptNum;
-     122           0 :     }
-     123             : 
-     124           0 :     void delay(unsigned long ms) override {
-     125             :       HAL_LOG("TestHal::delay(ms=" << ms << ")");
-     126           0 :       const auto start = std::chrono::high_resolution_clock::now();
-     127             : 
-     128             :       // sleep_for is sufficient for ms-precision sleep
-     129           0 :       std::this_thread::sleep_for(std::chrono::duration<unsigned long, std::milli>(ms));
-     130             : 
-     131             :       // measure and print
-     132           0 :       const auto end = std::chrono::high_resolution_clock::now();
-     133           0 :       const std::chrono::duration<double, std::milli> elapsed = end - start;
-     134             :       HAL_LOG("TestHal::delay(ms=" << ms << ")=" << elapsed.count() << "ms");
-     135           0 :     }
-     136             : 
-     137        4615 :     void delayMicroseconds(unsigned long us) override {
-     138             :       HAL_LOG("TestHal::delayMicroseconds(us=" << us << ")");
-     139        4615 :       const auto start = std::chrono::high_resolution_clock::now();
-     140             : 
-     141             :       // busy wait is needed for microseconds precision
-     142        4615 :       const auto len = std::chrono::microseconds(us);
-     143     6705199 :       while(std::chrono::high_resolution_clock::now() - start < len);
-     144             : 
-     145             :       // measure and print
-     146        4615 :       const auto end = std::chrono::high_resolution_clock::now();
-     147        4615 :       const std::chrono::duration<double, std::micro> elapsed = end - start;
-     148             :       HAL_LOG("TestHal::delayMicroseconds(us=" << us << ")=" << elapsed.count() << "us");
-     149        4615 :     }
-     150             : 
-     151           0 :     void yield() override {
-     152             :       HAL_LOG("TestHal::yield()");
-     153           0 :     }
-     154             : 
-     155         846 :     unsigned long millis() override {
-     156             :       HAL_LOG("TestHal::millis()");
-     157         846 :       std::chrono::time_point now = std::chrono::high_resolution_clock::now();
-     158         846 :       auto res = std::chrono::duration_cast<std::chrono::milliseconds>(now - this->start);
-     159             :       HAL_LOG("TestHal::millis()=" << res.count());
-     160         846 :       return(res.count());
-     161             :     }
-     162             : 
-     163        1462 :     unsigned long micros() override {
-     164             :       HAL_LOG("TestHal::micros()");
-     165        1462 :       std::chrono::time_point now = std::chrono::high_resolution_clock::now();
-     166        1462 :       auto res = std::chrono::duration_cast<std::chrono::microseconds>(now - this->start);
-     167             :       HAL_LOG("TestHal::micros()=" << res.count());
-     168        1462 :       return(res.count());
-     169             :     }
-     170             : 
-     171           0 :     long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout) override {
-     172             :       HAL_LOG("TestHal::pulseIn(pin=" << pin << ", state=" << state << ", timeout=" << timeout << ")");
-     173             : 
-     174             :       // TODO implement
-     175             :       (void)pin;
-     176             :       (void)state;
-     177             :       (void)timeout;
-     178           0 :       return(0);
-     179             :     }
-     180             : 
-     181           0 :     void spiBegin() {
-     182             :       HAL_LOG("TestHal::spiBegin()");
-     183           0 :     }
-     184             : 
-     185        1464 :     void spiBeginTransaction() {
-     186             :       HAL_LOG("TestHal::spiBeginTransaction()");
-     187        1464 :     }
-     188             : 
-     189        1464 :     void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
-     190             :       HAL_LOG("TestHal::spiTransfer(len=" << len << ")");
-     191             :       
-     192        5656 :       for(size_t i = 0; i < len; i++) {
-     193             :         // append to log
-     194        4192 :         (*this->spiLogPtr++) = out[i];
-     195             : 
-     196             :         // process the SPI byte
-     197        4192 :         in[i] = this->radio->HandleSPI(out[i]);
-     198             : 
-     199             :         // artificial delay to emulate SPI running at a finite speed
-     200             :         // this is added because timeouts are based on time duration,
-     201             :         // so we need to make sure some time actually elapses
-     202        4192 :         this->delayMicroseconds(100);
-     203             : 
-     204             :         // output debug
-     205             :         HAL_LOG(fmt::format("out={:#02x}, in={:#02x}", out[i], in[i]));
-     206             :       }
-     207        1464 :     }
-     208             : 
-     209        1464 :     void spiEndTransaction() {
-     210             :       HAL_LOG("TestHal::spiEndTransaction()");
-     211        1464 :     }
-     212             : 
-     213           0 :     void spiEnd() {
-     214             :       HAL_LOG("TestHal::spiEnd()");
-     215           0 :     }
-     216             : 
-     217           0 :     void tone(uint32_t pin, unsigned int frequency, unsigned long duration = 0) {
-     218             :       HAL_LOG("TestHal::tone(pin=" << pin << ", frequency=" << frequency << ", duration=" << duration << ")");
-     219             : 
-     220             :       // TODO implement
-     221             :       (void)pin;
-     222             :       (void)frequency;
-     223             :       (void)duration;
-     224           0 :     }
-     225             : 
-     226           0 :     void noTone(uint32_t pin) {
-     227             :       HAL_LOG("TestHal::noTone(pin=" << pin << ")");
-     228             : 
-     229             :       // TODO implement
-     230             :       (void)pin;
-     231           0 :     }
-     232             : 
-     233             :     // method to compare buffer to the internal SPI log, for verifying SPI transactions
-     234          12 :     int spiLogMemcmp(const void* in, size_t n) {
-     235          12 :       int ret = memcmp(this->spiLog, in, n);
-     236          12 :       this->spiLogWipe();
-     237          12 :       return(ret);
-     238             :     }
-     239             : 
-     240          16 :     void spiLogWipe() {
-     241          16 :       memset(this->spiLog, 0x00, TEST_HAL_SPI_LOG_LENGTH);
-     242          16 :       this->spiLogPtr = this->spiLog;
-     243          16 :     }
-     244             : 
-     245             :     // method that "connects" the emualted radio hardware to this HAL
-     246           4 :     void connectRadio(EmulatedRadio* r) {
-     247           4 :       this->radio = r;
-     248           4 :       this->radio->connect(&this->gpio[EMULATED_RADIO_NSS_PIN],
-     249             :                            &this->gpio[EMULATED_RADIO_IRQ_PIN],
-     250             :                            &this->gpio[EMULATED_RADIO_RST_PIN],
-     251             :                            &this->gpio[EMULATED_RADIO_GPIO_PIN]);
-     252           4 :     }
-     253             : 
-     254             :   private:
-     255             :     // array of emulated GPIO pins
-     256             :     EmulatedPin_t gpio[TEST_HAL_NUM_GPIO_PINS];
-     257             : 
-     258             :     // start time point
-     259             :     std::chrono::time_point<std::chrono::high_resolution_clock> start;
-     260             : 
-     261             :     // emulated radio hardware
-     262             :     EmulatedRadio* radio;
-     263             : 
-     264             :     // SPI history log
-     265             :     uint8_t spiLog[TEST_HAL_SPI_LOG_LENGTH];
-     266             :     uint8_t* spiLogPtr;
-     267             : };
-     268             : 
-     269             : #endif
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/index-sort-f.html b/coverage/extras/test/unit/include/index-sort-f.html deleted file mode 100644 index 47b2b633..00000000 --- a/coverage/extras/test/unit/include/index-sort-f.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/includeHitTotalCoverage
Test:lcov.infoLines:8310579.0 %
Date:2025-02-11 19:19:31Functions:182766.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
TestHal.hpp -
75.8%75.8%
-
75.8 %69 / 9162.5 %15 / 24
HardwareEmulation.hpp -
100.0%
-
100.0 %14 / 14100.0 %3 / 3
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/index-sort-l.html b/coverage/extras/test/unit/include/index-sort-l.html deleted file mode 100644 index e7b8934a..00000000 --- a/coverage/extras/test/unit/include/index-sort-l.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/includeHitTotalCoverage
Test:lcov.infoLines:8310579.0 %
Date:2025-02-11 19:19:31Functions:182766.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
TestHal.hpp -
75.8%75.8%
-
75.8 %69 / 9162.5 %15 / 24
HardwareEmulation.hpp -
100.0%
-
100.0 %14 / 14100.0 %3 / 3
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/include/index.html b/coverage/extras/test/unit/include/index.html deleted file mode 100644 index 848ab219..00000000 --- a/coverage/extras/test/unit/include/index.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/include - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/includeHitTotalCoverage
Test:lcov.infoLines:8310579.0 %
Date:2025-02-11 19:19:31Functions:182766.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HardwareEmulation.hpp -
100.0%
-
100.0 %14 / 14100.0 %3 / 3
TestHal.hpp -
75.8%75.8%
-
75.8 %69 / 9162.5 %15 / 24
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/tests/TestModule.cpp.func-sort-c.html b/coverage/extras/test/unit/tests/TestModule.cpp.func-sort-c.html deleted file mode 100644 index 615d07a5..00000000 --- a/coverage/extras/test/unit/tests/TestModule.cpp.func-sort-c.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/tests/TestModule.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/tests - TestModule.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:142142100.0 %
Date:2025-02-11 19:19:31Functions:1010100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN12suite_Module25Module_SPIgetRegValue_reg11test_methodEv1
_ZN12suite_Module25Module_SPIsetRegValue_reg11test_methodEv1
_ZN12suite_Module28Module_SPIgetRegValue_stream11test_methodEv1
_ZN12suite_Module28Module_SPIsetRegValue_stream11test_methodEv1
_ZN12suite_ModuleL33Module_SPIgetRegValue_reg_invokerEv1
_ZN12suite_ModuleL33Module_SPIsetRegValue_reg_invokerEv1
_ZN12suite_ModuleL36Module_SPIgetRegValue_stream_invokerEv1
_ZN12suite_ModuleL36Module_SPIsetRegValue_stream_invokerEv1
_ZN13ModuleFixtureC2Ev4
_ZN13ModuleFixtureD2Ev4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/tests/TestModule.cpp.func.html b/coverage/extras/test/unit/tests/TestModule.cpp.func.html deleted file mode 100644 index 9e07bddb..00000000 --- a/coverage/extras/test/unit/tests/TestModule.cpp.func.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/tests/TestModule.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/tests - TestModule.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:142142100.0 %
Date:2025-02-11 19:19:31Functions:1010100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN12suite_Module25Module_SPIgetRegValue_reg11test_methodEv1
_ZN12suite_Module25Module_SPIsetRegValue_reg11test_methodEv1
_ZN12suite_Module28Module_SPIgetRegValue_stream11test_methodEv1
_ZN12suite_Module28Module_SPIsetRegValue_stream11test_methodEv1
_ZN12suite_ModuleL33Module_SPIgetRegValue_reg_invokerEv1
_ZN12suite_ModuleL33Module_SPIsetRegValue_reg_invokerEv1
_ZN12suite_ModuleL36Module_SPIgetRegValue_stream_invokerEv1
_ZN12suite_ModuleL36Module_SPIsetRegValue_stream_invokerEv1
_ZN13ModuleFixtureC2Ev4
_ZN13ModuleFixtureD2Ev4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/tests/TestModule.cpp.gcov.html b/coverage/extras/test/unit/tests/TestModule.cpp.gcov.html deleted file mode 100644 index 9ca0385e..00000000 --- a/coverage/extras/test/unit/tests/TestModule.cpp.gcov.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/tests/TestModule.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/tests - TestModule.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:142142100.0 %
Date:2025-02-11 19:19:31Functions:1010100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // boost test header
-       2             : #include <boost/test/unit_test.hpp>
-       3             : 
-       4             : // mock HAL
-       5             : #include "TestHal.hpp"
-       6             : 
-       7             : // testing fixture
-       8             : struct ModuleFixture {
-       9             :   TestHal* hal = nullptr;
-      10             :   Module* mod = nullptr;
-      11             :   EmulatedRadio* radioHardware = nullptr;
-      12             : 
-      13           4 :   ModuleFixture()  { 
-      14           4 :     BOOST_TEST_MESSAGE("--- Module fixture setup ---"); 
-      15           4 :     hal = new TestHal();
-      16           4 :     radioHardware = new EmulatedRadio();
-      17           4 :     hal->connectRadio(radioHardware);
-      18             : 
-      19           4 :     mod = new Module(hal, EMULATED_RADIO_NSS_PIN, EMULATED_RADIO_IRQ_PIN, EMULATED_RADIO_RST_PIN, EMULATED_RADIO_GPIO_PIN);
-      20           4 :     mod->init();
-      21           4 :   }
-      22             : 
-      23           4 :   ~ModuleFixture() { 
-      24           4 :     BOOST_TEST_MESSAGE("--- Module fixture teardown ---");
-      25           4 :     mod->term();
-      26           4 :     delete[] mod;
-      27           4 :     delete[] hal;
-      28           4 :   }
-      29             : };
-      30             : 
-      31             : BOOST_FIXTURE_TEST_SUITE(suite_Module, ModuleFixture)
-      32             : 
-      33           2 :   BOOST_FIXTURE_TEST_CASE(Module_SPIgetRegValue_reg, ModuleFixture)
-      34             :   {
-      35           1 :     BOOST_TEST_MESSAGE("--- Test Module::SPIgetRegValue register access ---");
-      36             :     int16_t ret;
-      37             : 
-      38             :     // basic register read with default config
-      39           1 :     const uint8_t address = 0x12;
-      40           1 :     const uint8_t spiTxn[] = { address, 0x00 };
-      41           1 :     ret = mod->SPIgetRegValue(address);
-      42             : 
-      43             :     // check return code, value and history log
-      44           1 :     BOOST_TEST(ret >= RADIOLIB_ERR_NONE);
-      45           1 :     BOOST_TEST(ret == EMULATED_RADIO_SPI_RETURN);
-      46           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-      47             : 
-      48             :     // register read masking test
-      49           1 :     const uint8_t msb = 5;
-      50           1 :     const uint8_t lsb = 1;
-      51           1 :     const uint8_t maskedValue = 0x3E;
-      52           1 :     ret = mod->SPIgetRegValue(address, msb, lsb);
-      53           1 :     BOOST_TEST(ret == maskedValue);
-      54             : 
-      55             :     // invalid mask tests (swapped MSB and LSB, out of range bit masks)
-      56           1 :     ret = mod->SPIgetRegValue(address, lsb, msb);
-      57           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-      58           1 :     ret = mod->SPIgetRegValue(address, 10, lsb);
-      59           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-      60           1 :     ret = mod->SPIgetRegValue(address, msb, 10);
-      61           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-      62           1 :   }
-      63             : 
-      64           2 :   BOOST_FIXTURE_TEST_CASE(Module_SPIsetRegValue_reg, ModuleFixture)
-      65             :   {
-      66           1 :     BOOST_TEST_MESSAGE("--- Test Module::SPIsetRegValue register access ---");
-      67             :     int16_t ret;
-      68             : 
-      69             :     // basic register write with default config
-      70           1 :     const uint8_t address = 0x12;
-      71           1 :     const uint8_t value = 0xAB;
-      72           1 :     const uint8_t spiTxn[] = { address, 0x00, 0x80 | address, value };
-      73           1 :     ret = mod->SPIsetRegValue(address, value);
-      74             : 
-      75             :     // check return code and history log
-      76             :     // this will return write error because the bare emulated radio has no internal logic
-      77           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-      78           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-      79             : 
-      80             :     // register write masking test
-      81           1 :     const uint8_t msb = 5;
-      82           1 :     const uint8_t lsb = 1;
-      83           1 :     const uint8_t maskedValue = 0xEB;
-      84           1 :     const uint8_t spiTxn2[] = { address, 0x00, 0x80 | address, maskedValue };
-      85           1 :     ret = mod->SPIsetRegValue(address, value, msb, lsb);
-      86           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-      87           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn2, sizeof(spiTxn2)) == 0);
-      88             : 
-      89             :     // invalid mask tests (swapped MSB and LSB, out of range bit masks)
-      90           1 :     ret = mod->SPIsetRegValue(address, value, lsb, msb);
-      91           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-      92           1 :     ret = mod->SPIsetRegValue(address, value, 10, lsb);
-      93           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-      94           1 :     ret = mod->SPIsetRegValue(address, value, msb, 10);
-      95           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-      96             : 
-      97             :     // check interval test
-      98           1 :     const uint8_t interval = 200;
-      99           1 :     const unsigned long start = hal->micros();
-     100           1 :     ret = mod->SPIsetRegValue(address, value, 7, 0, interval);
-     101           1 :     const unsigned long stop = hal->micros();
-     102           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-     103           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     104           1 :     const unsigned long elapsed = stop - start;
-     105           1 :     BOOST_TEST(elapsed >= (unsigned long)interval*1000UL);
-     106             : 
-     107             :     // disabled check mask test
-     108           1 :     ret = mod->SPIsetRegValue(address, value, 7, 0, 2, 0);
-     109           1 :     BOOST_TEST(ret == RADIOLIB_ERR_NONE);
-     110           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     111             : 
-     112             :     // forced write test
-     113           1 :     ret = mod->SPIsetRegValue(address, value, 7, 0, 2, 0xFF, true);
-     114           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-     115           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     116           1 :   }
-     117             : 
-     118           2 :   BOOST_FIXTURE_TEST_CASE(Module_SPIgetRegValue_stream, ModuleFixture)
-     119             :   {
-     120           1 :     BOOST_TEST_MESSAGE("--- Test Module::SPIgetRegValue stream access ---");
-     121             :     int16_t ret;
-     122             : 
-     123             :     // change settings to stream type
-     124           1 :     mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR] = Module::BITS_16;
-     125           1 :     mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD] = Module::BITS_8;
-     126           1 :     mod->spiConfig.statusPos = 1;
-     127           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ] = RADIOLIB_SX126X_CMD_READ_REGISTER;
-     128           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE] = RADIOLIB_SX126X_CMD_WRITE_REGISTER;
-     129           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_NOP] = RADIOLIB_SX126X_CMD_NOP;
-     130           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_STATUS] = RADIOLIB_SX126X_CMD_GET_STATUS;
-     131           1 :     mod->spiConfig.stream = true;
-     132             : 
-     133             :     // basic register read
-     134           1 :     const uint8_t address = 0x12;
-     135           1 :     const uint8_t spiTxn[] = { RADIOLIB_SX126X_CMD_READ_REGISTER, 0x00, address, 0x00, 0x00 };
-     136           1 :     ret = mod->SPIgetRegValue(address);
-     137             : 
-     138             :     // check return code, value and history log
-     139           1 :     BOOST_TEST(ret >= RADIOLIB_ERR_NONE);
-     140           1 :     BOOST_TEST(ret == EMULATED_RADIO_SPI_RETURN);
-     141           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     142             : 
-     143             :     // register read masking test
-     144           1 :     const uint8_t msb = 5;
-     145           1 :     const uint8_t lsb = 1;
-     146           1 :     const uint8_t maskedValue = 0x3E;
-     147           1 :     ret = mod->SPIgetRegValue(address, msb, lsb);
-     148           1 :     BOOST_TEST(ret == maskedValue);
-     149             : 
-     150             :     // invalid mask tests (swapped MSB and LSB, out of range bit masks)
-     151           1 :     ret = mod->SPIgetRegValue(address, lsb, msb);
-     152           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-     153           1 :     ret = mod->SPIgetRegValue(address, 10, lsb);
-     154           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-     155           1 :     ret = mod->SPIgetRegValue(address, msb, 10);
-     156           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-     157           1 :   }
-     158             : 
-     159           2 :   BOOST_FIXTURE_TEST_CASE(Module_SPIsetRegValue_stream, ModuleFixture)
-     160             :   {
-     161           1 :     BOOST_TEST_MESSAGE("--- Test Module::SPIsetRegValue stream access ---");
-     162             :     int16_t ret;
-     163             : 
-     164             :     // change settings to stream type
-     165           1 :     mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR] = Module::BITS_16;
-     166           1 :     mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD] = Module::BITS_8;
-     167           1 :     mod->spiConfig.statusPos = 1;
-     168           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ] = RADIOLIB_SX126X_CMD_READ_REGISTER;
-     169           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE] = RADIOLIB_SX126X_CMD_WRITE_REGISTER;
-     170           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_NOP] = RADIOLIB_SX126X_CMD_NOP;
-     171           1 :     mod->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_STATUS] = RADIOLIB_SX126X_CMD_GET_STATUS;
-     172           1 :     mod->spiConfig.stream = true;
-     173             : 
-     174             :     // basic register write with default config
-     175           1 :     const uint8_t address = 0x12;
-     176           1 :     const uint8_t value = 0xAB;
-     177           1 :     const uint8_t spiTxn[] = { 
-     178             :       RADIOLIB_SX126X_CMD_READ_REGISTER,  0x00, address, 0x00, 0x00,
-     179             :       RADIOLIB_SX126X_CMD_WRITE_REGISTER, 0x00, address, value,
-     180             :     };
-     181           1 :     ret = mod->SPIsetRegValue(address, value);
-     182             : 
-     183             :     // check return code and history log
-     184             :     // this will return write error because the bare emulated radio has no internal logic
-     185           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-     186           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     187             : 
-     188             :     // register write masking test
-     189           1 :     const uint8_t msb = 5;
-     190           1 :     const uint8_t lsb = 1;
-     191           1 :     const uint8_t maskedValue = 0xEB;
-     192           1 :     const uint8_t spiTxn2[] = { 
-     193             :       RADIOLIB_SX126X_CMD_READ_REGISTER,  0x00, address, 0x00, 0x00,
-     194             :       RADIOLIB_SX126X_CMD_WRITE_REGISTER, 0x00, address, maskedValue,
-     195             :     };
-     196           1 :     ret = mod->SPIsetRegValue(address, value, msb, lsb);
-     197           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-     198           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn2, sizeof(spiTxn2)) == 0);
-     199             : 
-     200             :     // invalid mask tests (swapped MSB and LSB, out of range bit masks)
-     201           1 :     ret = mod->SPIsetRegValue(address, value, lsb, msb);
-     202           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-     203           1 :     ret = mod->SPIsetRegValue(address, value, 10, lsb);
-     204           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-     205           1 :     ret = mod->SPIsetRegValue(address, value, msb, 10);
-     206           1 :     BOOST_TEST(ret == RADIOLIB_ERR_INVALID_BIT_RANGE);
-     207             : 
-     208             :     // check interval test
-     209           1 :     const uint8_t interval = 200;
-     210           1 :     const unsigned long start = hal->micros();
-     211           1 :     ret = mod->SPIsetRegValue(address, value, 7, 0, interval);
-     212           1 :     const unsigned long stop = hal->micros();
-     213           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-     214           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     215           1 :     const unsigned long elapsed = stop - start;
-     216           1 :     BOOST_TEST(elapsed >= (unsigned long)interval*1000UL);
-     217             : 
-     218             :     // disabled check mask test
-     219           1 :     ret = mod->SPIsetRegValue(address, value, 7, 0, 2, 0);
-     220           1 :     BOOST_TEST(ret == RADIOLIB_ERR_NONE);
-     221           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     222             : 
-     223             :     // forced write test
-     224           1 :     ret = mod->SPIsetRegValue(address, value, 7, 0, 2, 0xFF, true);
-     225           1 :     BOOST_TEST(ret == RADIOLIB_ERR_SPI_WRITE_FAILED);
-     226           1 :     BOOST_TEST(hal->spiLogMemcmp(spiTxn, sizeof(spiTxn)) == 0);
-     227           1 :   }
-     228             : 
-     229             : BOOST_AUTO_TEST_SUITE_END()
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/tests/index-sort-f.html b/coverage/extras/test/unit/tests/index-sort-f.html deleted file mode 100644 index 5bb9e7ba..00000000 --- a/coverage/extras/test/unit/tests/index-sort-f.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/tests - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/testsHitTotalCoverage
Test:lcov.infoLines:142142100.0 %
Date:2025-02-11 19:19:31Functions:1010100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
TestModule.cpp -
100.0%
-
100.0 %142 / 142100.0 %10 / 10
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/tests/index-sort-l.html b/coverage/extras/test/unit/tests/index-sort-l.html deleted file mode 100644 index d8bf853b..00000000 --- a/coverage/extras/test/unit/tests/index-sort-l.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/tests - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/testsHitTotalCoverage
Test:lcov.infoLines:142142100.0 %
Date:2025-02-11 19:19:31Functions:1010100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
TestModule.cpp -
100.0%
-
100.0 %142 / 142100.0 %10 / 10
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/extras/test/unit/tests/index.html b/coverage/extras/test/unit/tests/index.html deleted file mode 100644 index 43fab762..00000000 --- a/coverage/extras/test/unit/tests/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - lcov.info - extras/test/unit/tests - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - extras/test/unit/testsHitTotalCoverage
Test:lcov.infoLines:142142100.0 %
Date:2025-02-11 19:19:31Functions:1010100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
TestModule.cpp -
100.0%
-
100.0 %142 / 142100.0 %10 / 10
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/gcov.css b/coverage/gcov.css deleted file mode 100644 index bfd0a83e..00000000 --- a/coverage/gcov.css +++ /dev/null @@ -1,519 +0,0 @@ -/* All views: initial background and text color */ -body -{ - color: #000000; - background-color: #FFFFFF; -} - -/* All views: standard link format*/ -a:link -{ - color: #284FA8; - text-decoration: underline; -} - -/* All views: standard link - visited format */ -a:visited -{ - color: #00CB40; - text-decoration: underline; -} - -/* All views: standard link - activated format */ -a:active -{ - color: #FF0040; - text-decoration: underline; -} - -/* All views: main title format */ -td.title -{ - text-align: center; - padding-bottom: 10px; - font-family: sans-serif; - font-size: 20pt; - font-style: italic; - font-weight: bold; -} - -/* All views: header item format */ -td.headerItem -{ - text-align: right; - padding-right: 6px; - font-family: sans-serif; - font-weight: bold; - vertical-align: top; - white-space: nowrap; -} - -/* All views: header item value format */ -td.headerValue -{ - text-align: left; - color: #284FA8; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; -} - -/* All views: header item coverage table heading */ -td.headerCovTableHead -{ - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - font-size: 80%; - white-space: nowrap; -} - -/* All views: header item coverage table entry */ -td.headerCovTableEntry -{ - text-align: right; - color: #284FA8; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #DAE7FE; -} - -/* All views: header item coverage table entry for high coverage rate */ -td.headerCovTableEntryHi -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #A7FC9D; -} - -/* All views: header item coverage table entry for medium coverage rate */ -td.headerCovTableEntryMed -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #FFEA20; -} - -/* All views: header item coverage table entry for ow coverage rate */ -td.headerCovTableEntryLo -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #FF0000; -} - -/* All views: header legend value for legend entry */ -td.headerValueLeg -{ - text-align: left; - color: #000000; - font-family: sans-serif; - font-size: 80%; - white-space: nowrap; - padding-top: 4px; -} - -/* All views: color of horizontal ruler */ -td.ruler -{ - background-color: #6688D4; -} - -/* All views: version string format */ -td.versionInfo -{ - text-align: center; - padding-top: 2px; - font-family: sans-serif; - font-style: italic; -} - -/* Directory view/File view (all)/Test case descriptions: - table headline format */ -td.tableHead -{ - text-align: center; - color: #FFFFFF; - background-color: #6688D4; - font-family: sans-serif; - font-size: 120%; - font-weight: bold; - white-space: nowrap; - padding-left: 4px; - padding-right: 4px; -} - -span.tableHeadSort -{ - padding-right: 4px; -} - -/* Directory view/File view (all): filename entry format */ -td.coverFile -{ - text-align: left; - padding-left: 10px; - padding-right: 20px; - color: #284FA8; - background-color: #DAE7FE; - font-family: monospace; -} - -/* Directory view/File view (all): bar-graph entry format*/ -td.coverBar -{ - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; -} - -/* Directory view/File view (all): bar-graph outline color */ -td.coverBarOutline -{ - background-color: #000000; -} - -/* Directory view/File view (all): percentage entry for files with - high coverage rate */ -td.coverPerHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #A7FC9D; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - high coverage rate */ -td.coverNumHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #A7FC9D; - white-space: nowrap; - font-family: sans-serif; -} - -/* Directory view/File view (all): percentage entry for files with - medium coverage rate */ -td.coverPerMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FFEA20; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - medium coverage rate */ -td.coverNumMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FFEA20; - white-space: nowrap; - font-family: sans-serif; -} - -/* Directory view/File view (all): percentage entry for files with - low coverage rate */ -td.coverPerLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FF0000; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - low coverage rate */ -td.coverNumLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FF0000; - white-space: nowrap; - font-family: sans-serif; -} - -/* File view (all): "show/hide details" link format */ -a.detail:link -{ - color: #B8D0FF; - font-size:80%; -} - -/* File view (all): "show/hide details" link - visited format */ -a.detail:visited -{ - color: #B8D0FF; - font-size:80%; -} - -/* File view (all): "show/hide details" link - activated format */ -a.detail:active -{ - color: #FFFFFF; - font-size:80%; -} - -/* File view (detail): test name entry */ -td.testName -{ - text-align: right; - padding-right: 10px; - background-color: #DAE7FE; - font-family: sans-serif; -} - -/* File view (detail): test percentage entry */ -td.testPer -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; - font-family: sans-serif; -} - -/* File view (detail): test lines count entry */ -td.testNum -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; - font-family: sans-serif; -} - -/* Test case descriptions: test name format*/ -dt -{ - font-family: sans-serif; - font-weight: bold; -} - -/* Test case descriptions: description table body */ -td.testDescription -{ - padding-top: 10px; - padding-left: 30px; - padding-bottom: 10px; - padding-right: 30px; - background-color: #DAE7FE; -} - -/* Source code view: function entry */ -td.coverFn -{ - text-align: left; - padding-left: 10px; - padding-right: 20px; - color: #284FA8; - background-color: #DAE7FE; - font-family: monospace; -} - -/* Source code view: function entry zero count*/ -td.coverFnLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FF0000; - font-weight: bold; - font-family: sans-serif; -} - -/* Source code view: function entry nonzero count*/ -td.coverFnHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; - font-weight: bold; - font-family: sans-serif; -} - -/* Source code view: source code format */ -pre.source -{ - font-family: monospace; - white-space: pre; - margin-top: 2px; -} - -/* Source code view: line number format */ -span.lineNum -{ - background-color: #EFE383; -} - -/* Source code view: format for lines which were executed */ -td.lineCov, -span.lineCov -{ - background-color: #CAD7FE; -} - -/* Source code view: format for Cov legend */ -span.coverLegendCov -{ - padding-left: 10px; - padding-right: 10px; - padding-bottom: 2px; - background-color: #CAD7FE; -} - -/* Source code view: format for lines which were not executed */ -td.lineNoCov, -span.lineNoCov -{ - background-color: #FF6230; -} - -/* Source code view: format for NoCov legend */ -span.coverLegendNoCov -{ - padding-left: 10px; - padding-right: 10px; - padding-bottom: 2px; - background-color: #FF6230; -} - -/* Source code view (function table): standard link - visited format */ -td.lineNoCov > a:visited, -td.lineCov > a:visited -{ - color: black; - text-decoration: underline; -} - -/* Source code view: format for lines which were executed only in a - previous version */ -span.lineDiffCov -{ - background-color: #B5F7AF; -} - -/* Source code view: format for branches which were executed - * and taken */ -span.branchCov -{ - background-color: #CAD7FE; -} - -/* Source code view: format for branches which were executed - * but not taken */ -span.branchNoCov -{ - background-color: #FF6230; -} - -/* Source code view: format for branches which were not executed */ -span.branchNoExec -{ - background-color: #FF6230; -} - -/* Source code view: format for the source code heading line */ -pre.sourceHeading -{ - white-space: pre; - font-family: monospace; - font-weight: bold; - margin: 0px; -} - -/* All views: header legend value for low rate */ -td.headerValueLegL -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 4px; - padding-right: 2px; - background-color: #FF0000; - font-size: 80%; -} - -/* All views: header legend value for med rate */ -td.headerValueLegM -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 2px; - padding-right: 2px; - background-color: #FFEA20; - font-size: 80%; -} - -/* All views: header legend value for hi rate */ -td.headerValueLegH -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 2px; - padding-right: 4px; - background-color: #A7FC9D; - font-size: 80%; -} - -/* All views except source code view: legend format for low coverage */ -span.coverLegendCovLo -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #FF0000; -} - -/* All views except source code view: legend format for med coverage */ -span.coverLegendCovMed -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #FFEA20; -} - -/* All views except source code view: legend format for hi coverage */ -span.coverLegendCovHi -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #A7FC9D; -} diff --git a/coverage/glass.png b/coverage/glass.png deleted file mode 100644 index e1abc006..00000000 Binary files a/coverage/glass.png and /dev/null differ diff --git a/coverage/index-sort-f.html b/coverage/index-sort-f.html deleted file mode 100644 index 43e417d6..00000000 --- a/coverage/index-sort-f.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - lcov.info - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelHitTotalCoverage
Test:lcov.infoLines:33748569.5 %
Date:2025-02-11 19:19:31Functions:386756.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
src -
47.1%47.1%
-
47.1 %112 / 23833.3 %10 / 30
extras/test/unit/include -
79.0%79.0%
-
79.0 %83 / 10566.7 %18 / 27
extras/test/unit/tests -
100.0%
-
100.0 %142 / 142100.0 %10 / 10
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/index-sort-l.html b/coverage/index-sort-l.html deleted file mode 100644 index 366bbbf7..00000000 --- a/coverage/index-sort-l.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - lcov.info - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelHitTotalCoverage
Test:lcov.infoLines:33748569.5 %
Date:2025-02-11 19:19:31Functions:386756.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
src -
47.1%47.1%
-
47.1 %112 / 23833.3 %10 / 30
extras/test/unit/include -
79.0%79.0%
-
79.0 %83 / 10566.7 %18 / 27
extras/test/unit/tests -
100.0%
-
100.0 %142 / 142100.0 %10 / 10
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/index.html b/coverage/index.html deleted file mode 100644 index 6db1a990..00000000 --- a/coverage/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - lcov.info - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelHitTotalCoverage
Test:lcov.infoLines:33748569.5 %
Date:2025-02-11 19:19:31Functions:386756.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
extras/test/unit/include -
79.0%79.0%
-
79.0 %83 / 10566.7 %18 / 27
extras/test/unit/tests -
100.0%
-
100.0 %142 / 142100.0 %10 / 10
src -
47.1%47.1%
-
47.1 %112 / 23833.3 %10 / 30
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/ruby.png b/coverage/ruby.png deleted file mode 100644 index 991b6d4e..00000000 Binary files a/coverage/ruby.png and /dev/null differ diff --git a/coverage/snow.png b/coverage/snow.png deleted file mode 100644 index 2cdae107..00000000 Binary files a/coverage/snow.png and /dev/null differ diff --git a/coverage/src/Hal.cpp.func-sort-c.html b/coverage/src/Hal.cpp.func-sort-c.html deleted file mode 100644 index e61494ff..00000000 --- a/coverage/src/Hal.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - lcov.info - src/Hal.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Hal.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:71936.8 %
Date:2025-02-11 19:19:31Functions:1714.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN11RadioLibHal14pinToInterruptEj0
_ZN11RadioLibHal4initEv0
_ZN11RadioLibHal4termEv0
_ZN11RadioLibHal4toneEjjm0
_ZN11RadioLibHal5yieldEv0
_ZN11RadioLibHal6noToneEj0
_ZN11RadioLibHalC2Ejjjjjj4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/Hal.cpp.func.html b/coverage/src/Hal.cpp.func.html deleted file mode 100644 index e27df2a8..00000000 --- a/coverage/src/Hal.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - lcov.info - src/Hal.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Hal.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:71936.8 %
Date:2025-02-11 19:19:31Functions:1714.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN11RadioLibHal14pinToInterruptEj0
_ZN11RadioLibHal4initEv0
_ZN11RadioLibHal4termEv0
_ZN11RadioLibHal4toneEjjm0
_ZN11RadioLibHal5yieldEv0
_ZN11RadioLibHal6noToneEj0
_ZN11RadioLibHalC2Ejjjjjj4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/Hal.cpp.gcov.html b/coverage/src/Hal.cpp.gcov.html deleted file mode 100644 index 70f35768..00000000 --- a/coverage/src/Hal.cpp.gcov.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - lcov.info - src/Hal.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Hal.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:71936.8 %
Date:2025-02-11 19:19:31Functions:1714.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "Hal.h"
-       2             : 
-       3           4 : RadioLibHal::RadioLibHal(const uint32_t input, const uint32_t output, const uint32_t low, const uint32_t high, const uint32_t rising, const uint32_t falling)
-       4           4 :     : GpioModeInput(input),
-       5           4 :       GpioModeOutput(output),
-       6           4 :       GpioLevelLow(low),
-       7           4 :       GpioLevelHigh(high),
-       8           4 :       GpioInterruptRising(rising),
-       9           4 :       GpioInterruptFalling(falling) {}
-      10             : 
-      11           0 : void RadioLibHal::init() {
-      12             : 
-      13           0 : }
-      14             : 
-      15           0 : void RadioLibHal::term() {
-      16             : 
-      17           0 : }
-      18             : 
-      19           0 : void RadioLibHal::tone(uint32_t pin, unsigned int frequency, RadioLibTime_t duration) {
-      20             :   (void)pin;
-      21             :   (void)frequency;
-      22             :   (void)duration;
-      23           0 : }
-      24             : 
-      25           0 : void RadioLibHal::noTone(uint32_t pin) {
-      26             :   (void)pin;
-      27           0 : }
-      28             : 
-      29           0 : void RadioLibHal::yield() {
-      30             : 
-      31           0 : }
-      32             : 
-      33           0 : uint32_t RadioLibHal::pinToInterrupt(uint32_t pin) {
-      34           0 :   return(pin);
-      35             : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/Module.cpp.func-sort-c.html b/coverage/src/Module.cpp.func-sort-c.html deleted file mode 100644 index 04963afd..00000000 --- a/coverage/src/Module.cpp.func-sort-c.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - LCOV - lcov.info - src/Module.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:10521947.9 %
Date:2025-02-11 19:19:31Functions:92339.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6Module13SPIreadStreamEPKhhPhmbb0
_ZN6Module13SPIreadStreamEtPhmbb0
_ZN6Module14SPIcheckStreamEv0
_ZN6Module14SPIwriteStreamEPKhhS1_mbb0
_ZN6Module14SPIwriteStreamEtPKhmbb0
_ZN6Module15setRfSwitchPinsEjj0
_ZN6Module16setRfSwitchStateEh0
_ZN6Module16setRfSwitchTableERA5_KjPKNS_14RfSwitchMode_tE0
_ZN6Module19waitForMicrosecondsEmm0
_ZN6Module20SPIreadRegisterBurstEjmPh0
_ZN6Module21SPIwriteRegisterBurstEjPKhm0
_ZN6ModuleC2ERKS_0
_ZN6ModuleaSERKS_0
_ZNK6Module16findRfSwitchModeEh0
_ZN6Module4initEv4
_ZN6Module4termEv4
_ZN6ModuleC2EP11RadioLibHaljjjj4
_ZN6Module14SPIgetRegValueEjhh10
_ZN6Module16SPIwriteRegisterEjh10
_ZN6Module14SPIsetRegValueEjhhhhhb16
_ZN6Module17SPItransferStreamEPKhhbS1_Phmb423
_ZN6Module11SPItransferEtjPKhPhm1041
_ZN6Module15SPIreadRegisterEj1454
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/Module.cpp.func.html b/coverage/src/Module.cpp.func.html deleted file mode 100644 index dbbed82b..00000000 --- a/coverage/src/Module.cpp.func.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - LCOV - lcov.info - src/Module.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:10521947.9 %
Date:2025-02-11 19:19:31Functions:92339.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6Module11SPItransferEtjPKhPhm1041
_ZN6Module13SPIreadStreamEPKhhPhmbb0
_ZN6Module13SPIreadStreamEtPhmbb0
_ZN6Module14SPIcheckStreamEv0
_ZN6Module14SPIgetRegValueEjhh10
_ZN6Module14SPIsetRegValueEjhhhhhb16
_ZN6Module14SPIwriteStreamEPKhhS1_mbb0
_ZN6Module14SPIwriteStreamEtPKhmbb0
_ZN6Module15SPIreadRegisterEj1454
_ZN6Module15setRfSwitchPinsEjj0
_ZN6Module16SPIwriteRegisterEjh10
_ZN6Module16setRfSwitchStateEh0
_ZN6Module16setRfSwitchTableERA5_KjPKNS_14RfSwitchMode_tE0
_ZN6Module17SPItransferStreamEPKhhbS1_Phmb423
_ZN6Module19waitForMicrosecondsEmm0
_ZN6Module20SPIreadRegisterBurstEjmPh0
_ZN6Module21SPIwriteRegisterBurstEjPKhm0
_ZN6Module4initEv4
_ZN6Module4termEv4
_ZN6ModuleC2EP11RadioLibHaljjjj4
_ZN6ModuleC2ERKS_0
_ZN6ModuleaSERKS_0
_ZNK6Module16findRfSwitchModeEh0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/Module.cpp.gcov.html b/coverage/src/Module.cpp.gcov.html deleted file mode 100644 index 301ed399..00000000 --- a/coverage/src/Module.cpp.gcov.html +++ /dev/null @@ -1,616 +0,0 @@ - - - - - - - LCOV - lcov.info - src/Module.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:lcov.infoLines:10521947.9 %
Date:2025-02-11 19:19:31Functions:92339.1 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "Module.h"
-       2             : 
-       3             : // the following is probably only needed on non-Arduino builds
-       4             : #include <stdio.h>
-       5             : #include <string.h>
-       6             : 
-       7             : #if defined(RADIOLIB_BUILD_ARDUINO)
-       8             : #include "hal/Arduino/ArduinoHal.h"
-       9             : 
-      10             : Module::Module(uint32_t cs, uint32_t irq, uint32_t rst, uint32_t gpio) : csPin(cs), irqPin(irq), rstPin(rst), gpioPin(gpio) {
-      11             :   this->hal = new ArduinoHal();
-      12             : }
-      13             : 
-      14             : Module::Module(uint32_t cs, uint32_t irq, uint32_t rst, uint32_t gpio, SPIClass& spi, SPISettings spiSettings) : csPin(cs), irqPin(irq), rstPin(rst), gpioPin(gpio) {
-      15             :   this->hal = new ArduinoHal(spi, spiSettings);
-      16             : }
-      17             : #endif
-      18             : 
-      19           4 : Module::Module(RadioLibHal *hal, uint32_t cs, uint32_t irq, uint32_t rst, uint32_t gpio) : csPin(cs), irqPin(irq), rstPin(rst), gpioPin(gpio) {
-      20           4 :   this->hal = hal;
-      21           4 : }
-      22             : 
-      23           0 : Module::Module(const Module& mod) {
-      24           0 :   *this = mod;
-      25           0 : }
-      26             : 
-      27           0 : Module& Module::operator=(const Module& mod) {
-      28           0 :   memcpy(reinterpret_cast<void*>(&(const_cast<Module&>(mod)).spiConfig), &this->spiConfig, sizeof(SPIConfig_t));
-      29           0 :   this->csPin = mod.csPin;
-      30           0 :   this->irqPin = mod.irqPin;
-      31           0 :   this->rstPin = mod.rstPin;
-      32           0 :   this->gpioPin = mod.gpioPin;
-      33           0 :   return(*this);
-      34             : }
-      35             : 
-      36             : static volatile const char info[] = RADIOLIB_INFO;
-      37           4 : void Module::init() {
-      38           4 :   this->hal->init();
-      39           4 :   this->hal->pinMode(csPin, this->hal->GpioModeOutput);
-      40           4 :   this->hal->digitalWrite(csPin, this->hal->GpioLevelHigh);
-      41             :   RADIOLIB_DEBUG_BASIC_PRINTLN(RADIOLIB_INFO);
-      42           4 : }
-      43             : 
-      44           4 : void Module::term() {
-      45             :   // stop hardware interfaces (if they were initialized by the library)
-      46           4 :   this->hal->term();
-      47           4 : }
-      48             : 
-      49          10 : int16_t Module::SPIgetRegValue(uint32_t reg, uint8_t msb, uint8_t lsb) {
-      50          10 :   if((msb > 7) || (lsb > 7) || (lsb > msb)) {
-      51           6 :     return(RADIOLIB_ERR_INVALID_BIT_RANGE);
-      52             :   }
-      53             : 
-      54           4 :   uint8_t rawValue = SPIreadRegister(reg);
-      55           4 :   uint8_t maskedValue = rawValue & ((0b11111111 << lsb) & (0b11111111 >> (7 - msb)));
-      56           4 :   return(maskedValue);
-      57             : }
-      58             : 
-      59          16 : int16_t Module::SPIsetRegValue(uint32_t reg, uint8_t value, uint8_t msb, uint8_t lsb, uint8_t checkInterval, uint8_t checkMask, bool force) {
-      60          16 :   if((msb > 7) || (lsb > 7) || (lsb > msb)) {
-      61           6 :     return(RADIOLIB_ERR_INVALID_BIT_RANGE);
-      62             :   }
-      63             : 
-      64             :   // read the current value
-      65          10 :   uint8_t currentValue = SPIreadRegister(reg);
-      66          10 :   uint8_t mask = ~((0b11111111 << (msb + 1)) | (0b11111111 >> (8 - lsb)));
-      67             : 
-      68             :   // check if we actually need to update the register
-      69          10 :   if((currentValue & mask) == (value & mask) && !force) {
-      70           0 :     return(RADIOLIB_ERR_NONE);
-      71             :   }
-      72             : 
-      73             :   // update the register
-      74          10 :   uint8_t newValue = (currentValue & ~mask) | (value & mask);
-      75          10 :   SPIwriteRegister(reg, newValue);
-      76             : 
-      77             :   #if RADIOLIB_SPI_PARANOID
-      78             :     // check register value each millisecond until check interval is reached
-      79             :     // some registers need a bit of time to process the change (e.g. SX127X_REG_OP_MODE)
-      80          10 :     RadioLibTime_t start = this->hal->micros();
-      81             :     #if RADIOLIB_DEBUG_SPI
-      82             :     uint8_t readValue = 0x00;
-      83             :     #endif
-      84        1448 :     while(this->hal->micros() - start < (checkInterval * 1000)) {
-      85        1440 :       uint8_t val = SPIreadRegister(reg);
-      86        1440 :       if((val & checkMask) == (newValue & checkMask)) {
-      87             :         // check passed, we can stop the loop
-      88           2 :         return(RADIOLIB_ERR_NONE);
-      89             :       }
-      90             :       #if RADIOLIB_DEBUG_SPI
-      91             :       readValue = val;
-      92             :       #endif
-      93             :     }
-      94             : 
-      95             :     // check failed, print debug info
-      96             :     RADIOLIB_DEBUG_SPI_PRINTLN();
-      97             :     RADIOLIB_DEBUG_SPI_PRINTLN("address:\t0x%X", reg);
-      98             :     RADIOLIB_DEBUG_SPI_PRINTLN("bits:\t\t%d %d", msb, lsb);
-      99             :     RADIOLIB_DEBUG_SPI_PRINTLN("value:\t\t0x%X", value);
-     100             :     RADIOLIB_DEBUG_SPI_PRINTLN("current:\t0x%X", currentValue);
-     101             :     RADIOLIB_DEBUG_SPI_PRINTLN("mask:\t\t0x%X", mask);
-     102             :     RADIOLIB_DEBUG_SPI_PRINTLN("new:\t\t0x%X", newValue);
-     103             :     RADIOLIB_DEBUG_SPI_PRINTLN("read:\t\t0x%X", readValue);
-     104             : 
-     105           8 :     return(RADIOLIB_ERR_SPI_WRITE_FAILED);
-     106             :   #else
-     107             :     return(RADIOLIB_ERR_NONE);
-     108             :   #endif
-     109             : }
-     110             : 
-     111           0 : void Module::SPIreadRegisterBurst(uint32_t reg, size_t numBytes, uint8_t* inBytes) {
-     112           0 :   if(!this->spiConfig.stream) {
-     113           0 :     SPItransfer(this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ], reg, NULL, inBytes, numBytes);
-     114             :   } else {
-     115             :     uint8_t cmd[6];
-     116           0 :     uint8_t* cmdPtr = cmd;
-     117           0 :     for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
-     118           0 :       *(cmdPtr++) = (this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ] >> 8*i) & 0xFF;
-     119             :     }
-     120           0 :     for(int8_t i = (int8_t)((this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8) - 1); i >= 0; i--) {
-     121           0 :       *(cmdPtr++) = (reg >> 8*i) & 0xFF;
-     122             :     }
-     123           0 :     SPItransferStream(cmd, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 + this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8, false, NULL, inBytes, numBytes, true);
-     124             :   }
-     125           0 : }
-     126             : 
-     127        1454 : uint8_t Module::SPIreadRegister(uint32_t reg) {
-     128        1454 :   uint8_t resp = 0;
-     129        1454 :   if(!spiConfig.stream) {
-     130        1036 :     SPItransfer(this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ], reg, NULL, &resp, 1);
-     131             :   } else {
-     132             :     uint8_t cmd[6];
-     133         418 :     uint8_t* cmdPtr = cmd;
-     134         836 :     for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
-     135         418 :       *(cmdPtr++) = (this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ] >> 8*i) & 0xFF;
-     136             :     }
-     137        1254 :     for(int8_t i = (int8_t)((this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8) - 1); i >= 0; i--) {
-     138         836 :       *(cmdPtr++) = (reg >> 8*i) & 0xFF;
-     139             :     }
-     140         418 :     SPItransferStream(cmd, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 + this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8, false, NULL, &resp, 1, true);
-     141             :   }
-     142        1454 :   return(resp);
-     143             : }
-     144             : 
-     145           0 : void Module::SPIwriteRegisterBurst(uint32_t reg, const uint8_t* data, size_t numBytes) {
-     146           0 :   if(!spiConfig.stream) {
-     147           0 :     SPItransfer(spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE], reg, data, NULL, numBytes);
-     148             :   } else {
-     149             :     uint8_t cmd[6];
-     150           0 :     uint8_t* cmdPtr = cmd;
-     151           0 :     for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
-     152           0 :       *(cmdPtr++) = (this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE] >> 8*i) & 0xFF;
-     153             :     }
-     154           0 :     for(int8_t i = (int8_t)((this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8) - 1); i >= 0; i--) {
-     155           0 :       *(cmdPtr++) = (reg >> 8*i) & 0xFF;
-     156             :     }
-     157           0 :     SPItransferStream(cmd, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 + this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8, true, data, NULL, numBytes, true);
-     158             :   }
-     159           0 : }
-     160             : 
-     161          10 : void Module::SPIwriteRegister(uint32_t reg, uint8_t data) {
-     162          10 :   if(!spiConfig.stream) {
-     163           5 :     SPItransfer(spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE], reg, &data, NULL, 1);
-     164             :   } else {
-     165             :     uint8_t cmd[6];
-     166           5 :     uint8_t* cmdPtr = cmd;
-     167          10 :     for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
-     168           5 :       *(cmdPtr++) = (this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE] >> 8*i) & 0xFF;
-     169             :     }
-     170          15 :     for(int8_t i = (int8_t)((this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8) - 1); i >= 0; i--) {
-     171          10 :       *(cmdPtr++) = (reg >> 8*i) & 0xFF;
-     172             :     }
-     173           5 :     SPItransferStream(cmd, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 + this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8, true, &data, NULL, 1, true);
-     174             :   }
-     175          10 : }
-     176             : 
-     177        1041 : void Module::SPItransfer(uint16_t cmd, uint32_t reg, const uint8_t* dataOut, uint8_t* dataIn, size_t numBytes) {
-     178             :   // prepare the buffers
-     179        1041 :   size_t buffLen = this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 + this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8 + numBytes;
-     180             :   #if RADIOLIB_STATIC_ONLY
-     181             :     uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
-     182             :     uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
-     183             :   #else
-     184        1041 :     uint8_t* buffOut = new uint8_t[buffLen];
-     185        1041 :     uint8_t* buffIn = new uint8_t[buffLen];
-     186             :   #endif
-     187        1041 :   uint8_t* buffOutPtr = buffOut;
-     188             : 
-     189             :   // copy the command
-     190             :   // TODO properly handle variable commands and addresses
-     191        1041 :   if(this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR] <= 8) {
-     192        1041 :     *(buffOutPtr++) = reg | cmd;
-     193             :   } else {
-     194           0 :     *(buffOutPtr++) = (reg >> 8) | cmd;
-     195           0 :     *(buffOutPtr++) = reg & 0xFF;
-     196             :   }
-     197             : 
-     198             :   // copy the data
-     199        1041 :   if(cmd == spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE]) {
-     200           5 :     memcpy(buffOutPtr, dataOut, numBytes);
-     201             :   } else {
-     202        1036 :     memset(buffOutPtr, this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_NOP], numBytes);
-     203             :   }
-     204             : 
-     205             :   // do the transfer
-     206        1041 :   this->hal->spiBeginTransaction();
-     207        1041 :   this->hal->digitalWrite(this->csPin, this->hal->GpioLevelLow);
-     208        1041 :   this->hal->spiTransfer(buffOut, buffLen, buffIn);
-     209        1041 :   this->hal->digitalWrite(this->csPin, this->hal->GpioLevelHigh);
-     210        1041 :   this->hal->spiEndTransaction();
-     211             :   
-     212             :   // copy the data
-     213        1041 :   if(cmd == spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ]) {
-     214        1036 :     memcpy(dataIn, &buffIn[this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8], numBytes);
-     215             :   }
-     216             : 
-     217             :   // print debug information
-     218             :   #if RADIOLIB_DEBUG_SPI
-     219             :     const uint8_t* debugBuffPtr = NULL;
-     220             :     if(cmd == spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_WRITE]) {
-     221             :       RADIOLIB_DEBUG_SPI_PRINT("W\t%X\t", reg);
-     222             :       debugBuffPtr = &buffOut[this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8];
-     223             :     } else if(cmd == spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ]) {
-     224             :       RADIOLIB_DEBUG_SPI_PRINT("R\t%X\t", reg);
-     225             :       debugBuffPtr = &buffIn[this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8];
-     226             :     }
-     227             :     for(size_t n = 0; n < numBytes; n++) {
-     228             :       RADIOLIB_DEBUG_SPI_PRINT_NOTAG("%X\t", debugBuffPtr[n]);
-     229             :     }
-     230             :     RADIOLIB_DEBUG_SPI_PRINTLN_NOTAG();
-     231             :   #endif
-     232             : 
-     233             :   #if !RADIOLIB_STATIC_ONLY
-     234        1041 :     delete[] buffOut;
-     235        1041 :     delete[] buffIn;
-     236             :   #endif
-     237        1041 : }
-     238             : 
-     239           0 : int16_t Module::SPIreadStream(uint16_t cmd, uint8_t* data, size_t numBytes, bool waitForGpio, bool verify) {
-     240             :   uint8_t cmdBuf[2];
-     241           0 :   uint8_t* cmdPtr = cmdBuf;
-     242           0 :   for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
-     243           0 :     *(cmdPtr++) = (cmd >> 8*i) & 0xFF;
-     244             :   }
-     245           0 :   return(this->SPIreadStream(cmdBuf, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8, data, numBytes, waitForGpio, verify));
-     246             : }
-     247             : 
-     248           0 : int16_t Module::SPIreadStream(const uint8_t* cmd, uint8_t cmdLen, uint8_t* data, size_t numBytes, bool waitForGpio, bool verify) {
-     249             :   // send the command
-     250           0 :   int16_t state = this->SPItransferStream(cmd, cmdLen, false, NULL, data, numBytes, waitForGpio);
-     251           0 :   RADIOLIB_ASSERT(state);
-     252             : 
-     253             :   #if !RADIOLIB_SPI_PARANOID
-     254             :   (void)verify;
-     255             :   return(RADIOLIB_ERR_NONE);
-     256             :   #else
-     257             : 
-     258             :   // check the status
-     259           0 :   if(verify && (this->spiConfig.checkStatusCb != nullptr)) {
-     260           0 :     state = this->spiConfig.checkStatusCb(this);
-     261             :   }
-     262             : 
-     263           0 :   return(state);
-     264             :   #endif
-     265             : }
-     266             : 
-     267           0 : int16_t Module::SPIwriteStream(uint16_t cmd, const uint8_t* data, size_t numBytes, bool waitForGpio, bool verify) {
-     268             :   uint8_t cmdBuf[2];
-     269           0 :   uint8_t* cmdPtr = cmdBuf;
-     270           0 :   for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
-     271           0 :     *(cmdPtr++) = (cmd >> 8*i) & 0xFF;
-     272             :   }
-     273           0 :   return(this->SPIwriteStream(cmdBuf, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8, data, numBytes, waitForGpio, verify));
-     274             : }
-     275             : 
-     276           0 : int16_t Module::SPIwriteStream(const uint8_t* cmd, uint8_t cmdLen, const uint8_t* data, size_t numBytes, bool waitForGpio, bool verify) {
-     277             :   // send the command
-     278           0 :   int16_t state = this->SPItransferStream(cmd, cmdLen, true, data, NULL, numBytes, waitForGpio);
-     279           0 :   RADIOLIB_ASSERT(state);
-     280             : 
-     281             :   #if !RADIOLIB_SPI_PARANOID
-     282             :   (void)verify;
-     283             :   return(RADIOLIB_ERR_NONE);
-     284             :   #else
-     285             : 
-     286             :   // check the status
-     287           0 :   if(verify && (this->spiConfig.checkStatusCb != nullptr)) {
-     288           0 :     state = this->spiConfig.checkStatusCb(this);
-     289             :   }
-     290             : 
-     291           0 :   return(state);
-     292             :   #endif
-     293             : }
-     294             : 
-     295           0 : int16_t Module::SPIcheckStream() {
-     296           0 :   int16_t state = RADIOLIB_ERR_NONE;
-     297             : 
-     298             :   #if RADIOLIB_SPI_PARANOID
-     299             :   // get the status
-     300           0 :   uint8_t spiStatus = 0;
-     301             :   uint8_t cmdBuf[2];
-     302           0 :   uint8_t* cmdPtr = cmdBuf;
-     303           0 :   for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
-     304           0 :     *(cmdPtr++) = ( this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_STATUS] >> 8*i) & 0xFF;
-     305             :   }
-     306           0 :   state = this->SPItransferStream(cmdBuf, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8, false, NULL, &spiStatus, 1, true);
-     307           0 :   RADIOLIB_ASSERT(state);
-     308             : 
-     309             :   // translate to RadioLib status code
-     310           0 :   if(this->spiConfig.parseStatusCb != nullptr) {
-     311           0 :     this->spiConfig.err = this->spiConfig.parseStatusCb(spiStatus);
-     312             :   }
-     313             :   #endif
-     314             : 
-     315           0 :   return(state);
-     316             : }
-     317             : 
-     318         423 : int16_t Module::SPItransferStream(const uint8_t* cmd, uint8_t cmdLen, bool write, const uint8_t* dataOut, uint8_t* dataIn, size_t numBytes, bool waitForGpio) {
-     319             :   // prepare the output buffer
-     320         423 :   size_t buffLen = cmdLen + numBytes;
-     321         423 :   if(!write) {
-     322         418 :     buffLen += (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8);
-     323             :   }
-     324             :   #if RADIOLIB_STATIC_ONLY
-     325             :     uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
-     326             :   #else
-     327         423 :     uint8_t* buffOut = new uint8_t[buffLen];
-     328             :   #endif
-     329         423 :   uint8_t* buffOutPtr = buffOut;
-     330             : 
-     331             :   // copy the command
-     332        1692 :   for(uint8_t n = 0; n < cmdLen; n++) {
-     333        1269 :     *(buffOutPtr++) = cmd[n];
-     334             :   }
-     335             : 
-     336             :   // copy the data
-     337         423 :   if(write) {
-     338           5 :     memcpy(buffOutPtr, dataOut, numBytes);
-     339             :   } else {
-     340         418 :     memset(buffOutPtr, this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_NOP], numBytes + (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8));
-     341             :   }
-     342             : 
-     343             :   // ensure GPIO is low
-     344         423 :   if(waitForGpio) {
-     345         423 :     if(this->gpioPin == RADIOLIB_NC) {
-     346           0 :       this->hal->delay(50);
-     347             :     } else {
-     348         423 :       RadioLibTime_t start = this->hal->millis();
-     349         423 :       while(this->hal->digitalRead(this->gpioPin)) {
-     350           0 :         this->hal->yield();
-     351             : 
-     352             :         // this timeout check triggers a false positive from cppcheck
-     353             :         // cppcheck-suppress unsignedLessThanZero
-     354           0 :         if(this->hal->millis() - start >= this->spiConfig.timeout) {
-     355             :           RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO pre-transfer timeout, is it connected?");
-     356             :           #if !RADIOLIB_STATIC_ONLY
-     357           0 :             delete[] buffOut;
-     358             :           #endif
-     359           0 :           return(RADIOLIB_ERR_SPI_CMD_TIMEOUT);
-     360             :         }
-     361             :       
-     362             :       }
-     363             :     }
-     364             :   }
-     365             : 
-     366             :   // prepare the input buffer
-     367             :   #if RADIOLIB_STATIC_ONLY
-     368             :     uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
-     369             :   #else
-     370         423 :     uint8_t* buffIn = new uint8_t[buffLen];
-     371             :   #endif
-     372             : 
-     373             :   // do the transfer
-     374         423 :   this->hal->spiBeginTransaction();
-     375         423 :   this->hal->digitalWrite(this->csPin, this->hal->GpioLevelLow);
-     376         423 :   this->hal->spiTransfer(buffOut, buffLen, buffIn);
-     377         423 :   this->hal->digitalWrite(this->csPin, this->hal->GpioLevelHigh);
-     378         423 :   this->hal->spiEndTransaction();
-     379             : 
-     380             :   // wait for GPIO to go high and then low
-     381         423 :   if(waitForGpio) {
-     382         423 :     if(this->gpioPin == RADIOLIB_NC) {
-     383           0 :       this->hal->delay(1);
-     384             :     } else {
-     385         423 :       this->hal->delayMicroseconds(1);
-     386         423 :       RadioLibTime_t start = this->hal->millis();
-     387         423 :       while(this->hal->digitalRead(this->gpioPin)) {
-     388           0 :         this->hal->yield();
-     389             :         
-     390             :         // this timeout check triggers a false positive from cppcheck
-     391             :         // cppcheck-suppress unsignedLessThanZero
-     392           0 :         if(this->hal->millis() - start >= this->spiConfig.timeout) {
-     393             :           RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO post-transfer timeout, is it connected?");
-     394             :           #if !RADIOLIB_STATIC_ONLY
-     395           0 :             delete[] buffOut;
-     396           0 :             delete[] buffIn;
-     397             :           #endif
-     398           0 :           return(RADIOLIB_ERR_SPI_CMD_TIMEOUT);
-     399             :         }
-     400             :       
-     401             :       }
-     402             :     }
-     403             :   }
-     404             : 
-     405             :   // parse status
-     406         423 :   int16_t state = RADIOLIB_ERR_NONE;
-     407         423 :   if((this->spiConfig.parseStatusCb != nullptr) && (numBytes > 0)) {
-     408           0 :     state = this->spiConfig.parseStatusCb(buffIn[this->spiConfig.statusPos]);
-     409             :   }
-     410             :   
-     411             :   // copy the data
-     412         423 :   if(!write) {
-     413             :     // skip the status bytes if present
-     414         418 :     memcpy(dataIn, &buffIn[cmdLen + (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8)], numBytes);
-     415             :   }
-     416             : 
-     417             :   // print debug information
-     418             :   #if RADIOLIB_DEBUG_SPI
-     419             :     // print command byte(s)
-     420             :     RADIOLIB_DEBUG_SPI_PRINT("CMD");
-     421             :     if(write) {
-     422             :       RADIOLIB_DEBUG_SPI_PRINT_NOTAG("W\t");
-     423             :     } else {
-     424             :       RADIOLIB_DEBUG_SPI_PRINT_NOTAG("R\t");
-     425             :     }
-     426             :     size_t n = 0;
-     427             :     for(; n < cmdLen; n++) {
-     428             :       RADIOLIB_DEBUG_SPI_PRINT_NOTAG("%X\t", cmd[n]);
-     429             :     }
-     430             :     RADIOLIB_DEBUG_SPI_PRINTLN_NOTAG();
-     431             : 
-     432             :     // print data bytes
-     433             :     RADIOLIB_DEBUG_SPI_PRINT("SI\t");
-     434             :     for(n = 0; n < cmdLen; n++) {
-     435             :       RADIOLIB_DEBUG_SPI_PRINT_NOTAG("\t");
-     436             :     }
-     437             :     for(; n < buffLen; n++) {
-     438             :       RADIOLIB_DEBUG_SPI_PRINT_NOTAG("%X\t", buffOut[n]);
-     439             :     }
-     440             :     RADIOLIB_DEBUG_SPI_PRINTLN_NOTAG();
-     441             :     RADIOLIB_DEBUG_SPI_PRINT("SO\t");
-     442             :     for(n = 0; n < buffLen; n++) {
-     443             :       RADIOLIB_DEBUG_SPI_PRINT_NOTAG("%X\t", buffIn[n]);
-     444             :     }
-     445             :     RADIOLIB_DEBUG_SPI_PRINTLN_NOTAG();
-     446             :   #endif
-     447             : 
-     448             :   #if !RADIOLIB_STATIC_ONLY
-     449         423 :     delete[] buffOut;
-     450         423 :     delete[] buffIn;
-     451             :   #endif
-     452             : 
-     453         423 :   return(state);
-     454             : }
-     455             : 
-     456           0 : void Module::waitForMicroseconds(RadioLibTime_t start, RadioLibTime_t len) {
-     457             :   #if RADIOLIB_INTERRUPT_TIMING
-     458             :   (void)start;
-     459             :   if((this->TimerSetupCb != nullptr) && (len != this->prevTimingLen)) {
-     460             :     prevTimingLen = len;
-     461             :     this->TimerSetupCb(len);
-     462             :   }
-     463             :   this->TimerFlag = false;
-     464             :   while(!this->TimerFlag) {
-     465             :     this->hal->yield();
-     466             :   }
-     467             :   #else
-     468           0 :    while(this->hal->micros() - start < len) {
-     469           0 :     this->hal->yield();
-     470             :   }
-     471             :   #endif
-     472           0 : }
-     473             : 
-     474             : #if RADIOLIB_DEBUG
-     475             : void Module::regdump(const char* level, uint16_t start, size_t len) {
-     476             :   #if RADIOLIB_STATIC_ONLY
-     477             :     uint8_t buff[RADIOLIB_STATIC_ARRAY_SIZE];
-     478             :   #else
-     479             :     uint8_t* buff = new uint8_t[len];
-     480             :   #endif
-     481             :   SPIreadRegisterBurst(start, len, buff);
-     482             :   rlb_hexdump(level, buff, len, start);
-     483             :   #if !RADIOLIB_STATIC_ONLY
-     484             :     delete[] buff;
-     485             :   #endif
-     486             : }
-     487             : #endif
-     488             : 
-     489           0 : void Module::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) {
-     490             :   // This can be on the stack, setRfSwitchTable copies the contents
-     491           0 :   const uint32_t pins[] = {
-     492             :     rxEn, txEn, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC,
-     493           0 :   };
-     494             :   
-     495             :   // This must be static, since setRfSwitchTable stores a reference.
-     496             :   static const RfSwitchMode_t table[] = {
-     497           0 :     { MODE_IDLE,  {this->hal->GpioLevelLow,  this->hal->GpioLevelLow} },
-     498           0 :     { MODE_RX,    {this->hal->GpioLevelHigh, this->hal->GpioLevelLow} },
-     499           0 :     { MODE_TX,    {this->hal->GpioLevelLow,  this->hal->GpioLevelHigh} },
-     500             :     END_OF_MODE_TABLE,
-     501           0 :   };
-     502           0 :   setRfSwitchTable(pins, table);
-     503           0 : }
-     504             : 
-     505           0 : void Module::setRfSwitchTable(const uint32_t (&pins)[RFSWITCH_MAX_PINS], const RfSwitchMode_t table[]) {
-     506           0 :   memcpy(this->rfSwitchPins, pins, sizeof(this->rfSwitchPins));
-     507           0 :   this->rfSwitchTable = table;
-     508           0 :   for(size_t i = 0; i < RFSWITCH_MAX_PINS; i++) {
-     509           0 :     this->hal->pinMode(pins[i], this->hal->GpioModeOutput);
-     510             :   }
-     511           0 : }
-     512             : 
-     513           0 : const Module::RfSwitchMode_t *Module::findRfSwitchMode(uint8_t mode) const {
-     514           0 :   const RfSwitchMode_t *row = this->rfSwitchTable;
-     515           0 :   while(row && row->mode != MODE_END_OF_TABLE) {
-     516           0 :     if(row->mode == mode) {
-     517           0 :       return row;
-     518             :     }
-     519           0 :     ++row;
-     520             :   }
-     521           0 :   return nullptr;
-     522             : }
-     523             : 
-     524           0 : void Module::setRfSwitchState(uint8_t mode) {
-     525           0 :   const RfSwitchMode_t *row = findRfSwitchMode(mode);
-     526           0 :   if(!row) {
-     527             :     // RF switch control is disabled or does not have this mode
-     528           0 :     return;
-     529             :   }
-     530             : 
-     531             :   // set pins
-     532           0 :   const uint32_t *value = &row->values[0];
-     533           0 :   for(size_t i = 0; i < RFSWITCH_MAX_PINS; i++) {
-     534           0 :     uint32_t pin = this->rfSwitchPins[i];
-     535           0 :     if(!(pin & RFSWITCH_PIN_FLAG)) {
-     536           0 :       this->hal->digitalWrite(pin, *value);
-     537             :     }
-     538           0 :     ++value;
-     539             :   }
-     540             : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/index-sort-f.html b/coverage/src/index-sort-f.html deleted file mode 100644 index 01c8a8f8..00000000 --- a/coverage/src/index-sort-f.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - lcov.info - src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - srcHitTotalCoverage
Test:lcov.infoLines:11223847.1 %
Date:2025-02-11 19:19:31Functions:103033.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Hal.cpp -
36.8%36.8%
-
36.8 %7 / 1914.3 %1 / 7
Module.cpp -
47.9%47.9%
-
47.9 %105 / 21939.1 %9 / 23
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/index-sort-l.html b/coverage/src/index-sort-l.html deleted file mode 100644 index caf7f626..00000000 --- a/coverage/src/index-sort-l.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - lcov.info - src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - srcHitTotalCoverage
Test:lcov.infoLines:11223847.1 %
Date:2025-02-11 19:19:31Functions:103033.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Hal.cpp -
36.8%36.8%
-
36.8 %7 / 1914.3 %1 / 7
Module.cpp -
47.9%47.9%
-
47.9 %105 / 21939.1 %9 / 23
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/src/index.html b/coverage/src/index.html deleted file mode 100644 index d607b86f..00000000 --- a/coverage/src/index.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - lcov.info - src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - srcHitTotalCoverage
Test:lcov.infoLines:11223847.1 %
Date:2025-02-11 19:19:31Functions:103033.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Hal.cpp -
36.8%36.8%
-
36.8 %7 / 1914.3 %1 / 7
Module.cpp -
47.9%47.9%
-
47.9 %105 / 21939.1 %9 / 23
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/coverage/updown.png b/coverage/updown.png deleted file mode 100644 index aa56a238..00000000 Binary files a/coverage/updown.png and /dev/null differ