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:
42
main/display/display.h
Normal file
42
main/display/display.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "info/info.h"
|
||||
|
||||
typedef void (*shutdown_display_handlerFunc)(void);
|
||||
typedef void (*restart_display_handlerFunc)(void);
|
||||
|
||||
class DisplayHandler {
|
||||
public:
|
||||
DisplayHandler(QueueHandle_t touch_queue, SemaphoreHandle_t lvgl_mutex);
|
||||
// the system_event_group is used to set display-ready bit
|
||||
virtual void init(EventGroupHandle_t system_event_group) = 0;
|
||||
virtual void start_event_loop() = 0;
|
||||
// get a handler to perform display shutdown cleanup, this is called after event loop ends and DisplayHandler is deleted
|
||||
virtual shutdown_display_handlerFunc get_shutdown_display_handler() = 0;
|
||||
virtual restart_display_handlerFunc get_restart_display_handler() = 0;
|
||||
virtual ~DisplayHandler() = 0;
|
||||
|
||||
private:
|
||||
DisplayHandler(const DisplayHandler&) = delete;
|
||||
DisplayHandler& operator=(const DisplayHandler&) = delete;
|
||||
};
|
||||
|
||||
class EInkDisplayHandler : public DisplayHandler {
|
||||
public:
|
||||
EInkDisplayHandler(QueueHandle_t touch_queue, SemaphoreHandle_t lvgl_mutex);
|
||||
void init(EventGroupHandle_t system_event_group) override;
|
||||
void start_event_loop() override;
|
||||
shutdown_display_handlerFunc get_shutdown_display_handler() override;
|
||||
restart_display_handlerFunc get_restart_display_handler() override;
|
||||
~EInkDisplayHandler() override;
|
||||
|
||||
private:
|
||||
// Task adapter used for FreeRTOS task creation. It forwards to the
|
||||
// instance `run_event_loop()` method using the `this` pointer passed
|
||||
// as the task parameter.
|
||||
static void task_adapter(void* arg);
|
||||
|
||||
// Instance method that implements the display task loop.
|
||||
void run_event_loop();
|
||||
// prevent copying
|
||||
EInkDisplayHandler(const EInkDisplayHandler&) = delete;
|
||||
EInkDisplayHandler& operator=(const EInkDisplayHandler&) = delete;
|
||||
};
|
||||
Reference in New Issue
Block a user