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.

41 lines
1.1 KiB

  1. /*
  2. BUTTON MODULE
  3. Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #pragma once
  6. #include <DebounceEvent.h>
  7. struct button_t {
  8. // TODO: dblclick and debounce delays - right now a global setting, independent of ID
  9. static unsigned long DebounceDelay;
  10. static unsigned long DblclickDelay;
  11. // Use built-in indexed definitions to configure DebounceEvent
  12. button_t(unsigned char index);
  13. // Provide custom DebounceEvent parameters instead
  14. button_t(unsigned char pin, unsigned char mode, unsigned long actions, unsigned char relayID);
  15. bool state();
  16. std::unique_ptr<DebounceEvent> event;
  17. unsigned long actions;
  18. unsigned char relayID;
  19. };
  20. bool buttonState(unsigned char id);
  21. unsigned char buttonAction(unsigned char id, unsigned char event);
  22. void buttonMQTT(unsigned char id, uint8_t event);
  23. void buttonEvent(unsigned char id, unsigned char event);
  24. unsigned char buttonAdd(unsigned char pin, unsigned char mode, unsigned long actions, unsigned char relayID = RELAY_NONE);
  25. unsigned char buttonCount();
  26. void buttonSetup();