From 6e0ec1cb2a46357f5d72b1ad86e66dc30db8cbde Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 27 Mar 2018 11:05:06 +0200 Subject: [PATCH] Added brownout remove and pullup on button --- src/main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 416a0db0..b3d48896 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -323,6 +323,12 @@ void init_display(const char *Productname, const char *Version) { void setup() { + // disable brownout detection +#ifdef DISABLE_BROWNOUT + // Register with brownout is at address DR_REG_RTCCNTL_BASE + 0xd4 + (*((volatile uint32_t *)ETS_UNCACHED_ADDR((DR_REG_RTCCNTL_BASE+0xd4)))) = 0; +#endif + // setup debug output or silence device #ifdef VERBOSE Serial.begin(115200); @@ -362,9 +368,15 @@ void setup() { #endif #ifdef HAS_BUTTON - // install button interrupt +#ifdef BUTTON_PULLUP + // install button interrupt (pullup mode) + pinMode(HAS_BUTTON, INPUT_PULLUP); + attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), isr_button_pressed, RISING); +#else + // install button interrupt (pulldown mode) pinMode(HAS_BUTTON, INPUT_PULLDOWN); attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), isr_button_pressed, FALLING); +#endif #endif // initialize wifi antenna