mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-18 16:05:05 +00:00
- 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
25 lines
716 B
C++
25 lines
716 B
C++
// SPDX-License-Identifier: Apache-2.0
|
|
#include <tactility/device.h>
|
|
#include <tactility/drivers/trackball.h>
|
|
#include <tactility/error.h>
|
|
|
|
#define TRACKBALL_DRIVER_API(driver) ((struct TrackballApi*)driver->api)
|
|
|
|
extern "C" {
|
|
|
|
error_t trackball_read_delta(Device* device, int32_t* out_dx, int32_t* out_dy) {
|
|
const auto* driver = device_get_driver(device);
|
|
return TRACKBALL_DRIVER_API(driver)->read_delta(device, out_dx, out_dy);
|
|
}
|
|
|
|
error_t trackball_get_button_pressed(Device* device, bool* out_pressed) {
|
|
const auto* driver = device_get_driver(device);
|
|
return TRACKBALL_DRIVER_API(driver)->get_button_pressed(device, out_pressed);
|
|
}
|
|
|
|
const DeviceType TRACKBALL_TYPE {
|
|
.name = "trackball"
|
|
};
|
|
|
|
}
|