Ken Van Hoeylandt 2a2558b29a
Remove old HAL components and refactored GPS-related code (#583)
- 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.
2026-07-25 17:20:17 +02:00

54 lines
1.2 KiB
C++

// SPDX-License-Identifier: Apache-2.0
#include "sdl_input.h"
#include <tactility/device.h>
#include <tactility/driver.h>
#include <tactility/drivers/keyboard.h>
#include <tactility/module.h>
// region Driver lifecycle
static error_t start(Device*) { return ERROR_NONE; }
static error_t stop(Device*) { return ERROR_NONE; }
// endregion
// region KeyboardApi
static error_t sdl_keyboard_read_key(Device*, KeyboardKeyData* data) {
sdl_input_pump();
uint32_t key = 0;
if (sdl_input_pop_key(&key)) {
data->key = key;
data->pressed = true;
data->continue_reading = sdl_input_has_queued_key();
} else {
data->key = 0;
data->pressed = false;
data->continue_reading = false;
}
return ERROR_NONE;
}
// endregion
static const KeyboardApi sdl_keyboard_api = {
.read_key = sdl_keyboard_read_key,
.get_backlight = nullptr,
};
extern Module simulator_module;
Driver sdl_keyboard_driver = {
.name = "sdl-keyboard",
.compatible = (const char*[]) { "tactility,sdl-keyboard", nullptr },
.start_device = start,
.stop_device = stop,
.api = &sdl_keyboard_api,
.device_type = &KEYBOARD_TYPE,
.owner = &simulator_module,
.internal = nullptr
};