Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
960 B

  1. /*
  2. HARDWARE MODULE
  3. Copyright (C) 2018 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #include <EEPROM.h>
  6. void hardwareSetup() {
  7. EEPROM.begin(EEPROM_SIZE);
  8. #if DEBUG_SERIAL_SUPPORT
  9. DEBUG_PORT.begin(SERIAL_BAUDRATE);
  10. #if DEBUG_ESP_WIFI
  11. DEBUG_PORT.setDebugOutput(true);
  12. #endif
  13. #elif defined(SERIAL_BAUDRATE)
  14. Serial.begin(SERIAL_BAUDRATE);
  15. #endif
  16. #if SPIFFS_SUPPORT
  17. SPIFFS.begin();
  18. #endif
  19. #if defined(ESPLIVE)
  20. //The ESPLive has an ADC MUX which needs to be configured.
  21. pinMode(16, OUTPUT);
  22. digitalWrite(16, HIGH); //Defualt CT input (pin B, solder jumper B)
  23. #endif
  24. }
  25. void hardwareLoop() {
  26. // Heartbeat
  27. #if HEARTBEAT_ENABLED
  28. static unsigned long last = 0;
  29. if ((last == 0) || (millis() - last > HEARTBEAT_INTERVAL)) {
  30. last = millis();
  31. heartbeat();
  32. }
  33. #endif // HEARTBEAT_ENABLED
  34. }