Ken Van Hoeylandt acb2f1d4c7
Replace Tactility SystemEvents with new kernel implementation (#598)
TactilityKernel now has a system event API to replace the one from the Tactility subproject. It also implements several tests for it.
2026-07-29 17:31:20 +02:00

39 lines
927 B
C++

#include <lvgl/lvgl.h>
#include <tactility/module.h>
#include <tactility/system_event.h>
#include <Tactility/kernel/Kernel.h>
#include <lilygo/drivers/tpager_encoder_input.h>
constexpr auto* TAG = "T-Lora Pager";
extern "C" {
static void on_boot_completed(struct SystemEvent* /*event*/, void* /*context*/) {
// The kernel tpager_encoder device is already started by kernel_init(); this just
// registers it as an LVGL input device, which requires LVGL to be up first.
lvgl_lock();
tpager_encoder::init();
lvgl_unlock();
}
static error_t start() {
system_event_subscribe(KERNEL_EVENT_BOOT_COMPLETED, on_boot_completed, nullptr);
return ERROR_NONE;
}
static error_t stop() {
system_event_unsubscribe(KERNEL_EVENT_BOOT_COMPLETED, on_boot_completed);
return ERROR_NONE;
}
Module lilygo_tlora_pager_module = {
.name = "lilygo-tlora-pager",
.start = start,
.stop = stop
};
}