/*
|
|
|
|
HARDWARE MODULE
|
|
|
|
Copyright (C) 2018 by Xose Pérez <xose dot perez at gmail dot com>
|
|
|
|
*/
|
|
|
|
#include <EEPROM.h>
|
|
|
|
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
|
|
|
|
}
|