- Implemented main application entry point in main.cpp, initializing queues and event groups. - Created TouchHandler and EInkTouchHandler classes for handling touch events. - Added a minimal event loop for touch processing in touch.cpp. - Introduced unit tests for the hello world application in pytest_hello_world.py. - Added configuration files for CI and Wokwi support. - Created empty header files for network and UI modules.
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#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<EInkTouchHandler*>(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));
|
|
}
|
|
}
|