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
60 lines
1.7 KiB
C
60 lines
1.7 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <tactility/drivers/gpio.h>
|
|
#include <tactility/error.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
struct Device;
|
|
struct DeviceType;
|
|
|
|
struct TpagerEncoderConfig {
|
|
struct GpioPinSpec pin_a;
|
|
struct GpioPinSpec pin_b;
|
|
struct GpioPinSpec pin_enter;
|
|
};
|
|
|
|
/**
|
|
* @brief API for the T-Lora Pager encoder wheel driver.
|
|
* Reports raw, unscaled pulses: pulses-per-detent scaling and enter-press debounce are UI
|
|
* concerns layered on top by the consumer, not something this driver knows about.
|
|
*/
|
|
struct TpagerEncoderApi {
|
|
/**
|
|
* @brief Reads the accumulated pulse count since the last read, then resets it to zero.
|
|
* @param[in] device the encoder device
|
|
* @param[out] out_pulses accumulated quadrature pulses (positive/negative by direction)
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*read_delta)(struct Device* device, int32_t* out_pulses);
|
|
|
|
/**
|
|
* @brief Gets whether the enter button is currently pressed.
|
|
* @param[in] device the encoder device
|
|
* @param[out] out_pressed true when pressed
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*get_button_pressed)(struct Device* device, bool* out_pressed);
|
|
};
|
|
|
|
/**
|
|
* @brief Reads the accumulated pulse count using the specified encoder device.
|
|
*/
|
|
error_t tpager_encoder_read_delta(struct Device* device, int32_t* out_pulses);
|
|
|
|
/**
|
|
* @brief Gets whether the enter button is currently pressed on the specified encoder device.
|
|
*/
|
|
error_t tpager_encoder_get_button_pressed(struct Device* device, bool* out_pressed);
|
|
|
|
extern const struct DeviceType TPAGER_ENCODER_TYPE;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|