Tab5 audio, I2C improvements, UiDensity moved to lvgl-module and cleanup (#506)

- UiDensity moved to lvgl-module
- Deleted tt_hal and tt_hal_gpio (breaks apps, but will fix those right after merging)
- Added I2C 8 bit register operations
- Added device.properties to simulator
- Improved Tab5 hardware init, implement audio
- Add README.md to kernel
This commit is contained in:
Ken Van Hoeylandt
2026-02-15 19:45:12 +01:00
committed by GitHub
parent 3a24d058c9
commit d860ba1f34
54 changed files with 417 additions and 179 deletions
+21
View File
@@ -0,0 +1,21 @@
# TactilityKernel
TactilityKernel is the core component of the Tactility project, providing a hardware abstraction layer (HAL) and essential kernel services for embedded systems.
## Features
- **Device and Driver Model**: A flexible system for managing hardware devices and their corresponding drivers.
- **Peripheral Support**: Standard interfaces for common peripherals:
- GPIO (General Purpose Input/Output)
- I2C (Inter-Integrated Circuit)
- I2S (Inter-IC Sound)
- SPI (Serial Peripheral Interface)
- UART (Universal Asynchronous Receiver-Transmitter)
- **Concurrency Primitives**: Built-in support for multi-threaded environments, including:
- Threads and Dispatchers
- Mutexes and Recursive Mutexes
- Event Groups
- Timers
- **Module System**: Support for loadable modules that can export symbols and provide runtime-extensible functionality.
- **Device Tree Integration**: Utilizes a devicetree-like system for hardware configuration and initialization.
- **Cross-Platform**: Designed to run on both embedded platforms (such as ESP32) and desktop environments (Linux) for simulation and testing.
@@ -163,6 +163,50 @@ error_t i2c_controller_write_register_array(struct Device* device, uint8_t addre
*/
error_t i2c_controller_has_device_at_address(struct Device* device, uint8_t address, TickType_t timeout);
/**
* @brief Sets the value of an 8-bit register of an I2C device.
* @param[in] device the I2C controller device
* @param[in] address the 7-bit I2C address of the slave device
* @param[in] reg the register address to set
* @param[in] value the value to set the register to
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the write operation was successful
*/
error_t i2c_controller_register8_set(struct Device* device, uint8_t address, uint8_t reg, uint8_t value, TickType_t timeout);
/**
* @brief Gets the value of an 8-bit register of an I2C device.
* @param[in] device the I2C controller device
* @param[in] address the 7-bit I2C address of the slave device
* @param[in] reg the register address to get
* @param[out] value a pointer to the variable to store the register value
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the read operation was successful
*/
error_t i2c_controller_register8_get(struct Device* device, uint8_t address, uint8_t reg, uint8_t* value, TickType_t timeout);
/**
* @brief Sets specific bits in an 8-bit register of an I2C device.
* @param[in] device the I2C controller device
* @param[in] address the 7-bit I2C address of the slave device
* @param[in] reg the register address
* @param[in] bits_to_set a bitmask of bits to set (set to 1)
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the operation was successful
*/
error_t i2c_controller_register8_set_bits(struct Device* device, uint8_t address, uint8_t reg, uint8_t bits_to_set, TickType_t timeout);
/**
* @brief Resets specific bits in an 8-bit register of an I2C device.
* @param[in] device the I2C controller device
* @param[in] address the 7-bit I2C address of the slave device
* @param[in] reg the register address
* @param[in] bits_to_reset a bitmask of bits to reset (set to 0)
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the operation was successful
*/
error_t i2c_controller_register8_reset_bits(struct Device* device, uint8_t address, uint8_t reg, uint8_t bits_to_reset, TickType_t timeout);
extern const struct DeviceType I2C_CONTROLLER_TYPE;
#ifdef __cplusplus
@@ -31,6 +31,34 @@ error_t i2c_controller_write_register(Device* device, uint8_t address, uint8_t r
return I2C_DRIVER_API(driver)->write_register(device, address, reg, data, dataSize, timeout);
}
error_t i2c_controller_register8_set(Device* device, uint8_t address, uint8_t reg, uint8_t value, TickType_t timeout) {
const auto* driver = device_get_driver(device);
return I2C_DRIVER_API(driver)->write_register(device, address, reg, &value, 1, timeout);
}
error_t i2c_controller_register8_get(Device* device, uint8_t address, uint8_t reg, uint8_t* value, TickType_t timeout) {
const auto* driver = device_get_driver(device);
return I2C_DRIVER_API(driver)->read_register(device, address, reg, value, 1, timeout);
}
error_t i2c_controller_register8_set_bits(Device* device, uint8_t address, uint8_t reg, uint8_t bits_to_set, TickType_t timeout) {
const auto* driver = device_get_driver(device);
uint8_t data = 0;
auto error = I2C_DRIVER_API(driver)->read_register(device, address, reg, &data, 1, timeout);
if (error != ERROR_NONE) return error;
data |= bits_to_set;
return I2C_DRIVER_API(driver)->write_register(device, address, reg, &data, 1, timeout);
}
error_t i2c_controller_register8_reset_bits(Device* device, uint8_t address, uint8_t reg, uint8_t bits_to_reset, TickType_t timeout) {
const auto* driver = device_get_driver(device);
uint8_t data = 0;
auto error = I2C_DRIVER_API(driver)->read_register(device, address, reg, &data, 1, timeout);
if (error != ERROR_NONE) return error;
data &= ~bits_to_reset;
return I2C_DRIVER_API(driver)->write_register(device, address, reg, &data, 1, timeout);
}
error_t i2c_controller_write_register_array(Device* device, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout) {
const auto* driver = device_get_driver(device);
if (dataSize % 2 != 0) {
+5
View File
@@ -80,6 +80,10 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = {
DEFINE_MODULE_SYMBOL(i2c_controller_write_register),
DEFINE_MODULE_SYMBOL(i2c_controller_write_register_array),
DEFINE_MODULE_SYMBOL(i2c_controller_has_device_at_address),
DEFINE_MODULE_SYMBOL(i2c_controller_register8_set),
DEFINE_MODULE_SYMBOL(i2c_controller_register8_get),
DEFINE_MODULE_SYMBOL(i2c_controller_register8_set_bits),
DEFINE_MODULE_SYMBOL(i2c_controller_register8_reset_bits),
DEFINE_MODULE_SYMBOL(I2C_CONTROLLER_TYPE),
// drivers/i2s_controller
DEFINE_MODULE_SYMBOL(i2s_controller_read),
@@ -94,6 +98,7 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = {
DEFINE_MODULE_SYMBOL(spi_controller_lock),
DEFINE_MODULE_SYMBOL(spi_controller_try_lock),
DEFINE_MODULE_SYMBOL(spi_controller_unlock),
DEFINE_MODULE_SYMBOL(SPI_CONTROLLER_TYPE),
// drivers/uart_controller
DEFINE_MODULE_SYMBOL(uart_controller_open),
DEFINE_MODULE_SYMBOL(uart_controller_close),