Add main application logic and touch handling functionality
- 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.
This commit is contained in:
62
main/display/display.cpp
Normal file
62
main/display/display.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "display.h"
|
||||
#include "common/constants.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/event_groups.h"
|
||||
// TODO: implement actual display functionality
|
||||
|
||||
DisplayHandler::DisplayHandler(QueueHandle_t touch_queue, SemaphoreHandle_t lvgl_mutex) {
|
||||
(void)touch_queue;
|
||||
(void)lvgl_mutex;
|
||||
}
|
||||
|
||||
DisplayHandler::~DisplayHandler() { }
|
||||
|
||||
EInkDisplayHandler::EInkDisplayHandler(QueueHandle_t touch_queue, SemaphoreHandle_t lvgl_mutex)
|
||||
: DisplayHandler(touch_queue, lvgl_mutex) { }
|
||||
|
||||
EInkDisplayHandler::~EInkDisplayHandler() { }
|
||||
|
||||
void EInkDisplayHandler::init(EventGroupHandle_t system_event_group) {
|
||||
if (system_event_group != NULL) {
|
||||
xEventGroupSetBits(system_event_group, DISPLAY_READY_BIT);
|
||||
}
|
||||
}
|
||||
void EInkDisplayHandler::start_event_loop() {
|
||||
// Minimal background task to represent display processing
|
||||
xTaskCreate(
|
||||
// use the static adapter and pass `this` as the task parameter
|
||||
EInkDisplayHandler::task_adapter,
|
||||
"display_task",
|
||||
2048,
|
||||
this,
|
||||
tskIDLE_PRIORITY + 1,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
|
||||
// static
|
||||
void EInkDisplayHandler::task_adapter(void* arg) {
|
||||
EInkDisplayHandler* self = static_cast<EInkDisplayHandler*>(arg);
|
||||
if (self) {
|
||||
self->run_event_loop();
|
||||
} else {
|
||||
printf("EInkDisplayHandler::task_adapter received null pointer\n");
|
||||
}
|
||||
// If run_event_loop ever returns, delete the task.
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
void EInkDisplayHandler::run_event_loop() {
|
||||
for (;;) {
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
}
|
||||
|
||||
shutdown_display_handlerFunc EInkDisplayHandler::get_shutdown_display_handler() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
restart_display_handlerFunc EInkDisplayHandler::get_restart_display_handler() {
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user