From: Andy Green Date: Wed, 14 Jun 2017 23:59:22 +0000 (+0800) Subject: esp32: make button debounce also available in factory X-Git-Tag: accepted/tizen/4.0/unified/20171012.191640~80 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Flibwebsockets.git;a=commitdiff_plain;h=31e26a4fab9488afd86417ea55cf66db7e90b430 esp32: make button debounce also available in factory --- diff --git a/lib/lws-plat-esp32.c b/lib/lws-plat-esp32.c index 37439ad..2765416 100644 --- a/lib/lws-plat-esp32.c +++ b/lib/lws-plat-esp32.c @@ -794,29 +794,6 @@ again: return 0; } -void __attribute__(( weak )) -lws_esp32_button(int down) -{ -} - -void IRAM_ATTR -gpio_irq(void *arg) -{ - bdown ^= 1; - gpio_set_intr_type(GPIO_SW, GPIO_INTR_DISABLE); - xTimerStart(debounce_timer, 0); - - lws_esp32_button(bdown); -} - -static void lws_esp32_debounce_timer_cb(TimerHandle_t th) -{ - if (bdown) - gpio_set_intr_type(GPIO_SW, GPIO_INTR_POSEDGE); - else - gpio_set_intr_type(GPIO_SW, GPIO_INTR_NEGEDGE); -} - static void lws_esp32_mdns_timer_cb(TimerHandle_t th) { uint64_t now = time_in_microseconds(); @@ -914,6 +891,30 @@ next: } #endif +void __attribute__(( weak )) +lws_esp32_button(int down) +{ +} + +void IRAM_ATTR +gpio_irq(void *arg) +{ + bdown ^= 1; + gpio_set_intr_type(GPIO_SW, GPIO_INTR_DISABLE); + xTimerStart(debounce_timer, 0); + + lws_esp32_button(bdown); +} + +static void lws_esp32_debounce_timer_cb(TimerHandle_t th) +{ + if (bdown) + gpio_set_intr_type(GPIO_SW, GPIO_INTR_POSEDGE); + else + gpio_set_intr_type(GPIO_SW, GPIO_INTR_NEGEDGE); +} + + static int start_scan() {