From ebdaedb5145781780fa2da4fc4c2d48bb2617226 Mon Sep 17 00:00:00 2001 From: Marcelo Aquino Date: Sun, 21 Aug 2016 23:25:11 -0300 Subject: [PATCH] Add ESP8266 Serial modes SERIAL_TX_ONLY allows to use RX (GPIO3) as a general purpose input/output SERIAL_RX_ONLY allows to use TX (GPIO1) as a general purpose input/output --- MyConfig.h | 22 ++++++++++++++++++++++ core/MyHwESP8266.h | 2 +- keywords.txt | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/MyConfig.h b/MyConfig.h index 366a676..2e1d3df 100644 --- a/MyConfig.h +++ b/MyConfig.h @@ -643,6 +643,10 @@ // If MY_CONTROLLER_IP_ADDRESS is left un-defined, gateway acts as server allowing incoming connections. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254 +/************************************** +* Node Locking +***************************************/ + /** * @defgroup MyLockgrp MyNodeLock * @ingroup internals @@ -699,8 +703,26 @@ #endif /** @}*/ // Node lock group +/********************************** +* ESP8266 Defaults +***********************************/ + +/** + * @def MY_ESP8266_SERIAL_MODE + * @brief Serial modes: SERIAL_FULL, SERIAL_RX_ONLY, SERIAL_TX_ONLY + * + * SERIAL_FULL: Default mode. + * SERIAL_TX_ONLY: allows to use RX (GPIO3) as a general purpose input/output. + * SERIAL_RX_ONLY: allows to use TX (GPIO1) as a general purpose input/output. + */ +#ifndef MY_ESP8266_SERIAL_MODE +#define MY_ESP8266_SERIAL_MODE SERIAL_FULL #endif +/** @}*/ // ESP8266 Defaults + +#endif // MyConfig_h + // Doxygen specific constructs, not included when built normally // This is used to enable disabled macros/definitions to be included in the documentation as well. #if DOXYGEN diff --git a/core/MyHwESP8266.h b/core/MyHwESP8266.h index ffbcb69..3bd6c00 100644 --- a/core/MyHwESP8266.h +++ b/core/MyHwESP8266.h @@ -35,7 +35,7 @@ // Define these as macros to save valuable space #define hwDigitalWrite(__pin, __value) (digitalWrite(__pin, __value)) -#define hwInit() MY_SERIALDEVICE.begin(MY_BAUD_RATE); MY_SERIALDEVICE.setDebugOutput(true) +#define hwInit() MY_SERIALDEVICE.begin(MY_BAUD_RATE, SERIAL_8N1, MY_ESP8266_SERIAL_MODE, 1); MY_SERIALDEVICE.setDebugOutput(true) #define hwWatchdogReset() wdt_reset() #define hwReboot() ESP.restart(); #define hwMillis() millis() diff --git a/keywords.txt b/keywords.txt index b84d949..5d8da56 100644 --- a/keywords.txt +++ b/keywords.txt @@ -107,6 +107,7 @@ MY_GATEWAY_MAX_RECEIVE_LENGTH LITERAL1 MY_ESP8266_SSID LITERAL1 MY_ESP8266_PASSWORD LITERAL1 MY_ESP8266_HOSTNAME LITERAL1 +MY_ESP8266_SERIAL_MODE LITERAL1 MY_IP_GATEWAY_ADDRESS LITERAL1 MY_IP_SUBNET_ADDRESS LITERAL1 MY_W5100_SPI_EN LITERAL1