RadioLib
Universal wireless communication library for Arduino
TypeDef.h
1 #if !defined(_RADIOLIB_TYPES_H)
2 #define _RADIOLIB_TYPES_H
3 
4 #include "BuildOpt.h"
5 
15 #define RADIOLIB_USE_SPI 0x00
16 
20 #define RADIOLIB_USE_UART 0x01
21 
25 #define RADIOLIB_USE_I2C 0x02
26 
40 #define RADIOLIB_UART_STOPBIT_1 0x01
41 
45 #define RADIOLIB_UART_STOPBIT_1_5 0x02
46 
50 #define RADIOLIB_UART_STOPBIT_2 0x03
51 
55 #define RADIOLIB_UART_PARITY_NONE 0x00
56 
60 #define RADIOLIB_UART_PARITY_ODD 0x01
61 
65 #define RADIOLIB_UART_PARITY_EVEN 0x02
66 
70 #define RADIOLIB_UART_FLOW_NONE 0x00
71 
75 #define RADIOLIB_UART_FLOW_RTS 0x01
76 
80 #define RADIOLIB_UART_FLOW_CTS 0x02
81 
85 #define RADIOLIB_UART_FLOW_BOTH 0x03
86 
100 #define RADIOLIB_SHAPING_NONE 0x00
101 
105 #define RADIOLIB_SHAPING_0_3 0x01
106 
110 #define RADIOLIB_SHAPING_0_5 0x02
111 
115 #define RADIOLIB_SHAPING_0_7 0x03
116 
120 #define RADIOLIB_SHAPING_1_0 0x04
121 
135 #define RADIOLIB_ENCODING_NRZ 0x00
136 
140 #define RADIOLIB_ENCODING_MANCHESTER 0x01
141 
145 #define RADIOLIB_ENCODING_WHITENING 0x02
146 
157 // common status codes
158 
162 #define ERR_NONE 0
163 
168 #define ERR_UNKNOWN -1
169 
170 // SX127x/RFM9x status codes
171 
176 #define ERR_CHIP_NOT_FOUND -2
177 
181 #define ERR_MEMORY_ALLOCATION_FAILED -3
182 
186 #define ERR_PACKET_TOO_LONG -4
187 
191 #define ERR_TX_TIMEOUT -5
192 
196 #define ERR_RX_TIMEOUT -6
197 
202 #define ERR_CRC_MISMATCH -7
203 
207 #define ERR_INVALID_BANDWIDTH -8
208 
212 #define ERR_INVALID_SPREADING_FACTOR -9
213 
217 #define ERR_INVALID_CODING_RATE -10
218 
222 #define ERR_INVALID_BIT_RANGE -11
223 
227 #define ERR_INVALID_FREQUENCY -12
228 
232 #define ERR_INVALID_OUTPUT_POWER -13
233 
238 #define PREAMBLE_DETECTED -14
239 
243 #define CHANNEL_FREE -15
244 
248 #define ERR_SPI_WRITE_FAILED -16
249 
253 #define ERR_INVALID_CURRENT_LIMIT -17
254 
258 #define ERR_INVALID_PREAMBLE_LENGTH -18
259 
263 #define ERR_INVALID_GAIN -19
264 
269 #define ERR_WRONG_MODEM -20
270 
274 #define ERR_INVALID_NUM_SAMPLES -21
275 
279 #define ERR_INVALID_RSSI_OFFSET -22
280 
284 #define ERR_INVALID_ENCODING -23
285 
289 #define ERR_LORA_HEADER_DAMAGED -24
290 
291 // RF69-specific status codes
292 
296 #define ERR_INVALID_BIT_RATE -101
297 
301 #define ERR_INVALID_FREQUENCY_DEVIATION -102
302 
306 #define ERR_INVALID_BIT_RATE_BW_RATIO -103
307 
311 #define ERR_INVALID_RX_BANDWIDTH -104
312 
316 #define ERR_INVALID_SYNC_WORD -105
317 
321 #define ERR_INVALID_DATA_SHAPING -106
322 
326 #define ERR_INVALID_MODULATION -107
327 
331 #define ERR_INVALID_OOK_RSSI_PEAK_TYPE -108
332 
333 // ESP8266 status codes
334 
338 #define ERR_AT_FAILED -201
339 
343 #define ERR_URL_MALFORMED -202
344 
348 #define ERR_RESPONSE_MALFORMED_AT -203
349 
353 #define ERR_RESPONSE_MALFORMED -204
354 
358 #define ERR_MQTT_CONN_VERSION_REJECTED -205
359 
363 #define ERR_MQTT_CONN_ID_REJECTED -206
364 
368 #define ERR_MQTT_CONN_SERVER_UNAVAILABLE -207
369 
373 #define ERR_MQTT_CONN_BAD_USERNAME_PASSWORD -208
374 
378 #define ERR_MQTT_CONN_NOT_AUTHORIZED -208
379 
383 #define ERR_MQTT_UNEXPECTED_PACKET_ID -209
384 
388 #define ERR_MQTT_NO_NEW_PACKET_AVAILABLE -210
389 
393 #define MQTT_SUBS_SUCCESS_QOS_0 0x00
394 
398 #define MQTT_SUBS_SUCCESS_QOS_1 0x01
399 
403 #define MQTT_SUBS_SUCCESS_QOS_2 0x02
404 
408 #define ERR_MQTT_SUBS_FAILED 0x80
409 
410 // XBee status codes
411 
415 #define ERR_CMD_MODE_FAILED -301
416 
420 #define ERR_FRAME_MALFORMED -302
421 
425 #define ERR_FRAME_INCORRECT_CHECKSUM -303
426 
430 #define ERR_FRAME_UNEXPECTED_ID -304
431 
435 #define ERR_FRAME_NO_RESPONSE -305
436 
437 // RTTY status codes
438 
442 #define ERR_INVALID_RTTY_SHIFT -401
443 
447 #define ERR_UNSUPPORTED_ENCODING -402
448 
449 // nRF24-specific status codes
450 
454 #define ERR_INVALID_DATA_RATE -501
455 
459 #define ERR_INVALID_ADDRESS_WIDTH -502
460 
464 #define ERR_INVALID_PIPE_NUMBER -503
465 
469 #define ERR_ACK_NOT_RECEIVED -504
470 
471 // CC1101-specific status codes
472 
476 #define ERR_INVALID_NUM_BROAD_ADDRS -601
477 
478 // SX126x-specific status codes
479 
483 #define ERR_INVALID_CRC_CONFIGURATION -701
484 
488 #define LORA_DETECTED -702
489 
493 #define ERR_INVALID_TCXO_VOLTAGE -703
494 
498 #define ERR_INVALID_MODULATION_PARAMETERS -704
499 
503 #define ERR_SPI_CMD_TIMEOUT -705
504 
508 #define ERR_SPI_CMD_INVALID -706
509 
513 #define ERR_SPI_CMD_FAILED -707
514 
521 #define ERR_INVALID_SLEEP_PERIOD -708
522 
528 #define ERR_INVALID_RX_PERIOD -709
529 
530 // AX.25-specific status codes
531 
537 #define ERR_INVALID_CALLSIGN -801
538 
544 #define ERR_INVALID_NUM_REPEATERS -802
545 
551 #define ERR_INVALID_REPEATER_CALLSIGN -803
552 
553 // SX128x-specific status codes
554 
558 #define ERR_RANGING_TIMEOUT -901
559 
564 #endif