From 02dfa1385e25875659eec20313b8914ccbf60954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gassmann?= Date: Fri, 11 Oct 2024 02:18:54 +0200 Subject: [+] Button module with long / short press and release detection --- main/main.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'main/main.c') diff --git a/main/main.c b/main/main.c index 81a51b1..16e1ca6 100644 --- a/main/main.c +++ b/main/main.c @@ -1,11 +1,13 @@ -#include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/event_groups.h" #include "screen.h" #include "dpp_wifi.h" #include "time_sntp.h" +#include "button_handler.h" +struct Button* button; struct Screen screen; char t[4]; @@ -25,26 +27,38 @@ void setup_nvs() ESP_ERROR_CHECK(ret); } + void app_main(void) { + printf("Starting up...\n"); + configure_screen(&screen); display(&screen, "aaaa"); printf("Screen Configured!\n"); + setup_nvs(); display(&screen, "0aaa"); printf("NVS Flash Configured!\n"); - launch_dpp(); + + button = (struct Button*)malloc(sizeof(struct Button)); + button->time = 0; + setup_button(button); display(&screen, "00aa"); + printf("User Inputs Configured!\n"); + + launch_dpp(); + display(&screen, "000a"); printf("WiFi Configured!\n"); + set_tz("CET-1CEST,M3.5.0/2,M10.5.0/2"); - display(&screen, "000a"); sync_time(); display(&screen, "0000"); printf("SNTP Configured!\n"); + while(1){ refresh_screen(); - sleep(2); + vTaskDelay(2000 / portTICK_PERIOD_MS); } } \ No newline at end of file -- cgit v1.2.3