diff --git a/code/espurna/debug.ino b/code/espurna/debug.ino index dd3d0e72..5039d51a 100644 --- a/code/espurna/debug.ino +++ b/code/espurna/debug.ino @@ -10,6 +10,7 @@ Copyright (C) 2016-2018 by Xose Pérez #include #include +#include extern "C" { #include "user_interface.h" diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index 21d167f8..a6d278a3 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -20,52 +20,11 @@ along with this program. If not, see . */ #include "config/all.h" -#include -// ----------------------------------------------------------------------------- -// METHODS // ----------------------------------------------------------------------------- unsigned long _loopDelay = 0; -void hardwareSetup() { - - EEPROM.begin(EEPROM_SIZE); - - #if DEBUG_SERIAL_SUPPORT - DEBUG_PORT.begin(SERIAL_BAUDRATE); - #if DEBUG_ESP_WIFI - DEBUG_PORT.setDebugOutput(true); - #endif - #elif defined(SERIAL_BAUDRATE) - Serial.begin(SERIAL_BAUDRATE); - #endif - - #if SPIFFS_SUPPORT - SPIFFS.begin(); - #endif - - #if defined(ESPLIVE) - //The ESPLive has an ADC MUX which needs to be configured. - pinMode(16, OUTPUT); - digitalWrite(16, HIGH); //Defualt CT input (pin B, solder jumper B) - #endif - -} - -void hardwareLoop() { - - // Heartbeat - #if HEARTBEAT_ENABLED - static unsigned long last = 0; - if ((last == 0) || (millis() - last > HEARTBEAT_INTERVAL)) { - last = millis(); - heartbeat(); - } - #endif // HEARTBEAT_ENABLED - -} - // ----------------------------------------------------------------------------- // BOOTING // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino new file mode 100644 index 00000000..b5e534e7 --- /dev/null +++ b/code/espurna/hardware.ino @@ -0,0 +1,47 @@ +/* + +HARDWARE MODULE + +Copyright (C) 2018 by Xose Pérez + +*/ + +#include + +void hardwareSetup() { + + EEPROM.begin(EEPROM_SIZE); + + #if DEBUG_SERIAL_SUPPORT + DEBUG_PORT.begin(SERIAL_BAUDRATE); + #if DEBUG_ESP_WIFI + DEBUG_PORT.setDebugOutput(true); + #endif + #elif defined(SERIAL_BAUDRATE) + Serial.begin(SERIAL_BAUDRATE); + #endif + + #if SPIFFS_SUPPORT + SPIFFS.begin(); + #endif + + #if defined(ESPLIVE) + //The ESPLive has an ADC MUX which needs to be configured. + pinMode(16, OUTPUT); + digitalWrite(16, HIGH); //Defualt CT input (pin B, solder jumper B) + #endif + +} + +void hardwareLoop() { + + // Heartbeat + #if HEARTBEAT_ENABLED + static unsigned long last = 0; + if ((last == 0) || (millis() - last > HEARTBEAT_INTERVAL)) { + last = millis(); + heartbeat(); + } + #endif // HEARTBEAT_ENABLED + +}