resistance touch lcd

This commit is contained in:
2026-07-03 11:22:17 +08:00
commit bf249faed0
8 changed files with 336 additions and 0 deletions

34
main/main.c Normal file
View File

@@ -0,0 +1,34 @@
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "resistive_touch.h"
static const char *TAG = "touch";
void app_main(void)
{
bool was_pressed = false;
resistive_touch_init();
ESP_LOGI(TAG, "resistive touch terminal output started");
while (1) {
resistive_touch_point_t point;
if (resistive_touch_read(&point)) {
if (!was_pressed) {
ESP_LOGI(TAG, "TOUCH DOWN");
}
ESP_LOGI(TAG, "TOUCH POINT x=%u y=%u raw_x=%u raw_y=%u",
point.x, point.y, point.raw_x, point.raw_y);
was_pressed = true;
} else if (was_pressed && !resistive_touch_is_pressed()) {
ESP_LOGI(TAG, "TOUCH UP");
was_pressed = false;
}
vTaskDelay(pdMS_TO_TICKS(50));
}
}