mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 19:05:07 +00:00
- 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]
41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
// SPDX-License-Identifier: Apache-2.0
|
|
#include <tactility/drivers/backlight.h>
|
|
#include <tactility/device.h>
|
|
|
|
#define BACKLIGHT_DRIVER_API(driver) ((struct BacklightApi*)driver->api)
|
|
|
|
extern "C" {
|
|
|
|
error_t backlight_set_brightness(Device* device, uint8_t brightness) {
|
|
const auto* driver = device_get_driver(device);
|
|
return BACKLIGHT_DRIVER_API(driver)->set_brightness(device, brightness);
|
|
}
|
|
|
|
error_t backlight_set_brightness_default(Device* device) {
|
|
const auto* driver = device_get_driver(device);
|
|
return BACKLIGHT_DRIVER_API(driver)->set_brightness_default(device);
|
|
}
|
|
|
|
error_t backlight_get_brightness(Device* device, uint8_t* out_brightness) {
|
|
const auto* driver = device_get_driver(device);
|
|
return BACKLIGHT_DRIVER_API(driver)->get_brightness(device, out_brightness);
|
|
}
|
|
|
|
uint8_t backlight_get_min_brightness(Device* device) {
|
|
const auto* driver = device_get_driver(device);
|
|
auto* function = BACKLIGHT_DRIVER_API(driver)->get_min_brightness;
|
|
return function ? function(device) : 0;
|
|
}
|
|
|
|
uint8_t backlight_get_max_brightness(Device* device) {
|
|
const auto* driver = device_get_driver(device);
|
|
auto* function = BACKLIGHT_DRIVER_API(driver)->get_max_brightness;
|
|
return function ? function(device) : 255;
|
|
}
|
|
|
|
const DeviceType BACKLIGHT_TYPE {
|
|
.name = "backlight",
|
|
};
|
|
|
|
}
|