From c73286d70bb9e20a722a1c073a97f444a837ffc0 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 8 Feb 2026 21:00:19 +0100 Subject: [PATCH] WIP --- .../DevicetreeCompiler/source/generator.py | 2 + .../bigtreetech,panda-touch.dts | 2 - .../cyd-2432s028r/Source/devices/SdCard.cpp | 4 +- .../cyd-2432s028rv3/Source/devices/SdCard.cpp | 4 +- .../cyd-2432s032c/Source/Configuration.cpp | 2 +- .../Source/devices/St7701Display.h | 2 - Devices/cyd-4848s040c/cyd,4848s040c.dts | 2 - Devices/cyd-8048s043c/cyd,8048s043c.dts | 2 - .../Source/devices/SdCard.cpp | 3 +- .../elecrow,crowpanel-advance-28.dts | 2 - .../Source/devices/SdCard.cpp | 3 +- .../elecrow,crowpanel-advance-35.dts | 2 - .../elecrow,crowpanel-advance-50.dts | 2 - .../elecrow,crowpanel-basic-28.dts | 4 +- .../elecrow,crowpanel-basic-35.dts | 4 +- .../elecrow,crowpanel-basic-50.dts | 2 - .../guition,jc1060p470ciwy.dts | 2 - .../guition,jc3248w535c.dts | 4 -- .../Source/devices/SdCard.cpp | 7 +-- .../guition,jc8048w550c.dts | 4 -- .../heltec,wifi-lora-32-v3.dts | 2 - .../Source/devices/Display.cpp | 2 +- .../lilygo-tdongle-s3/lilygo,tdongle-s3.dts | 2 - .../Source/Configuration.cpp | 28 +-------- .../Source/devices/SdCard.cpp | 7 ++- .../lilygo-tlora-pager/lilygo,tlora-pager.dts | 12 ++++ .../Source/Configuration.cpp | 55 +---------------- .../Source/devices/SdCard.cpp | 9 ++- .../m5stack,cardputer-adv.dts | 27 +++++++-- .../Source/Configuration.cpp | 54 +---------------- .../Source/devices/SdCard.cpp | 9 ++- .../m5stack-cardputer/m5stack,cardputer.dts | 25 +++++++- .../m5stack-core2/Source/Configuration.cpp | 31 +--------- .../m5stack-core2/Source/devices/Display.h | 1 - .../m5stack-core2/Source/devices/SdCard.cpp | 7 ++- Devices/m5stack-core2/m5stack,core2.dts | 16 +++-- .../m5stack-cores3/Source/Configuration.cpp | 28 +-------- .../m5stack-cores3/Source/devices/Display.h | 2 +- .../m5stack-cores3/Source/devices/SdCard.cpp | 12 ++-- Devices/m5stack-cores3/m5stack,cores3.dts | 22 ++++--- .../m5stack-papers3/Source/Configuration.cpp | 29 +-------- .../m5stack-papers3/Source/devices/SdCard.cpp | 12 ++-- Devices/m5stack-papers3/device.properties | 2 +- Devices/m5stack-papers3/m5stack,papers3.dts | 14 ++++- .../Source/Configuration.cpp | 31 +--------- .../m5stack,stickc-plus.dts | 16 +++-- .../Source/Configuration.cpp | 28 +-------- .../m5stack,stickc-plus2.dts | 16 +++-- Devices/m5stack-tab5/Source/Configuration.cpp | 28 +-------- .../Source/devices/Ili9881cDisplay.h | 2 +- .../m5stack-tab5/Source/devices/SdCard.cpp | 12 ++-- Devices/m5stack-tab5/m5stack,tab5.dts | 16 +++-- Devices/unphone/Source/Configuration.cpp | 31 +--------- .../unphone/Source/devices/Hx8357Display.h | 2 - Devices/unphone/Source/devices/SdCard.cpp | 7 ++- Devices/unphone/unphone.dts | 14 ++++- .../Source/Configuration.cpp | 30 +--------- .../Source/devices/Display.h | 1 - .../waveshare,esp32-s3-geek.dts | 14 ++++- .../Source/Configuration.cpp | 53 +---------------- .../Source/devices/Display.h | 1 - .../Source/devices/SdCard.cpp | 9 ++- .../waveshare,s3-lcd-13.dts | 26 +++++++- .../Source/Configuration.cpp | 59 +------------------ .../Source/devices/SdCard.cpp | 10 +++- .../device.properties | 8 ++- .../waveshare,s3-touch-lcd-128.dts | 26 +++++++- .../Source/Configuration.cpp | 54 +---------------- .../Source/devices/Axs5106Touch.cpp | 2 - .../Source/devices/Display.cpp | 1 - .../Source/devices/Jd9853Display.h | 4 +- .../Source/devices/Sdcard.cpp | 12 ++-- .../waveshare,s3-touch-lcd-147.dts | 26 +++++++- .../Source/Configuration.cpp | 29 +-------- .../Source/devices/SdCard.cpp | 11 +++- .../waveshare,s3-touch-lcd-43.dts | 14 ++++- .../wireless-tag,wt32-sc01-plus.dts | 2 - Documentation/ideas.md | 1 + Drivers/EspLcdCompat/Source/EspLcdDisplay.h | 1 - Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h | 2 +- Drivers/GC9A01/Source/Gc9a01Display.h | 8 +-- Drivers/ILI9488/Source/Ili9488Display.h | 2 +- Drivers/ST7735/Source/St7735Display.h | 2 - Drivers/ST7796/Source/St7796Display.h | 1 - Modules/lvgl-module/Source/arch/lvgl_esp32.c | 4 +- .../Include/Tactility/hal/Configuration.h | 1 - Tactility/Source/service/wifi/WifiEsp.cpp | 4 +- TactilityC/Source/tt_init.cpp | 11 +++- .../Include/Tactility/kernel/SpiDeviceLock.h | 2 +- 89 files changed, 384 insertions(+), 717 deletions(-) diff --git a/Buildscripts/DevicetreeCompiler/source/generator.py b/Buildscripts/DevicetreeCompiler/source/generator.py index 9d59a952..bdcf7ce2 100644 --- a/Buildscripts/DevicetreeCompiler/source/generator.py +++ b/Buildscripts/DevicetreeCompiler/source/generator.py @@ -63,6 +63,8 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str: type = property.type if type == "value": return property.value + if type == "boolean": + return "true" elif type == "text": return f"\"{property.value}\"" elif type == "values": diff --git a/Devices/btt-panda-touch/bigtreetech,panda-touch.dts b/Devices/btt-panda-touch/bigtreetech,panda-touch.dts index e19626de..1b829a08 100644 --- a/Devices/btt-panda-touch/bigtreetech,panda-touch.dts +++ b/Devices/btt-panda-touch/bigtreetech,panda-touch.dts @@ -20,8 +20,6 @@ clock-frequency = <400000>; pin-sda = <2>; pin-scl = <1>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_external: i2c1 { diff --git a/Devices/cyd-2432s028r/Source/devices/SdCard.cpp b/Devices/cyd-2432s028r/Source/devices/SdCard.cpp index fa96aa26..85960aac 100644 --- a/Devices/cyd-2432s028r/Source/devices/SdCard.cpp +++ b/Devices/cyd-2432s028r/Source/devices/SdCard.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include using tt::hal::sdcard::SpiSdCardDevice; @@ -14,7 +12,7 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - std::make_shared(), + nullptr, std::vector(), SPI3_HOST ); diff --git a/Devices/cyd-2432s028rv3/Source/devices/SdCard.cpp b/Devices/cyd-2432s028rv3/Source/devices/SdCard.cpp index fa96aa26..85960aac 100644 --- a/Devices/cyd-2432s028rv3/Source/devices/SdCard.cpp +++ b/Devices/cyd-2432s028rv3/Source/devices/SdCard.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include using tt::hal::sdcard::SpiSdCardDevice; @@ -14,7 +12,7 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - std::make_shared(), + nullptr, std::vector(), SPI3_HOST ); diff --git a/Devices/cyd-2432s032c/Source/Configuration.cpp b/Devices/cyd-2432s032c/Source/Configuration.cpp index 5308ea91..af80ae19 100644 --- a/Devices/cyd-2432s032c/Source/Configuration.cpp +++ b/Devices/cyd-2432s032c/Source/Configuration.cpp @@ -8,7 +8,7 @@ #include -bool initBoot() { +static bool initBoot() { if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) { return false; } diff --git a/Devices/cyd-4848s040c/Source/devices/St7701Display.h b/Devices/cyd-4848s040c/Source/devices/St7701Display.h index 104e725a..593885f8 100644 --- a/Devices/cyd-4848s040c/Source/devices/St7701Display.h +++ b/Devices/cyd-4848s040c/Source/devices/St7701Display.h @@ -1,7 +1,5 @@ #pragma once -#include - #include #include diff --git a/Devices/cyd-4848s040c/cyd,4848s040c.dts b/Devices/cyd-4848s040c/cyd,4848s040c.dts index 049c6072..1ec85d2b 100644 --- a/Devices/cyd-4848s040c/cyd,4848s040c.dts +++ b/Devices/cyd-4848s040c/cyd,4848s040c.dts @@ -20,8 +20,6 @@ clock-frequency = <400000>; pin-sda = <19>; pin-scl = <45>; - pin-sda-pullup; - pin-scl-pullup; }; spi0 { diff --git a/Devices/cyd-8048s043c/cyd,8048s043c.dts b/Devices/cyd-8048s043c/cyd,8048s043c.dts index 446ab501..d0c4c449 100644 --- a/Devices/cyd-8048s043c/cyd,8048s043c.dts +++ b/Devices/cyd-8048s043c/cyd,8048s043c.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <19>; pin-scl = <20>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_external { diff --git a/Devices/elecrow-crowpanel-advance-28/Source/devices/SdCard.cpp b/Devices/elecrow-crowpanel-advance-28/Source/devices/SdCard.cpp index aba0191c..a7308c95 100644 --- a/Devices/elecrow-crowpanel-advance-28/Source/devices/SdCard.cpp +++ b/Devices/elecrow-crowpanel-advance-28/Source/devices/SdCard.cpp @@ -1,7 +1,6 @@ #include "SdCard.h" #include -#include #include using tt::hal::sdcard::SpiSdCardDevice; @@ -15,7 +14,7 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - tt::lvgl::getSyncLock(), + nullptr, std::vector(), SPI3_HOST ); diff --git a/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts b/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts index b798d91a..9e49dbdc 100644 --- a/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts +++ b/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <15>; pin-scl = <16>; - pin-sda-pullup; - pin-scl-pullup; }; display_spi: spi0 { diff --git a/Devices/elecrow-crowpanel-advance-35/Source/devices/SdCard.cpp b/Devices/elecrow-crowpanel-advance-35/Source/devices/SdCard.cpp index aba0191c..a7308c95 100644 --- a/Devices/elecrow-crowpanel-advance-35/Source/devices/SdCard.cpp +++ b/Devices/elecrow-crowpanel-advance-35/Source/devices/SdCard.cpp @@ -1,7 +1,6 @@ #include "SdCard.h" #include -#include #include using tt::hal::sdcard::SpiSdCardDevice; @@ -15,7 +14,7 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - tt::lvgl::getSyncLock(), + nullptr, std::vector(), SPI3_HOST ); diff --git a/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts b/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts index ae6afc60..74abc8b0 100644 --- a/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts +++ b/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <15>; pin-scl = <16>; - pin-sda-pullup; - pin-scl-pullup; }; display_spi: spi0 { diff --git a/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts b/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts index ef5d4554..828f3613 100644 --- a/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts +++ b/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <15>; pin-scl = <16>; - pin-sda-pullup; - pin-scl-pullup; }; sdcard_spi: spi0 { diff --git a/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts b/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts index e151ef58..50563f6d 100644 --- a/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts +++ b/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <22>; pin-scl = <21>; - pin-sda-pullup; - pin-scl-pullup; }; display_spi: spi0 { @@ -33,7 +31,7 @@ pin-sclk = <14>; pin-wp = ; pin-hd = ; - max-transfer-size = <0>; + max-transfer-size = <65536>; }; sdcard_spi: spi1 { diff --git a/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts b/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts index aada9daa..31003672 100644 --- a/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts +++ b/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <22>; pin-scl = <21>; - pin-sda-pullup; - pin-scl-pullup; }; display_spi: spi0 { @@ -33,7 +31,7 @@ pin-sclk = <14>; pin-wp = ; pin-hd = ; - max-transfer-size = <0>; + max-transfer-size = <65536>; }; sdcard_spi: spi1 { diff --git a/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts b/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts index 02d14548..9e2cf261 100644 --- a/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts +++ b/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <19>; pin-scl = <20>; - pin-sda-pullup; - pin-scl-pullup; }; sdcard_spi: spi0 { diff --git a/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts b/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts index 50b62152..6df073fd 100644 --- a/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts +++ b/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts @@ -28,8 +28,6 @@ clock-frequency = <400000>; pin-sda = <7>; pin-scl = <8>; - pin-sda-pullup; - pin-scl-pullup; }; i2s0 { diff --git a/Devices/guition-jc3248w535c/guition,jc3248w535c.dts b/Devices/guition-jc3248w535c/guition,jc3248w535c.dts index 16d548f0..c16e5500 100644 --- a/Devices/guition-jc3248w535c/guition,jc3248w535c.dts +++ b/Devices/guition-jc3248w535c/guition,jc3248w535c.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <4>; pin-scl = <8>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_external: i2c1 { @@ -31,8 +29,6 @@ clock-frequency = <400000>; pin-sda = <17>; pin-scl = <18>; - pin-sda-pullup; - pin-scl-pullup; }; display_spi: spi0 { diff --git a/Devices/guition-jc8048w550c/Source/devices/SdCard.cpp b/Devices/guition-jc8048w550c/Source/devices/SdCard.cpp index 876fca40..1b44c476 100644 --- a/Devices/guition-jc8048w550c/Source/devices/SdCard.cpp +++ b/Devices/guition-jc8048w550c/Source/devices/SdCard.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include using tt::hal::sdcard::SpiSdCardDevice; @@ -13,10 +11,7 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, GPIO_NUM_NC, - SdCardDevice::MountBehaviour::AtBoot, - nullptr, - std::vector(), - SPI2_HOST + SdCardDevice::MountBehaviour::AtBoot ); auto* spi_controller = device_find_by_name("spi0"); diff --git a/Devices/guition-jc8048w550c/guition,jc8048w550c.dts b/Devices/guition-jc8048w550c/guition,jc8048w550c.dts index 1c71247d..2661aaae 100644 --- a/Devices/guition-jc8048w550c/guition,jc8048w550c.dts +++ b/Devices/guition-jc8048w550c/guition,jc8048w550c.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <19>; pin-scl = <20>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_external: i2c1 { @@ -31,8 +29,6 @@ clock-frequency = <400000>; pin-sda = <17>; pin-scl = <18>; - pin-sda-pullup; - pin-scl-pullup; }; spi0 { diff --git a/Devices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dts b/Devices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dts index 0a54fd48..8a5cd882 100644 --- a/Devices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dts +++ b/Devices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dts @@ -19,7 +19,5 @@ clock-frequency = <200000>; pin-sda = <17>; pin-scl = <18>; - pin-sda-pullup; - pin-scl-pullup; }; }; diff --git a/Devices/lilygo-tdongle-s3/Source/devices/Display.cpp b/Devices/lilygo-tdongle-s3/Source/devices/Display.cpp index 3285ba7c..328d0ee4 100644 --- a/Devices/lilygo-tdongle-s3/Source/devices/Display.cpp +++ b/Devices/lilygo-tdongle-s3/Source/devices/Display.cpp @@ -9,7 +9,7 @@ #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 createDisplay() { auto configuration = std::make_unique( diff --git a/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts b/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts index bcfc2c99..964c30e8 100644 --- a/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts +++ b/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts @@ -21,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <44>; pin-scl = <43>; - pin-sda-pullup; - pin-scl-pullup; }; spi0 { diff --git a/Devices/lilygo-tlora-pager/Source/Configuration.cpp b/Devices/lilygo-tlora-pager/Source/Configuration.cpp index 969a9b4f..a6a5a816 100644 --- a/Devices/lilygo-tlora-pager/Source/Configuration.cpp +++ b/Devices/lilygo-tlora-pager/Source/Configuration.cpp @@ -6,12 +6,9 @@ #include #include -#include #include #include -#define TPAGER_SPI_TRANSFER_SIZE_LIMIT (480 * 222 * (LV_COLOR_DEPTH / 8)) - bool tpagerInit(); using namespace tt::hal; @@ -38,28 +35,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = tpagerInit, - .createDevices = createDevices, - .spi {spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_34, - .miso_io_num = GPIO_NUM_33, - .sclk_io_num = GPIO_NUM_35, - .quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported - .quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported - .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 = TPAGER_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 }; diff --git a/Devices/lilygo-tlora-pager/Source/devices/SdCard.cpp b/Devices/lilygo-tlora-pager/Source/devices/SdCard.cpp index 940dc7d4..7ce5e885 100644 --- a/Devices/lilygo-tlora-pager/Source/devices/SdCard.cpp +++ b/Devices/lilygo-tlora-pager/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include #include @@ -23,7 +24,11 @@ std::shared_ptr createTpagerSdCard() { } ); + auto* spi_controller = device_find_by_name("spi0"); + check(spi_controller, "spi0 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts b/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts index 69bcfcad..ec60078b 100644 --- a/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts +++ b/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts @@ -4,6 +4,7 @@ #include #include #include +#include #include // Reference: https://wiki.lilygo.cc/get_started/en/LoRa_GPS/T-LoraPager/T-LoraPager.html#Pin-Overview @@ -24,6 +25,17 @@ pin-scl = <2>; }; + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <34>; + pin-miso = <33>; + pin-sclk = <35>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; + }; + // ES8311 // TODO: init via I2C to enable audio playback i2s0 { diff --git a/Devices/m5stack-cardputer-adv/Source/Configuration.cpp b/Devices/m5stack-cardputer-adv/Source/Configuration.cpp index 7dfce0d5..1d16e201 100644 --- a/Devices/m5stack-cardputer-adv/Source/Configuration.cpp +++ b/Devices/m5stack-cardputer-adv/Source/Configuration.cpp @@ -5,14 +5,13 @@ #include #include -#include #include #include using namespace tt::hal; -bool initBoot() { +static bool initBoot() { return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT, 512); } @@ -30,55 +29,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - // Display - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_35, - .miso_io_num = GPIO_NUM_NC, - .sclk_io_num = GPIO_NUM_36, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = LCD_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() - }, - // SDCard - spi::Configuration { - .device = SPI3_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_14, - .miso_io_num = GPIO_NUM_39, - .sclk_io_num = GPIO_NUM_40, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = 0, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = nullptr - }, - } + .createDevices = createDevices }; diff --git a/Devices/m5stack-cardputer-adv/Source/devices/SdCard.cpp b/Devices/m5stack-cardputer-adv/Source/devices/SdCard.cpp index 8715d72c..abc1703e 100644 --- a/Devices/m5stack-cardputer-adv/Source/devices/SdCard.cpp +++ b/Devices/m5stack-cardputer-adv/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include constexpr auto SDCARD_PIN_CS = GPIO_NUM_12; @@ -14,12 +15,16 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - tt::hal::spi::getLock(SPI3_HOST), + nullptr, std::vector { EXPANSION_HEADER_PIN_CS }, SPI3_HOST ); + auto* spi_controller = device_find_by_name("spi1"); + check(spi_controller, "spi1 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts b/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts index b616f418..63ee256b 100644 --- a/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts +++ b/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts @@ -4,6 +4,7 @@ #include #include #include +#include #include // Reference: https://docs.m5stack.com/en/core/Cardputer-Adv @@ -22,8 +23,6 @@ clock-frequency = <400000>; pin-sda = <8>; pin-scl = <9>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_port_a { @@ -32,8 +31,28 @@ clock-frequency = <400000>; pin-sda = <2>; pin-scl = <1>; - pin-sda-pullup; - pin-scl-pullup; + }; + + display_spi: spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <35>; + pin-miso = ; + pin-sclk = <36>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; + }; + + sdcard_spi: spi1 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <14>; + pin-miso = <39>; + pin-sclk = <40>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; // Speaker and microphone (ES8311) diff --git a/Devices/m5stack-cardputer/Source/Configuration.cpp b/Devices/m5stack-cardputer/Source/Configuration.cpp index 9c2757c2..604ba926 100644 --- a/Devices/m5stack-cardputer/Source/Configuration.cpp +++ b/Devices/m5stack-cardputer/Source/Configuration.cpp @@ -7,7 +7,6 @@ #include #include -#include using namespace tt::hal; @@ -28,56 +27,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - // Display - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_35, - .miso_io_num = GPIO_NUM_NC, - .sclk_io_num = GPIO_NUM_36, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = LCD_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() - }, - // SDCard - spi::Configuration { - .device = SPI3_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_14, - .miso_io_num = GPIO_NUM_39, - .sclk_io_num = GPIO_NUM_40, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = 0, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = nullptr - }, - - } + .createDevices = createDevices }; diff --git a/Devices/m5stack-cardputer/Source/devices/SdCard.cpp b/Devices/m5stack-cardputer/Source/devices/SdCard.cpp index b7a130a9..7ab98cfa 100644 --- a/Devices/m5stack-cardputer/Source/devices/SdCard.cpp +++ b/Devices/m5stack-cardputer/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include constexpr auto SDCARD_PIN_CS = GPIO_NUM_12; @@ -13,12 +14,16 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - tt::hal::spi::getLock(SPI3_HOST), + nullptr, std::vector(), SPI3_HOST ); + auto* spi_controller = device_find_by_name("spi1"); + check(spi_controller, "spi1 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/m5stack-cardputer/m5stack,cardputer.dts b/Devices/m5stack-cardputer/m5stack,cardputer.dts index 1eb50b04..8904f898 100644 --- a/Devices/m5stack-cardputer/m5stack,cardputer.dts +++ b/Devices/m5stack-cardputer/m5stack,cardputer.dts @@ -4,6 +4,7 @@ #include #include #include +#include #include // Reference: https://docs.m5stack.com/en/core/Cardputer @@ -22,8 +23,28 @@ clock-frequency = <400000>; pin-sda = <2>; pin-scl = <1>; - pin-sda-pullup; - pin-scl-pullup; + }; + + display_spi: spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <35>; + pin-miso = ; + pin-sclk = <36>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; + }; + + sdcard_spi: spi1 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <14>; + pin-miso = <39>; + pin-sclk = <40>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; // Speaker and microphone diff --git a/Devices/m5stack-core2/Source/Configuration.cpp b/Devices/m5stack-core2/Source/Configuration.cpp index e71cc956..7883adff 100644 --- a/Devices/m5stack-core2/Source/Configuration.cpp +++ b/Devices/m5stack-core2/Source/Configuration.cpp @@ -1,14 +1,12 @@ #include "devices/Display.h" #include "devices/SdCard.h" #include "devices/Power.h" -#include #include -#include using namespace tt::hal; -bool initBoot() { +static bool initBoot() { return initAxp(); } @@ -22,30 +20,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, - .createDevices = createDevices, - .spi { - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_23, - .miso_io_num = GPIO_NUM_38, - .sclk_io_num = GPIO_NUM_18, - .quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported - .quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported - .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 = LCD_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 }; diff --git a/Devices/m5stack-core2/Source/devices/Display.h b/Devices/m5stack-core2/Source/devices/Display.h index e359e869..bc66d310 100644 --- a/Devices/m5stack-core2/Source/devices/Display.h +++ b/Devices/m5stack-core2/Source/devices/Display.h @@ -12,6 +12,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 320; constexpr auto LCD_VERTICAL_RESOLUTION = 240; constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10; constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT; -constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8; std::shared_ptr createDisplay(); diff --git a/Devices/m5stack-core2/Source/devices/SdCard.cpp b/Devices/m5stack-core2/Source/devices/SdCard.cpp index 9d0f12b9..3d0a8e30 100644 --- a/Devices/m5stack-core2/Source/devices/SdCard.cpp +++ b/Devices/m5stack-core2/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include #include @@ -21,7 +22,11 @@ std::shared_ptr createSdCard() { } ); + auto* spi_controller = device_find_by_name("spi0"); + check(spi_controller, "spi0 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/m5stack-core2/m5stack,core2.dts b/Devices/m5stack-core2/m5stack,core2.dts index f8e1b6a6..4346415e 100644 --- a/Devices/m5stack-core2/m5stack,core2.dts +++ b/Devices/m5stack-core2/m5stack,core2.dts @@ -4,6 +4,7 @@ #include #include #include +#include #include // Reference: https://docs.m5stack.com/en/core/Core2 @@ -22,8 +23,6 @@ clock-frequency = <400000>; pin-sda = <21>; pin-scl = <22>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_port_a { @@ -32,8 +31,17 @@ clock-frequency = <400000>; pin-sda = <32>; pin-scl = <33>; - pin-sda-pullup; - pin-scl-pullup; + }; + + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <23>; + pin-miso = <38>; + pin-sclk = <18>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; // NS4168: Speaker and microphone diff --git a/Devices/m5stack-cores3/Source/Configuration.cpp b/Devices/m5stack-cores3/Source/Configuration.cpp index ffa11dd7..d00a16c3 100644 --- a/Devices/m5stack-cores3/Source/Configuration.cpp +++ b/Devices/m5stack-cores3/Source/Configuration.cpp @@ -4,7 +4,6 @@ #include #include -#include #include using namespace tt::hal; @@ -21,30 +20,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, - .createDevices = createDevices, - .spi { - spi::Configuration { - .device = SPI3_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_37, - .miso_io_num = GPIO_NUM_35, - .sclk_io_num = GPIO_NUM_36, - .data2_io_num = GPIO_NUM_NC, - .data3_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 = LCD_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 }; diff --git a/Devices/m5stack-cores3/Source/devices/Display.h b/Devices/m5stack-cores3/Source/devices/Display.h index 04caf646..bfb96522 100644 --- a/Devices/m5stack-cores3/Source/devices/Display.h +++ b/Devices/m5stack-cores3/Source/devices/Display.h @@ -5,7 +5,7 @@ #include // Display -constexpr auto LCD_SPI_HOST = SPI3_HOST; +constexpr auto LCD_SPI_HOST = SPI2_HOST; constexpr auto LCD_PIN_CS = GPIO_NUM_3; constexpr auto LCD_PIN_DC = GPIO_NUM_35; constexpr auto LCD_HORIZONTAL_RESOLUTION = 320; diff --git a/Devices/m5stack-cores3/Source/devices/SdCard.cpp b/Devices/m5stack-cores3/Source/devices/SdCard.cpp index f314b5f5..9083ef80 100644 --- a/Devices/m5stack-cores3/Source/devices/SdCard.cpp +++ b/Devices/m5stack-cores3/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include #include @@ -16,13 +17,14 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, tt::lvgl::getSyncLock(), - std::vector { - CORES3_LCD_PIN_CS - }, - SPI3_HOST + std::vector { CORES3_LCD_PIN_CS } ); + auto* spi_controller = device_find_by_name("spi0"); + check(spi_controller, "spi0 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/m5stack-cores3/m5stack,cores3.dts b/Devices/m5stack-cores3/m5stack,cores3.dts index 5cc2d785..a4e7b679 100644 --- a/Devices/m5stack-cores3/m5stack,cores3.dts +++ b/Devices/m5stack-cores3/m5stack,cores3.dts @@ -4,6 +4,7 @@ #include #include #include +#include #include // Reference: https://docs.m5stack.com/en/core/CoreS3 @@ -22,8 +23,6 @@ clock-frequency = <400000>; pin-sda = <12>; pin-scl = <11>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_port_a { @@ -32,18 +31,14 @@ clock-frequency = <400000>; pin-sda = <2>; pin-scl = <1>; - pin-sda-pullup; - pin-scl-pullup; }; - +/* i2c_port_b { compatible = "espressif,esp32-i2c"; port = ; clock-frequency = <400000>; pin-sda = <9>; pin-scl = <8>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_port_c { @@ -52,8 +47,17 @@ clock-frequency = <400000>; pin-sda = <18>; pin-scl = <17>; - sda-pullup; - scl-pullup; + }; +*/ + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <37>; + pin-miso = <35>; + pin-sclk = <36>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; // TODO: Enable speaker via ES7210 I2C: https://github.com/m5stack/M5Unified/blob/a6256725481f1bc366655fa48cf03b6095e30ad1/src/M5Unified.cpp#L417 diff --git a/Devices/m5stack-papers3/Source/Configuration.cpp b/Devices/m5stack-papers3/Source/Configuration.cpp index b9731963..f6c53e55 100644 --- a/Devices/m5stack-papers3/Source/Configuration.cpp +++ b/Devices/m5stack-papers3/Source/Configuration.cpp @@ -1,9 +1,7 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include -#include using namespace tt::hal; @@ -17,30 +15,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = nullptr, - .createDevices = createDevices, - .spi { - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_38, - .miso_io_num = GPIO_NUM_40, - .sclk_io_num = GPIO_NUM_39, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = 4096, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = tt::lvgl::getSyncLock() - } - } + .createDevices = createDevices }; diff --git a/Devices/m5stack-papers3/Source/devices/SdCard.cpp b/Devices/m5stack-papers3/Source/devices/SdCard.cpp index 4c477dd0..cc51ba7d 100644 --- a/Devices/m5stack-papers3/Source/devices/SdCard.cpp +++ b/Devices/m5stack-papers3/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include #include @@ -13,13 +14,14 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, GPIO_NUM_NC, - SdCardDevice::MountBehaviour::AtBoot, - tt::lvgl::getSyncLock(), - std::vector{}, - SPI2_HOST + SdCardDevice::MountBehaviour::AtBoot ); + auto* spi_controller = device_find_by_name("spi0"); + check(spi_controller, "spi0 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/m5stack-papers3/device.properties b/Devices/m5stack-papers3/device.properties index 83cdb996..4b56d840 100644 --- a/Devices/m5stack-papers3/device.properties +++ b/Devices/m5stack-papers3/device.properties @@ -1,6 +1,6 @@ [general] vendor=M5Stack -name=Paper S3 +name=PaperS3 incubating=true [hardware] diff --git a/Devices/m5stack-papers3/m5stack,papers3.dts b/Devices/m5stack-papers3/m5stack,papers3.dts index 9b0a43df..29d30b4e 100644 --- a/Devices/m5stack-papers3/m5stack,papers3.dts +++ b/Devices/m5stack-papers3/m5stack,papers3.dts @@ -3,6 +3,7 @@ #include #include #include +#include / { compatible = "root"; @@ -19,7 +20,16 @@ clock-frequency = <400000>; pin-sda = <41>; pin-scl = <42>; - pin-sda-pullup; - pin-scl-pullup; + }; + + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <38>; + pin-miso = <40>; + pin-sclk = <39>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <4096>; }; }; diff --git a/Devices/m5stack-stickc-plus/Source/Configuration.cpp b/Devices/m5stack-stickc-plus/Source/Configuration.cpp index 8899fc0a..8f395ec3 100644 --- a/Devices/m5stack-stickc-plus/Source/Configuration.cpp +++ b/Devices/m5stack-stickc-plus/Source/Configuration.cpp @@ -1,14 +1,12 @@ #include "devices/Display.h" #include "devices/Power.h" -#include #include -#include #include using namespace tt::hal; -bool initBoot() { +static bool initBoot() { // CH552 applies 4 V to GPIO 0, which reduces Wi-Fi sensitivity // Setting output to high adds a bias of 3.3 V and suppresses over-voltage: gpio::configure(0, gpio::Mode::Output, false, false); @@ -28,30 +26,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_15, - .miso_io_num = GPIO_NUM_NC, - .sclk_io_num = GPIO_NUM_13, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = LCD_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 }; diff --git a/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts b/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts index 2b3c5788..4fab2a0c 100644 --- a/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts +++ b/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts @@ -3,6 +3,7 @@ #include #include #include +#include #include / { @@ -20,8 +21,6 @@ clock-frequency = <400000>; pin-sda = <21>; pin-scl = <22>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_grove { @@ -30,8 +29,17 @@ clock-frequency = <400000>; pin-sda = <32>; pin-scl = <33>; - pin-sda-pullup; - pin-scl-pullup; + }; + + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <15>; + pin-miso = ; + pin-sclk = <13>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; uart_grove: uart1 { diff --git a/Devices/m5stack-stickc-plus2/Source/Configuration.cpp b/Devices/m5stack-stickc-plus2/Source/Configuration.cpp index 1600b953..6c8f3854 100644 --- a/Devices/m5stack-stickc-plus2/Source/Configuration.cpp +++ b/Devices/m5stack-stickc-plus2/Source/Configuration.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include @@ -30,30 +29,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_15, - .miso_io_num = GPIO_NUM_NC, - .sclk_io_num = GPIO_NUM_13, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = LCD_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 }; diff --git a/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts b/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts index 83f936a1..76166f4c 100644 --- a/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts +++ b/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts @@ -2,6 +2,7 @@ #include #include #include +#include #include / { @@ -19,8 +20,6 @@ clock-frequency = <400000>; pin-sda = <21>; pin-scl = <22>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_grove { @@ -29,8 +28,17 @@ clock-frequency = <400000>; pin-sda = <32>; pin-scl = <33>; - pin-sda-pullup; - pin-scl-pullup; + }; + + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <15>; + pin-miso = ; + pin-sclk = <13>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; uart_grove: uart1 { diff --git a/Devices/m5stack-tab5/Source/Configuration.cpp b/Devices/m5stack-tab5/Source/Configuration.cpp index eab607a8..6de4c518 100644 --- a/Devices/m5stack-tab5/Source/Configuration.cpp +++ b/Devices/m5stack-tab5/Source/Configuration.cpp @@ -88,31 +88,5 @@ static bool initBoot() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, - .createDevices = createDevices, - .spi = { - // SDCard - spi::Configuration { - .device = SPI3_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_44, - .miso_io_num = GPIO_NUM_39, - .sclk_io_num = GPIO_NUM_43, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = 0, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = nullptr - } - } + .createDevices = createDevices }; diff --git a/Devices/m5stack-tab5/Source/devices/Ili9881cDisplay.h b/Devices/m5stack-tab5/Source/devices/Ili9881cDisplay.h index e2819f86..3ba945cc 100644 --- a/Devices/m5stack-tab5/Source/devices/Ili9881cDisplay.h +++ b/Devices/m5stack-tab5/Source/devices/Ili9881cDisplay.h @@ -34,7 +34,7 @@ public: Ili9881cDisplay( const std::shared_ptr& configuration - ) : EspLcdDisplayV2(configuration, std::make_shared()) {} + ) : EspLcdDisplayV2(configuration) {} ~Ili9881cDisplay() override; diff --git a/Devices/m5stack-tab5/Source/devices/SdCard.cpp b/Devices/m5stack-tab5/Source/devices/SdCard.cpp index 5103a121..639eed88 100644 --- a/Devices/m5stack-tab5/Source/devices/SdCard.cpp +++ b/Devices/m5stack-tab5/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include constexpr auto SDCARD_PIN_CS = GPIO_NUM_42; @@ -12,13 +13,14 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, GPIO_NUM_NC, - SdCardDevice::MountBehaviour::AtBoot, - tt::hal::spi::getLock(SPI3_HOST), - std::vector(), - SPI3_HOST + SdCardDevice::MountBehaviour::AtBoot ); + auto* spi_controller = device_find_by_name("spi0"); + check(spi_controller, "spi0 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/m5stack-tab5/m5stack,tab5.dts b/Devices/m5stack-tab5/m5stack,tab5.dts index d4576ad9..bb6c82fb 100644 --- a/Devices/m5stack-tab5/m5stack,tab5.dts +++ b/Devices/m5stack-tab5/m5stack,tab5.dts @@ -3,6 +3,7 @@ #include #include #include +#include / { compatible = "root"; @@ -19,8 +20,6 @@ clock-frequency = <400000>; pin-sda = <31>; pin-scl = <32>; - pin-sda-pullup; - pin-scl-pullup; }; i2c_port_a { @@ -29,7 +28,16 @@ clock-frequency = <400000>; pin-sda = <53>; pin-scl = <54>; - pin-sda-pullup; - pin-scl-pullup; + }; + + sdcard_spi: spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <44>; + pin-miso = <39>; + pin-sclk = <43>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; }; diff --git a/Devices/unphone/Source/Configuration.cpp b/Devices/unphone/Source/Configuration.cpp index 5322cf2f..e51ecfd1 100644 --- a/Devices/unphone/Source/Configuration.cpp +++ b/Devices/unphone/Source/Configuration.cpp @@ -1,12 +1,8 @@ #include "UnPhoneFeatures.h" #include "devices/Hx8357Display.h" #include "devices/SdCard.h" -#include #include -#include - -#define UNPHONE_SPI_TRANSFER_SIZE_LIMIT (UNPHONE_LCD_HORIZONTAL_RESOLUTION * UNPHONE_LCD_SPI_TRANSFER_HEIGHT * LV_COLOR_DEPTH / 8) bool initBoot(); @@ -19,30 +15,5 @@ static tt::hal::DeviceVector createDevices() { extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, - .createDevices = createDevices, - .spi { - tt::hal::spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_40, - .miso_io_num = GPIO_NUM_41, - .sclk_io_num = GPIO_NUM_39, - .quadwp_io_num = -1, // Quad SPI LCD driver is not yet supported - .quadhd_io_num = -1, // Quad SPI LCD driver is not yet supported - .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 = UNPHONE_SPI_TRANSFER_SIZE_LIMIT, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = tt::hal::spi::InitMode::ByTactility, - .isMutable = false, - .lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display - } - } + .createDevices = createDevices }; diff --git a/Devices/unphone/Source/devices/Hx8357Display.h b/Devices/unphone/Source/devices/Hx8357Display.h index 9dea80f1..24b0076f 100644 --- a/Devices/unphone/Source/devices/Hx8357Display.h +++ b/Devices/unphone/Source/devices/Hx8357Display.h @@ -2,7 +2,6 @@ #include #include -#include #include #include @@ -17,7 +16,6 @@ #define UNPHONE_LCD_HORIZONTAL_RESOLUTION 320 #define UNPHONE_LCD_VERTICAL_RESOLUTION 480 #define UNPHONE_LCD_DRAW_BUFFER_HEIGHT (UNPHONE_LCD_VERTICAL_RESOLUTION / 15) -#define UNPHONE_LCD_SPI_TRANSFER_HEIGHT (UNPHONE_LCD_VERTICAL_RESOLUTION / 15) class Hx8357Display : public tt::hal::display::DisplayDevice { diff --git a/Devices/unphone/Source/devices/SdCard.cpp b/Devices/unphone/Source/devices/SdCard.cpp index 749470ee..c75ca563 100644 --- a/Devices/unphone/Source/devices/SdCard.cpp +++ b/Devices/unphone/Source/devices/SdCard.cpp @@ -1,5 +1,6 @@ #include "SdCard.h" +#include #include #include @@ -25,7 +26,11 @@ std::shared_ptr createSdCard() { } ); + auto* spi_controller = device_find_by_name("spi0"); + check(spi_controller, "spi0 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/unphone/unphone.dts b/Devices/unphone/unphone.dts index 0da8e2c2..354d759f 100644 --- a/Devices/unphone/unphone.dts +++ b/Devices/unphone/unphone.dts @@ -3,6 +3,7 @@ #include #include #include +#include / { compatible = "root"; @@ -19,7 +20,16 @@ clock-frequency = <400000>; pin-sda = <3>; pin-scl = <4>; - pin-sda-pullup; - pin-scl-pullup; + }; + + sdcard_spi: spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <40>; + pin-miso = <41>; + pin-sclk = <39>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <65536>; }; }; diff --git a/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp b/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp index 70c85db0..c93cd002 100644 --- a/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp +++ b/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp @@ -1,9 +1,7 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include -#include #include #include @@ -24,31 +22,5 @@ static bool initBoot() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - // Display - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_DISABLED, - .config = { - .mosi_io_num = GPIO_NUM_11, - .miso_io_num = GPIO_NUM_NC, - .sclk_io_num = GPIO_NUM_12, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = LCD_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 }; \ No newline at end of file diff --git a/Devices/waveshare-esp32-s3-geek/Source/devices/Display.h b/Devices/waveshare-esp32-s3-geek/Source/devices/Display.h index d7cd4f1d..628270ac 100644 --- a/Devices/waveshare-esp32-s3-geek/Source/devices/Display.h +++ b/Devices/waveshare-esp32-s3-geek/Source/devices/Display.h @@ -14,6 +14,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 135; constexpr auto LCD_VERTICAL_RESOLUTION = 240; constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 3; constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT; -constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8; std::shared_ptr createDisplay(); \ No newline at end of file diff --git a/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts b/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts index 963dba0f..d38b3084 100644 --- a/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts +++ b/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts @@ -3,6 +3,7 @@ #include #include #include +#include #include / { @@ -20,8 +21,17 @@ clock-frequency = <400000>; pin-sda = <16>; pin-scl = <17>; - pin-sda-pullup; - pin-scl-pullup; + }; + + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <11>; + pin-miso = ; + pin-sclk = <12>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; uart0 { diff --git a/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp b/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp index d211a1f3..42cb0e13 100644 --- a/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp +++ b/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp @@ -3,7 +3,6 @@ #include #include -#include #include using namespace tt::hal; @@ -22,55 +21,5 @@ static bool initBoot() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - // Display - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_DISABLED, - .config = { - .mosi_io_num = GPIO_NUM_41, - .miso_io_num = GPIO_NUM_NC, - .sclk_io_num = GPIO_NUM_40, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = LCD_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 - }, - // SD card - spi::Configuration { - .device = SPI3_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_18, - .miso_io_num = GPIO_NUM_16, - .sclk_io_num = GPIO_NUM_21, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = 32768, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = nullptr // No custom lock needed - } - } + .createDevices = createDevices }; diff --git a/Devices/waveshare-s3-lcd-13/Source/devices/Display.h b/Devices/waveshare-s3-lcd-13/Source/devices/Display.h index e08682b4..a1cd4fe6 100644 --- a/Devices/waveshare-s3-lcd-13/Source/devices/Display.h +++ b/Devices/waveshare-s3-lcd-13/Source/devices/Display.h @@ -8,4 +8,3 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240; constexpr auto LCD_VERTICAL_RESOLUTION = 240; constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 3; constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT; -constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8; diff --git a/Devices/waveshare-s3-lcd-13/Source/devices/SdCard.cpp b/Devices/waveshare-s3-lcd-13/Source/devices/SdCard.cpp index b2c81f67..ae706305 100644 --- a/Devices/waveshare-s3-lcd-13/Source/devices/SdCard.cpp +++ b/Devices/waveshare-s3-lcd-13/Source/devices/SdCard.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using tt::hal::sdcard::SpiSdCardDevice; @@ -13,12 +14,16 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - std::make_shared(), + nullptr, std::vector(), SPI3_HOST ); + auto* spi_controller = device_find_by_name("spi1"); + check(spi_controller, "spi1 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts b/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts index 3f8839e7..ba44bd3c 100644 --- a/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts +++ b/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts @@ -3,7 +3,9 @@ #include #include #include +#include +// Reference: https://www.waveshare.com/wiki/ESP32-S3-LCD-1.3 / { compatible = "root"; model = "Waveshare S3 LCD 1.3"; @@ -19,7 +21,27 @@ clock-frequency = <400000>; pin-sda = <47>; pin-scl = <48>; - pin-sda-pullup; - pin-scl-pullup; + }; + + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <41>; + pin-miso = ; + pin-sclk = <40>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; + }; + + spi1 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <18>; + pin-miso = <16>; + pin-sclk = <21>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; }; diff --git a/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp b/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp index d871491c..fcfe9eac 100644 --- a/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp +++ b/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp @@ -1,9 +1,7 @@ #include "devices/Display.h" -#include "devices/SdCard.h" #include #include -#include #include using namespace tt::hal; @@ -12,8 +10,7 @@ constexpr auto* TAG = "Waveshare"; static DeviceVector createDevices() { return { - createDisplay(), - createSdCard() + createDisplay() }; } @@ -24,57 +21,5 @@ static bool initBoot() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - // Display - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_DISABLED, - .config = { - .mosi_io_num = GPIO_NUM_11, - .miso_io_num = GPIO_NUM_12, - .sclk_io_num = GPIO_NUM_10, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = ((240 * (240 / 10)) * LV_COLOR_DEPTH / 8), - .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 - }, - // SD card available via external sd card module and uses VSYS (5V) / GND / IO15 / IO16 / IO17 / IO18 pins. - // Common micro sd card module you'd find on aliexpress with voltage regulator onboard. Others may work. - // JST SH 1.0 Header, GND / VSYS (5V) / RESET / BOOT / GND / 3.3V / IO15 / IO16 / IO17 / IO18 / IO21 / IO33 - spi::Configuration { - .device = SPI3_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_16, - .miso_io_num = GPIO_NUM_15, - .sclk_io_num = GPIO_NUM_17, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = 32768, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = nullptr // No custom lock needed - } - } + .createDevices = createDevices }; diff --git a/Devices/waveshare-s3-touch-lcd-128/Source/devices/SdCard.cpp b/Devices/waveshare-s3-touch-lcd-128/Source/devices/SdCard.cpp index d9adcbde..e56e5361 100644 --- a/Devices/waveshare-s3-touch-lcd-128/Source/devices/SdCard.cpp +++ b/Devices/waveshare-s3-touch-lcd-128/Source/devices/SdCard.cpp @@ -1,8 +1,8 @@ #include "SdCard.h" +#include #include #include -#include using tt::hal::sdcard::SpiSdCardDevice; @@ -13,12 +13,16 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - std::make_shared(), + nullptr, std::vector(), SPI3_HOST ); + auto* spi_controller = device_find_by_name("spi1"); + check(spi_controller, "spi1 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/waveshare-s3-touch-lcd-128/device.properties b/Devices/waveshare-s3-touch-lcd-128/device.properties index 2940b09a..4dae4ced 100644 --- a/Devices/waveshare-s3-touch-lcd-128/device.properties +++ b/Devices/waveshare-s3-touch-lcd-128/device.properties @@ -18,4 +18,10 @@ shape=circle dpi=265 [lvgl] -colorDepth=16 \ No newline at end of file +colorDepth=16 + +[sdkconfig] +# Fix error "PSRAM space not enough for the Flash instructions" on boot: +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=n +CONFIG_SPIRAM_RODATA=n +CONFIG_SPIRAM_XIP_FROM_PSRAM=n \ No newline at end of file diff --git a/Devices/waveshare-s3-touch-lcd-128/waveshare,s3-touch-lcd-128.dts b/Devices/waveshare-s3-touch-lcd-128/waveshare,s3-touch-lcd-128.dts index a6b95330..aaedb2f0 100644 --- a/Devices/waveshare-s3-touch-lcd-128/waveshare,s3-touch-lcd-128.dts +++ b/Devices/waveshare-s3-touch-lcd-128/waveshare,s3-touch-lcd-128.dts @@ -3,7 +3,9 @@ #include #include #include +#include +// Reference: https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28 / { compatible = "root"; model = "Waveshare S3 Touch LCD 1.28"; @@ -13,11 +15,33 @@ gpio-count = <49>; }; - i2c_main { + i2c0 { compatible = "espressif,esp32-i2c"; port = ; clock-frequency = <400000>; pin-sda = <6>; pin-scl = <7>; }; + + display_spi: spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <11>; + pin-miso = <12>; + pin-sclk = <10>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; + }; + + sdcard_spi: spi1 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <16>; + pin-miso = <15>; + pin-sclk = <17>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; + }; }; diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp b/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp index 7c1524fe..acec5b45 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp @@ -1,11 +1,7 @@ #include "devices/Display.h" #include "devices/Sdcard.h" -#include #include -#include - -#define SPI_TRANSFER_SIZE_LIMIT (172 * 320 * (LV_COLOR_DEPTH / 8)) bool initBoot(); @@ -21,53 +17,5 @@ static std::vector> createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, - .createDevices = createDevices, - .spi { - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_39, - .miso_io_num = GPIO_NUM_NC, - .sclk_io_num = GPIO_NUM_38, - .quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported - .quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported - .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 = 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 - }, - spi::Configuration { - .device = SPI3_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_15, - .miso_io_num = GPIO_NUM_17, - .sclk_io_num = GPIO_NUM_16, - .data2_io_num = GPIO_NUM_NC, - .data3_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 = SPI_TRANSFER_SIZE_LIMIT, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = nullptr - } - } + .createDevices = createDevices }; diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Axs5106Touch.cpp b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Axs5106Touch.cpp index 6115c5d5..a56aa279 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Axs5106Touch.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Axs5106Touch.cpp @@ -3,8 +3,6 @@ #include #include -constexpr auto* TAG = "AXS5106"; - bool Axs5106Touch::createIoHandle(esp_lcd_panel_io_handle_t& outHandle) { esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_AXS5106_CONFIG(); return esp_lcd_new_panel_io_i2c(configuration->port, &io_config, &outHandle) == ESP_OK; diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Display.cpp b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Display.cpp index b31c4d8b..f23e7fdd 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Display.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Display.cpp @@ -8,7 +8,6 @@ constexpr auto LCD_PIN_DC = GPIO_NUM_45; constexpr auto LCD_PIN_RESET = GPIO_NUM_40; constexpr auto LCD_HORIZONTAL_RESOLUTION = 172; constexpr auto LCD_VERTICAL_RESOLUTION = 320; -constexpr auto LCD_SPI_TRANSFER_HEIGHT = (LCD_VERTICAL_RESOLUTION / 10); void setBacklightDuty(uint8_t level); diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Jd9853Display.h b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Jd9853Display.h index aec2e5c2..b1430e03 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Jd9853Display.h +++ b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Jd9853Display.h @@ -84,9 +84,7 @@ public: explicit Jd9853Display(std::unique_ptr inConfiguration) : configuration(std::move(inConfiguration) - ) { - assert(configuration != nullptr); - } + ) {} std::string getName() const override { return "JD9853"; } diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Sdcard.cpp b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Sdcard.cpp index 46ec8738..f419562c 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/devices/Sdcard.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/Source/devices/Sdcard.cpp @@ -1,12 +1,12 @@ #include "Sdcard.h" +#include #include #include using tt::hal::sdcard::SpiSdCardDevice; constexpr auto SDCARD_PIN_CS = GPIO_NUM_14; -constexpr auto LCD_PIN_CS = GPIO_NUM_21; std::shared_ptr createSdCard() { auto configuration = std::make_unique( @@ -15,12 +15,16 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, SdCardDevice::MountBehaviour::AtBoot, - tt::hal::spi::getLock(SPI3_HOST), - std::vector { LCD_PIN_CS }, + nullptr, + std::vector { }, SPI3_HOST ); + auto* spi_controller = device_find_by_name("spi1"); + check(spi_controller, "spi1 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/waveshare-s3-touch-lcd-147/waveshare,s3-touch-lcd-147.dts b/Devices/waveshare-s3-touch-lcd-147/waveshare,s3-touch-lcd-147.dts index 463e34f0..544306b2 100644 --- a/Devices/waveshare-s3-touch-lcd-147/waveshare,s3-touch-lcd-147.dts +++ b/Devices/waveshare-s3-touch-lcd-147/waveshare,s3-touch-lcd-147.dts @@ -3,7 +3,9 @@ #include #include #include +#include +// Reference: https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.47 / { compatible = "root"; model = "Waveshare S3 Touch LCD 1.47"; @@ -19,7 +21,27 @@ clock-frequency = <400000>; pin-sda = <42>; pin-scl = <41>; - pin-sda-pullup; - pin-scl-pullup; + }; + + display_spi: spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <39>; + pin-miso = ; + pin-sclk = <38>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; + }; + + sdcard_spi: spi1 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <15>; + pin-miso = <17>; + pin-sclk = <16>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; }; diff --git a/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp b/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp index 52063bf4..7ec8c4ce 100644 --- a/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp +++ b/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp @@ -1,6 +1,5 @@ #include "devices/Display.h" #include "devices/SdCard.h" -#include #include @@ -14,31 +13,5 @@ static DeviceVector createDevices() { } extern const Configuration hardwareConfiguration = { - .createDevices = createDevices, - .spi { - // SD card - spi::Configuration { - .device = SPI2_HOST, - .dma = SPI_DMA_CH_AUTO, - .config = { - .mosi_io_num = GPIO_NUM_11, - .miso_io_num = GPIO_NUM_13, - .sclk_io_num = GPIO_NUM_12, - .quadwp_io_num = GPIO_NUM_NC, - .quadhd_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 = 8192, - .flags = 0, - .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, - .intr_flags = 0 - }, - .initMode = spi::InitMode::ByTactility, - .isMutable = false, - .lock = nullptr - } - } + .createDevices = createDevices }; diff --git a/Devices/waveshare-s3-touch-lcd-43/Source/devices/SdCard.cpp b/Devices/waveshare-s3-touch-lcd-43/Source/devices/SdCard.cpp index a27db36c..89112994 100644 --- a/Devices/waveshare-s3-touch-lcd-43/Source/devices/SdCard.cpp +++ b/Devices/waveshare-s3-touch-lcd-43/Source/devices/SdCard.cpp @@ -1,6 +1,8 @@ #include "SdCard.h" +#include #include +#include using tt::hal::sdcard::SpiSdCardDevice; @@ -10,10 +12,15 @@ std::shared_ptr createSdCard() { GPIO_NUM_NC, GPIO_NUM_NC, GPIO_NUM_NC, - SdCardDevice::MountBehaviour::AtBoot + SdCardDevice::MountBehaviour::AtBoot, + tt::lvgl::getSyncLock() ); + auto* spi_controller = device_find_by_name("spi0"); + check(spi_controller, "spi0 not found"); + return std::make_shared( - std::move(configuration) + std::move(configuration), + spi_controller ); } diff --git a/Devices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dts b/Devices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dts index 21757ad1..7400203c 100644 --- a/Devices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dts +++ b/Devices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dts @@ -3,6 +3,7 @@ #include #include #include +#include #include / { @@ -20,8 +21,17 @@ clock-frequency = <400000>; pin-sda = <8>; pin-scl = <9>; - pin-sda-pullup; - pin-scl-pullup; + }; + + spi0 { + compatible = "espressif,esp32-spi"; + host = ; + pin-mosi = <11>; + pin-miso = <13>; + pin-sclk = <12>; + pin-wp = ; + pin-hd = ; + max-transfer-size = <0>; }; uart1 { diff --git a/Devices/wireless-tag-wt32-sc01-plus/wireless-tag,wt32-sc01-plus.dts b/Devices/wireless-tag-wt32-sc01-plus/wireless-tag,wt32-sc01-plus.dts index 6c98b020..d62f21a8 100644 --- a/Devices/wireless-tag-wt32-sc01-plus/wireless-tag,wt32-sc01-plus.dts +++ b/Devices/wireless-tag-wt32-sc01-plus/wireless-tag,wt32-sc01-plus.dts @@ -19,7 +19,5 @@ clock-frequency = <400000>; pin-sda = <6>; pin-scl = <5>; - pin-sda-pullup; - pin-scl-pullup; }; }; diff --git a/Documentation/ideas.md b/Documentation/ideas.md index 7a3600ea..41c63a42 100644 --- a/Documentation/ideas.md +++ b/Documentation/ideas.md @@ -14,6 +14,7 @@ - Make a root device type so it can be discovered more easily. - DTS/yaml: Consider support for default values. - DTS: throw custom exceptions and catch them to show cleaner error messages. +- When device.py selects a new device, it should automatically delete the build dirs (build/, cmake-*/) when it detects that the platform has changed. - Add font design tokens such as "regular", "title" and "smaller". Perhaps via the LVGL kernel module. - Add kernel listening mechanism so that the root device init can be notified when a device becomes available: Callback for device/start stop with filtering on device type: diff --git a/Drivers/EspLcdCompat/Source/EspLcdDisplay.h b/Drivers/EspLcdCompat/Source/EspLcdDisplay.h index 0c26a2e7..223395ea 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdDisplay.h +++ b/Drivers/EspLcdCompat/Source/EspLcdDisplay.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include diff --git a/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h b/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h index 2f3ca207..124c2356 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h +++ b/Drivers/EspLcdCompat/Source/EspLcdDisplayV2.h @@ -65,7 +65,7 @@ protected: public: - EspLcdDisplayV2(const std::shared_ptr& configuration) : + explicit EspLcdDisplayV2(const std::shared_ptr& configuration) : configuration(configuration) { assert(configuration != nullptr); diff --git a/Drivers/GC9A01/Source/Gc9a01Display.h b/Drivers/GC9A01/Source/Gc9a01Display.h index f6236123..d9a270ed 100644 --- a/Drivers/GC9A01/Source/Gc9a01Display.h +++ b/Drivers/GC9A01/Source/Gc9a01Display.h @@ -12,8 +12,6 @@ class Gc9a01Display final : public EspLcdDisplay { - std::shared_ptr lock; - public: class Configuration { @@ -82,12 +80,8 @@ private: public: explicit Gc9a01Display(std::unique_ptr inConfiguration) : - EspLcdDisplay(tt::hal::spi::getLock(inConfiguration->spiHostDevice)), configuration(std::move(inConfiguration) - ) { - assert(configuration != nullptr); - assert(getLock() != nullptr); - } + ) {} std::string getName() const override { return "GC9A01"; } diff --git a/Drivers/ILI9488/Source/Ili9488Display.h b/Drivers/ILI9488/Source/Ili9488Display.h index 8e2fb3f8..438170e4 100644 --- a/Drivers/ILI9488/Source/Ili9488Display.h +++ b/Drivers/ILI9488/Source/Ili9488Display.h @@ -28,7 +28,7 @@ public: bool mirrorX = false, bool mirrorY = false, bool invertColor = false, - uint32_t bufferSize = 0 // Size in pixel count. 0 means default, which is 1/20 of the screen size + uint32_t bufferSize = 0 // Size in pixel count. 0 means default, which is 1/10 of the screen size ) : spiHostDevice(spiHostDevice), csPin(csPin), dcPin(dcPin), diff --git a/Drivers/ST7735/Source/St7735Display.h b/Drivers/ST7735/Source/St7735Display.h index 0c2083d8..19420e67 100644 --- a/Drivers/ST7735/Source/St7735Display.h +++ b/Drivers/ST7735/Source/St7735Display.h @@ -12,8 +12,6 @@ class St7735Display final : public EspLcdDisplay { - std::shared_ptr lock; - public: class Configuration { diff --git a/Drivers/ST7796/Source/St7796Display.h b/Drivers/ST7796/Source/St7796Display.h index 195cbd0f..2f1097d4 100644 --- a/Drivers/ST7796/Source/St7796Display.h +++ b/Drivers/ST7796/Source/St7796Display.h @@ -78,7 +78,6 @@ private: public: explicit St7796Display(std::unique_ptr inConfiguration) : - EspLcdDisplay(tt::hal::spi::getLock(inConfiguration->spiHostDevice)), configuration(std::move(inConfiguration) ) { assert(configuration != nullptr); diff --git a/Modules/lvgl-module/Source/arch/lvgl_esp32.c b/Modules/lvgl-module/Source/arch/lvgl_esp32.c index 29370019..231564b0 100644 --- a/Modules/lvgl-module/Source/arch/lvgl_esp32.c +++ b/Modules/lvgl-module/Source/arch/lvgl_esp32.c @@ -12,12 +12,12 @@ extern struct LvglModuleConfig lvgl_module_config; static bool initialized = false; bool lvgl_lock(void) { - if (!initialized) return true; // We allow (ake) locking because it's safe to do so as LVGL is not running yet + if (!initialized) return true; // We allow (fake) locking because it's safe to do so as LVGL is not running yet return lvgl_port_lock(portMAX_DELAY); } bool lvgl_try_lock_timed(uint32_t timeout) { - if (!initialized) return true; // We allow (ake) locking because it's safe to do so as LVGL is not running yet + if (!initialized) return true; // We allow (fake) locking because it's safe to do so as LVGL is not running yet return lvgl_port_lock(millis_to_ticks(timeout)); } diff --git a/Tactility/Include/Tactility/hal/Configuration.h b/Tactility/Include/Tactility/hal/Configuration.h index 966c89f6..6d4ece8f 100644 --- a/Tactility/Include/Tactility/hal/Configuration.h +++ b/Tactility/Include/Tactility/hal/Configuration.h @@ -20,7 +20,6 @@ enum class UiScale { struct Configuration { /** - * Called before I2C/SPI/etc is initialized. * Used for powering on the peripherals manually. */ const InitBoot initBoot = nullptr; diff --git a/Tactility/Source/service/wifi/WifiEsp.cpp b/Tactility/Source/service/wifi/WifiEsp.cpp index a5221185..bb7b3926 100644 --- a/Tactility/Source/service/wifi/WifiEsp.cpp +++ b/Tactility/Source/service/wifi/WifiEsp.cpp @@ -858,7 +858,7 @@ static void dispatchDisconnectButKeepActive(std::shared_ptr wifi) { static bool shouldScanForAutoConnect(std::shared_ptr wifi) { auto lock = wifi->dataMutex.asScopedLock(); - if (!lock.lock(100)) { + if (!lock.lock(100 / portTICK_PERIOD_MS)) { return false; } @@ -893,7 +893,7 @@ std::string getIp() { auto wifi = std::static_pointer_cast(wifi_singleton); auto lock = wifi->dataMutex.asScopedLock(); - if (!lock.lock(100)) { + if (!lock.lock(100 / portTICK_PERIOD_MS)) { return "0.0.0.0"; } diff --git a/TactilityC/Source/tt_init.cpp b/TactilityC/Source/tt_init.cpp index e89757de..27e63a4d 100644 --- a/TactilityC/Source/tt_init.cpp +++ b/TactilityC/Source/tt_init.cpp @@ -90,19 +90,28 @@ const esp_elfsym main_symbols[] { // esp_sntp.h ESP_ELFSYM_EXPORT(sntp_get_sync_status), // math.h + ESP_ELFSYM_EXPORT(acos), + ESP_ELFSYM_EXPORT(acoshf), + ESP_ELFSYM_EXPORT(acosf), + ESP_ELFSYM_EXPORT(asin), + ESP_ELFSYM_EXPORT(asinhf), + ESP_ELFSYM_EXPORT(asinf), ESP_ELFSYM_EXPORT(atan), + ESP_ELFSYM_EXPORT(atanhf), ESP_ELFSYM_EXPORT(atanf), ESP_ELFSYM_EXPORT(cos), + ESP_ELFSYM_EXPORT(coshf), ESP_ELFSYM_EXPORT(cosf), ESP_ELFSYM_EXPORT(sin), + ESP_ELFSYM_EXPORT(sinhf), ESP_ELFSYM_EXPORT(sinf), ESP_ELFSYM_EXPORT(tan), + ESP_ELFSYM_EXPORT(tanhf), ESP_ELFSYM_EXPORT(tanf), ESP_ELFSYM_EXPORT(frexp), ESP_ELFSYM_EXPORT(frexpf), ESP_ELFSYM_EXPORT(modf), ESP_ELFSYM_EXPORT(modff), - ESP_ELFSYM_EXPORT(fmodf), ESP_ELFSYM_EXPORT(ceil), ESP_ELFSYM_EXPORT(ceilf), ESP_ELFSYM_EXPORT(fabs), diff --git a/TactilityCore/Include/Tactility/kernel/SpiDeviceLock.h b/TactilityCore/Include/Tactility/kernel/SpiDeviceLock.h index 09e7b93d..ad3acd17 100644 --- a/TactilityCore/Include/Tactility/kernel/SpiDeviceLock.h +++ b/TactilityCore/Include/Tactility/kernel/SpiDeviceLock.h @@ -10,7 +10,7 @@ namespace tt { class SpiDeviceLock : public Lock { ::Device* device; public: - SpiDeviceLock(::Device* device) : device(device) { } + explicit SpiDeviceLock(::Device* device) : device(device) { } bool lock(TickType_t timeout) const override { return spi_controller_try_lock(device, timeout) == ERROR_NONE;