d896657bf9
Device migrations: - cyd-4848S040c - guition-jc1060p470ciwy - guition-jc2432w328c - guition-jc3248w535c (known issue with display and touch, Shadowtrance will look into it) - guition-jc8048w550c - heltec-wifi-lora-32-v3 - lilygo-tdeck-max (excluding graphics) - lilygo-tdisplay - lilygo-tdisplay-s3 - lilygo-tdongle-s3 - lilygo-tlora-pager Driver migrations: - Implemented haptic driver interface in kernel - AXS15231b - BQ25896 - BQ27220 - CST328 - CST6xx - DRV2605 - JD9165 - Custom LilyGO driver for T-Lora Pager - SSD1306 - ST7701 - ST7735 - SY6970 - TCA8418 Fixes/improvements: - Boot app: support for multiple power devices, improved UI - lvgl_devices and related code: fixes for mapping - Support for arrays in dts parser
72 lines
2.3 KiB
C++
72 lines
2.3 KiB
C++
// SPDX-License-Identifier: Apache-2.0
|
|
#include <tactility/drivers/pointer.h>
|
|
#include <tactility/device.h>
|
|
|
|
#define POINTER_DRIVER_API(driver) ((struct PointerApi*)driver->api)
|
|
|
|
extern "C" {
|
|
|
|
error_t pointer_enter_sleep(struct Device* device) {
|
|
const auto* driver = device_get_driver(device);
|
|
const auto* api = POINTER_DRIVER_API(driver);
|
|
if (api->enter_sleep == nullptr) {
|
|
return ERROR_NOT_SUPPORTED;
|
|
}
|
|
return api->enter_sleep(device);
|
|
}
|
|
|
|
error_t pointer_exit_sleep(Device* device) {
|
|
const auto* driver = device_get_driver(device);
|
|
const auto* api = POINTER_DRIVER_API(driver);
|
|
if (api->exit_sleep == nullptr) {
|
|
return ERROR_NOT_SUPPORTED;
|
|
}
|
|
return api->exit_sleep(device);
|
|
}
|
|
|
|
error_t pointer_read_data(Device* device, TickType_t timeout) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->read_data(device, timeout);
|
|
}
|
|
|
|
bool pointer_get_touched_points(Device* device, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_count, uint8_t max_point_count) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->get_touched_points(device, x, y, strength, point_count, max_point_count);
|
|
}
|
|
|
|
error_t pointer_set_swap_xy(Device* device, bool swap) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->set_swap_xy(device, swap);
|
|
}
|
|
|
|
error_t pointer_get_swap_xy(Device* device, bool* swap) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->get_swap_xy(device, swap);
|
|
}
|
|
|
|
error_t pointer_set_mirror_x(Device* device, bool mirror) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->set_mirror_x(device, mirror);
|
|
}
|
|
|
|
error_t pointer_get_mirror_x(Device* device, bool* mirror) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->get_mirror_x(device, mirror);
|
|
}
|
|
|
|
error_t pointer_set_mirror_y(Device* device, bool mirror) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->set_mirror_y(device, mirror);
|
|
}
|
|
|
|
error_t pointer_get_mirror_y(Device* device, bool* mirror) {
|
|
const auto* driver = device_get_driver(device);
|
|
return POINTER_DRIVER_API(driver)->get_mirror_y(device, mirror);
|
|
}
|
|
|
|
const struct DeviceType POINTER_TYPE {
|
|
.name = "pointer"
|
|
};
|
|
|
|
}
|