Ken Van Hoeylandt def65ef899
CL-32 v0.4 implementation + split v0.2/v0.3 (#683)
- Implement ST7305 driver at `Drivers/st7305-module`
- Rename `cl32` device project to `cl32-v02-v03` and removed v0.4 drivers
- Implement CL-32 v0.4 device as `cl32-v04`: display, keyboard, backlight/frontlight driver and power supply
- Remove `TT_LAUNCHER_APP_ID` (it was always the same setting)
- Remove `TT_LVGL_STATUSBAR_COLORS_INVERTED` (unused since recent changes)
- Wi-Fi only refreshes once, so users can navigate with the keyboard through the results, without constently resetting focus/selection. After initial scan, manual scans can be requested via the toolbar.
- Themes: material and material_mono theme don't show post-selection border animation anymore. It looks weird on monochrome devices and it doesn't add anything on other devices either.
- Made `merge.sh` executable
- backlight driver API change: min/max brightness functions are now optional, defaults to [0, 255]
2026-10-10 00:51:20 +02:00

99 lines
3.2 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>
/**
* @brief Inclusive range of brightness levels accepted by a backlight driver.
*/
struct BrightnessLevelRange {
uint8_t min;
uint8_t max;
};
/**
* @brief API for backlight drivers.
*
* @note The minimum brightness level (see get_min_brightness()) turns the backlight fully off.
* There is no separate on/off control: to turn the backlight off, call set_brightness() with
* the minimum value; to turn it back on, set any value above the minimum.
*/
struct BacklightApi {
/**
* @brief Sets the backlight brightness.
* @param[in] device the backlight device
* @param[in] brightness the brightness level, expected to be within [get_min_brightness(), get_max_brightness()]
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_brightness)(struct Device* device, uint8_t brightness);
/**
* @brief Sets the backlight brightness to its devicetree-configured default level.
* @param[in] device the backlight device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_brightness_default)(struct Device* device);
/**
* @brief Gets the current backlight brightness.
* @param[in] device the backlight device
* @param[out] out_brightness the current brightness level
* @retval ERROR_NONE when the operation was successful
*/
error_t (*get_brightness)(struct Device* device, uint8_t* out_brightness);
/**
* @brief Gets the minimum brightness level. Setting the brightness to this value turns the backlight off.
* This function is optional. If not present, 0 is assumed as minimum.
* @param[in] device the backlight device
* @return the minimum brightness level
*/
uint8_t (*get_min_brightness)(struct Device* device);
/**
* @brief Gets the maximum (full-strength) brightness level.
* This function is optional. If not present, 255 is assumed as maximum.
* @param[in] device the backlight device
* @return the maximum brightness level
*/
uint8_t (*get_max_brightness)(struct Device* device);
};
/**
* @brief Sets the backlight brightness using the specified backlight device.
*/
error_t backlight_set_brightness(struct Device* device, uint8_t brightness);
/**
* @brief Sets the backlight brightness to its devicetree-configured default level using the specified backlight device.
*/
error_t backlight_set_brightness_default(struct Device* device);
/**
* @brief Gets the current backlight brightness using the specified backlight device.
*/
error_t backlight_get_brightness(struct Device* device, uint8_t* out_brightness);
/**
* @brief Gets the minimum brightness level using the specified backlight device. This level turns the backlight off.
*/
uint8_t backlight_get_min_brightness(struct Device* device);
/**
* @brief Gets the maximum brightness level using the specified backlight device.
*/
uint8_t backlight_get_max_brightness(struct Device* device);
extern const struct DeviceType BACKLIGHT_TYPE;
#ifdef __cplusplus
}
#endif