This commit is contained in:
cyberman54 2022-08-04 13:52:16 +02:00
parent e73bd19a82
commit 399e815cd8
2 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,10 @@
#include "display.h" #include "display.h"
#include "payload.h" #include "payload.h"
#ifndef BUTTON_ACTIVEHIGH
#define BUTTON_ACTIVEHIGH 0
#endif
void button_init(int pin); void button_init(int pin);
void readButton(); void readButton();

View File

@ -11,10 +11,10 @@ static const char TAG[] = __FILE__;
static Button *b = NULL; static Button *b = NULL;
void button_init(int pin) { void button_init(int pin) {
#ifdef BUTTON_PULLDOWN #ifdef BUTTON_PULLUP
b = new Button(pin);
#else
b = new ButtonPullup(pin); b = new ButtonPullup(pin);
#else
b = new Button(pin, !BUTTON_ACTIVEHIGH);
#endif #endif
// attach events to the button // attach events to the button