#include "touch.h" #include "common/constants.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/event_groups.h" // TODO: implement actual touch functionality TouchHandler::TouchHandler(QueueHandle_t touch_queue) { (void)touch_queue; } TouchHandler::~TouchHandler() { } EInkTouchHandler::EInkTouchHandler(QueueHandle_t touch_queue) : TouchHandler(touch_queue) { } EInkTouchHandler::~EInkTouchHandler() { } void EInkTouchHandler::init(EventGroupHandle_t system_event_group) { if (system_event_group != NULL) { xEventGroupSetBits(system_event_group, TOUCH_CALIBRATED_BIT); } } void EInkTouchHandler::start_event_loop() { // Minimal background task to represent touch processing xTaskCreate( // use static adapter and pass `this` as task parameter EInkTouchHandler::task_adapter, "touch_task", 2048, this, tskIDLE_PRIORITY + 1, nullptr ); } // static void EInkTouchHandler::task_adapter(void* arg) { EInkTouchHandler* self = static_cast(arg); if (self) { self->run_event_loop(); } else { printf("EInkTouchHandler::task_adapter received null pointer\n"); } vTaskDelete(NULL); } void EInkTouchHandler::run_event_loop() { for (;;) { vTaskDelay(pdMS_TO_TICKS(1000)); } }