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:
Ken Van Hoeylandt
2026-02-08 22:14:18 +01:00
committed by GitHub
parent 74127a5f6c
commit d27404964a
177 changed files with 1091 additions and 2205 deletions
@@ -1,11 +1,7 @@
#include "devices/Display.h"
#include "devices/Sdcard.h"
#include <driver/gpio.h>
#include <Tactility/hal/Configuration.h>
#include <Tactility/lvgl/LvglSync.h>
#define TDECK_SPI_TRANSFER_SIZE_LIMIT (80 * 160 * (LV_COLOR_DEPTH / 8))
bool initBoot();
@@ -21,29 +17,5 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
extern const Configuration hardwareConfiguration = {
.initBoot = initBoot,
.uiScale = UiScale::Smallest,
.createDevices = createDevices,
.spi {
spi::Configuration {
.device = SPI3_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_3,
.miso_io_num = GPIO_NUM_NC,
.sclk_io_num = GPIO_NUM_5,
.quadwp_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = TDECK_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
}
.createDevices = createDevices
};
@@ -3,13 +3,13 @@
#include <PwmBacklight.h>
#include <St7735Display.h>
#define LCD_SPI_HOST SPI3_HOST
#define LCD_SPI_HOST SPI2_HOST
#define LCD_PIN_CS GPIO_NUM_4
#define LCD_PIN_DC GPIO_NUM_2
#define LCD_PIN_RESET GPIO_NUM_1
#define LCD_HORIZONTAL_RESOLUTION 80
#define LCD_VERTICAL_RESOLUTION 160
#define LCD_SPI_TRANSFER_HEIGHT LCD_VERTICAL_RESOLUTION / 4
#define LCD_SPI_TRANSFER_HEIGHT (LCD_VERTICAL_RESOLUTION / 4)
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto configuration = std::make_unique<St7735Display::Configuration>(
@@ -3,6 +3,7 @@
#include <tactility/bindings/root.h>
#include <tactility/bindings/esp32_gpio.h>
#include <tactility/bindings/esp32_i2c.h>
#include <tactility/bindings/esp32_spi.h>
#include <tactility/bindings/esp32_uart.h>
/ {
@@ -20,8 +21,17 @@
clock-frequency = <400000>;
pin-sda = <44>;
pin-scl = <43>;
pin-sda-pullup;
pin-scl-pullup;
};
spi0 {
compatible = "espressif,esp32-spi";
host = <SPI2_HOST>;
pin-mosi = <3>;
pin-miso = <GPIO_PIN_NONE>;
pin-sclk = <5>;
pin-wp = <GPIO_PIN_NONE>;
pin-hd = <GPIO_PIN_NONE>;
max-transfer-size = <0>;
};
stemma_qt: uart1 {