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
+2 -2
View File
@@ -15,7 +15,7 @@ typedef enum {
DEVICE_TYPE_KEYBOARD,
DEVICE_TYPE_POWER,
DEVICE_TYPE_GPS
} DeviceType;
} TtDeviceType;
typedef uint32_t DeviceId;
@@ -27,7 +27,7 @@ typedef uint32_t DeviceId;
* @param[in] maxCount the maximum number of items that the "deviceIds" output can contain (minimum value is 1)
* @return true if one or more devices were found
*/
bool tt_hal_device_find(DeviceType type, DeviceId* deviceIds, uint16_t* count, uint16_t maxCount);
bool tt_hal_device_find(TtDeviceType type, DeviceId* deviceIds, uint16_t* count, uint16_t maxCount);
#ifdef __cplusplus
}
+3 -3
View File
@@ -2,9 +2,9 @@
#include <tactility/check.h>
#include <Tactility/hal/Device.h>
#include <tactility/hal/Device.h>
static tt::hal::Device::Type toTactilityDeviceType(DeviceType type) {
static tt::hal::Device::Type toTactilityDeviceType(TtDeviceType type) {
switch (type) {
case DEVICE_TYPE_I2C:
return tt::hal::Device::Type::I2c;
@@ -27,7 +27,7 @@ static tt::hal::Device::Type toTactilityDeviceType(DeviceType type) {
extern "C" {
bool tt_hal_device_find(DeviceType type, DeviceId* deviceIds, uint16_t* count, uint16_t maxCount) {
bool tt_hal_device_find(TtDeviceType type, DeviceId* deviceIds, uint16_t* count, uint16_t maxCount) {
assert(maxCount > 0);
int16_t currentIndex = -1;
+1 -1
View File
@@ -2,7 +2,7 @@
#include <tactility/check.h>
#include <Tactility/hal/Device.h>
#include <tactility/hal/Device.h>
#include <Tactility/hal/display/DisplayDevice.h>
#include <Tactility/hal/display/DisplayDriver.h>
+2 -2
View File
@@ -24,7 +24,7 @@ bool tt_hal_gpio_get_level(GpioPin pin) {
Device* device_result = find_first_gpio_controller();
if (device_result == nullptr) return false;
bool pin_state = false;
if (!gpio_controller_get_level(device_result, pin, &pin_state)) return false;
if (gpio_controller_get_level(device_result, pin, &pin_state) != ERROR_NONE) return false;
return pin_state;
}
@@ -32,7 +32,7 @@ int tt_hal_gpio_get_pin_count() {
Device* device_result = find_first_gpio_controller();
if (device_result == nullptr) return 0;
uint32_t pin_count = 0;
if (!gpio_controller_get_pin_count(device_result, &pin_count)) return 0;
if (gpio_controller_get_pin_count(device_result, &pin_count) != ERROR_NONE) return 0;
return (int)pin_count;
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include "tt_hal_touch.h"
#include "Tactility/hal/Device.h"
#include <tactility/hal/Device.h>
#include "Tactility/hal/touch/TouchDevice.h"
#include "Tactility/hal/touch/TouchDriver.h"