Create hal-device module, fix GPIO, fix tests, fix TactilityC (#471)

* **New Features**
  * Added a HAL device module providing device enumeration, type queries and a HAL↔kernel bridge.

* **Improvements**
  * Integrated HAL module into startup; standardized module names, includes and lifecycle logging; safer file append behavior; broader build support.

* **API Changes**
  * Driver lifecycle now uses explicit add/remove semantics; C and HAL device type/lookup APIs clarified.

* **Chores**
  * Added module README and Apache‑2.0 license; updated build configuration to include the new module.

* **Fixes**
  * Updated tests and object file handling to behave correctly.
This commit is contained in:
Ken Van Hoeylandt
2026-02-01 01:05:16 +01:00
committed by GitHub
parent 5993ceb232
commit 3fe1dc0312
74 changed files with 836 additions and 211 deletions
@@ -36,7 +36,7 @@ static bool initBoot() {
using namespace tt::hal;
static std::vector<std::shared_ptr<Device>> createDevices() {
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
createPower(),
ButtonControl::createOneButtonControl(0),
@@ -12,7 +12,7 @@ bool initBoot();
using namespace tt::hal;
static std::vector<std::shared_ptr<Device>> createDevices() {
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
createPower(),
createDisplay(),
@@ -1,6 +1,6 @@
#pragma once
#include <Tactility/hal/Device.h>
#include <tactility/hal/Device.h>
#include <Tactility/TactilityCore.h>
class KeyboardBacklightDevice final : public tt::hal::Device {
@@ -5,7 +5,7 @@
#include <Tactility/settings/KeyboardSettings.h>
#include <Tactility/settings/DisplaySettings.h>
#include <Tactility/hal/display/DisplayDevice.h>
#include <Tactility/hal/Device.h>
#include <tactility/hal/Device.h>
#include <Tactility/Logger.h>
#include <KeyboardBacklight/KeyboardBacklight.h>
@@ -1,6 +1,6 @@
#pragma once
#include <Tactility/hal/Device.h>
#include <tactility/hal/Device.h>
#include <lvgl.h>
class TrackballDevice : public tt::hal::Device {
@@ -9,7 +9,7 @@ bool initBoot();
using namespace tt::hal;
static std::vector<std::shared_ptr<Device>> createDevices() {
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
createPower(),
createDisplay(),
@@ -11,7 +11,7 @@ static bool initBoot() {
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
}
static std::vector<std::shared_ptr<Device>> createDevices() {
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
createDisplay(),
ButtonControl::createTwoButtonControl(35, 0)
@@ -10,7 +10,7 @@ bool initBoot();
using namespace tt::hal;
static std::vector<std::shared_ptr<Device>> createDevices() {
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
createDisplay(),
createSdCard()
@@ -22,7 +22,7 @@ static DeviceVector createDevices() {
auto tca8418 = std::make_shared<Tca8418>(I2C_NUM_0);
auto keyboard = std::make_shared<TpagerKeyboard>(tca8418);
return std::vector<std::shared_ptr<Device>> {
return std::vector<std::shared_ptr<tt::hal::Device>> {
tca8418,
std::make_shared<Bq25896>(I2C_NUM_0),
bq27220,
+2 -2
View File
@@ -9,14 +9,14 @@ extern Driver tlora_pager_driver;
static error_t start() {
/* We crash when construct fails, because if a single driver fails to construct,
* there is no guarantee that the previously constructed drivers can be destroyed */
check(driver_construct(&tlora_pager_driver) == ERROR_NONE);
check(driver_construct_add(&tlora_pager_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
/* We crash when destruct fails, because if a single driver fails to destruct,
* there is no guarantee that the previously destroyed drivers can be recovered */
check(driver_destruct(&tlora_pager_driver) == ERROR_NONE);
check(driver_remove_destruct(&tlora_pager_driver) == ERROR_NONE);
return ERROR_NONE;
}
+1 -1
View File
@@ -28,7 +28,7 @@ static void deinitPower() {
#endif
}
static std::vector<std::shared_ptr<Device>> createDevices() {
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
std::make_shared<SdlDisplay>(),
std::make_shared<SdlKeyboard>(),
@@ -10,7 +10,7 @@ bool initBoot();
using namespace tt::hal;
static std::vector<std::shared_ptr<Device>> createDevices() {
static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
return {
createDisplay(),
createSdCard()