mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-17 23:55:04 +00:00
- Added generic GPS/GNSS support with device detection, configuration, and persistent settings. - Improved device and module lifecycle management. - Added flexible filesystem locking support for displays and storage. - Improved display-idle and keyboard backlight handling. - Updated architecture, driver, module, testing, and licensing documentation. - Removed old HAL device and related code.
30 lines
794 B
C++
30 lines
794 B
C++
// SPDX-License-Identifier: Apache-2.0
|
|
#include <tactility/drivers/keyboard.h>
|
|
#include <tactility/error.h>
|
|
#include <tactility/device.h>
|
|
|
|
#define KEYBOARD_DRIVER_API(driver) ((struct KeyboardApi*)driver->api)
|
|
|
|
extern "C" {
|
|
|
|
error_t keyboard_read_key(Device* device, KeyboardKeyData* data) {
|
|
const auto* driver = device_get_driver(device);
|
|
return KEYBOARD_DRIVER_API(driver)->read_key(device, data);
|
|
}
|
|
|
|
error_t keyboard_get_backlight(Device* device, Device** backlight_device) {
|
|
const auto* driver = device_get_driver(device);
|
|
|
|
if (KEYBOARD_DRIVER_API(driver)->get_backlight == nullptr) {
|
|
return ERROR_NOT_SUPPORTED;
|
|
}
|
|
|
|
return KEYBOARD_DRIVER_API(driver)->get_backlight(device, backlight_device);
|
|
}
|
|
|
|
const DeviceType KEYBOARD_TYPE {
|
|
.name = "keyboard"
|
|
};
|
|
|
|
}
|