SPI device migration (#490)
- Implement SPI devices in dts files for all devices - Removed `tt::hal::spi` HAL and its configurations - Fix for devicetree generator "boolean" support - Remove unused custom locks in all `DisplayDevice` implementations - Fixed some bugs with devices - Updated XPT2046 driver - Fix for `WifiEsp` deadlock - Export a lot of new `math.h` symbols with `tt_init.cpp` - Created `SpiDeviceLock` in `TactilityCore` as a wrapper for kernel SPI locking - Improved `TactilityKernel` SPI driver.
This commit is contained in:
committed by
GitHub
parent
74127a5f6c
commit
d27404964a
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/esp32_spi.h>
|
||||
#include <tactility/concurrent/mutex.h>
|
||||
#include <tactility/concurrent/recursive_mutex.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <esp_log.h>
|
||||
@@ -16,27 +16,27 @@
|
||||
extern "C" {
|
||||
|
||||
struct Esp32SpiInternal {
|
||||
Mutex mutex;
|
||||
RecursiveMutex mutex = {};
|
||||
bool initialized = false;
|
||||
|
||||
Esp32SpiInternal() {
|
||||
mutex_construct(&mutex);
|
||||
recursive_mutex_construct(&mutex);
|
||||
}
|
||||
|
||||
~Esp32SpiInternal() {
|
||||
mutex_destruct(&mutex);
|
||||
recursive_mutex_destruct(&mutex);
|
||||
}
|
||||
};
|
||||
|
||||
static error_t lock(Device* device) {
|
||||
auto* driver_data = GET_DATA(device);
|
||||
mutex_lock(&driver_data->mutex);
|
||||
recursive_mutex_lock(&driver_data->mutex);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static error_t try_lock(Device* device, TickType_t timeout) {
|
||||
auto* driver_data = GET_DATA(device);
|
||||
if (mutex_try_lock(&driver_data->mutex, timeout)) {
|
||||
if (recursive_mutex_try_lock(&driver_data->mutex, timeout)) {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
return ERROR_TIMEOUT;
|
||||
@@ -44,7 +44,7 @@ static error_t try_lock(Device* device, TickType_t timeout) {
|
||||
|
||||
static error_t unlock(Device* device) {
|
||||
auto* driver_data = GET_DATA(device);
|
||||
mutex_unlock(&driver_data->mutex);
|
||||
recursive_mutex_unlock(&driver_data->mutex);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user