10#define DEBOUNCE_DELAY 500
13#if defined(IS_MIN_DESKTOP)
14extern "C" void pinMode(
int,
int);
55 virtual int id() {
return pin; }
58#if defined(USE_TOUCH_READ)
67 LOGI(
"touch pin: %d value %d (limit: %d) -> %s", this->pin, value,
75 return this->
readPin(this->pin);
84 if (value != this->lastState) {
87 if ((value && this->activeLogic ==
ActiveHigh) ||
88 (!value && this->activeLogic ==
ActiveLow)) {
89 this->
actionOn(
true, this->pin, this->ref);
91 this->
actionOff(
false, this->pin, this->ref);
93 this->lastState = value;
98 if (value != this->lastState &&
millis() > this->debounceTimeout) {
101 this->
actionOn(active, this->pin, this->ref);
102 this->lastState = value;
106 bool active = (this->activeLogic ==
ActiveLow) ? !value : value;
108 (active != this->lastState ||
millis() > this->debounceTimeout)) {
111 this->
actionOn(active, this->pin, this->ref);
112 this->lastState = active;
142 void add(
int pin,
void (*actionOn)(
bool pinStatus,
int pin,
void* ref),
144 add(pin, actionOn,
nullptr, activeLogic, ref);
148 void add(
int pin,
void (*actionOn)(
bool pinStatus,
int pin,
void* ref),
149 void (*actionOff)(
bool pinStatus,
int pin,
void* ref),
159 action.actionOn = actionOn;
160 action.actionOff = actionOff;
169 LOGW(
"pin %d -> Ignored", pin);
271 LOGI(
"pin %d -> INPUT_PULLUP", pin);
274 LOGI(
"pin %d -> INPUT", pin);
278#if defined(ARDUINO) && !defined(IS_MIN_DESKTOP)
#define DEBOUNCE_DELAY
Definition AudioActions.h:10
#define TOUCH_LIMIT
Definition AudioActions.h:6
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define INPUT
Definition NoArduino.h:38
#define INPUT_PULLUP
Definition NoArduino.h:46
void pinMode(int pin, int mode)
Definition NoArduino.h:210
int digitalRead(int pin)
e.g. for AudioActions
Definition NoArduino.h:201