1 #if !defined(_RADIOLIB_SI443X_H)
2 #define _RADIOLIB_SI443X_H
4 #include "../../TypeDef.h"
6 #if !defined(RADIOLIB_EXCLUDE_SI443X)
8 #include "../../Module.h"
10 #include "../../protocols/PhysicalLayer/PhysicalLayer.h"
13 #define RADIOLIB_SI443X_FREQUENCY_STEP_SIZE 156.25
14 #define RADIOLIB_SI443X_MAX_PACKET_LENGTH 64
17 #define RADIOLIB_SI443X_REG_DEVICE_TYPE 0x00
18 #define RADIOLIB_SI443X_REG_DEVICE_VERSION 0x01
19 #define RADIOLIB_SI443X_REG_DEVICE_STATUS 0x02
20 #define RADIOLIB_SI443X_REG_INTERRUPT_STATUS_1 0x03
21 #define RADIOLIB_SI443X_REG_INTERRUPT_STATUS_2 0x04
22 #define RADIOLIB_SI443X_REG_INTERRUPT_ENABLE_1 0x05
23 #define RADIOLIB_SI443X_REG_INTERRUPT_ENABLE_2 0x06
24 #define RADIOLIB_SI443X_REG_OP_FUNC_CONTROL_1 0x07
25 #define RADIOLIB_SI443X_REG_OP_FUNC_CONTROL_2 0x08
26 #define RADIOLIB_SI443X_REG_XOSC_LOAD_CAPACITANCE 0x09
27 #define RADIOLIB_SI443X_REG_MCU_OUTPUT_CLOCK 0x0A
28 #define RADIOLIB_SI443X_REG_GPIO0_CONFIG 0x0B
29 #define RADIOLIB_SI443X_REG_GPIO1_CONFIG 0x0C
30 #define RADIOLIB_SI443X_REG_GPIO2_CONFIG 0x0D
31 #define RADIOLIB_SI443X_REG_IO_PORT_CONFIG 0x0E
32 #define RADIOLIB_SI443X_REG_ADC_CONFIG 0x0F
33 #define RADIOLIB_SI443X_REG_ADC_SENSOR_AMP_OFFSET 0x10
34 #define RADIOLIB_SI443X_REG_ADC_VALUE 0x11
35 #define RADIOLIB_SI443X_REG_TEMP_SENSOR_CONTROL 0x12
36 #define RADIOLIB_SI443X_REG_TEMP_VALUE_OFFSET 0x13
37 #define RADIOLIB_SI443X_REG_WAKEUP_TIMER_PERIOD_1 0x14
38 #define RADIOLIB_SI443X_REG_WAKEUP_TIMER_PERIOD_2 0x15
39 #define RADIOLIB_SI443X_REG_WAKEUP_TIMER_PERIOD_3 0x16
40 #define RADIOLIB_SI443X_REG_WAKEUP_TIMER_VALUE_1 0x17
41 #define RADIOLIB_SI443X_REG_WAKEUP_TIMER_VALUE_2 0x18
42 #define RADIOLIB_SI443X_REG_LOW_DC_MODE_DURATION 0x19
43 #define RADIOLIB_SI443X_REG_LOW_BATT_DET_THRESHOLD 0x1A
44 #define RADIOLIB_SI443X_REG_BATT_VOLTAGE_LEVEL 0x1B
45 #define RADIOLIB_SI443X_REG_IF_FILTER_BANDWIDTH 0x1C
46 #define RADIOLIB_SI443X_REG_AFC_LOOP_GEARSHIFT_OVERRIDE 0x1D
47 #define RADIOLIB_SI443X_REG_AFC_TIMING_CONTROL 0x1E
48 #define RADIOLIB_SI443X_REG_CLOCK_REC_GEARSHIFT_OVERRIDE 0x1F
49 #define RADIOLIB_SI443X_REG_CLOCK_REC_OVERSAMP_RATIO 0x20
50 #define RADIOLIB_SI443X_REG_CLOCK_REC_OFFSET_2 0x21
51 #define RADIOLIB_SI443X_REG_CLOCK_REC_OFFSET_1 0x22
52 #define RADIOLIB_SI443X_REG_CLOCK_REC_OFFSET_0 0x23
53 #define RADIOLIB_SI443X_REG_CLOCK_REC_TIMING_LOOP_GAIN_1 0x24
54 #define RADIOLIB_SI443X_REG_CLOCK_REC_TIMING_LOOP_GAIN_0 0x25
55 #define RADIOLIB_SI443X_REG_RSSI 0x26
56 #define RADIOLIB_SI443X_REG_RSSI_CLEAR_CHANNEL_THRESHOLD 0x27
57 #define RADIOLIB_SI443X_REG_ANTENNA_DIVERSITY_1 0x28
58 #define RADIOLIB_SI443X_REG_ANTENNA_DIVERSITY_2 0x29
59 #define RADIOLIB_SI443X_REG_AFC_LIMITER 0x2A
60 #define RADIOLIB_SI443X_REG_AFC_CORRECTION 0x2B
61 #define RADIOLIB_SI443X_REG_OOK_COUNTER_1 0x2C
62 #define RADIOLIB_SI443X_REG_OOK_COUNTER_2 0x2D
63 #define RADIOLIB_SI443X_REG_SLICER_PEAK_HOLD 0x2E
64 #define RADIOLIB_SI443X_REG_DATA_ACCESS_CONTROL 0x30
65 #define RADIOLIB_SI443X_REG_EZMAC_STATUS 0x31
66 #define RADIOLIB_SI443X_REG_HEADER_CONTROL_1 0x32
67 #define RADIOLIB_SI443X_REG_HEADER_CONTROL_2 0x33
68 #define RADIOLIB_SI443X_REG_PREAMBLE_LENGTH 0x34
69 #define RADIOLIB_SI443X_REG_PREAMBLE_DET_CONTROL 0x35
70 #define RADIOLIB_SI443X_REG_SYNC_WORD_3 0x36
71 #define RADIOLIB_SI443X_REG_SYNC_WORD_2 0x37
72 #define RADIOLIB_SI443X_REG_SYNC_WORD_1 0x38
73 #define RADIOLIB_SI443X_REG_SYNC_WORD_0 0x39
74 #define RADIOLIB_SI443X_REG_TRANSMIT_HEADER_3 0x3A
75 #define RADIOLIB_SI443X_REG_TRANSMIT_HEADER_2 0x3B
76 #define RADIOLIB_SI443X_REG_TRANSMIT_HEADER_1 0x3C
77 #define RADIOLIB_SI443X_REG_TRANSMIT_HEADER_0 0x3D
78 #define RADIOLIB_SI443X_REG_TRANSMIT_PACKET_LENGTH 0x3E
79 #define RADIOLIB_SI443X_REG_CHECK_HEADER_3 0x3F
80 #define RADIOLIB_SI443X_REG_CHECK_HEADER_2 0x40
81 #define RADIOLIB_SI443X_REG_CHECK_HEADER_1 0x41
82 #define RADIOLIB_SI443X_REG_CHECK_HEADER_0 0x42
83 #define RADIOLIB_SI443X_REG_HEADER_ENABLE_3 0x43
84 #define RADIOLIB_SI443X_REG_HEADER_ENABLE_2 0x44
85 #define RADIOLIB_SI443X_REG_HEADER_ENABLE_1 0x45
86 #define RADIOLIB_SI443X_REG_HEADER_ENABLE_0 0x46
87 #define RADIOLIB_SI443X_REG_RECEIVED_HEADER_3 0x47
88 #define RADIOLIB_SI443X_REG_RECEIVED_HEADER_2 0x48
89 #define RADIOLIB_SI443X_REG_RECEIVED_HEADER_1 0x49
90 #define RADIOLIB_SI443X_REG_RECEIVED_HEADER_0 0x4A
91 #define RADIOLIB_SI443X_REG_RECEIVED_PACKET_LENGTH 0x4B
92 #define RADIOLIB_SI443X_REG_ADC8_CONTROL 0x4F
93 #define RADIOLIB_SI443X_REG_CHANNEL_FILTER_COEFF 0x60
94 #define RADIOLIB_SI443X_REG_XOSC_CONTROL_TEST 0x62
95 #define RADIOLIB_SI443X_REG_AGC_OVERRIDE_1 0x69
96 #define RADIOLIB_SI443X_REG_TX_POWER 0x6D
97 #define RADIOLIB_SI443X_REG_TX_DATA_RATE_1 0x6E
98 #define RADIOLIB_SI443X_REG_TX_DATA_RATE_0 0x6F
99 #define RADIOLIB_SI443X_REG_MODULATION_MODE_CONTROL_1 0x70
100 #define RADIOLIB_SI443X_REG_MODULATION_MODE_CONTROL_2 0x71
101 #define RADIOLIB_SI443X_REG_FREQUENCY_DEVIATION 0x72
102 #define RADIOLIB_SI443X_REG_FREQUENCY_OFFSET_1 0x73
103 #define RADIOLIB_SI443X_REG_FREQUENCY_OFFSET_2 0x74
104 #define RADIOLIB_SI443X_REG_FREQUENCY_BAND_SELECT 0x75
105 #define RADIOLIB_SI443X_REG_NOM_CARRIER_FREQUENCY_1 0x76
106 #define RADIOLIB_SI443X_REG_NOM_CARRIER_FREQUENCY_0 0x77
107 #define RADIOLIB_SI443X_REG_FREQUENCY_HOPPING_CHANNEL_SEL 0x79
108 #define RADIOLIB_SI443X_REG_FREQUENCY_HOPPING_STEP_SIZE 0x7A
109 #define RADIOLIB_SI443X_REG_TX_FIFO_CONTROL_1 0x7C
110 #define RADIOLIB_SI443X_REG_TX_FIFO_CONTROL_2 0x7D
111 #define RADIOLIB_SI443X_REG_RX_FIFO_CONTROL 0x7E
112 #define RADIOLIB_SI443X_REG_FIFO_ACCESS 0x7F
115 #define RADIOLIB_SI443X_DEVICE_TYPE 0x08
118 #define RADIOLIB_SI443X_DEVICE_VERSION 0x06
121 #define RADIOLIB_SI443X_RX_TX_FIFO_OVERFLOW 0b10000000
122 #define RADIOLIB_SI443X_RX_TX_FIFO_UNDERFLOW 0b01000000
123 #define RADIOLIB_SI443X_RX_FIFO_EMPTY 0b00100000
124 #define RADIOLIB_SI443X_HEADER_ERROR 0b00010000
125 #define RADIOLIB_SI443X_FREQUENCY_ERROR 0b00001000
126 #define RADIOLIB_SI443X_TX 0b00000010
127 #define RADIOLIB_SI443X_RX 0b00000001
128 #define RADIOLIB_SI443X_IDLE 0b00000000
131 #define RADIOLIB_SI443X_FIFO_LEVEL_ERROR_INTERRUPT 0b10000000
132 #define RADIOLIB_SI443X_TX_FIFO_ALMOST_FULL_INTERRUPT 0b01000000
133 #define RADIOLIB_SI443X_TX_FIFO_ALMOST_EMPTY_INTERRUPT 0b00100000
134 #define RADIOLIB_SI443X_RX_FIFO_ALMOST_FULL_INTERRUPT 0b00010000
135 #define RADIOLIB_SI443X_EXTERNAL_INTERRUPT 0b00001000
136 #define RADIOLIB_SI443X_PACKET_SENT_INTERRUPT 0b00000100
137 #define RADIOLIB_SI443X_VALID_PACKET_RECEIVED_INTERRUPT 0b00000010
138 #define RADIOLIB_SI443X_CRC_ERROR_INTERRUPT 0b00000001
141 #define RADIOLIB_SI443X_SYNC_WORD_DETECTED_INTERRUPT 0b10000000
142 #define RADIOLIB_SI443X_VALID_RADIOLIB_PREAMBLE_DETECTED_INTERRUPT 0b01000000
143 #define RADIOLIB_SI443X_INVALID_RADIOLIB_PREAMBLE_DETECTED_INTERRUPT 0b00100000
144 #define RADIOLIB_SI443X_RSSI_INTERRUPT 0b00010000
145 #define RADIOLIB_SI443X_WAKEUP_TIMER_INTERRUPT 0b00001000
146 #define RADIOLIB_SI443X_LOW_BATTERY_INTERRUPT 0b00000100
147 #define RADIOLIB_SI443X_CHIP_READY_INTERRUPT 0b00000010
148 #define RADIOLIB_SI443X_POWER_ON_RESET_INTERRUPT 0b00000001
151 #define RADIOLIB_SI443X_FIFO_LEVEL_ERROR_ENABLED 0b10000000
152 #define RADIOLIB_SI443X_TX_FIFO_ALMOST_FULL_ENABLED 0b01000000
153 #define RADIOLIB_SI443X_TX_FIFO_ALMOST_EMPTY_ENABLED 0b00100000
154 #define RADIOLIB_SI443X_RX_FIFO_ALMOST_FULL_ENABLED 0b00010000
155 #define RADIOLIB_SI443X_EXTERNAL_ENABLED 0b00001000
156 #define RADIOLIB_SI443X_PACKET_SENT_ENABLED 0b00000100
157 #define RADIOLIB_SI443X_VALID_PACKET_RECEIVED_ENABLED 0b00000010
158 #define RADIOLIB_SI443X_CRC_ERROR_ENABLED 0b00000001
161 #define RADIOLIB_SI443X_SYNC_WORD_DETECTED_ENABLED 0b10000000
162 #define RADIOLIB_SI443X_VALID_RADIOLIB_PREAMBLE_DETECTED_ENABLED 0b01000000
163 #define RADIOLIB_SI443X_INVALID_RADIOLIB_PREAMBLE_DETECTED_ENABLED 0b00100000
164 #define RADIOLIB_SI443X_RSSI_ENABLED 0b00010000
165 #define RADIOLIB_SI443X_WAKEUP_TIMER_ENABLED 0b00001000
166 #define RADIOLIB_SI443X_LOW_BATTERY_ENABLED 0b00000100
167 #define RADIOLIB_SI443X_CHIP_READY_ENABLED 0b00000010
168 #define RADIOLIB_SI443X_POWER_ON_RESET_ENABLED 0b00000001
171 #define RADIOLIB_SI443X_SOFTWARE_RESET 0b10000000
172 #define RADIOLIB_SI443X_ENABLE_LOW_BATTERY_DETECT 0b01000000
173 #define RADIOLIB_SI443X_ENABLE_WAKEUP_TIMER 0b00100000
174 #define RADIOLIB_SI443X_32_KHZ_RC 0b00000000
175 #define RADIOLIB_SI443X_32_KHZ_XOSC 0b00010000
176 #define RADIOLIB_SI443X_TX_ON 0b00001000
177 #define RADIOLIB_SI443X_RX_ON 0b00000100
178 #define RADIOLIB_SI443X_PLL_ON 0b00000010
179 #define RADIOLIB_SI443X_XTAL_OFF 0b00000000
180 #define RADIOLIB_SI443X_XTAL_ON 0b00000001
183 #define RADIOLIB_SI443X_ANT_DIV_TR_HL_IDLE_L 0b00000000
184 #define RADIOLIB_SI443X_ANT_DIV_TR_LH_IDLE_L 0b00100000
185 #define RADIOLIB_SI443X_ANT_DIV_TR_HL_IDLE_H 0b01000000
186 #define RADIOLIB_SI443X_ANT_DIV_TR_LH_IDLE_H 0b01100000
187 #define RADIOLIB_SI443X_ANT_DIV_TR_ALG_IDLE_L 0b10000000
188 #define RADIOLIB_SI443X_ANT_DIV_TR_ALG_IDLE_H 0b10100000
189 #define RADIOLIB_SI443X_ANT_DIV_TR_ALG_BEACON_IDLE_L 0b11000000
190 #define RADIOLIB_SI443X_ANT_DIV_TR_ALG_BEACON_IDLE_H 0b11100000
191 #define RADIOLIB_SI443X_RX_MULTIPACKET_OFF 0b00000000
192 #define RADIOLIB_SI443X_RX_MULTIPACKET_ON 0b00010000
193 #define RADIOLIB_SI443X_AUTO_TX_OFF 0b00000000
194 #define RADIOLIB_SI443X_AUTO_TX_ON 0b00001000
195 #define RADIOLIB_SI443X_LOW_DUTY_CYCLE_OFF 0b00000000
196 #define RADIOLIB_SI443X_LOW_DUTY_CYCLE_ON 0b00000100
197 #define RADIOLIB_SI443X_RX_FIFO_RESET 0b00000010
198 #define RADIOLIB_SI443X_RX_FIFO_CLEAR 0b00000000
199 #define RADIOLIB_SI443X_TX_FIFO_RESET 0b00000001
200 #define RADIOLIB_SI443X_TX_FIFO_CLEAR 0b00000000
203 #define RADIOLIB_SI443X_XTAL_SHIFT 0b00000000
204 #define RADIOLIB_SI443X_XTAL_LOAD_CAPACITANCE 0b01111111
207 #define RADIOLIB_SI443X_CLOCK_TAIL_CYCLES_OFF 0b00000000
208 #define RADIOLIB_SI443X_CLOCK_TAIL_CYCLES_128 0b00010000
209 #define RADIOLIB_SI443X_CLOCK_TAIL_CYCLES_256 0b00100000
210 #define RADIOLIB_SI443X_CLOCK_TAIL_CYCLES_512 0b00110000
211 #define RADIOLIB_SI443X_LOW_FREQ_CLOCK_OFF 0b00000000
212 #define RADIOLIB_SI443X_LOW_FREQ_CLOCK_ON 0b00001000
213 #define RADIOLIB_SI443X_MCU_CLOCK_30_MHZ 0b00000000
214 #define RADIOLIB_SI443X_MCU_CLOCK_15_MHZ 0b00000001
215 #define RADIOLIB_SI443X_MCU_CLOCK_10_MHZ 0b00000010
216 #define RADIOLIB_SI443X_MCU_CLOCK_4_MHZ 0b00000011
217 #define RADIOLIB_SI443X_MCU_CLOCK_3_MHZ 0b00000100
218 #define RADIOLIB_SI443X_MCU_CLOCK_2_MHZ 0b00000101
219 #define RADIOLIB_SI443X_MCU_CLOCK_1_MHZ 0b00000110
220 #define RADIOLIB_SI443X_MCU_CLOCK_32_KHZ 0b00000111
223 #define RADIOLIB_SI443X_GPIOX_DRIVE_STRENGTH 0b00000000
224 #define RADIOLIB_SI443X_GPIOX_PULLUP_OFF 0b00000000
225 #define RADIOLIB_SI443X_GPIOX_PULLUP_ON 0b00100000
226 #define RADIOLIB_SI443X_GPIO0_POWER_ON_RESET_OUT 0b00000000
227 #define RADIOLIB_SI443X_GPIO1_POWER_ON_RESET_INV_OUT 0b00000000
228 #define RADIOLIB_SI443X_GPIO2_MCU_CLOCK_OUT 0b00000000
229 #define RADIOLIB_SI443X_GPIOX_WAKEUP_OUT 0b00000001
230 #define RADIOLIB_SI443X_GPIOX_LOW_BATTERY_OUT 0b00000010
231 #define RADIOLIB_SI443X_GPIOX_DIGITAL_OUT 0b00000011
232 #define RADIOLIB_SI443X_GPIOX_EXT_INT_FALLING_IN 0b00000100
233 #define RADIOLIB_SI443X_GPIOX_EXT_INT_RISING_IN 0b00000101
234 #define RADIOLIB_SI443X_GPIOX_EXT_INT_CHANGE_IN 0b00000110
235 #define RADIOLIB_SI443X_GPIOX_ADC_IN 0b00000111
236 #define RADIOLIB_SI443X_GPIOX_ANALOG_TEST_N_IN 0b00001000
237 #define RADIOLIB_SI443X_GPIOX_ANALOG_TEST_P_IN 0b00001001
238 #define RADIOLIB_SI443X_GPIOX_DIGITAL_IN 0b00001010
239 #define RADIOLIB_SI443X_GPIOX_DIGITAL_TEST_OUT 0b00001011
240 #define RADIOLIB_SI443X_GPIOX_ANALOG_TEST_N_OUT 0b00001100
241 #define RADIOLIB_SI443X_GPIOX_ANALOG_TEST_P_OUT 0b00001101
242 #define RADIOLIB_SI443X_GPIOX_REFERENCE_VOLTAGE_OUT 0b00001110
243 #define RADIOLIB_SI443X_GPIOX_TX_RX_DATA_CLK_OUT 0b00001111
244 #define RADIOLIB_SI443X_GPIOX_TX_DATA_IN 0b00010000
245 #define RADIOLIB_SI443X_GPIOX_EXT_RETRANSMIT_REQUEST_IN 0b00010001
246 #define RADIOLIB_SI443X_GPIOX_TX_STATE_OUT 0b00010010
247 #define RADIOLIB_SI443X_GPIOX_TX_FIFO_ALMOST_FULL_OUT 0b00010011
248 #define RADIOLIB_SI443X_GPIOX_RX_DATA_OUT 0b00010100
249 #define RADIOLIB_SI443X_GPIOX_RX_STATE_OUT 0b00010101
250 #define RADIOLIB_SI443X_GPIOX_RX_FIFO_ALMOST_FULL_OUT 0b00010110
251 #define RADIOLIB_SI443X_GPIOX_ANT_DIV_1_OUT 0b00010111
252 #define RADIOLIB_SI443X_GPIOX_ANT_DIV_2_OUT 0b00011000
253 #define RADIOLIB_SI443X_GPIOX_VALID_PREAMBLE_OUT 0b00011001
254 #define RADIOLIB_SI443X_GPIOX_INVALID_PREAMBLE_OUT 0b00011010
255 #define RADIOLIB_SI443X_GPIOX_SYNC_WORD_DETECTED_OUT 0b00011011
256 #define RADIOLIB_SI443X_GPIOX_CLEAR_CHANNEL_OUT 0b00011100
257 #define RADIOLIB_SI443X_GPIOX_VDD 0b00011101
258 #define RADIOLIB_SI443X_GPIOX_GND 0b00011110
261 #define RADIOLIB_SI443X_GPIO2_EXT_INT_STATE_MASK 0b01000000
262 #define RADIOLIB_SI443X_GPIO1_EXT_INT_STATE_MASK 0b00100000
263 #define RADIOLIB_SI443X_GPIO0_EXT_INT_STATE_MASK 0b00010000
264 #define RADIOLIB_SI443X_IRQ_BY_SDO_OFF 0b00000000
265 #define RADIOLIB_SI443X_IRQ_BY_SDO_ON 0b00001000
266 #define RADIOLIB_SI443X_GPIO2_DIGITAL_STATE_MASK 0b00000100
267 #define RADIOLIB_SI443X_GPIO1_DIGITAL_STATE_MASK 0b00000010
268 #define RADIOLIB_SI443X_GPIO0_DIGITAL_STATE_MASK 0b00000001
271 #define RADIOLIB_SI443X_ADC_START 0b10000000
272 #define RADIOLIB_SI443X_ADC_RUNNING 0b00000000
273 #define RADIOLIB_SI443X_ADC_DONE 0b10000000
274 #define RADIOLIB_SI443X_ADC_SOURCE_TEMPERATURE 0b00000000
275 #define RADIOLIB_SI443X_ADC_SOURCE_GPIO0_SINGLE 0b00010000
276 #define RADIOLIB_SI443X_ADC_SOURCE_GPIO1_SINGLE 0b00100000
277 #define RADIOLIB_SI443X_ADC_SOURCE_GPIO2_SINGLE 0b00110000
278 #define RADIOLIB_SI443X_ADC_SOURCE_GPIO01_DIFF 0b01000000
279 #define RADIOLIB_SI443X_ADC_SOURCE_GPIO12_DIFF 0b01010000
280 #define RADIOLIB_SI443X_ADC_SOURCE_GPIO02_DIFF 0b01100000
281 #define RADIOLIB_SI443X_ADC_SOURCE_GND 0b01110000
282 #define RADIOLIB_SI443X_ADC_REFERNCE_BAND_GAP 0b00000000
283 #define RADIOLIB_SI443X_ADC_REFERNCE_VDD_3 0b00001000
284 #define RADIOLIB_SI443X_ADC_REFERNCE_VDD_2 0b00001100
285 #define RADIOLIB_SI443X_ADC_GAIN 0b00000000
288 #define RADIOLIB_SI443X_ADC_OFFSET 0b00000000
291 #define RADIOLIB_SI443X_TEMP_SENSOR_RANGE_64_TO_64_C 0b00000000
292 #define RADIOLIB_SI443X_TEMP_SENSOR_RANGE_64_TO_192_C 0b01000000
293 #define RADIOLIB_SI443X_TEMP_SENSOR_RANGE_0_TO_128_C 0b11000000
294 #define RADIOLIB_SI443X_TEMP_SENSOR_RANGE_40_TO_216_F 0b10000000
295 #define RADIOLIB_SI443X_TEMP_SENSOR_KELVIN_TO_CELSIUS_OFF 0b00000000
296 #define RADIOLIB_SI443X_TEMP_SENSOR_KELVIN_TO_CELSIUS_ON 0b00100000
297 #define RADIOLIB_SI443X_TEMP_SENSOR_TRIM_OFF 0b00000000
298 #define RADIOLIB_SI443X_TEMP_SENSOR_TRIM_ON 0b00010000
299 #define RADIOLIB_SI443X_TEMP_SENSOR_TRIM_VALUE 0b00000000
302 #define RADIOLIB_SI443X_WAKEUP_TIMER_EXPONENT 0b00000011
305 #define RADIOLIB_SI443X_WAKEUP_TIMER_MANTISSA_MSB 0x00
306 #define RADIOLIB_SI443X_WAKEUP_TIMER_MANTISSA_LSB 0x01
309 #define RADIOLIB_SI443X_LOW_DC_MODE_DURATION_MANTISSA 0x01
312 #define RADIOLIB_SI443X_LOW_BATT_DET_THRESHOLD 0b00010100
315 #define RADIOLIB_SI443X_BYPASS_DEC_BY_3_OFF 0b00000000
316 #define RADIOLIB_SI443X_BYPASS_DEC_BY_3_ON 0b10000000
317 #define RADIOLIB_SI443X_IF_FILTER_DEC_RATE 0b00000000
318 #define RADIOLIB_SI443X_IF_FILTER_COEFF_SET 0b00000001
321 #define RADIOLIB_SI443X_AFC_WIDEBAND_OFF 0b00000000
322 #define RADIOLIB_SI443X_AFC_WIDEBAND_ON 0b10000000
323 #define RADIOLIB_SI443X_AFC_OFF 0b00000000
324 #define RADIOLIB_SI443X_AFC_ON 0b01000000
325 #define RADIOLIB_SI443X_AFC_HIGH_GEAR_SETTING 0b00000000
326 #define RADIOLIB_SI443X_SECOND_PHASE_BIAS_0_DB 0b00000100
327 #define RADIOLIB_SI443X_SECOND_PHASE_BIAS_1_5_DB 0b00000000
328 #define RADIOLIB_SI443X_MOVING_AVERAGE_TAP_8 0b00000010
329 #define RADIOLIB_SI443X_MOVING_AVERAGE_TAP_4 0b00000000
330 #define RADIOLIB_SI443X_ZERO_PHASE_RESET_5 0b00000000
331 #define RADIOLIB_SI443X_ZERO_PHASE_RESET_2 0b00000001
334 #define RADIOLIB_SI443X_SW_ANT_TIMER 0b00000000
335 #define RADIOLIB_SI443X_SHORT_WAIT 0b00001000
336 #define RADIOLIB_SI443X_ANTENNA_SWITCH_WAIT 0b00000010
339 #define RADIOLIB_SI443X_CLOCK_RECOVER_FAST_GEARSHIFT 0b00000000
340 #define RADIOLIB_SI443X_CLOCK_RECOVER_SLOW_GEARSHIFT 0b00000011
343 #define RADIOLIB_SI443X_CLOCK_REC_OVERSAMP_RATIO_LSB 0b01100100
346 #define RADIOLIB_SI443X_CLOCK_REC_OVERSAMP_RATIO_MSB 0b00000000
347 #define RADIOLIB_SI443X_SECOND_PHASE_SKIP_THRESHOLD 0b00000000
348 #define RADIOLIB_SI443X_NCO_OFFSET_MSB 0b00000001
351 #define RADIOLIB_SI443X_NCO_OFFSET_MID 0b01000111
354 #define RADIOLIB_SI443X_NCO_OFFSET_LSB 0b10101110
357 #define RADIOLIB_SI443X_RX_COMPENSATION_OFF 0b00000000
358 #define RADIOLIB_SI443X_RX_COMPENSATION_ON 0b00010000
359 #define RADIOLIB_SI443X_CLOCK_REC_GAIN_DOUBLE_OFF 0b00000000
360 #define RADIOLIB_SI443X_CLOCK_REC_GAIN_DOUBLE_ON 0b00001000
361 #define RADIOLIB_SI443X_CLOCK_REC_LOOP_GAIN_MSB 0b00000010
364 #define RADIOLIB_SI443X_CLOCK_REC_LOOP_GAIN_LSB 0b10001111
367 #define RADIOLIB_SI443X_RSSI_CLEAR_CHANNEL_THRESHOLD 0b00011110
370 #define RADIOLIB_SI443X_AFC_LIMITER 0x00
373 #define RADIOLIB_SI443X_OOK_FREEZE_OFF 0b00000000
374 #define RADIOLIB_SI443X_OOK_FREEZE_ON 0b00100000
375 #define RADIOLIB_SI443X_PEAK_DETECTOR_OFF 0b00000000
376 #define RADIOLIB_SI443X_PEAK_DETECTOR_ON 0b00010000
377 #define RADIOLIB_SI443X_OOK_MOVING_AVERAGE_OFF 0b00000000
378 #define RADIOLIB_SI443X_OOK_MOVING_AVERAGE_ON 0b00001000
379 #define RADIOLIB_SI443X_OOK_COUNTER_MSB 0b00000000
382 #define RADIOLIB_SI443X_OOK_COUNTER_LSB 0b10111100
385 #define RADIOLIB_SI443X_PEAK_DETECTOR_ATTACK 0b00010000
386 #define RADIOLIB_SI443X_PEAK_DETECTOR_DECAY 0b00001100
389 #define RADIOLIB_SI443X_PACKET_RX_HANDLING_OFF 0b00000000
390 #define RADIOLIB_SI443X_PACKET_RX_HANDLING_ON 0b10000000
391 #define RADIOLIB_SI443X_LSB_FIRST_OFF 0b00000000
392 #define RADIOLIB_SI443X_LSB_FIRST_ON 0b01000000
393 #define RADIOLIB_SI443X_CRC_DATA_ONLY_OFF 0b00000000
394 #define RADIOLIB_SI443X_CRC_DATA_ONLY_ON 0b00100000
395 #define RADIOLIB_SI443X_SKIP_SECOND_PHASE_PREAMBLE_DET_OFF 0b00000000
396 #define RADIOLIB_SI443X_SKIP_SECOND_PHASE_PREAMBLE_DET_ON 0b00010000
397 #define RADIOLIB_SI443X_PACKET_TX_HANDLING_OFF 0b00000000
398 #define RADIOLIB_SI443X_PACKET_TX_HANDLING_ON 0b00001000
399 #define RADIOLIB_SI443X_CRC_OFF 0b00000000
400 #define RADIOLIB_SI443X_CRC_ON 0b00000100
401 #define RADIOLIB_SI443X_CRC_CCITT 0b00000000
402 #define RADIOLIB_SI443X_CRC_IBM_CRC16 0b00000001
403 #define RADIOLIB_SI443X_CRC_IEC16 0b00000010
404 #define RADIOLIB_SI443X_CRC_BIACHEVA 0b00000011
407 #define RADIOLIB_SI443X_CRC_ALL_ONE 0b01000000
408 #define RADIOLIB_SI443X_PACKET_SEARCHING 0b00100000
409 #define RADIOLIB_SI443X_PACKET_RECEIVING 0b00010000
410 #define RADIOLIB_SI443X_VALID_PACKET_RECEIVED 0b00001000
411 #define RADIOLIB_SI443X_CRC_ERROR 0b00000100
412 #define RADIOLIB_SI443X_PACKET_TRANSMITTING 0b00000010
413 #define RADIOLIB_SI443X_PACKET_SENT 0b00000001
416 #define RADIOLIB_SI443X_BROADCAST_ADDR_CHECK_NONE 0b00000000
417 #define RADIOLIB_SI443X_BROADCAST_ADDR_CHECK_BYTE0 0b00010000
418 #define RADIOLIB_SI443X_BROADCAST_ADDR_CHECK_BYTE1 0b00100000
419 #define RADIOLIB_SI443X_BROADCAST_ADDR_CHECK_BYTE2 0b01000000
420 #define RADIOLIB_SI443X_BROADCAST_ADDR_CHECK_BYTE3 0b10000000
421 #define RADIOLIB_SI443X_RECEIVED_HEADER_CHECK_NONE 0b00000000
422 #define RADIOLIB_SI443X_RECEIVED_HEADER_CHECK_BYTE0 0b00000001
423 #define RADIOLIB_SI443X_RECEIVED_HEADER_CHECK_BYTE1 0b00000010
424 #define RADIOLIB_SI443X_RECEIVED_HEADER_CHECK_BYTE2 0b00000100
425 #define RADIOLIB_SI443X_RECEIVED_HEADER_CHECK_BYTE3 0b00001000
428 #define RADIOLIB_SI443X_SYNC_WORD_TIMEOUT_OFF 0b00000000
429 #define RADIOLIB_SI443X_SYNC_WORD_TIMEOUT_ON 0b10000000
430 #define RADIOLIB_SI443X_HEADER_LENGTH_HEADER_NONE 0b00000000
431 #define RADIOLIB_SI443X_HEADER_LENGTH_HEADER_3 0b00010000
432 #define RADIOLIB_SI443X_HEADER_LENGTH_HEADER_32 0b00100000
433 #define RADIOLIB_SI443X_HEADER_LENGTH_HEADER_321 0b00110000
434 #define RADIOLIB_SI443X_HEADER_LENGTH_HEADER_3210 0b01000000
435 #define RADIOLIB_SI443X_FIXED_PACKET_LENGTH_OFF 0b00000000
436 #define RADIOLIB_SI443X_FIXED_PACKET_LENGTH_ON 0b00001000
437 #define RADIOLIB_SI443X_SYNC_LENGTH_SYNC_3 0b00000000
438 #define RADIOLIB_SI443X_SYNC_LENGTH_SYNC_32 0b00000010
439 #define RADIOLIB_SI443X_SYNC_LENGTH_SYNC_321 0b00000100
440 #define RADIOLIB_SI443X_SYNC_LENGTH_SYNC_3210 0b00000110
441 #define RADIOLIB_SI443X_PREAMBLE_LENGTH_MSB 0b00000000
444 #define RADIOLIB_SI443X_PREAMBLE_LENGTH_LSB 0b00001000
447 #define RADIOLIB_SI443X_PREAMBLE_DET_THRESHOLD 0b00101000
448 #define RADIOLIB_SI443X_RSSI_OFFSET 0b00000010
451 #define RADIOLIB_SI443X_SYNC_WORD_3 0x2D
452 #define RADIOLIB_SI443X_SYNC_WORD_2 0xD4
453 #define RADIOLIB_SI443X_SYNC_WORD_1 0x00
454 #define RADIOLIB_SI443X_SYNC_WORD_0 0x00
457 #define RADIOLIB_SI443X_INVALID_PREAMBLE_THRESHOLD 0b00000000
460 #define RADIOLIB_SI443X_STATE_LOW_POWER 0b00000000
461 #define RADIOLIB_SI443X_STATE_READY 0b00100000
462 #define RADIOLIB_SI443X_STATE_TUNE 0b01100000
463 #define RADIOLIB_SI443X_STATE_TX 0b01000000
464 #define RADIOLIB_SI443X_STATE_RX 0b11100000
467 #define RADIOLIB_SI443X_AGC_GAIN_INCREASE_OFF 0b00000000
468 #define RADIOLIB_SI443X_AGC_GAIN_INCREASE_ON 0b01000000
469 #define RADIOLIB_SI443X_AGC_OFF 0b00000000
470 #define RADIOLIB_SI443X_AGC_ON 0b00100000
471 #define RADIOLIB_SI443X_LNA_GAIN_MIN 0b00000000
472 #define RADIOLIB_SI443X_LNA_GAIN_MAX 0b00010000
473 #define RADIOLIB_SI443X_PGA_GAIN_OVERRIDE 0b00000000
476 #define RADIOLIB_SI443X_LNA_SWITCH_OFF 0b00000000
477 #define RADIOLIB_SI443X_LNA_SWITCH_ON 0b00001000
478 #define RADIOLIB_SI443X_OUTPUT_POWER 0b00000000
481 #define RADIOLIB_SI443X_DATA_RATE_MSB 0x0A
482 #define RADIOLIB_SI443X_DATA_RATE_LSB 0x3D
485 #define RADIOLIB_SI443X_HIGH_DATA_RATE_MODE 0b00000000
486 #define RADIOLIB_SI443X_LOW_DATA_RATE_MODE 0b00100000
487 #define RADIOLIB_SI443X_PACKET_HANDLER_POWER_DOWN_OFF 0b00000000
488 #define RADIOLIB_SI443X_PACKET_HANDLER_POWER_DOWN_ON 0b00010000
489 #define RADIOLIB_SI443X_MANCHESTER_PREAMBLE_POL_LOW 0b00000000
490 #define RADIOLIB_SI443X_MANCHESTER_PREAMBLE_POL_HIGH 0b00001000
491 #define RADIOLIB_SI443X_MANCHESTER_INVERTED_OFF 0b00000000
492 #define RADIOLIB_SI443X_MANCHESTER_INVERTED_ON 0b00000100
493 #define RADIOLIB_SI443X_MANCHESTER_OFF 0b00000000
494 #define RADIOLIB_SI443X_MANCHESTER_ON 0b00000010
495 #define RADIOLIB_SI443X_WHITENING_OFF 0b00000000
496 #define RADIOLIB_SI443X_WHITENING_ON 0b00000001
499 #define RADIOLIB_SI443X_TX_DATA_CLOCK_NONE 0b00000000
500 #define RADIOLIB_SI443X_TX_DATA_CLOCK_GPIO 0b01000000
501 #define RADIOLIB_SI443X_TX_DATA_CLOCK_SDI 0b10000000
502 #define RADIOLIB_SI443X_TX_DATA_CLOCK_NIRQ 0b11000000
503 #define RADIOLIB_SI443X_TX_DATA_SOURCE_GPIO 0b00000000
504 #define RADIOLIB_SI443X_TX_DATA_SOURCE_SDI 0b00010000
505 #define RADIOLIB_SI443X_TX_DATA_SOURCE_FIFO 0b00100000
506 #define RADIOLIB_SI443X_TX_DATA_SOURCE_PN9 0b00110000
507 #define RADIOLIB_SI443X_TX_RX_INVERTED_OFF 0b00000000
508 #define RADIOLIB_SI443X_TX_RX_INVERTED_ON 0b00001000
509 #define RADIOLIB_SI443X_FREQUENCY_DEVIATION_MSB 0b00000000
510 #define RADIOLIB_SI443X_MODULATION_NONE 0b00000000
511 #define RADIOLIB_SI443X_MODULATION_OOK 0b00000001
512 #define RADIOLIB_SI443X_MODULATION_FSK 0b00000010
513 #define RADIOLIB_SI443X_MODULATION_GFSK 0b00000011
516 #define RADIOLIB_SI443X_FREQUENCY_DEVIATION_LSB 0b00100000
519 #define RADIOLIB_SI443X_FREQUENCY_OFFSET_MSB 0x00
520 #define RADIOLIB_SI443X_FREQUENCY_OFFSET_LSB 0x00
523 #define RADIOLIB_SI443X_SIDE_BAND_SELECT_LOW 0b00000000
524 #define RADIOLIB_SI443X_SIDE_BAND_SELECT_HIGH 0b01000000
525 #define RADIOLIB_SI443X_BAND_SELECT_LOW 0b00000000
526 #define RADIOLIB_SI443X_BAND_SELECT_HIGH 0b00100000
527 #define RADIOLIB_SI443X_FREQUENCY_BAND_SELECT 0b00010101
530 #define RADIOLIB_SI443X_NOM_CARRIER_FREQUENCY_MSB 0b10111011
531 #define RADIOLIB_SI443X_NOM_CARRIER_FREQUENCY_LSB 0b10000000
534 #define RADIOLIB_SI443X_FREQUENCY_HOPPING_CHANNEL 0x00
537 #define RADIOLIB_SI443X_FREQUENCY_HOPPING_STEP_SIZE 0x00
540 #define RADIOLIB_SI443X_TX_FIFO_ALMOST_FULL_THRESHOLD 0x37
543 #define RADIOLIB_SI443X_TX_FIFO_ALMOST_EMPTY_THRESHOLD 0x04
546 #define RADIOLIB_SI443X_RX_FIFO_ALMOST_FULL_THRESHOLD 0x37
581 int16_t
begin(
float br,
float freqDev,
float rxBw, uint8_t preambleLen);
596 int16_t
transmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
605 int16_t
receive(uint8_t* data,
size_t len)
override;
625 int16_t
standby(uint8_t mode)
override;
688 int16_t
startTransmit(uint8_t* data,
size_t len, uint8_t addr = 0)
override;
710 int16_t
startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask,
size_t len);
719 int16_t
readData(uint8_t* data,
size_t len)
override;
749 int16_t
setSyncWord(uint8_t* syncWord,
size_t len);
799 #if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
827 #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
832 #if !defined(RADIOLIB_GODMODE)
837 float frequencyDev = 0;
840 size_t packetLength = 0;
841 bool packetLengthQueried =
false;
842 uint8_t packetLengthConfig = RADIOLIB_SI443X_FIXED_PACKET_LENGTH_ON;
844 int16_t setFrequencyRaw(
float newFreq);
845 int16_t setPacketMode(uint8_t mode, uint8_t len);
847 #if !defined(RADIOLIB_GODMODE)
851 void clearIRQFlags();
852 void clearFIFO(
size_t count);
854 int16_t updateClockRecovery();
855 int16_t directMode();
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:31
static const size_t RFSWITCH_MAX_PINS
The maximum number of pins supported by the RF switch code.
Definition: Module.h:42
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:33
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:149
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
Base class for Si443x series. All derived classes for Si443x (e.g. Si4431 or Si4432) inherit from thi...
Definition: Si443x.h:553
int16_t startReceive()
Interrupt-driven receive method. IRQ will be activated when full valid packet is received.
Definition: Si443x.cpp:282
int16_t setEncoding(uint8_t encoding) override
Sets transmission encoding. Only available in FSK mode. Allowed values are RADIOLIB_ENCODING_NRZ,...
Definition: Si443x.cpp:556
int16_t receiveDirect() override
Enables direct reception mode. While in direct mode, the module will not be able to transmit or recei...
Definition: Si443x.cpp:189
void clearPacketSentAction()
Clears interrupt service routine to call when a packet is sent.
Definition: Si443x.cpp:229
void setPacketReceivedAction(void(*func)(void))
Sets interrupt service routine to call when a packet is received.
Definition: Si443x.cpp:217
size_t getPacketLength(bool update=true) override
Query modem for the packet length of received payload.
Definition: Si443x.cpp:543
virtual int16_t readData(uint8_t *data, size_t len)
Reads data that was received after calling startReceive method.
Definition: PhysicalLayer.cpp:209
void setRfSwitchPins(uint32_t rxEn, uint32_t txEn)
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: Si443x.cpp:595
int16_t begin(float br, float freqDev, float rxBw, uint8_t preambleLen)
Initialization method.
Definition: Si443x.cpp:13
int16_t setPreambleLength(uint8_t preambleLen)
Sets preamble length.
Definition: Si443x.cpp:527
int16_t transmit(const char *str, uint8_t addr=0)
C-string transmit method.
Definition: PhysicalLayer.cpp:52
int16_t setSyncWord(uint8_t *syncWord, size_t len)
Sets sync word. Up to 4 bytes can be set as sync word.
Definition: Si443x.cpp:510
int16_t setRxBandwidth(float rxBw)
Sets receiver bandwidth. Allowed values range from 2.6 to 620.7 kHz.
Definition: Si443x.cpp:403
int16_t getChipVersion()
Read version SPI register. Should return RADIOLIB_SI443X_DEVICE_VERSION (0x06) if Si443x is connected...
Definition: Si443x.cpp:622
void setDirectAction(void(*func)(void))
Set interrupt service routine function to call when data bit is received in direct mode.
Definition: Si443x.cpp:627
int16_t transmitDirect(uint32_t frf=0) override
Enables direct transmission mode. While in direct mode, the module will not be able to transmit or re...
Definition: Si443x.cpp:147
int16_t packetMode()
Disables direct mode and enables packet mode, allowing the module to receive packets.
Definition: Si443x.cpp:202
void clearPacketReceivedAction()
Clears interrupt service routine to call when a packet is received.
Definition: Si443x.cpp:221
int16_t finishTransmit() override
Clean up after transmission is done.
Definition: Si443x.cpp:274
uint8_t randomByte()
Get one truly random byte from RSSI noise.
Definition: Si443x.cpp:603
int16_t setFrequencyDeviation(float freqDev) override
Sets FSK frequency deviation from carrier frequency. Allowed values range from 0.625 to 320....
Definition: Si443x.cpp:380
void setIrqAction(void(*func)(void))
Sets interrupt service routine to call when IRQ activates.
Definition: Si443x.cpp:209
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: Si443x.cpp:599
void clearIrqAction()
Clears interrupt service routine to call when IRQ activates.
Definition: Si443x.cpp:213
int16_t startTransmit(const char *str, uint8_t addr=0)
Interrupt-driven Arduino String transmit method. Unlike the standard transmit method,...
Definition: PhysicalLayer.cpp:149
void setPacketSentAction(void(*func)(void))
Sets interrupt service routine to call when a packet is sent.
Definition: Si443x.cpp:225
virtual int16_t receive(uint8_t *data, size_t len)
Binary receive method. Must be implemented in module class.
Definition: PhysicalLayer.cpp:112
int16_t variablePacketLengthMode(uint8_t maxLen=RADIOLIB_SI443X_MAX_PACKET_LENGTH)
Set modem in variable packet length mode.
Definition: Si443x.cpp:640
int16_t standby() override
Sets the module to standby (with XTAL on).
Definition: Si443x.cpp:137
int16_t fixedPacketLengthMode(uint8_t len=RADIOLIB_SI443X_MAX_PACKET_LENGTH)
Set modem in fixed packet length mode.
Definition: Si443x.cpp:636
int16_t setBitRate(float br)
Sets FSK bit rate. Allowed values range from 0.123 to 256.0 kbps.
Definition: Si443x.cpp:349
int16_t sleep()
Sets the module to sleep to save power. Module will not be able to transmit or receive any data while...
Definition: Si443x.cpp:121
int16_t setDataShaping(uint8_t sh) override
Sets Gaussian filter bandwidth-time product that will be used for data shaping. Only available in FSK...
Definition: Si443x.cpp:575
void reset()
Reset method. Will reset the chip to the default state using SDN pin.
Definition: Si443x.cpp:70
Si443x(Module *mod)
Default constructor.
Definition: Si443x.cpp:5
void readBit(uint32_t pin)
Function to read and process data bit in direct reception mode.
Definition: Si443x.cpp:631