]> vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

git git / sw / tic2json.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6477495)
embedded: esptic: add LED heartbeat task
2021年9月27日 10:22:03 +0000 (12:22 +0200)
2021年9月28日 13:53:00 +0000 (15:53 +0200)

diff --git a/embedded/ESP-RTOS/esptic/main/Kconfig b/embedded/ESP-RTOS/esptic/main/Kconfig
index 97a7c9204b6667a577ad19ee02f540d1c5834ff3..935303e7598c406b573bb5570b1454fce69da7bb 100644 (file)
--- a/embedded/ESP-RTOS/esptic/main/Kconfig
+++ b/embedded/ESP-RTOS/esptic/main/Kconfig
@@ -33,5 +33,9 @@ config ESPTIC_UDP_PORT
string "UDP remote port"
default "8094"
+config ESPTIC_LED_GPIO_NUM
+ int "LED GPIO NUM"
+ default 2
+
endmenu
diff --git a/embedded/ESP-RTOS/esptic/main/main.c b/embedded/ESP-RTOS/esptic/main/main.c
index e0cfe8318603ec4f22087b5f7bb836ed5cbd9e08..8a73f18442a7a9cca1b56df5d01b3bc6938f57a2 100644 (file)
--- a/embedded/ESP-RTOS/esptic/main/main.c
+++ b/embedded/ESP-RTOS/esptic/main/main.c
@@ -24,6 +24,7 @@
#include "esp_vfs_dev.h"
#include "esp_log.h"
#include "driver/uart.h"
+#include "driver/gpio.h"
#include "lwip/err.h"
#include "lwip/sockets.h"
@@ -33,6 +34,7 @@
#define XSTR(s) STR(s)
#define STR(s) #s
+#define LED_GPIO CONFIG_ESPTIC_LED_GPIO_NUM
#define UDPBUFSIZE 1432 // avoid fragmentation
static const char * TAG = "esptic";
@@ -105,6 +107,19 @@ static void tic_task(void *pvParameter)
tic2json_main(yyin, buf, UDPBUFSIZE, ticframecb);
}
+static void ledhb_task(void *pvParameter)
+{
+ uint32_t level = 0;
+
+ gpio_set_direction(LED_GPIO, GPIO_MODE_OUTPUT);
+
+ while (1) {
+ gpio_set_level(LED_GPIO, level);
+ level = !level;
+ vTaskDelay(1000 / portTICK_RATE_MS);
+ }
+}
+
void app_main(void)
{
BaseType_t ret;
@@ -136,5 +151,7 @@ void app_main(void)
abort();
}
+ xTaskCreate(&ledhb_task, "lhb", 512, NULL, 1, NULL);
+
ESP_LOGI(TAG, "Rock'n'roll");
}
tic2json TIC parser/converter
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /