Device migrations, drivers and fixes (#571)
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
This commit is contained in:
committed by
GitHub
parent
3b5a401594
commit
d896657bf9
@@ -20,7 +20,14 @@ enum DisplayCapability {
|
||||
DISPLAY_CAPABILITY_INVERT_COLOR = 1 << 3,
|
||||
DISPLAY_CAPABILITY_ON_OFF = 1 << 4,
|
||||
DISPLAY_CAPABILITY_BACKLIGHT = 1 << 5,
|
||||
DISPLAY_CAPABILITY_SLEEP = 1 << 6
|
||||
DISPLAY_CAPABILITY_SLEEP = 1 << 6,
|
||||
/**
|
||||
* Panel can only be written a full frame at a time (e.g. no row-address command, relying on
|
||||
* an internal auto-increment counter reset by writing the whole frame from the top every
|
||||
* time) - draw_bitmap() must always be called with the full resolution, never a sub-region.
|
||||
* LVGL-facing callers (see lvgl_display.c) must use LV_DISPLAY_RENDER_MODE_FULL for such panels.
|
||||
*/
|
||||
DISPLAY_CAPABILITY_REQUIRES_FULL_FRAME = 1 << 7
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -115,6 +122,24 @@ struct DisplayApi {
|
||||
*/
|
||||
error_t (*set_gap)(struct Device* device, int32_t x_gap, int32_t y_gap);
|
||||
|
||||
/**
|
||||
* @brief Gets the devicetree-configured baseline X gap (i.e. as set at LV_DISPLAY_ROTATION_0,
|
||||
* before any rotation-driven swap_xy/mirror changes) - not necessarily the last value passed
|
||||
* to set_gap(), which callers (e.g. lvgl_display.c on rotation change) may have since swapped.
|
||||
* @warning Function pointer should be null if capability not available.
|
||||
* @param[in] device the display device
|
||||
* @return the baseline X gap
|
||||
*/
|
||||
int32_t (*get_gap_x)(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Gets the devicetree-configured baseline Y gap. See get_gap_x() for details.
|
||||
* @warning Function pointer should be null if capability not available.
|
||||
* @param[in] device the display device
|
||||
* @return the baseline Y gap
|
||||
*/
|
||||
int32_t (*get_gap_y)(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Inverts the panel's color output.
|
||||
* @warning Function pointer should be null if capability not available.
|
||||
@@ -250,6 +275,18 @@ bool display_get_mirror_y(struct Device* device);
|
||||
*/
|
||||
error_t display_set_gap(struct Device* device, int32_t x_gap, int32_t y_gap);
|
||||
|
||||
/**
|
||||
* @brief Gets the devicetree-configured baseline X gap using the specified display. See
|
||||
* DisplayApi::get_gap_x() for details.
|
||||
*/
|
||||
int32_t display_get_gap_x(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Gets the devicetree-configured baseline Y gap using the specified display. See
|
||||
* DisplayApi::get_gap_y() for details.
|
||||
*/
|
||||
int32_t display_get_gap_y(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Inverts the panel's color output using the specified display.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/error.h>
|
||||
|
||||
/**
|
||||
* @brief API for haptic motor driver chips (e.g. ERM/LRA drivers with an onboard waveform
|
||||
* library, such as the TI DRV260x family).
|
||||
*/
|
||||
struct HapticApi {
|
||||
/**
|
||||
* @brief Sets one slot of the effect sequence played by start_playback().
|
||||
* @param[in] device the haptic device
|
||||
* @param[in] slot sequence slot index, driver-defined range (e.g. [0,7] for DRV260x)
|
||||
* @param[in] waveform waveform library index to play in this slot, 0 ends the sequence
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*set_waveform)(struct Device* device, uint8_t slot, uint8_t waveform);
|
||||
|
||||
/**
|
||||
* @brief Selects the onboard waveform library to play effects from.
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*select_library)(struct Device* device, uint8_t library);
|
||||
|
||||
/**
|
||||
* @brief Starts playback of the currently configured effect sequence.
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*start_playback)(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Stops playback.
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*stop_playback)(struct Device* device);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Sets one slot of the effect sequence using the specified haptic device.
|
||||
*/
|
||||
error_t haptic_set_waveform(struct Device* device, uint8_t slot, uint8_t waveform);
|
||||
|
||||
/**
|
||||
* @brief Selects the onboard waveform library using the specified haptic device.
|
||||
*/
|
||||
error_t haptic_select_library(struct Device* device, uint8_t library);
|
||||
|
||||
/**
|
||||
* @brief Starts playback using the specified haptic device.
|
||||
*/
|
||||
error_t haptic_start_playback(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Stops playback using the specified haptic device.
|
||||
*/
|
||||
error_t haptic_stop_playback(struct Device* device);
|
||||
|
||||
extern const struct DeviceType HAPTIC_TYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -17,15 +17,19 @@ extern "C" {
|
||||
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);
|
||||
|
||||
|
||||
@@ -60,6 +60,18 @@ error_t display_set_gap(Device* device, int32_t x_gap, int32_t y_gap) {
|
||||
return DISPLAY_DRIVER_API(driver)->set_gap(device, x_gap, y_gap);
|
||||
}
|
||||
|
||||
int32_t display_get_gap_x(Device* device) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
const auto* api = DISPLAY_DRIVER_API(driver);
|
||||
return api->get_gap_x != nullptr ? api->get_gap_x(device) : 0;
|
||||
}
|
||||
|
||||
int32_t display_get_gap_y(Device* device) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
const auto* api = DISPLAY_DRIVER_API(driver);
|
||||
return api->get_gap_y != nullptr ? api->get_gap_y(device) : 0;
|
||||
}
|
||||
|
||||
error_t display_invert_color(Device* device, bool invert_color_data) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return DISPLAY_DRIVER_API(driver)->invert_color(device, invert_color_data);
|
||||
@@ -102,7 +114,11 @@ uint8_t display_get_frame_buffer_count(Device* device) {
|
||||
|
||||
error_t display_get_backlight(Device* device, Device** backlight) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return DISPLAY_DRIVER_API(driver)->get_backlight(device, backlight);
|
||||
const auto* api = DISPLAY_DRIVER_API(driver);
|
||||
if (api->get_backlight == nullptr) {
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
return api->get_backlight(device, backlight);
|
||||
}
|
||||
|
||||
const struct DeviceType DISPLAY_TYPE {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <tactility/drivers/haptic.h>
|
||||
#include <tactility/device.h>
|
||||
|
||||
#define HAPTIC_DRIVER_API(driver) ((HapticApi*)driver->api)
|
||||
|
||||
extern "C" {
|
||||
|
||||
error_t haptic_set_waveform(Device* device, uint8_t slot, uint8_t waveform) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return HAPTIC_DRIVER_API(driver)->set_waveform(device, slot, waveform);
|
||||
}
|
||||
|
||||
error_t haptic_select_library(Device* device, uint8_t library) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return HAPTIC_DRIVER_API(driver)->select_library(device, library);
|
||||
}
|
||||
|
||||
error_t haptic_start_playback(Device* device) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return HAPTIC_DRIVER_API(driver)->start_playback(device);
|
||||
}
|
||||
|
||||
error_t haptic_stop_playback(Device* device) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return HAPTIC_DRIVER_API(driver)->stop_playback(device);
|
||||
}
|
||||
|
||||
const DeviceType HAPTIC_TYPE {
|
||||
.name = "haptic"
|
||||
};
|
||||
|
||||
}
|
||||
@@ -8,12 +8,20 @@ extern "C" {
|
||||
|
||||
error_t pointer_enter_sleep(struct Device* device) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return POINTER_DRIVER_API(driver)->enter_sleep(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);
|
||||
return POINTER_DRIVER_API(driver)->exit_sleep(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) {
|
||||
|
||||
Reference in New Issue
Block a user