mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-17 23:55:04 +00:00
Fixes
This commit is contained in:
parent
abc42be9be
commit
c903c5c432
@ -10,6 +10,7 @@
|
||||
#include <tactility/time.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace gps_ublox {
|
||||
|
||||
|
||||
@ -406,7 +406,7 @@ void run(Module* dtsModules[], DtsDevice dtsDevices[]) {
|
||||
});
|
||||
check(module_construct(&lvgl_module) == ERROR_NONE);
|
||||
check(module_add(&lvgl_module) == ERROR_NONE);
|
||||
module_start(&lvgl_module);
|
||||
check(module_start(&lvgl_module) == ERROR_NONE);
|
||||
|
||||
registerAndStartSecondaryServices();
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ class KeyboardIdleService final : public Service {
|
||||
bool keyboardDimmed = false;
|
||||
settings::keyboard::KeyboardSettings cachedKeyboardSettings;
|
||||
|
||||
// TODO: This only works for the fist active keyboard. Update it so it works for all keyboards with a backlight.
|
||||
static Device* getKeyboardBacklight() {
|
||||
::Device* keyboard;
|
||||
if (device_get_first_active_by_type(&KEYBOARD_TYPE, &keyboard) == ERROR_NONE) {
|
||||
@ -31,13 +32,19 @@ class KeyboardIdleService final : public Service {
|
||||
return backlight; // WARNING: did not increase refcount
|
||||
}
|
||||
// TODO: Remove after all drivers are migrated
|
||||
return device_find_by_name("keyboard_backlight");
|
||||
::Device* backlight;
|
||||
if (device_get_by_name("keyboard_backlight", &backlight) != ERROR_NONE) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return backlight;
|
||||
}
|
||||
|
||||
void setKeyboardBacklightBrightness(uint8_t brightness) {
|
||||
Device* backlight = getKeyboardBacklight();
|
||||
if (backlight != nullptr) {
|
||||
backlight_set_brightness(backlight, brightness);
|
||||
device_put(backlight);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,6 +57,9 @@ class KeyboardIdleService final : public Service {
|
||||
if (lvgl_try_lock(100)) {
|
||||
inactive_ms = lv_display_get_inactive_time(nullptr);
|
||||
lvgl_unlock();
|
||||
} else {
|
||||
// Assume it's not used
|
||||
inactive_ms = 100;
|
||||
}
|
||||
|
||||
// Handle keyboard backlight
|
||||
|
||||
@ -388,7 +388,7 @@ error_t device_get_first_by_type(const struct DeviceType* type, struct Device**
|
||||
* @param[in] type non-null device type pointer
|
||||
* @param[out] out_device receives the found device on success; untouched on failure
|
||||
* @retval ERROR_NOT_FOUND if no started device of that type exists
|
||||
* @retval ERROR_NONE on success; caller must call device_put(*out_device) exactly once
|
||||
* @retval ERROR_NONE if a started device of that type exists; must call device_put() exactly once afterwards.
|
||||
*/
|
||||
error_t device_get_first_active_by_type(const struct DeviceType* type, struct Device** out_device);
|
||||
|
||||
@ -397,7 +397,7 @@ error_t device_get_first_active_by_type(const struct DeviceType* type, struct De
|
||||
*
|
||||
* @param[in] type non-null device type pointer
|
||||
* @retval ERROR_NOT_FOUND if no started device of that type exists
|
||||
* @retval ERROR_NONE on success; caller must call device_put(*out_device) exactly once
|
||||
* @retval ERROR_NONE if a started device of that type exists
|
||||
*/
|
||||
bool device_has_active_by_type(const struct DeviceType* type);
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ struct KeyboardApi {
|
||||
|
||||
/**
|
||||
* @brief Returns the baclight if the keyboard has one.
|
||||
* @warning Returns a referenced device. Must call device_put() afterwards.
|
||||
* @param[in] device the keyboard device
|
||||
* @param[out] backlight_device the output backlight device
|
||||
* @retval ERROR_NONE when the backlight_device was set
|
||||
@ -55,6 +56,7 @@ error_t keyboard_read_key(struct Device* device, struct KeyboardKeyData* data);
|
||||
|
||||
/**
|
||||
* @brief Returns the backlight if the keyboard has one.
|
||||
* @warning Returns a referenced device. Must call device_put() afterwards.
|
||||
* @param[in] device the keyboard device
|
||||
* @param[out] backlight_device the output backlight device
|
||||
* @retval ERROR_NONE when the backlight_device was set
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user