Refactor RaspberryPi port
This commit is contained in:
+24
-45
@@ -52,6 +52,10 @@
|
||||
#define MY_NODE_TYPE "NODE"
|
||||
#endif
|
||||
|
||||
#if defined(MY_GATEWAY_RASPBERRYPI)
|
||||
#define MY_GATEWAY_LINUX
|
||||
#endif
|
||||
|
||||
// Enable radio "feature" if one of the radio types was enabled
|
||||
#if defined(MY_RADIO_NRF24) || defined(MY_RADIO_RFM69) || defined(MY_RS485)
|
||||
#define MY_RADIO_FEATURE
|
||||
@@ -68,7 +72,7 @@
|
||||
#elif defined(ARDUINO_ARCH_AVR)
|
||||
#include "core/MyHwATMega328.cpp"
|
||||
#elif defined(ARDUINO_ARCH_SAMD)
|
||||
#include "core/MyHwSAMD.cpp"
|
||||
#include "core/MyHwSAMD.cpp"
|
||||
#elif defined(LINUX_ARCH_GENERIC)
|
||||
// Remove PSTR macros from debug prints
|
||||
#undef PSTR
|
||||
@@ -80,6 +84,7 @@
|
||||
#define snprintf_P(...) snprintf( __VA_ARGS__ )
|
||||
#define memcpy_P memcpy
|
||||
#define pgm_read_dword(x) (*x)
|
||||
#define pgm_read_byte_near(x) (*x)
|
||||
#include "core/MyHwLinuxGeneric.cpp"
|
||||
#endif
|
||||
|
||||
@@ -197,7 +202,7 @@
|
||||
#define MY_REPEATER_FEATURE
|
||||
#endif
|
||||
// GATEWAY - COMMON FUNCTIONS
|
||||
// We only support MQTT Client using W5100 and ESP8266 at the moment
|
||||
// We support MQTT Client using W5100, ESP8266 and Linux
|
||||
#if !(defined(MY_CONTROLLER_URL_ADDRESS) || defined(MY_CONTROLLER_IP_ADDRESS))
|
||||
#error You must specify MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS
|
||||
#endif
|
||||
@@ -208,18 +213,25 @@
|
||||
#if !defined(MY_MQTT_SUBSCRIBE_TOPIC_PREFIX)
|
||||
#error You must specify a topic subscribe prefix MY_MQTT_SUBSCRIBE_TOPIC_PREFIX for this MQTT client
|
||||
#endif
|
||||
#if !defined(MY_MQTT_CLIENT_ID)
|
||||
|
||||
#if !defined(MY_MQTT_CLIENT_ID)
|
||||
#error You must define a unique MY_MQTT_CLIENT_ID for this MQTT client
|
||||
#endif
|
||||
|
||||
#include "drivers/PubSubClient/PubSubClient.cpp"
|
||||
#include "core/MyGatewayTransport.cpp"
|
||||
#include "core/MyProtocolMySensors.cpp"
|
||||
|
||||
#if defined(MY_GATEWAY_LINUX)
|
||||
#include "drivers/Linux/EthernetClient.cpp"
|
||||
#include "drivers/Linux/EthernetServer.cpp"
|
||||
#include "drivers/Linux/IPAddress.cpp"
|
||||
#endif
|
||||
#include "drivers/PubSubClient/PubSubClient.cpp"
|
||||
#include "core/MyGatewayTransportMQTTClient.cpp"
|
||||
#elif defined(MY_GATEWAY_FEATURE)
|
||||
// GATEWAY - COMMON FUNCTIONS
|
||||
#include "core/MyGatewayTransport.cpp"
|
||||
|
||||
// We currently only support one protocol at the moment, enable it.
|
||||
#include "core/MyProtocolMySensors.cpp"
|
||||
|
||||
// GATEWAY - CONFIGURATION
|
||||
@@ -227,9 +239,6 @@
|
||||
// We assume that a gateway having a radio also should act as repeater
|
||||
#define MY_REPEATER_FEATURE
|
||||
#endif
|
||||
#if defined(MY_GATEWAY_RASPBERRYPI)
|
||||
#define MY_GATEWAY_LINUX
|
||||
#endif
|
||||
#if defined(MY_CONTROLLER_IP_ADDRESS)
|
||||
#define MY_GATEWAY_CLIENT_MODE
|
||||
#endif
|
||||
@@ -238,23 +247,16 @@
|
||||
#endif
|
||||
#if defined(MY_GATEWAY_ESP8266)
|
||||
// GATEWAY - ESP8266
|
||||
#if defined(MY_GATEWAY_MQTT_CLIENT)
|
||||
#include "drivers/pubsubclient/src/PubSubClient.cpp"
|
||||
#include "core/MyGatewayTransportMQTTClient.cpp"
|
||||
#else
|
||||
#include "core/MyGatewayTransportEthernet.cpp"
|
||||
#endif
|
||||
#include "core/MyGatewayTransportEthernet.cpp"
|
||||
#elif defined(MY_GATEWAY_LINUX)
|
||||
// GATEWAY - Generic Linux (RaspberryPi, BBB)
|
||||
#include "core/MyGatewayTransportEthernetLinux.cpp"
|
||||
// GATEWAY - Generic Linux (RaspberryPi, BBB, ...)
|
||||
#include "drivers/Linux/EthernetClient.cpp"
|
||||
#include "drivers/Linux/EthernetServer.cpp"
|
||||
#include "drivers/Linux/IPAddress.cpp"
|
||||
#include "core/MyGatewayTransportEthernet.cpp"
|
||||
#elif defined(MY_GATEWAY_W5100)
|
||||
// GATEWAY - W5100
|
||||
#if defined(MY_GATEWAY_MQTT_CLIENT)
|
||||
#include "drivers/pubsubclient/src/PubSubClient.cpp"
|
||||
#include "core/MyGatewayTransportMQTTClient.cpp"
|
||||
#else
|
||||
#include "core/MyGatewayTransportEthernet.cpp"
|
||||
#endif
|
||||
#include "core/MyGatewayTransportEthernet.cpp"
|
||||
#elif defined(MY_GATEWAY_ENC28J60)
|
||||
// GATEWAY - ENC28J60
|
||||
#if defined(MY_USE_UDP)
|
||||
@@ -264,32 +266,9 @@
|
||||
#elif defined(MY_GATEWAY_SERIAL)
|
||||
// GATEWAY - SERIAL
|
||||
#include "core/MyGatewayTransportSerial.cpp"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// GATEWAY - MQTT
|
||||
#if defined(MY_GATEWAY_MQTT_CLIENT) && !defined(MY_GATEWAY_LINUX)
|
||||
// GATEWAY - COMMON FUNCTIONS
|
||||
// We only support MQTT Client using W5100, ESP8266 or Linux/RasperryPi at the moment
|
||||
#if !(defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_LINUX))
|
||||
#error We only support MQTT Client using W5100, ESP8266 or Linux/RasperryPi at the moment
|
||||
#endif
|
||||
|
||||
#if !(defined(MY_CONTROLLER_URL_ADDRESS) || defined(MY_CONTROLLER_IP_ADDRESS))
|
||||
#error You must specify MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS
|
||||
#endif
|
||||
|
||||
#if !defined(MY_MQTT_PUBLISH_TOPIC_PREFIX)
|
||||
#error You must specify a topic publish prefix MY_MQTT_PUBLISH_TOPIC_PREFIX for this MQTT client
|
||||
#endif
|
||||
#if !defined(MY_MQTT_SUBSCRIBE_TOPIC_PREFIX)
|
||||
#error You must specify a topic subscribe prefix MY_MQTT_SUBSCRIBE_TOPIC_PREFIX for this MQTT client
|
||||
#endif
|
||||
#if !defined(MY_MQTT_CLIENT_ID)
|
||||
#error You must define a unique MY_MQTT_CLIENT_ID for this MQTT client
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// RADIO
|
||||
#if defined(MY_RADIO_NRF24) || defined(MY_RADIO_RFM69) || defined(MY_RS485)
|
||||
|
||||
Reference in New Issue
Block a user