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

/*
BUTTON MODULE
Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
*/
#pragma once
#include <DebounceEvent.h>
struct button_t {
// TODO: dblclick and debounce delays - right now a global setting, independent of ID
static unsigned long DebounceDelay;
static unsigned long DblclickDelay;
// Use built-in indexed definitions to configure DebounceEvent
button_t(unsigned char index);
// Provide custom DebounceEvent parameters instead
button_t(unsigned char pin, unsigned char mode, unsigned long actions, unsigned char relayID);
bool state();
std::unique_ptr<DebounceEvent> event;
unsigned long actions;
unsigned char relayID;
};
bool buttonState(unsigned char id);
unsigned char buttonAction(unsigned char id, unsigned char event);
void buttonMQTT(unsigned char id, uint8_t event);
void buttonEvent(unsigned char id, unsigned char event);
unsigned char buttonAdd(unsigned char pin, unsigned char mode, unsigned long actions, unsigned char relayID = RELAY_NONE);
unsigned char buttonCount();
void buttonSetup();