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.

28 lines
652 B

7 years ago
  1. /*
  2. ESPurna
  3. BUTTON MODULE
  4. Copyright (C) 2016 by Xose Pérez <xose dot perez at gmail dot com>
  5. */
  6. #include <DebounceEvent.h>
  7. DebounceEvent button1 = false;
  8. // -----------------------------------------------------------------------------
  9. // BUTTON
  10. // -----------------------------------------------------------------------------
  11. void buttonSetup() {
  12. button1 = DebounceEvent(BUTTON_PIN);
  13. }
  14. void buttonLoop() {
  15. if (button1.loop()) {
  16. if (button1.getEvent() == EVENT_SINGLE_CLICK) toggleRelay();
  17. if (button1.getEvent() == EVENT_LONG_CLICK) createAP();
  18. if (button1.getEvent() == EVENT_DOUBLE_CLICK) ESP.reset();
  19. }
  20. }