Ken Van Hoeylandt 74127a5f6c
Add kernel drivers for SPI and UART and make locking APIs more consistent (#489)
- Add kernel support for SPI driver
- Add kernel support for UART driver
- Implemented ESP32 UART kernel driver
- Update existing UART-related code in Tactility to use new kernel driver
- Remove UART from tt::hal::Configuration
- Remove tt_hal_uart functionality but keep functions for now
- Update devicetrees for UART changes
- Kernel mutex and recursive mutex: improved locking API design
- Other kernel improvements
- Added device_exists_of_type() and device_find_by_name()
2026-02-07 21:28:11 +01:00

30 lines
824 B
C++

// SPDX-License-Identifier: Apache-2.0
#include <tactility/drivers/spi_controller.h>
#include <tactility/error.h>
#include <tactility/device.h>
#define SPI_DRIVER_API(driver) ((struct SpiControllerApi*)driver->api)
extern "C" {
error_t spi_controller_lock(struct Device* device) {
const auto* driver = device_get_driver(device);
return SPI_DRIVER_API(driver)->lock(device);
}
error_t spi_controller_try_lock(struct Device* device, TickType_t timeout) {
const auto* driver = device_get_driver(device);
return SPI_DRIVER_API(driver)->try_lock(device, timeout);
}
error_t spi_controller_unlock(struct Device* device) {
const auto* driver = device_get_driver(device);
return SPI_DRIVER_API(driver)->unlock(device);
}
const struct DeviceType SPI_CONTROLLER_TYPE {
.name = "spi-controller"
};
}