RadioLib/src/TypeDef.h

110 wiersze
4.3 KiB
C
Czysty Zwykły widok Historia

2018-03-05 16:08:42 +00:00
#ifndef _KITELIB_TYPES_H
#define _KITELIB_TYPES_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
//#define KITELIB_DEBUG
2018-03-05 16:08:42 +00:00
#ifdef KITELIB_DEBUG
#define DEBUG_BEGIN(x) Serial.begin (x)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINT(x) Serial.print (x)
2018-07-23 09:10:48 +00:00
#define DEBUG_PRINT_BIN(x) Serial.print (x, BIN)
#define DEBUG_PRINTLN_BIN(x) Serial.println (x, BIN)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINT_DEC(x) Serial.print (x, DEC)
2018-07-23 09:10:48 +00:00
#define DEBUG_PRINTLN_DEC(x) Serial.println (x, DEC)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINT_HEX(x) Serial.print (x, HEX)
2018-07-23 09:10:48 +00:00
#define DEBUG_PRINTLN_HEX(x) Serial.println (x, HEX)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINTLN(x) Serial.println (x)
#define DEBUG_PRINT_STR(x) Serial.print (F(x))
#define DEBUG_PRINTLN_STR(x) Serial.println (F(x))
#else
#define DEBUG_BEGIN(x)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINT(x)
2018-07-23 09:10:48 +00:00
#define DEBUG_PRINT_BIN(x)
#define DEBUG_PRINTLN_BIN(x)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINT_DEC(x)
2018-07-23 09:10:48 +00:00
#define DEBUG_PRINTLN_DEC(x)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINT_HEX(x)
2018-07-23 09:10:48 +00:00
#define DEBUG_PRINTLN_HEX(x)
2018-04-19 16:50:42 +00:00
#define DEBUG_PRINTLN(x)
#define DEBUG_PRINT_STR(x)
#define DEBUG_PRINTLN_STR(x)
#endif
2018-04-19 16:50:42 +00:00
2018-03-05 16:08:42 +00:00
// Shield configuration
#define USE_SPI 0x00
#define USE_UART 0x01
#define USE_I2C 0x02
#define INT_NONE 0x00
#define INT_0 0x01
#define INT_1 0x02
#define INT_BOTH 0x03
2018-03-05 16:08:42 +00:00
// UART configuration
#define UART_STOPBIT_1 0x01
#define UART_STOPBIT_1_5 0x02
#define UART_STOPBIT_2 0x03
#define UART_PARITY_NONE 0x00
#define UART_PARITY_ODD 0x01
#define UART_PARITY_EVEN 0x02
#define UART_FLOW_NONE 0x00
#define UART_FLOW_RTS 0x01
#define UART_FLOW_CTS 0x02
#define UART_FLOW_BOTH 0x03
2018-03-05 16:08:42 +00:00
// Common status codes
#define ERR_NONE 0x00
#define ERR_UNKNOWN 0x63 // maximum status code value is 99 DEC, so that it does not interfere with HTTP status codes
2018-03-05 16:08:42 +00:00
// SX1278/SX1272/RF69 status codes
#define ERR_CHIP_NOT_FOUND 0x01
#define ERR_EEPROM_NOT_INITIALIZED 0x02
#define ERR_PACKET_TOO_LONG 0x03
#define ERR_TX_TIMEOUT 0x04
#define ERR_RX_TIMEOUT 0x05
#define ERR_CRC_MISMATCH 0x06
#define ERR_INVALID_BANDWIDTH 0x07
#define ERR_INVALID_SPREADING_FACTOR 0x08
#define ERR_INVALID_CODING_RATE 0x09
#define ERR_INVALID_BIT_RANGE 0x0A
#define ERR_INVALID_FREQUENCY 0x0B
#define ERR_INVALID_OUTPUT_POWER 0x0C
#define PREAMBLE_DETECTED 0x0D
#define CHANNEL_FREE 0x0E
2018-07-14 06:43:04 +00:00
// RF69-specific status codes
2018-07-04 13:16:00 +00:00
#define ERR_INVALID_BIT_RATE 0x0F
#define ERR_INVALID_FREQUENCY_DEVIATION 0x10
#define ERR_INVALID_BIT_RATE_BW_RATIO 0x11
#define ERR_INVALID_RX_BANDWIDTH 0x12
2018-07-14 06:43:04 +00:00
#define ERR_INVALID_SYNC_WORD 0x13
2018-03-05 16:08:42 +00:00
// ESP8266 status codes
#define ERR_AT_FAILED 0x01
#define ERR_URL_MALFORMED 0x02
#define ERR_RESPONSE_MALFORMED_AT 0x03
#define ERR_RESPONSE_MALFORMED 0x04
#define ERR_MQTT_CONN_VERSION_REJECTED 0x05
#define ERR_MQTT_CONN_ID_REJECTED 0x06
#define ERR_MQTT_CONN_SERVER_UNAVAILABLE 0x07
#define ERR_MQTT_CONN_BAD_USERNAME_PASSWORD 0x08
#define ERR_MQTT_CONN_NOT_AUTHORIZED 0x09
2018-07-10 10:50:14 +00:00
#define ERR_MQTT_UNEXPECTED_PACKET_ID 0x0A
#define ERR_MQTT_NO_NEW_PACKET_AVAILABLE 0x0B
2018-07-10 10:50:14 +00:00
#define MQTT_SUBS_SUCCESS_QOS_0 0x00
#define MQTT_SUBS_SUCCESS_QOS_1 0x01
#define MQTT_SUBS_SUCCESS_QOS_2 0x02
#define ERR_MQTT_SUBS_FAILED 0x80
2018-03-05 16:08:42 +00:00
// XBee status codes
#define ERR_CMD_MODE_FAILED 0x02
2018-07-19 14:21:47 +00:00
#define ERR_FRAME_MALFORMED 0x03
#define ERR_FRAME_INCORRECT_CHECKSUM 0x04
#define ERR_FRAME_UNEXPECTED_ID 0x05
2018-03-05 16:08:42 +00:00
#endif