mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-18 07:55:06 +00:00
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
156 lines
5.4 KiB
C
156 lines
5.4 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <tactility/device.h>
|
|
#include <tactility/error.h>
|
|
#include <tactility/freertos/freertos.h>
|
|
|
|
/**
|
|
* @brief API for pointer controller drivers.
|
|
*/
|
|
struct PointerApi {
|
|
/**
|
|
* @brief Puts the pointer controller into its low-power sleep mode.
|
|
* @warning Function pointer should be null if not supported by the underlying protocol.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
* @retval ERROR_NOT_SUPPORTED when this controller has no sleep mode
|
|
*/
|
|
error_t (*enter_sleep)(struct Device* device);
|
|
|
|
/**
|
|
* @brief Wakes the pointer controller from sleep mode.
|
|
* @warning Function pointer should be null if not supported by the underlying protocol.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
* @retval ERROR_NOT_SUPPORTED when this controller has no sleep mode
|
|
*/
|
|
error_t (*exit_sleep)(struct Device* device);
|
|
|
|
/**
|
|
* @brief Performs a blocking read of the latest touch data from the controller into its internal state.
|
|
* Call this before get_touched_points().
|
|
* @param[in] device the pointer device
|
|
* @param[in] timeout the maximum time to wait for the operation to complete
|
|
* @retval ERROR_NONE when the read operation was successful
|
|
* @retval ERROR_TIMEOUT when the operation timed out
|
|
*/
|
|
error_t (*read_data)(struct Device* device, TickType_t timeout);
|
|
|
|
/**
|
|
* @brief Retrieves the coordinates most recently read by read_data().
|
|
* @param[in] device the pointer device
|
|
* @param[out] x array of X coordinates
|
|
* @param[out] y array of Y coordinates
|
|
* @param[out] strength optional array of touch strengths (nullable)
|
|
* @param[out] point_count the number of points currently touched
|
|
* @param[in] max_point_count the maximum number of points the arrays can hold
|
|
* @return true when touched and coordinates are available
|
|
*/
|
|
bool (*get_touched_points)(struct Device* device, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_count, uint8_t max_point_count);
|
|
|
|
/**
|
|
* @brief Sets whether the X and Y axes should be swapped.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*set_swap_xy)(struct Device* device, bool swap);
|
|
|
|
/**
|
|
* @brief Gets whether the X and Y axes are swapped.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*get_swap_xy)(struct Device* device, bool* swap);
|
|
|
|
/**
|
|
* @brief Sets whether the X axis should be mirrored.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*set_mirror_x)(struct Device* device, bool mirror);
|
|
|
|
/**
|
|
* @brief Gets whether the X axis is mirrored.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*get_mirror_x)(struct Device* device, bool* mirror);
|
|
|
|
/**
|
|
* @brief Sets whether the Y axis should be mirrored.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*set_mirror_y)(struct Device* device, bool mirror);
|
|
|
|
/**
|
|
* @brief Gets whether the Y axis is mirrored.
|
|
* @param[in] device the pointer device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*get_mirror_y)(struct Device* device, bool* mirror);
|
|
};
|
|
|
|
/**
|
|
* @brief Puts the pointer controller into its low-power sleep mode using the specified pointer device.
|
|
*/
|
|
error_t pointer_enter_sleep(struct Device* device);
|
|
|
|
/**
|
|
* @brief Wakes the pointer controller from sleep mode using the specified pointer device.
|
|
*/
|
|
error_t pointer_exit_sleep(struct Device* device);
|
|
|
|
/**
|
|
* @brief Performs a blocking read of the latest touch data using the specified pointer device.
|
|
*/
|
|
error_t pointer_read_data(struct Device* device, TickType_t timeout);
|
|
|
|
/**
|
|
* @brief Retrieves the coordinates most recently read using the specified pointer device.
|
|
*/
|
|
bool pointer_get_touched_points(struct Device* device, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_count, uint8_t max_point_count);
|
|
|
|
/**
|
|
* @brief Sets whether the X and Y axes should be swapped using the specified pointer device.
|
|
*/
|
|
error_t pointer_set_swap_xy(struct Device* device, bool swap);
|
|
|
|
/**
|
|
* @brief Gets whether the X and Y axes are swapped using the specified pointer device.
|
|
*/
|
|
error_t pointer_get_swap_xy(struct Device* device, bool* swap);
|
|
|
|
/**
|
|
* @brief Sets whether the X axis should be mirrored using the specified pointer device.
|
|
*/
|
|
error_t pointer_set_mirror_x(struct Device* device, bool mirror);
|
|
|
|
/**
|
|
* @brief Gets whether the X axis is mirrored using the specified pointer device.
|
|
*/
|
|
error_t pointer_get_mirror_x(struct Device* device, bool* mirror);
|
|
|
|
/**
|
|
* @brief Sets whether the Y axis should be mirrored using the specified pointer device.
|
|
*/
|
|
error_t pointer_set_mirror_y(struct Device* device, bool mirror);
|
|
|
|
/**
|
|
* @brief Gets whether the Y axis is mirrored using the specified pointer device.
|
|
*/
|
|
error_t pointer_get_mirror_y(struct Device* device, bool* mirror);
|
|
|
|
extern const struct DeviceType POINTER_TYPE;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|