Trackball rewrite (#600)
- Implement generic trackball settings - Refactor T-Deck trackball driver into generic driver at `Drivers/gpio-trackball-module` - Automatically bind/unbind trackball devices with LVGL - Automatically load settings for trackball devices on boot
This commit is contained in:
committed by
GitHub
parent
de6fc3b346
commit
c729e8340f
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <new>
|
||||
|
||||
struct Device;
|
||||
|
||||
/**
|
||||
* Common driver-data wrapper attached to every LVGL display/indev created by this module: bundles
|
||||
* the kernel Device* with an optional device-type-specific context blob (LvglDisplayCtx,
|
||||
* LvglPointerCtx, LvglTrackballCtx, ...), so each device type doesn't have to store its own Device*
|
||||
* redundantly. Owns context: any resources referenced through it (buffers, cursor objects, etc.)
|
||||
* must be released by the caller before the wrapper is deleted, since context is trivially
|
||||
* destructible and only its own memory is freed here.
|
||||
*/
|
||||
struct LvglDeviceContext {
|
||||
struct Device* device = nullptr;
|
||||
void* context;
|
||||
|
||||
explicit LvglDeviceContext(void* context) : context(context) {}
|
||||
|
||||
~LvglDeviceContext() {
|
||||
if (context != nullptr) {
|
||||
::operator delete(context);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user