13#define DEBOUNCE_DELAY 500
18#if defined(IS_MIN_DESKTOP)
61#if defined(USE_TOUCH_READ)
64 int value = touchRead(this->pin);
68 value = touchRead(this->pin);
70 LOGI(
"touch pin: %d value %d (limit: %d) -> %s", this->pin, value,
78 return this->
readPin(this->pin);
87 if (value != this->lastState) {
90 if ((value && this->activeLogic ==
ActiveHigh) ||
91 (!value && this->activeLogic ==
ActiveLow)) {
92 this->
actionOn(
true, this->pin, this->ref);
94 this->
actionOff(
false, this->pin, this->ref);
96 this->lastState = value;
100 if (value != this->lastState &&
millis() > this->debounceTimeout) {
102 this->
actionOn(active, this->pin, this->ref);
103 this->lastState = value;
107 bool active = (this->activeLogic ==
ActiveLow) ? !value : value;
109 (active != this->lastState ||
millis() > this->debounceTimeout)) {
111 this->
actionOn(active, this->pin, this->ref);
112 this->lastState = active;
143 void (*actionOn)(
bool pinStatus,
digital_pin_t pin,
void* ref),
145 add(pin, actionOn,
nullptr, activeLogic, ref);
150 void (*actionOn)(
bool pinStatus,
digital_pin_t pin,
void* ref),
151 void (*actionOff)(
bool pinStatus,
digital_pin_t pin,
void* ref),
162 if (p_action ==
nullptr) {
205 if (action !=
nullptr && action->enabled) action->process();
216 if (action ==
nullptr || !action->enabled)
continue;
224 if (action !=
nullptr && action->id() == id) {
233 if (action !=
nullptr && action->pin == pin) {
244 if (action ==
nullptr)
continue;
245 if (action->id() == id) {
261 if (action ==
nullptr)
continue;
277 void* ref =
nullptr) {
295 LOGE(
"insertAction: refusing to add nullptr");
307#if defined(IS_ZEPHYR)
311 struct gpio_callback* cb, uint32_t pins) {
325 ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_BOTH);
327 LOGE(
"Error %d: failed to enable interrupt", ret);
336 static void audioActionsISR() {
345#if defined(ARDUINO) && (!defined(IS_MIN_DESKTOP) && !defined(IS_DESKTOP))
346 attachInterrupt(digitalPinToInterrupt(pin), audioActionsISR, CHANGE);
347#elif defined(IS_ZEPHYR)
#define INPUT
Definition Arduino.h:34
#define INPUT_PULLUP
Definition Arduino.h:42
#define GPIO_TO_INT(pin)
Definition Arduino.h:249
#define DEBOUNCE_DELAY
Definition AudioActions.h:13
#define TOUCH_LIMIT
Definition AudioActions.h:9
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGE(...)
Definition AudioLoggerIDF.h:30