diff --git a/.github/actions/build-firmware/action.yml b/.github/actions/build-firmware/action.yml index 9bc197a97..d6042d2fc 100644 --- a/.github/actions/build-firmware/action.yml +++ b/.github/actions/build-firmware/action.yml @@ -20,7 +20,7 @@ runs: - name: 'Build' uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.5.2 + esp_idf_version: v6.1 target: ${{ inputs.arch }} path: './' - name: 'Release' diff --git a/.github/actions/build-sdk/action.yml b/.github/actions/build-sdk/action.yml index 538130142..dfcaa5f16 100644 --- a/.github/actions/build-sdk/action.yml +++ b/.github/actions/build-sdk/action.yml @@ -21,14 +21,14 @@ runs: uses: espressif/esp-idf-ci-action@v1 with: # NOTE: Update with ESP-IDF! - esp_idf_version: v5.5.2 + esp_idf_version: v6.1 target: ${{ inputs.arch }} path: './' - name: 'Release' shell: bash env: # NOTE: Update with ESP-IDF! - ESP_IDF_VERSION: '5.5.2' + ESP_IDF_VERSION: '6.1' run: python Buildscripts/release-sdk-esp32.py release/TactilitySDK - name: 'Test Integration Prep' shell: bash @@ -41,7 +41,7 @@ runs: - name: 'Test Integration' uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.5.2 + esp_idf_version: v6.1 target: ${{ inputs.arch }} command: export TACTILITY_SDK_PATH=../../test_sdk && cd Tests/SdkIntegration && python tactility.py build -a ${{ inputs.arch }} --local-sdk - name: 'Upload Artifact' diff --git a/.github/actions/build-simulator/action.yml b/.github/actions/build-simulator/action.yml index 80eeb5ae8..ac41dbf20 100644 --- a/.github/actions/build-simulator/action.yml +++ b/.github/actions/build-simulator/action.yml @@ -40,6 +40,13 @@ runs: uses: jwlawson/actions-setup-cmake@v2 with: cmake-version: '3.31.x' + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install mbedtls codegen Python dependencies + shell: bash + run: pip install -r Libraries/mbedtls/scripts/driver.requirements.txt - name: "Prepare Project" shell: bash run: cmake -S ./ -B buildsim diff --git a/Buildscripts/sdkconfig/default.properties b/Buildscripts/sdkconfig/default.properties index bb6d1faaa..9b0b86806 100644 --- a/Buildscripts/sdkconfig/default.properties +++ b/Buildscripts/sdkconfig/default.properties @@ -8,6 +8,19 @@ CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y +# Wi-Fi hot-path code normally duplicated into IRAM for throughput/latency +# Tactility's Wi-Fi usage (HTTP/NTP/ESP-NOW, not sustained high-throughput streaming) doesn't need it. +# Frees >27KB IRAM across Wi-Fi-enabled boards. +CONFIG_ESP_WIFI_IRAM_OPT=n +CONFIG_ESP_WIFI_RX_IRAM_OPT=n +CONFIG_ESP_WIFI_EXTRA_IRAM_OPT=n +CONFIG_ESP_WIFI_SLP_IRAM_OPT=n +CONFIG_WIFI_RMT_IRAM_OPT=n +CONFIG_WIFI_RMT_EXTRA_IRAM_OPT=n +CONFIG_WIFI_RMT_RX_IRAM_OPT=n +CONFIG_WIFI_RMT_SLP_IRAM_OPT=n +CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS=n +CONFIG_LOG_IN_IRAM=n # EmbedTLS # Use TLS 1.2 because 1.3 conflicts with MbedTLS dynamic buffer CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y diff --git a/Devices/btt-panda-touch/bigtreetech,panda-touch.dts b/Devices/btt-panda-touch/bigtreetech,panda-touch.dts index 2bf477185..cd1002566 100644 --- a/Devices/btt-panda-touch/bigtreetech,panda-touch.dts +++ b/Devices/btt-panda-touch/bigtreetech,panda-touch.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ }; i2c_internal: i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 2 GPIO_FLAG_NONE>; @@ -47,7 +47,7 @@ }; i2c_external: i2c1 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 4 GPIO_FLAG_NONE>; diff --git a/Devices/btt-panda-touch/source/module.cpp b/Devices/btt-panda-touch/source/module.cpp index 1f1981f58..63ad7f4b2 100644 --- a/Devices/btt-panda-touch/source/module.cpp +++ b/Devices/btt-panda-touch/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module btt_panda_touch_module = { - .name = "btt-panda-touch" + .name = "btt-panda-touch", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cl32/cl32.dts b/Devices/cl32/cl32.dts index 042b2256a..26ea813fe 100644 --- a/Devices/cl32/cl32.dts +++ b/Devices/cl32/cl32.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -29,7 +29,7 @@ // Top Stemma/Qwiic port 1 shares this bus with the keyboard and RTC (SDA: pin 1 <-> SCL: pin 2). // External I2C devices on that port are reachable via i2c0. i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 1 GPIO_FLAG_PULL_UP>; diff --git a/Devices/cyd-2432s024c/cyd,2432s024c.dts b/Devices/cyd-2432s024c/cyd,2432s024c.dts index eafea7ac4..6dc664e13 100644 --- a/Devices/cyd-2432s024c/cyd,2432s024c.dts +++ b/Devices/cyd-2432s024c/cyd,2432s024c.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -26,7 +26,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 33 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-2432s024c/source/module.cpp b/Devices/cyd-2432s024c/source/module.cpp index 538fe2447..137119788 100644 --- a/Devices/cyd-2432s024c/source/module.cpp +++ b/Devices/cyd-2432s024c/source/module.cpp @@ -4,6 +4,11 @@ extern "C" { Module cyd_2432s024c_module = { .name = "cyd-2432s024c", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-2432s024r/source/module.cpp b/Devices/cyd-2432s024r/source/module.cpp index c816de82a..29c76420c 100644 --- a/Devices/cyd-2432s024r/source/module.cpp +++ b/Devices/cyd-2432s024r/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_2432s024r_module = { - .name = "cyd-2432s024r" + .name = "cyd-2432s024r", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-2432s028r/cyd,2432s028r.dts b/Devices/cyd-2432s028r/cyd,2432s028r.dts index 443a3f42e..0e265a17b 100644 --- a/Devices/cyd-2432s028r/cyd,2432s028r.dts +++ b/Devices/cyd-2432s028r/cyd,2432s028r.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ }; i2c_cn1 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 27 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-2432s028r/source/module.cpp b/Devices/cyd-2432s028r/source/module.cpp index 047fd86f4..bab284510 100644 --- a/Devices/cyd-2432s028r/source/module.cpp +++ b/Devices/cyd-2432s028r/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_2432s028r_module = { - .name = "cyd-2432s028r" + .name = "cyd-2432s028r", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts b/Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts index 93aaf1731..c9a4c48f5 100644 --- a/Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts +++ b/Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ }; i2c_cn1 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 27 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-2432s028rv3/source/module.cpp b/Devices/cyd-2432s028rv3/source/module.cpp index 00f233932..7edcb9967 100644 --- a/Devices/cyd-2432s028rv3/source/module.cpp +++ b/Devices/cyd-2432s028rv3/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_2432s028rv3_module = { - .name = "cyd-2432s028rv3" + .name = "cyd-2432s028rv3", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-2432s032c/cyd,2432s032c.dts b/Devices/cyd-2432s032c/cyd,2432s032c.dts index 563e73726..11dcf2289 100644 --- a/Devices/cyd-2432s032c/cyd,2432s032c.dts +++ b/Devices/cyd-2432s032c/cyd,2432s032c.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -26,7 +26,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 33 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-2432s032c/source/module.cpp b/Devices/cyd-2432s032c/source/module.cpp index 966c1da99..c991e41be 100644 --- a/Devices/cyd-2432s032c/source/module.cpp +++ b/Devices/cyd-2432s032c/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_2432s032c_module = { - .name = "cyd-2432s032c" + .name = "cyd-2432s032c", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-3248s035c/cyd,3248s035c.dts b/Devices/cyd-3248s035c/cyd,3248s035c.dts index 8718e54b3..d6b575d5e 100644 --- a/Devices/cyd-3248s035c/cyd,3248s035c.dts +++ b/Devices/cyd-3248s035c/cyd,3248s035c.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ }; i2c_internal: i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 33 GPIO_FLAG_NONE>; @@ -43,7 +43,7 @@ // CN1 header i2c_external: i2c1 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 21 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-3248s035c/source/module.cpp b/Devices/cyd-3248s035c/source/module.cpp index d43c57edf..36163ac9f 100644 --- a/Devices/cyd-3248s035c/source/module.cpp +++ b/Devices/cyd-3248s035c/source/module.cpp @@ -1,9 +1,14 @@ -#include - -extern "C" { - -Module cyd_3248s035c_module = { - .name = "cyd-3248s035c" -}; - -} +#include + +extern "C" { + +Module cyd_3248s035c_module = { + .name = "cyd-3248s035c", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr +}; + +} diff --git a/Devices/cyd-4848s040c/cyd,4848s040c.dts b/Devices/cyd-4848s040c/cyd,4848s040c.dts index cc7379061..7c95f47ee 100644 --- a/Devices/cyd-4848s040c/cyd,4848s040c.dts +++ b/Devices/cyd-4848s040c/cyd,4848s040c.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 19 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-4848s040c/source/module.cpp b/Devices/cyd-4848s040c/source/module.cpp index da3236374..cc07a28e9 100644 --- a/Devices/cyd-4848s040c/source/module.cpp +++ b/Devices/cyd-4848s040c/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_4848s040c_module = { - .name = "cyd-4848s040c" + .name = "cyd-4848s040c", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-8048s043c/cyd,8048s043c.dts b/Devices/cyd-8048s043c/cyd,8048s043c.dts index e5712e6db..d5dd5e89b 100644 --- a/Devices/cyd-8048s043c/cyd,8048s043c.dts +++ b/Devices/cyd-8048s043c/cyd,8048s043c.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -31,7 +31,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 19 GPIO_FLAG_NONE>; @@ -49,7 +49,7 @@ }; i2c_external { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 17 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-8048s043c/source/module.cpp b/Devices/cyd-8048s043c/source/module.cpp index 6d8e1ea31..fc0d08b8b 100644 --- a/Devices/cyd-8048s043c/source/module.cpp +++ b/Devices/cyd-8048s043c/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_8048s043c_module = { - .name = "cyd-8048s043c" + .name = "cyd-8048s043c", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-e32r28t/source/module.cpp b/Devices/cyd-e32r28t/source/module.cpp index 3ba363950..ed776992f 100644 --- a/Devices/cyd-e32r28t/source/module.cpp +++ b/Devices/cyd-e32r28t/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_e32r28t_module = { - .name = "cyd-e32r28t" + .name = "cyd-e32r28t", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/cyd-e32r32p/cyd,e32r32p.dts b/Devices/cyd-e32r32p/cyd,e32r32p.dts index 51a8fa564..d4ea26ee5 100644 --- a/Devices/cyd-e32r32p/cyd,e32r32p.dts +++ b/Devices/cyd-e32r32p/cyd,e32r32p.dts @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -28,7 +28,7 @@ }; i2c_external { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 32 GPIO_FLAG_NONE>; diff --git a/Devices/cyd-e32r32p/source/module.cpp b/Devices/cyd-e32r32p/source/module.cpp index 7c259cbc2..8fa63396a 100644 --- a/Devices/cyd-e32r32p/source/module.cpp +++ b/Devices/cyd-e32r32p/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module cyd_e32r32p_module = { - .name = "cyd-e32r32p" + .name = "cyd-e32r32p", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 bf79731b8..d44af8f1b 100644 --- a/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts +++ b/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 15 GPIO_FLAG_NONE>; diff --git a/Devices/elecrow-crowpanel-advance-28/source/module.cpp b/Devices/elecrow-crowpanel-advance-28/source/module.cpp index 14294e236..7234819c0 100644 --- a/Devices/elecrow-crowpanel-advance-28/source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-28/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module elecrow_crowpanel_advance_28_module = { - .name = "elecrow-crowpanel-advance-28" + .name = "elecrow-crowpanel-advance-28", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 5aa682e22..f4f022147 100644 --- a/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts +++ b/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 15 GPIO_FLAG_NONE>; diff --git a/Devices/elecrow-crowpanel-advance-35/source/module.cpp b/Devices/elecrow-crowpanel-advance-35/source/module.cpp index 5a3b45fad..2aa0a7e41 100644 --- a/Devices/elecrow-crowpanel-advance-35/source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-35/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module elecrow_crowpanel_advance_35_module = { - .name = "elecrow-crowpanel-advance-35" + .name = "elecrow-crowpanel-advance-35", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 8291fb775..432dc7a51 100644 --- a/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts +++ b/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 15 GPIO_FLAG_NONE>; diff --git a/Devices/elecrow-crowpanel-advance-50/source/module.cpp b/Devices/elecrow-crowpanel-advance-50/source/module.cpp index 30b4008fb..fe6fdcfec 100644 --- a/Devices/elecrow-crowpanel-advance-50/source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-50/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module elecrow_crowpanel_advance_50_module = { - .name = "elecrow-crowpanel-advance-50" + .name = "elecrow-crowpanel-advance-50", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 77e07953a..5b3684de7 100644 --- a/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts +++ b/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -26,7 +26,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 22 GPIO_FLAG_NONE>; diff --git a/Devices/elecrow-crowpanel-basic-28/source/module.cpp b/Devices/elecrow-crowpanel-basic-28/source/module.cpp index fe05be7b8..1b01a2ba7 100644 --- a/Devices/elecrow-crowpanel-basic-28/source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-28/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module elecrow_crowpanel_basic_28_module = { - .name = "elecrow-crowpanel-basic-28" + .name = "elecrow-crowpanel-basic-28", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 f5ab1aeca..a3f06a14a 100644 --- a/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts +++ b/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -26,7 +26,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 22 GPIO_FLAG_NONE>; diff --git a/Devices/elecrow-crowpanel-basic-35/source/module.cpp b/Devices/elecrow-crowpanel-basic-35/source/module.cpp index b0292a47a..54ac87a83 100644 --- a/Devices/elecrow-crowpanel-basic-35/source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-35/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module elecrow_crowpanel_basic_35_module = { - .name = "elecrow-crowpanel-basic-35" + .name = "elecrow-crowpanel-basic-35", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 6cb5bba2c..d581bf121 100644 --- a/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts +++ b/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 19 GPIO_FLAG_NONE>; diff --git a/Devices/elecrow-crowpanel-basic-50/source/module.cpp b/Devices/elecrow-crowpanel-basic-50/source/module.cpp index 68ce47a1b..913454176 100644 --- a/Devices/elecrow-crowpanel-basic-50/source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-50/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module elecrow_crowpanel_basic_50_module = { - .name = "elecrow-crowpanel-basic-50" + .name = "elecrow-crowpanel-basic-50", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/es3c28p/es3c28p.dts b/Devices/es3c28p/es3c28p.dts index ab0baee69..d861d6915 100644 --- a/Devices/es3c28p/es3c28p.dts +++ b/Devices/es3c28p/es3c28p.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -69,7 +69,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 16 GPIO_FLAG_NONE>; diff --git a/Devices/es3c28p/source/module.cpp b/Devices/es3c28p/source/module.cpp index 7b4335bf9..38d70d651 100644 --- a/Devices/es3c28p/source/module.cpp +++ b/Devices/es3c28p/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module es3c28p_module = { - .name = "es3c28p" + .name = "es3c28p", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/generic-esp32/generic,esp32.dts b/Devices/generic-esp32/generic,esp32.dts index 84fc39d4f..e611540d7 100644 --- a/Devices/generic-esp32/generic,esp32.dts +++ b/Devices/generic-esp32/generic,esp32.dts @@ -3,7 +3,6 @@ #include #include #include -#include / { compatible = "root"; diff --git a/Devices/generic-esp32/source/module.cpp b/Devices/generic-esp32/source/module.cpp index 360b5608f..04800db7b 100644 --- a/Devices/generic-esp32/source/module.cpp +++ b/Devices/generic-esp32/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module generic_esp32_module = { - .name = "generic-esp32" + .name = "generic-esp32", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/generic-esp32c6/generic,esp32c6.dts b/Devices/generic-esp32c6/generic,esp32c6.dts index 7c5254acb..f63786ea3 100644 --- a/Devices/generic-esp32c6/generic,esp32c6.dts +++ b/Devices/generic-esp32c6/generic,esp32c6.dts @@ -3,7 +3,6 @@ #include #include #include -#include / { compatible = "root"; diff --git a/Devices/generic-esp32c6/source/module.cpp b/Devices/generic-esp32c6/source/module.cpp index 46aab4331..d5381c72d 100644 --- a/Devices/generic-esp32c6/source/module.cpp +++ b/Devices/generic-esp32c6/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module generic_esp32c6_module = { - .name = "generic-esp32c6" + .name = "generic-esp32c6", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/generic-esp32p4/generic,esp32p4.dts b/Devices/generic-esp32p4/generic,esp32p4.dts index 44ec7a762..93d6280a9 100644 --- a/Devices/generic-esp32p4/generic,esp32p4.dts +++ b/Devices/generic-esp32p4/generic,esp32p4.dts @@ -2,7 +2,6 @@ #include #include -#include / { compatible = "root"; diff --git a/Devices/generic-esp32p4/source/module.cpp b/Devices/generic-esp32p4/source/module.cpp index fb38fb0fb..9465ba9b3 100644 --- a/Devices/generic-esp32p4/source/module.cpp +++ b/Devices/generic-esp32p4/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module generic_esp32p4_module = { - .name = "generic-esp32p4" + .name = "generic-esp32p4", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/generic-esp32s3/generic,esp32s3.dts b/Devices/generic-esp32s3/generic,esp32s3.dts index eba13b006..22c92c013 100644 --- a/Devices/generic-esp32s3/generic,esp32s3.dts +++ b/Devices/generic-esp32s3/generic,esp32s3.dts @@ -3,7 +3,6 @@ #include #include #include -#include / { compatible = "root"; diff --git a/Devices/generic-esp32s3/source/module.cpp b/Devices/generic-esp32s3/source/module.cpp index 1392f3419..a38b1298c 100644 --- a/Devices/generic-esp32s3/source/module.cpp +++ b/Devices/generic-esp32s3/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module generic_esp32s3_module = { - .name = "generic-esp32s3" + .name = "generic-esp32s3", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts b/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts index fd1bac776..df86cdc79 100644 --- a/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts +++ b/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -42,7 +42,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 7 GPIO_FLAG_NONE>; diff --git a/Devices/guition-jc1060p470ciwy/source/module.cpp b/Devices/guition-jc1060p470ciwy/source/module.cpp index 2750b3005..7b2bba590 100644 --- a/Devices/guition-jc1060p470ciwy/source/module.cpp +++ b/Devices/guition-jc1060p470ciwy/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module guition_jc1060p470ciwy_module = { - .name = "guition-jc1060p470ciwy" + .name = "guition-jc1060p470ciwy", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/guition-jc2432w328c/guition,jc2432w328c.dts b/Devices/guition-jc2432w328c/guition,jc2432w328c.dts index 3fa69997c..e354c5129 100644 --- a/Devices/guition-jc2432w328c/guition,jc2432w328c.dts +++ b/Devices/guition-jc2432w328c/guition,jc2432w328c.dts @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ }; i2c_internal: i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 33 GPIO_FLAG_NONE>; @@ -43,7 +43,7 @@ // CN1 header i2c_external: i2c1 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 21 GPIO_FLAG_NONE>; diff --git a/Devices/guition-jc2432w328c/source/module.cpp b/Devices/guition-jc2432w328c/source/module.cpp index 445cd4c4f..cf38381a6 100644 --- a/Devices/guition-jc2432w328c/source/module.cpp +++ b/Devices/guition-jc2432w328c/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module guition_jc2432w328c_module = { - .name = "guition-jc2432w328c" + .name = "guition-jc2432w328c", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/guition-jc8048w550c/guition,jc8048w550c.dts b/Devices/guition-jc8048w550c/guition,jc8048w550c.dts index ffa959dc3..81fb13302 100644 --- a/Devices/guition-jc8048w550c/guition,jc8048w550c.dts +++ b/Devices/guition-jc8048w550c/guition,jc8048w550c.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ }; i2c_internal: i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 19 GPIO_FLAG_NONE>; @@ -51,7 +51,7 @@ }; i2c_external: i2c1 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 17 GPIO_FLAG_NONE>; diff --git a/Devices/guition-jc8048w550c/source/module.cpp b/Devices/guition-jc8048w550c/source/module.cpp index 76b649b38..cf2380f47 100644 --- a/Devices/guition-jc8048w550c/source/module.cpp +++ b/Devices/guition-jc8048w550c/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module guition_jc8048w550c_module = { - .name = "guition-jc8048w550c" + .name = "guition-jc8048w550c", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 c989662c1..bff83d70a 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 @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <200000>; pin-sda = <&gpio0 17 GPIO_FLAG_NONE>; diff --git a/Devices/heltec-wifi-lora-32-v3/source/module.cpp b/Devices/heltec-wifi-lora-32-v3/source/module.cpp index f90445949..595b475f9 100644 --- a/Devices/heltec-wifi-lora-32-v3/source/module.cpp +++ b/Devices/heltec-wifi-lora-32-v3/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module heltec_wifi_lora_32_v3_module = { - .name = "heltec-wifi-lora-32-v3" + .name = "heltec-wifi-lora-32-v3", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-tdeck-max/source/module.cpp b/Devices/lilygo-tdeck-max/source/module.cpp index 2fec15e34..ec75ebbd9 100644 --- a/Devices/lilygo-tdeck-max/source/module.cpp +++ b/Devices/lilygo-tdeck-max/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module lilygo_tdeck_max_module = { - .name = "lilygo-tdeck-max" + .name = "lilygo-tdeck-max", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-tdeck-plus/lilygo,tdeck-plus.dts b/Devices/lilygo-tdeck-plus/lilygo,tdeck-plus.dts index fc97380b2..a99367e30 100644 --- a/Devices/lilygo-tdeck-plus/lilygo,tdeck-plus.dts +++ b/Devices/lilygo-tdeck-plus/lilygo,tdeck-plus.dts @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -97,7 +97,7 @@ }; i2c_internal: i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 18 GPIO_FLAG_NONE>; diff --git a/Devices/lilygo-tdeck-plus/source/module.cpp b/Devices/lilygo-tdeck-plus/source/module.cpp index 2ae197226..d6b9e8607 100644 --- a/Devices/lilygo-tdeck-plus/source/module.cpp +++ b/Devices/lilygo-tdeck-plus/source/module.cpp @@ -27,6 +27,9 @@ Module lilygo_tdeck_plus_module = { .name = "lilygo-tdeck-plus", .start = start, .stop = stop, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-tdeck/lilygo,tdeck.dts b/Devices/lilygo-tdeck/lilygo,tdeck.dts index 5819ac1e2..5a53d6c36 100644 --- a/Devices/lilygo-tdeck/lilygo,tdeck.dts +++ b/Devices/lilygo-tdeck/lilygo,tdeck.dts @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -95,7 +95,7 @@ }; i2c_internal: i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 18 GPIO_FLAG_NONE>; diff --git a/Devices/lilygo-tdeck/source/module.cpp b/Devices/lilygo-tdeck/source/module.cpp index a5590c11f..119f1ca71 100644 --- a/Devices/lilygo-tdeck/source/module.cpp +++ b/Devices/lilygo-tdeck/source/module.cpp @@ -25,7 +25,10 @@ static error_t stop() { Module lilygo_tdeck_module = { .name = "lilygo-tdeck", .start = start, - .stop = stop + .stop = stop, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-tdisplay-s3/CMakeLists.txt b/Devices/lilygo-tdisplay-s3/CMakeLists.txt index a832a83a2..94b4fdaef 100644 --- a/Devices/lilygo-tdisplay-s3/CMakeLists.txt +++ b/Devices/lilygo-tdisplay-s3/CMakeLists.txt @@ -2,5 +2,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*) idf_component_register( SRCS ${SOURCE_FILES} - REQUIRES TactilityKernel driver + REQUIRES TactilityKernel driver esp_driver_gpio ) diff --git a/Devices/lilygo-tdisplay-s3/source/module.cpp b/Devices/lilygo-tdisplay-s3/source/module.cpp index 68e880e48..218f64259 100644 --- a/Devices/lilygo-tdisplay-s3/source/module.cpp +++ b/Devices/lilygo-tdisplay-s3/source/module.cpp @@ -37,7 +37,10 @@ static error_t stop() { Module lilygo_tdisplay_s3_module = { .name = "lilygo-tdisplay-s3", .start = start, - .stop = stop + .stop = stop, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-tdisplay/source/module.cpp b/Devices/lilygo-tdisplay/source/module.cpp index 132360802..246988ba5 100644 --- a/Devices/lilygo-tdisplay/source/module.cpp +++ b/Devices/lilygo-tdisplay/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module lilygo_tdisplay_module = { - .name = "lilygo-tdisplay" + .name = "lilygo-tdisplay", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts b/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts index 02983f122..d647c355c 100644 --- a/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts +++ b/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -31,7 +31,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 44 GPIO_FLAG_NONE>; diff --git a/Devices/lilygo-tdongle-s3/source/module.cpp b/Devices/lilygo-tdongle-s3/source/module.cpp index 53d5600ee..06b46bcbd 100644 --- a/Devices/lilygo-tdongle-s3/source/module.cpp +++ b/Devices/lilygo-tdongle-s3/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module lilygo_tdongle_s3_module = { - .name = "lilygo-tdongle-s3" + .name = "lilygo-tdongle-s3", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-thmi/lilygo,thmi.dts b/Devices/lilygo-thmi/lilygo,thmi.dts index 83bb6c7f8..5ad46f05b 100644 --- a/Devices/lilygo-thmi/lilygo,thmi.dts +++ b/Devices/lilygo-thmi/lilygo,thmi.dts @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include diff --git a/Devices/lilygo-thmi/source/module.cpp b/Devices/lilygo-thmi/source/module.cpp index 02bd8a6bd..cd9757cbd 100644 --- a/Devices/lilygo-thmi/source/module.cpp +++ b/Devices/lilygo-thmi/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module lilygo_thmi_module = { - .name = "lilygo-thmi" + .name = "lilygo-thmi", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts b/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts index 87a4bd8c5..8f7293f13 100644 --- a/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts +++ b/Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 3 GPIO_FLAG_NONE>; diff --git a/Devices/lilygo-tlora-pager/source/module.cpp b/Devices/lilygo-tlora-pager/source/module.cpp index f249bc7a7..27797e5f7 100644 --- a/Devices/lilygo-tlora-pager/source/module.cpp +++ b/Devices/lilygo-tlora-pager/source/module.cpp @@ -26,7 +26,10 @@ static error_t stop() { Module lilygo_tlora_pager_module = { .name = "lilygo-tlora-pager", .start = start, - .stop = stop + .stop = stop, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts b/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts index 421feebf9..ae258ae1f 100644 --- a/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts +++ b/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 8 GPIO_FLAG_NONE>; diff --git a/Devices/m5stack-cardputer-adv/source/module.cpp b/Devices/m5stack-cardputer-adv/source/module.cpp index e1d4845e4..5e4f2605b 100644 --- a/Devices/m5stack-cardputer-adv/source/module.cpp +++ b/Devices/m5stack-cardputer-adv/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module m5stack_cardputer_adv_module = { - .name = "m5stack-cardputer-adv" + .name = "m5stack-cardputer-adv", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-cardputer/m5stack,cardputer.dts b/Devices/m5stack-cardputer/m5stack,cardputer.dts index 4f59d58b7..9339b7ffe 100644 --- a/Devices/m5stack-cardputer/m5stack,cardputer.dts +++ b/Devices/m5stack-cardputer/m5stack,cardputer.dts @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/Devices/m5stack-cardputer/source/module.cpp b/Devices/m5stack-cardputer/source/module.cpp index c1e7f7ca7..c96dfda9c 100644 --- a/Devices/m5stack-cardputer/source/module.cpp +++ b/Devices/m5stack-cardputer/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module m5stack_cardputer_module = { - .name = "m5stack-cardputer" + .name = "m5stack-cardputer", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-core2/m5stack,core2.dts b/Devices/m5stack-core2/m5stack,core2.dts index 87ceca1eb..1f180c401 100644 --- a/Devices/m5stack-core2/m5stack,core2.dts +++ b/Devices/m5stack-core2/m5stack,core2.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 21 GPIO_FLAG_NONE>; diff --git a/Devices/m5stack-core2/source/module.cpp b/Devices/m5stack-core2/source/module.cpp index d574d630e..2272f6556 100644 --- a/Devices/m5stack-core2/source/module.cpp +++ b/Devices/m5stack-core2/source/module.cpp @@ -6,7 +6,12 @@ extern "C" { // and axp192-module's start()), replacing what used to be done by hand here via a // DEVICE_EVENT_STARTED device_listener. Module m5stack_core2_module = { - .name = "m5stack-core2" + .name = "m5stack-core2", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-cores3/m5stack,cores3.dts b/Devices/m5stack-cores3/m5stack,cores3.dts index 225a822be..aaefa217c 100644 --- a/Devices/m5stack-cores3/m5stack,cores3.dts +++ b/Devices/m5stack-cores3/m5stack,cores3.dts @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -55,7 +55,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 12 GPIO_FLAG_NONE>; diff --git a/Devices/m5stack-cores3/source/module.cpp b/Devices/m5stack-cores3/source/module.cpp index 56828ac30..d55b1a78d 100644 --- a/Devices/m5stack-cores3/source/module.cpp +++ b/Devices/m5stack-cores3/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module m5stack_cores3_module = { - .name = "m5stack-cores3" + .name = "m5stack-cores3", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-papers3/m5stack,papers3.dts b/Devices/m5stack-papers3/m5stack,papers3.dts index ad3d56b96..eaccfaa9d 100644 --- a/Devices/m5stack-papers3/m5stack,papers3.dts +++ b/Devices/m5stack-papers3/m5stack,papers3.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -35,7 +35,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 41 GPIO_FLAG_NONE>; diff --git a/Devices/m5stack-papers3/source/module.cpp b/Devices/m5stack-papers3/source/module.cpp index 0060cf9c0..06a311f76 100644 --- a/Devices/m5stack-papers3/source/module.cpp +++ b/Devices/m5stack-papers3/source/module.cpp @@ -16,7 +16,11 @@ static Driver* const papers3_drivers[] = { Module m5stack_papers3_module = { .name = "m5stack-papers3", - .drivers = papers3_drivers + .start = nullptr, + .stop = nullptr, + .drivers = papers3_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-stackchan/m5stack,stackchan.dts b/Devices/m5stack-stackchan/m5stack,stackchan.dts index bfc3a0e05..706f2dfb0 100644 --- a/Devices/m5stack-stackchan/m5stack,stackchan.dts +++ b/Devices/m5stack-stackchan/m5stack,stackchan.dts @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 12 GPIO_FLAG_NONE>; diff --git a/Devices/m5stack-stackchan/source/module.cpp b/Devices/m5stack-stackchan/source/module.cpp index 367b38487..c40a54afb 100644 --- a/Devices/m5stack-stackchan/source/module.cpp +++ b/Devices/m5stack-stackchan/source/module.cpp @@ -56,7 +56,10 @@ static error_t stop() { Module m5stack_stackchan_module = { .name = "m5stack-stackchan", .start = start, - .stop = stop + .stop = stop, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-stickc-plus2/CMakeLists.txt b/Devices/m5stack-stickc-plus2/CMakeLists.txt index 38c007833..84e79791b 100644 --- a/Devices/m5stack-stickc-plus2/CMakeLists.txt +++ b/Devices/m5stack-stickc-plus2/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*) idf_component_register( SRCS ${SOURCE_FILES} INCLUDE_DIRS "source" - REQUIRES TactilityKernel driver + REQUIRES TactilityKernel driver esp_driver_gpio ) diff --git a/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts b/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts index dff6ff412..b0eb4c8c0 100644 --- a/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts +++ b/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 21 GPIO_FLAG_NONE>; @@ -45,7 +45,7 @@ }; i2c_grove { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 32 GPIO_FLAG_NONE>; diff --git a/Devices/m5stack-stickc-plus2/source/module.cpp b/Devices/m5stack-stickc-plus2/source/module.cpp index abb6e4cdf..8a9c09456 100644 --- a/Devices/m5stack-stickc-plus2/source/module.cpp +++ b/Devices/m5stack-stickc-plus2/source/module.cpp @@ -22,7 +22,11 @@ static error_t init_power() { Module m5stack_stickc_plus2_module = { .name = "m5stack-stickc-plus2", - .start = init_power + .start = init_power, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-sticks3/m5stack,sticks3.dts b/Devices/m5stack-sticks3/m5stack,sticks3.dts index 23e616f3c..1c0b9ff97 100644 --- a/Devices/m5stack-sticks3/m5stack,sticks3.dts +++ b/Devices/m5stack-sticks3/m5stack,sticks3.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 47 GPIO_FLAG_NONE>; @@ -73,7 +73,7 @@ }; i2c_grove { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 9 GPIO_FLAG_NONE>; diff --git a/Devices/m5stack-sticks3/source/module.cpp b/Devices/m5stack-sticks3/source/module.cpp index 047c0a97b..88186e6fd 100644 --- a/Devices/m5stack-sticks3/source/module.cpp +++ b/Devices/m5stack-sticks3/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module m5stack_sticks3_module = { - .name = "m5stack-sticks3" + .name = "m5stack-sticks3", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-tab5/Source/module.cpp b/Devices/m5stack-tab5/Source/module.cpp index 20b63bf84..b757e8465 100644 --- a/Devices/m5stack-tab5/Source/module.cpp +++ b/Devices/m5stack-tab5/Source/module.cpp @@ -92,7 +92,9 @@ Module m5stack_tab5_module = { .name = "m5stack-tab5", .start = start, .stop = stop, - .drivers = tab5_drivers + .drivers = tab5_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/m5stack-tab5/device.properties b/Devices/m5stack-tab5/device.properties index 38d7e4243..eea1e19d7 100644 --- a/Devices/m5stack-tab5/device.properties +++ b/Devices/m5stack-tab5/device.properties @@ -55,4 +55,4 @@ sdkconfig.CONFIG_LV_DEF_REFR_PERIOD=15 # SC202CS (SC2356) MIPI CSI camera sensor + ISP pipeline (AE/AWB/demosaicing) sdkconfig.CONFIG_CAMERA_SC202CS=y sdkconfig.CONFIG_CAMERA_SC202CS_AUTO_DETECT_MIPI_INTERFACE_SENSOR=y -sdkconfig.CONFIG_ESP_VIDEO_ENABLE_ISP_PIPELINE_CONTROLLER=y +sdkconfig.CONFIG_ESP_VIDEO_ENABLE_ISP_PIPELINE_CONTROLLER=y \ No newline at end of file diff --git a/Devices/simulator/Source/module.cpp b/Devices/simulator/Source/module.cpp index 02319c923..23108a67e 100644 --- a/Devices/simulator/Source/module.cpp +++ b/Devices/simulator/Source/module.cpp @@ -102,7 +102,9 @@ Module simulator_module = { .name = "simulator", .start = start, .stop = stop, - .drivers = simulator_drivers + .drivers = simulator_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/tulip-4r11/source/module.cpp b/Devices/tulip-4r11/source/module.cpp index 8e5beb223..dbf68376b 100644 --- a/Devices/tulip-4r11/source/module.cpp +++ b/Devices/tulip-4r11/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module tulip_4r11_module = { - .name = "tulip-4r11" + .name = "tulip-4r11", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/tulip-4r11/tulip-4r11.dts b/Devices/tulip-4r11/tulip-4r11.dts index f21e1d2d7..c5acd59f6 100644 --- a/Devices/tulip-4r11/tulip-4r11.dts +++ b/Devices/tulip-4r11/tulip-4r11.dts @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -53,7 +53,7 @@ // The Grove connector shares this I2C bus with the touch controller i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <100000>; pin-sda = <&gpio0 17 GPIO_FLAG_PULL_UP>; diff --git a/Devices/unphone/CMakeLists.txt b/Devices/unphone/CMakeLists.txt index 21b60ea5c..740104fd0 100644 --- a/Devices/unphone/CMakeLists.txt +++ b/Devices/unphone/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*) idf_component_register( SRCS ${SOURCE_FILES} INCLUDE_DIRS "source" - REQUIRES TactilityKernel TactilityFreeRtos bq24295-module driver + REQUIRES TactilityKernel TactilityFreeRtos bq24295-module driver esp_driver_gpio ) diff --git a/Devices/unphone/source/module.cpp b/Devices/unphone/source/module.cpp index 5969f540f..949a23211 100644 --- a/Devices/unphone/source/module.cpp +++ b/Devices/unphone/source/module.cpp @@ -57,7 +57,9 @@ Module unphone_module = { .name = "unphone", .start = start, .stop = stop, - .drivers = unphone_drivers + .drivers = unphone_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Devices/unphone/unphone.dts b/Devices/unphone/unphone.dts index 9f044220f..af476836a 100644 --- a/Devices/unphone/unphone.dts +++ b/Devices/unphone/unphone.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 3 GPIO_FLAG_NONE>; diff --git a/Devices/waveshare-esp32-s3-geek/source/module.cpp b/Devices/waveshare-esp32-s3-geek/source/module.cpp index a71bbd9bc..2da417d10 100644 --- a/Devices/waveshare-esp32-s3-geek/source/module.cpp +++ b/Devices/waveshare-esp32-s3-geek/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module waveshare_esp32_s3_geek_module = { - .name = "waveshare-esp32-s3-geek" + .name = "waveshare-esp32-s3-geek", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 58ac91a0b..5c5cdbaa7 100644 --- a/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts +++ b/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 16 GPIO_FLAG_NONE>; diff --git a/Devices/waveshare-s3-lcd-13/source/module.cpp b/Devices/waveshare-s3-lcd-13/source/module.cpp index 2e534e615..4b5a9f300 100644 --- a/Devices/waveshare-s3-lcd-13/source/module.cpp +++ b/Devices/waveshare-s3-lcd-13/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module waveshare_s3_lcd_13_module = { - .name = "waveshare-s3-lcd-13" + .name = "waveshare-s3-lcd-13", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 656a50cc5..0393c160d 100644 --- a/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts +++ b/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c_main { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 47 GPIO_FLAG_NONE>; diff --git a/Devices/waveshare-s3-touch-lcd-128/source/module.cpp b/Devices/waveshare-s3-touch-lcd-128/source/module.cpp index 5a7a9ed90..a358cf8d6 100644 --- a/Devices/waveshare-s3-touch-lcd-128/source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-128/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module waveshare_s3_touch_lcd_128_module = { - .name = "waveshare-s3-touch-lcd-128" + .name = "waveshare-s3-touch-lcd-128", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 543d5e793..812e33086 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 @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 6 GPIO_FLAG_NONE>; diff --git a/Devices/waveshare-s3-touch-lcd-147/source/module.cpp b/Devices/waveshare-s3-touch-lcd-147/source/module.cpp index 3547f718a..ecd25fabc 100644 --- a/Devices/waveshare-s3-touch-lcd-147/source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module waveshare_s3_touch_lcd_147_module = { - .name = "waveshare-s3-touch-lcd-147" + .name = "waveshare-s3-touch-lcd-147", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 728305bd9..fcad9fd57 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 @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ }; i2c_internal { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 42 GPIO_FLAG_NONE>; diff --git a/Devices/waveshare-s3-touch-lcd-43/source/module.cpp b/Devices/waveshare-s3-touch-lcd-43/source/module.cpp index d2f335e70..16376aa0b 100644 --- a/Devices/waveshare-s3-touch-lcd-43/source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-43/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module waveshare_s3_touch_lcd_43_module = { - .name = "waveshare-s3-touch-lcd-43" + .name = "waveshare-s3-touch-lcd-43", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 f1119af52..bd6c62b07 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 @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 8 GPIO_FLAG_PULL_UP>; diff --git a/Devices/wireless-tag-wt32-sc01-plus/source/module.cpp b/Devices/wireless-tag-wt32-sc01-plus/source/module.cpp index f3a438cbd..305706d45 100644 --- a/Devices/wireless-tag-wt32-sc01-plus/source/module.cpp +++ b/Devices/wireless-tag-wt32-sc01-plus/source/module.cpp @@ -3,7 +3,12 @@ extern "C" { Module wireless_tag_wt32_sc01_plus_module = { - .name = "wireless-tag-wt32-sc01-plus" + .name = "wireless-tag-wt32-sc01-plus", + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } 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 b12d9a315..bcc9742d4 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 @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 6 GPIO_FLAG_NONE>; diff --git a/Drivers/audio-stream-module/source/audio_stream.cpp b/Drivers/audio-stream-module/source/audio_stream.cpp index 2512d686a..2c2913233 100644 --- a/Drivers/audio-stream-module/source/audio_stream.cpp +++ b/Drivers/audio-stream-module/source/audio_stream.cpp @@ -815,6 +815,7 @@ Device audio_stream_device = { .name = "audio-stream0", .config = nullptr, .parent = nullptr, + .flags = 0, .internal = nullptr, }; diff --git a/Drivers/audio-stream-module/source/module.cpp b/Drivers/audio-stream-module/source/module.cpp index 7cca7697e..3988accee 100644 --- a/Drivers/audio-stream-module/source/module.cpp +++ b/Drivers/audio-stream-module/source/module.cpp @@ -44,7 +44,9 @@ Module audio_stream_module = { .name = "audio-stream", .start = start, .stop = stop, - .symbols = audio_stream_module_symbols + .drivers = nullptr, + .symbols = audio_stream_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/aw88298-module/source/module.cpp b/Drivers/aw88298-module/source/module.cpp index 8e067a2d2..d2e885367 100644 --- a/Drivers/aw88298-module/source/module.cpp +++ b/Drivers/aw88298-module/source/module.cpp @@ -15,8 +15,11 @@ static Driver* const aw88298_drivers[] = { Module aw88298_module = { .name = "aw88298", + .start = nullptr, + .stop = nullptr, .drivers = aw88298_drivers, - .symbols = aw88298_module_symbols + .symbols = aw88298_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/aw9523b-module/source/module.cpp b/Drivers/aw9523b-module/source/module.cpp index e7b280106..8002258b7 100644 --- a/Drivers/aw9523b-module/source/module.cpp +++ b/Drivers/aw9523b-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const aw9523b_drivers[] = { Module aw9523b_module = { .name = "aw9523b", - .drivers = aw9523b_drivers + .start = nullptr, + .stop = nullptr, + .drivers = aw9523b_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/axp192-module/source/axp192.cpp b/Drivers/axp192-module/source/axp192.cpp index 1aca04166..4d4119086 100644 --- a/Drivers/axp192-module/source/axp192.cpp +++ b/Drivers/axp192-module/source/axp192.cpp @@ -363,7 +363,7 @@ struct Axp192Internal { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new(std::nothrow) Device { .address = 0, .name = "axp192-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new(std::nothrow) Device { .address = 0, .name = "axp192-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/axp192-module/source/module.cpp b/Drivers/axp192-module/source/module.cpp index b9997ab09..fdcd5c759 100644 --- a/Drivers/axp192-module/source/module.cpp +++ b/Drivers/axp192-module/source/module.cpp @@ -35,6 +35,8 @@ const struct ModuleSymbol axp192_module_symbols[] = { Module axp192_module = { .name = "axp192", + .start = nullptr, + .stop = nullptr, .drivers = axp192_drivers, .symbols = axp192_module_symbols, .internal = nullptr diff --git a/Drivers/axp2101-module/source/axp2101.cpp b/Drivers/axp2101-module/source/axp2101.cpp index 578414fef..6c162560e 100644 --- a/Drivers/axp2101-module/source/axp2101.cpp +++ b/Drivers/axp2101-module/source/axp2101.cpp @@ -473,7 +473,7 @@ struct Axp2101Internal { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new(std::nothrow) Device { .address = 0, .name = "axp2101-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new(std::nothrow) Device { .address = 0, .name = "axp2101-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/axp2101-module/source/module.cpp b/Drivers/axp2101-module/source/module.cpp index fd2995e48..a5fdfc3dd 100644 --- a/Drivers/axp2101-module/source/module.cpp +++ b/Drivers/axp2101-module/source/module.cpp @@ -36,8 +36,11 @@ const struct ModuleSymbol axp2101_module_symbols[] = { Module axp2101_module = { .name = "axp2101", + .start = nullptr, + .stop = nullptr, .drivers = axp2101_drivers, - .symbols = axp2101_module_symbols + .symbols = axp2101_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/axs5106-module/source/module.cpp b/Drivers/axs5106-module/source/module.cpp index 0b465574d..705567a3a 100644 --- a/Drivers/axs5106-module/source/module.cpp +++ b/Drivers/axs5106-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const axs5106_drivers[] = { Module axs5106_module = { .name = "axs5106", - .drivers = axs5106_drivers + .start = nullptr, + .stop = nullptr, + .drivers = axs5106_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/bm8563-module/source/module.cpp b/Drivers/bm8563-module/source/module.cpp index 7a73b962c..1cc61e956 100644 --- a/Drivers/bm8563-module/source/module.cpp +++ b/Drivers/bm8563-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const bm8563_drivers[] = { Module bm8563_module = { .name = "bm8563", - .drivers = bm8563_drivers + .start = nullptr, + .stop = nullptr, + .drivers = bm8563_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/bmi270-module/source/module.cpp b/Drivers/bmi270-module/source/module.cpp index 2c8758dfe..dfcd01b7f 100644 --- a/Drivers/bmi270-module/source/module.cpp +++ b/Drivers/bmi270-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const bmi270_drivers[] = { Module bmi270_module = { .name = "bmi270", - .drivers = bmi270_drivers + .start = nullptr, + .stop = nullptr, + .drivers = bmi270_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/bq24295-module/source/bq24295.cpp b/Drivers/bq24295-module/source/bq24295.cpp index 5def959d1..7d096956d 100644 --- a/Drivers/bq24295-module/source/bq24295.cpp +++ b/Drivers/bq24295-module/source/bq24295.cpp @@ -187,7 +187,7 @@ struct Bq24295Internal { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new(std::nothrow) Device { .address = 0, .name = "bq24295-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new(std::nothrow) Device { .address = 0, .name = "bq24295-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/bq24295-module/source/module.cpp b/Drivers/bq24295-module/source/module.cpp index dc6710360..e60e14c42 100644 --- a/Drivers/bq24295-module/source/module.cpp +++ b/Drivers/bq24295-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const bq24295_drivers[] = { Module bq24295_module = { .name = "bq24295", - .drivers = bq24295_drivers + .start = nullptr, + .stop = nullptr, + .drivers = bq24295_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/bq25896-module/source/bq25896.cpp b/Drivers/bq25896-module/source/bq25896.cpp index a28dc5303..75dc4f3b0 100644 --- a/Drivers/bq25896-module/source/bq25896.cpp +++ b/Drivers/bq25896-module/source/bq25896.cpp @@ -85,7 +85,7 @@ struct Bq25896Internal { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new (std::nothrow) Device { .address = 0, .name = "bq25896-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new (std::nothrow) Device { .address = 0, .name = "bq25896-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/bq25896-module/source/module.cpp b/Drivers/bq25896-module/source/module.cpp index 5a67a7ff9..92ea66e0e 100644 --- a/Drivers/bq25896-module/source/module.cpp +++ b/Drivers/bq25896-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const bq25896_drivers[] = { Module bq25896_module = { .name = "bq25896", - .drivers = bq25896_drivers + .start = nullptr, + .stop = nullptr, + .drivers = bq25896_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/bq27220-module/source/bq27220.cpp b/Drivers/bq27220-module/source/bq27220.cpp index 4dc2b42bf..d928942be 100644 --- a/Drivers/bq27220-module/source/bq27220.cpp +++ b/Drivers/bq27220-module/source/bq27220.cpp @@ -131,7 +131,7 @@ struct Bq27220Internal { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new (std::nothrow) Device { .address = 0, .name = "bq27220-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new (std::nothrow) Device { .address = 0, .name = "bq27220-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/bq27220-module/source/module.cpp b/Drivers/bq27220-module/source/module.cpp index c4fae88d2..a7b9e96fa 100644 --- a/Drivers/bq27220-module/source/module.cpp +++ b/Drivers/bq27220-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const bq27220_drivers[] = { Module bq27220_module = { .name = "bq27220", - .drivers = bq27220_drivers + .start = nullptr, + .stop = nullptr, + .drivers = bq27220_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/button-control-module/source/button_control.cpp b/Drivers/button-control-module/source/button_control.cpp index 4a32ffdb6..3f6f91da4 100644 --- a/Drivers/button-control-module/source/button_control.cpp +++ b/Drivers/button-control-module/source/button_control.cpp @@ -206,6 +206,8 @@ static error_t button_control_read_key(Device* device, KeyboardKeyData* data) { static constexpr KeyboardApi button_control_api = { .read_key = button_control_read_key, + .get_backlight = nullptr, + .is_present = nullptr, }; Driver button_control_driver = { diff --git a/Drivers/button-control-module/source/module.cpp b/Drivers/button-control-module/source/module.cpp index 183f597de..5583173c6 100644 --- a/Drivers/button-control-module/source/module.cpp +++ b/Drivers/button-control-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const button_control_drivers[] = { Module button_control_module = { .name = "button-control", - .drivers = button_control_drivers + .start = nullptr, + .stop = nullptr, + .drivers = button_control_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ch422g-module/source/module.cpp b/Drivers/ch422g-module/source/module.cpp index 9e16d6641..c49437c2c 100644 --- a/Drivers/ch422g-module/source/module.cpp +++ b/Drivers/ch422g-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const ch422g_drivers[] = { Module ch422g_module = { .name = "ch422g", - .drivers = ch422g_drivers + .start = nullptr, + .stop = nullptr, + .drivers = ch422g_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/cst328-module/source/module.cpp b/Drivers/cst328-module/source/module.cpp index 80529ec15..13b15c06c 100644 --- a/Drivers/cst328-module/source/module.cpp +++ b/Drivers/cst328-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const cst328_drivers[] = { Module cst328_module = { .name = "cst328", - .drivers = cst328_drivers + .start = nullptr, + .stop = nullptr, + .drivers = cst328_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/cst66xx-module/source/module.cpp b/Drivers/cst66xx-module/source/module.cpp index f8ab86a73..e52b6cf16 100644 --- a/Drivers/cst66xx-module/source/module.cpp +++ b/Drivers/cst66xx-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const cst66xx_drivers[] = { Module cst66xx_module = { .name = "cst66xx", - .drivers = cst66xx_drivers + .start = nullptr, + .stop = nullptr, + .drivers = cst66xx_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/cst816s-module/source/cst816s.cpp b/Drivers/cst816s-module/source/cst816s.cpp index 04a44ff1c..a4f80306b 100644 --- a/Drivers/cst816s-module/source/cst816s.cpp +++ b/Drivers/cst816s-module/source/cst816s.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -36,17 +35,29 @@ static inline gpio_num_t pin_or_nc(const struct GpioPinSpec& pin) { // CST816S always sits at a fixed I2C address, unlike GT911's strapping-dependent address, // so no bus probing is needed here. static esp_err_t create_io_handle(Device* parent, esp_lcd_panel_io_handle_t* out_handle) { - esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG(); + // Not using ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG(): its designated-initializer field order (and + // missing transaction_timeout_ms) predates this SDK's esp_lcd_panel_io_i2c_config_t layout. + esp_lcd_panel_io_i2c_config_t io_config = { + .dev_addr = ESP_LCD_TOUCH_IO_I2C_CST816S_ADDRESS, + .scl_speed_hz = 100000, + .control_phase_bytes = 1, + .dc_bit_offset = 0, + .lcd_cmd_bits = 8, + .lcd_param_bits = 0, + .on_color_trans_done = nullptr, + .user_ctx = nullptr, + .flags = { + .dc_low_on_data = 0, + .disable_control_phase = 1, + }, + .transaction_timeout_ms = 0, + }; auto* parent_driver = device_get_driver(parent); - if (driver_is_compatible(parent_driver, "espressif,esp32-i2c")) { - auto port = static_cast(parent->config)->port; - return esp_lcd_new_panel_io_i2c_v1(port, &io_config, out_handle); - } if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) { auto bus = esp32_i2c_master_get_bus_handle(parent); io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent); - return esp_lcd_new_panel_io_i2c_v2(bus, &io_config, out_handle); + return esp_lcd_new_panel_io_i2c(bus, &io_config, out_handle); } LOG_E(TAG, "Unsupported I2C driver"); @@ -151,7 +162,19 @@ static error_t cst816s_read_data(Device* device, TickType_t timeout) { static bool cst816s_get_touched_points(Device* device, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_count, uint8_t max_point_count) { auto* internal = static_cast(device_get_driver_data(device)); - return esp_lcd_touch_get_coordinates(internal->touch_handle, x, y, strength, point_count, max_point_count); + esp_lcd_touch_point_data_t points[CONFIG_ESP_LCD_TOUCH_MAX_POINTS]; + uint8_t clamped_max_point_count = max_point_count < CONFIG_ESP_LCD_TOUCH_MAX_POINTS ? max_point_count : CONFIG_ESP_LCD_TOUCH_MAX_POINTS; + if (esp_lcd_touch_get_data(internal->touch_handle, points, point_count, clamped_max_point_count) != ESP_OK) { + return false; + } + for (uint8_t i = 0; i < *point_count; i++) { + x[i] = points[i].x; + y[i] = points[i].y; + if (strength != nullptr) { + strength[i] = points[i].strength; + } + } + return *point_count > 0; } static error_t cst816s_set_swap_xy(Device* device, bool swap) { diff --git a/Drivers/cst816s-module/source/module.cpp b/Drivers/cst816s-module/source/module.cpp index c2400011d..db5c82a1e 100644 --- a/Drivers/cst816s-module/source/module.cpp +++ b/Drivers/cst816s-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const cst816s_drivers[] = { Module cst816s_module = { .name = "cst816s", - .drivers = cst816s_drivers + .start = nullptr, + .stop = nullptr, + .drivers = cst816s_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/cst816t-module/source/module.cpp b/Drivers/cst816t-module/source/module.cpp index 4e4af0ee1..65763fc7d 100644 --- a/Drivers/cst816t-module/source/module.cpp +++ b/Drivers/cst816t-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const cst816t_drivers[] = { Module cst816t_module = { .name = "cst816t", - .drivers = cst816t_drivers + .start = nullptr, + .stop = nullptr, + .drivers = cst816t_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/drv2605-module/source/module.cpp b/Drivers/drv2605-module/source/module.cpp index f6e0f2752..c037c9f54 100644 --- a/Drivers/drv2605-module/source/module.cpp +++ b/Drivers/drv2605-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const drv2605_drivers[] = { Module drv2605_module = { .name = "drv2605", - .drivers = drv2605_drivers + .start = nullptr, + .stop = nullptr, + .drivers = drv2605_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/dummy-i2s-amp-module/source/module.cpp b/Drivers/dummy-i2s-amp-module/source/module.cpp index efe4c34bd..cf91e48e3 100644 --- a/Drivers/dummy-i2s-amp-module/source/module.cpp +++ b/Drivers/dummy-i2s-amp-module/source/module.cpp @@ -15,8 +15,11 @@ extern const ModuleSymbol dummy_i2s_amp_module_symbols[]; Module dummy_i2s_amp_module = { .name = "dummy_i2s_amp", + .start = nullptr, + .stop = nullptr, .drivers = dummy_drivers, - .symbols = dummy_i2s_amp_module_symbols + .symbols = dummy_i2s_amp_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/es7210-module/source/module.cpp b/Drivers/es7210-module/source/module.cpp index 833b67595..9918ea98a 100644 --- a/Drivers/es7210-module/source/module.cpp +++ b/Drivers/es7210-module/source/module.cpp @@ -15,8 +15,11 @@ extern const ModuleSymbol es7210_module_symbols[]; Module es7210_module = { .name = "es7210", + .start = nullptr, + .stop = nullptr, .drivers = es7210_drivers, .symbols = es7210_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/es8311-module/source/module.cpp b/Drivers/es8311-module/source/module.cpp index ab4208171..5c0ea63eb 100644 --- a/Drivers/es8311-module/source/module.cpp +++ b/Drivers/es8311-module/source/module.cpp @@ -15,8 +15,11 @@ extern const ModuleSymbol es8311_module_symbols[]; Module es8311_module = { .name = "es8311", + .start = nullptr, + .stop = nullptr, .drivers = es8311_drivers, - .symbols = es8311_module_symbols + .symbols = es8311_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/es8388-module/source/module.cpp b/Drivers/es8388-module/source/module.cpp index 69bb68677..d635e132a 100644 --- a/Drivers/es8388-module/source/module.cpp +++ b/Drivers/es8388-module/source/module.cpp @@ -15,8 +15,11 @@ extern const ModuleSymbol es8388_module_symbols[]; Module es8388_module = { .name = "es8388", + .start = nullptr, + .stop = nullptr, .drivers = es8388_drivers, - .symbols = es8388_module_symbols + .symbols = es8388_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/esp-epaper-module/source/esp_epaper.cpp b/Drivers/esp-epaper-module/source/esp_epaper.cpp index 0fc5506c0..7b2168887 100644 --- a/Drivers/esp-epaper-module/source/esp_epaper.cpp +++ b/Drivers/esp-epaper-module/source/esp_epaper.cpp @@ -207,6 +207,8 @@ static const DisplayApi esp_epaper_display_api = { .reset = esp_epaper_reset, .init = esp_epaper_init, .draw_bitmap = esp_epaper_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = nullptr, .swap_xy = nullptr, .get_swap_xy = nullptr, diff --git a/Drivers/esp-epaper-module/source/module.cpp b/Drivers/esp-epaper-module/source/module.cpp index 9a24dde3f..59c19bdc9 100644 --- a/Drivers/esp-epaper-module/source/module.cpp +++ b/Drivers/esp-epaper-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const esp_epaper_drivers[] = { Module esp_epaper_module = { .name = "esp_epaper", - .drivers = esp_epaper_drivers + .start = nullptr, + .stop = nullptr, + .drivers = esp_epaper_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ft5x06-module/source/ft5x06.cpp b/Drivers/ft5x06-module/source/ft5x06.cpp index 37fb078a5..f347ecffb 100644 --- a/Drivers/ft5x06-module/source/ft5x06.cpp +++ b/Drivers/ft5x06-module/source/ft5x06.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -71,14 +70,10 @@ static esp_err_t create_io_handle(Device* parent, esp_lcd_panel_io_handle_t* out esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_FT5x06_CONFIG(); auto* parent_driver = device_get_driver(parent); - if (driver_is_compatible(parent_driver, "espressif,esp32-i2c")) { - auto port = static_cast(parent->config)->port; - return esp_lcd_new_panel_io_i2c_v1(port, &io_config, out_handle); - } if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) { auto bus = esp32_i2c_master_get_bus_handle(parent); io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent); - return esp_lcd_new_panel_io_i2c_v2(bus, &io_config, out_handle); + return esp_lcd_new_panel_io_i2c(bus, &io_config, out_handle); } LOG_E(TAG, "Unsupported I2C driver"); diff --git a/Drivers/ft5x06-module/source/module.cpp b/Drivers/ft5x06-module/source/module.cpp index ce79913b2..933f57604 100644 --- a/Drivers/ft5x06-module/source/module.cpp +++ b/Drivers/ft5x06-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const ft5x06_drivers[] = { Module ft5x06_module = { .name = "ft5x06", - .drivers = ft5x06_drivers + .start = nullptr, + .stop = nullptr, + .drivers = ft5x06_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ft6x36-module/source/ft6x36.cpp b/Drivers/ft6x36-module/source/ft6x36.cpp index 12ad5894c..6f052ba54 100644 --- a/Drivers/ft6x36-module/source/ft6x36.cpp +++ b/Drivers/ft6x36-module/source/ft6x36.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -73,14 +72,10 @@ static esp_err_t create_io_handle(Device* parent, esp_lcd_panel_io_handle_t* out esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_FT6x36_CONFIG(); auto* parent_driver = device_get_driver(parent); - if (driver_is_compatible(parent_driver, "espressif,esp32-i2c")) { - auto port = static_cast(parent->config)->port; - return esp_lcd_new_panel_io_i2c_v1(port, &io_config, out_handle); - } if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) { auto bus = esp32_i2c_master_get_bus_handle(parent); io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent); - return esp_lcd_new_panel_io_i2c_v2(bus, &io_config, out_handle); + return esp_lcd_new_panel_io_i2c(bus, &io_config, out_handle); } LOG_E(TAG, "Unsupported I2C driver"); diff --git a/Drivers/ft6x36-module/source/module.cpp b/Drivers/ft6x36-module/source/module.cpp index bd6c28e33..0159009ba 100644 --- a/Drivers/ft6x36-module/source/module.cpp +++ b/Drivers/ft6x36-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const ft6x36_drivers[] = { Module ft6x36_module = { .name = "ft6x36", - .drivers = ft6x36_drivers + .start = nullptr, + .stop = nullptr, + .drivers = ft6x36_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/gc9a01-module/source/gc9a01.cpp b/Drivers/gc9a01-module/source/gc9a01.cpp index aa4fbbdab..693a03377 100644 --- a/Drivers/gc9a01-module/source/gc9a01.cpp +++ b/Drivers/gc9a01-module/source/gc9a01.cpp @@ -72,8 +72,8 @@ static error_t start(Device* device) { } esp_lcd_panel_io_spi_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), - .dc_gpio_num = pin_or_unused(config->pin_dc), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), + .dc_gpio_num = static_cast(pin_or_unused(config->pin_dc)), .spi_mode = 0, .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, @@ -90,6 +90,7 @@ static error_t start(Device* device) { .octal_mode = 0, .quad_mode = 0, .sio_mode = 0, + .psram_dma_direct = 0, .lsb_first = 0, .cs_high_active = 0, }, @@ -104,13 +105,13 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = 16, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = nullptr, // GC9A01's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = nullptr, }; ret = esp_lcd_new_panel_gc9a01(internal->io_handle, &panel_config, &internal->panel_handle); @@ -330,6 +331,8 @@ static const DisplayApi gc9a01_display_api = { .reset = gc9a01_reset, .init = gc9a01_init, .draw_bitmap = gc9a01_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = gc9a01_mirror, .swap_xy = gc9a01_swap_xy, .get_swap_xy = gc9a01_get_swap_xy, diff --git a/Drivers/gc9a01-module/source/module.cpp b/Drivers/gc9a01-module/source/module.cpp index 164f6e2ae..a0f257bc4 100644 --- a/Drivers/gc9a01-module/source/module.cpp +++ b/Drivers/gc9a01-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const gc9a01_drivers[] = { Module gc9a01_module = { .name = "gc9a01", - .drivers = gc9a01_drivers + .start = nullptr, + .stop = nullptr, + .drivers = gc9a01_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/gdeq031t10-module/source/gdeq031t10.cpp b/Drivers/gdeq031t10-module/source/gdeq031t10.cpp index 51334e1c5..0ba388cda 100644 --- a/Drivers/gdeq031t10-module/source/gdeq031t10.cpp +++ b/Drivers/gdeq031t10-module/source/gdeq031t10.cpp @@ -559,6 +559,8 @@ static const DisplayApi gdeq031t10_display_api = { .reset = gdeq031t10_reset, .init = gdeq031t10_init, .draw_bitmap = gdeq031t10_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = nullptr, .swap_xy = nullptr, .get_swap_xy = nullptr, diff --git a/Drivers/gdeq031t10-module/source/module.cpp b/Drivers/gdeq031t10-module/source/module.cpp index be30cbd34..43ca500f5 100644 --- a/Drivers/gdeq031t10-module/source/module.cpp +++ b/Drivers/gdeq031t10-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const gdeq031t10_drivers[] = { Module gdeq031t10_module = { .name = "gdeq031t10", - .drivers = gdeq031t10_drivers + .start = nullptr, + .stop = nullptr, + .drivers = gdeq031t10_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/gpio-encoder-module/source/module.cpp b/Drivers/gpio-encoder-module/source/module.cpp index 4de7b72f6..0b32b70a0 100644 --- a/Drivers/gpio-encoder-module/source/module.cpp +++ b/Drivers/gpio-encoder-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const gpio_encoder_drivers[] = { Module gpio_encoder_module = { .name = "gpio-encoder", - .drivers = gpio_encoder_drivers + .start = nullptr, + .stop = nullptr, + .drivers = gpio_encoder_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/gpio-trackball-module/source/module.cpp b/Drivers/gpio-trackball-module/source/module.cpp index 0b463f445..9d32f7615 100644 --- a/Drivers/gpio-trackball-module/source/module.cpp +++ b/Drivers/gpio-trackball-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const gpio_trackball_drivers[] = { Module gpio_trackball_module = { .name = "gpio-trackball", - .drivers = gpio_trackball_drivers + .start = nullptr, + .stop = nullptr, + .drivers = gpio_trackball_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/gps-generic-module/source/module.cpp b/Drivers/gps-generic-module/source/module.cpp index 213cacdb2..9513e535b 100644 --- a/Drivers/gps-generic-module/source/module.cpp +++ b/Drivers/gps-generic-module/source/module.cpp @@ -5,7 +5,11 @@ extern "C" { Module gps_meshtastic_module = { .name = "gps-meshtastic", - .drivers = nullptr + .start = nullptr, + .stop = nullptr, + .drivers = nullptr, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/gps-meshtastic-module/source/gps_meshtastic.cpp b/Drivers/gps-meshtastic-module/source/gps_meshtastic.cpp index e21c34ea9..495e0a621 100644 --- a/Drivers/gps-meshtastic-module/source/gps_meshtastic.cpp +++ b/Drivers/gps-meshtastic-module/source/gps_meshtastic.cpp @@ -167,7 +167,7 @@ static int32_t gps_thread_main(void* context) { if (bytes_read > 0U) { switch (minmea_sentence_id(reinterpret_cast(buffer), false)) { case MINMEA_SENTENCE_RMC: { - GpsEvent event { .type = GPS_EVENT_MESSAGE_RMC }; + GpsEvent event { .type = GPS_EVENT_MESSAGE_RMC, .data = {} }; if (minmea_parse_rmc(&event.data.rmc, reinterpret_cast(buffer))) { notify_subscribers(internal, event); } else { @@ -176,7 +176,7 @@ static int32_t gps_thread_main(void* context) { break; } case MINMEA_SENTENCE_GGA: { - GpsEvent event { .type = GPS_EVENT_MESSAGE_GGA }; + GpsEvent event { .type = GPS_EVENT_MESSAGE_GGA, .data = {} }; if (minmea_parse_gga(&event.data.gga, reinterpret_cast(buffer))) { notify_subscribers(internal, event); } else { @@ -196,7 +196,7 @@ static int32_t gps_thread_main(void* context) { // Wake any subscribers still awaiting an event so they don't block forever on a device that's // going away, then drop them - stop() is about to free `internal`. - notify_subscribers(internal, GpsEvent { .type = GPS_EVENT_UNSUBSCRIBED }); + notify_subscribers(internal, GpsEvent { .type = GPS_EVENT_UNSUBSCRIBED, .data = {} }); recursive_mutex_lock(&internal->mutex); internal->subscribers = nullptr; recursive_mutex_unlock(&internal->mutex); @@ -340,5 +340,6 @@ Driver meshtastic_gps_driver = { .stop_device = stop, .api = &generic_gps_api, .device_type = &GPS_TYPE, - .owner = &gps_meshtastic_module + .owner = &gps_meshtastic_module, + .internal = nullptr }; diff --git a/Drivers/gps-meshtastic-module/source/module.cpp b/Drivers/gps-meshtastic-module/source/module.cpp index 137850659..689a96026 100644 --- a/Drivers/gps-meshtastic-module/source/module.cpp +++ b/Drivers/gps-meshtastic-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const meshtastic_generic_drivers[] = { Module gps_generic_module = { .name = "gps-meshtastic", - .drivers = meshtastic_generic_drivers + .start = nullptr, + .stop = nullptr, + .drivers = meshtastic_generic_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/gt911-module/source/gt911.cpp b/Drivers/gt911-module/source/gt911.cpp index 098ad0b60..d2254f906 100644 --- a/Drivers/gt911-module/source/gt911.cpp +++ b/Drivers/gt911-module/source/gt911.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -87,14 +86,10 @@ static esp_err_t create_io_handle(Device* parent, esp_lcd_panel_io_handle_t* out } auto* parent_driver = device_get_driver(parent); - if (driver_is_compatible(parent_driver, "espressif,esp32-i2c")) { - auto port = static_cast(parent->config)->port; - return esp_lcd_new_panel_io_i2c_v1(port, &io_config, out_handle); - } if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) { auto bus = esp32_i2c_master_get_bus_handle(parent); io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent); - return esp_lcd_new_panel_io_i2c_v2(bus, &io_config, out_handle); + return esp_lcd_new_panel_io_i2c(bus, &io_config, out_handle); } LOG_E(TAG, "Unsupported I2C driver"); @@ -232,7 +227,19 @@ static error_t gt911_read_data(Device* device, TickType_t timeout) { static bool gt911_get_touched_points(Device* device, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_count, uint8_t max_point_count) { auto* internal = static_cast(device_get_driver_data(device)); - return esp_lcd_touch_get_coordinates(internal->touch_handle, x, y, strength, point_count, max_point_count); + esp_lcd_touch_point_data_t points[CONFIG_ESP_LCD_TOUCH_MAX_POINTS]; + uint8_t clamped_max_point_count = max_point_count < CONFIG_ESP_LCD_TOUCH_MAX_POINTS ? max_point_count : CONFIG_ESP_LCD_TOUCH_MAX_POINTS; + if (esp_lcd_touch_get_data(internal->touch_handle, points, point_count, clamped_max_point_count) != ESP_OK) { + return false; + } + for (uint8_t i = 0; i < *point_count; i++) { + x[i] = points[i].x; + y[i] = points[i].y; + if (strength != nullptr) { + strength[i] = points[i].strength; + } + } + return *point_count > 0; } static error_t gt911_set_swap_xy(Device* device, bool swap) { diff --git a/Drivers/gt911-module/source/module.cpp b/Drivers/gt911-module/source/module.cpp index d9749a304..31f36d233 100644 --- a/Drivers/gt911-module/source/module.cpp +++ b/Drivers/gt911-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const gt911_drivers[] = { Module gt911_module = { .name = "gt911", - .drivers = gt911_drivers + .start = nullptr, + .stop = nullptr, + .drivers = gt911_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/hx8357-module/source/hx8357.cpp b/Drivers/hx8357-module/source/hx8357.cpp index ff0c140e2..3d7394939 100644 --- a/Drivers/hx8357-module/source/hx8357.cpp +++ b/Drivers/hx8357-module/source/hx8357.cpp @@ -443,6 +443,8 @@ static const DisplayApi hx8357_display_api = { .reset = hx8357_reset, .init = hx8357_init, .draw_bitmap = hx8357_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = hx8357_mirror, .swap_xy = hx8357_swap_xy, .get_swap_xy = hx8357_get_swap_xy, @@ -452,6 +454,8 @@ static const DisplayApi hx8357_display_api = { // static gap-x/gap-y devicetree config already folded into draw_bitmap(); matches the deprecated // HAL, which never exposed a runtime gap either. .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = hx8357_invert_color, .disp_on_off = hx8357_disp_on_off, .disp_sleep = hx8357_disp_sleep, diff --git a/Drivers/hx8357-module/source/module.cpp b/Drivers/hx8357-module/source/module.cpp index fbd6cb5f5..9b05379bb 100644 --- a/Drivers/hx8357-module/source/module.cpp +++ b/Drivers/hx8357-module/source/module.cpp @@ -13,7 +13,11 @@ extern "C" { Module hx8357_module = { .name = "hx8357", - .drivers = hx8357_drivers + .start = nullptr, + .stop = nullptr, + .drivers = hx8357_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ili9341-module/source/ili9341.cpp b/Drivers/ili9341-module/source/ili9341.cpp index 3b30b1338..0072d2f2f 100644 --- a/Drivers/ili9341-module/source/ili9341.cpp +++ b/Drivers/ili9341-module/source/ili9341.cpp @@ -129,8 +129,8 @@ static error_t start(Device* device) { } esp_lcd_panel_io_spi_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), - .dc_gpio_num = pin_or_unused(config->pin_dc), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), + .dc_gpio_num = static_cast(pin_or_unused(config->pin_dc)), .spi_mode = 0, .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, @@ -147,6 +147,7 @@ static error_t start(Device* device) { .octal_mode = 0, .quad_mode = 0, .sio_mode = 1, + .psram_dma_direct = 0, .lsb_first = 0, .cs_high_active = 0, }, @@ -164,14 +165,14 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - // Always -1: pulse_reset() handles the physical pin itself (see its comment for why), and - // esp_lcd_panel_reset() below falls back to a SWRESET command when this is -1. - .reset_gpio_num = -1, .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, - .flags = { .reset_active_high = config->reset_active_high }, + // Always NC: pulse_reset() handles the physical pin itself (see its comment for why), and + // esp_lcd_panel_reset() below falls back to a SWRESET command when this is NC. + .reset_gpio_num = GPIO_NUM_NC, .vendor_config = nullptr, + .flags = { .reset_active_high = config->reset_active_high }, }; ret = esp_lcd_new_panel_ili9341(internal->io_handle, &panel_config, &internal->panel_handle); @@ -435,6 +436,8 @@ static const DisplayApi ili9341_display_api = { .reset = ili9341_reset, .init = ili9341_init, .draw_bitmap = ili9341_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = ili9341_mirror, .swap_xy = ili9341_swap_xy, .get_swap_xy = ili9341_get_swap_xy, diff --git a/Drivers/ili9341-module/source/module.cpp b/Drivers/ili9341-module/source/module.cpp index 9faaca4b4..1807a6c92 100644 --- a/Drivers/ili9341-module/source/module.cpp +++ b/Drivers/ili9341-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const ili9341_drivers[] = { Module ili9341_module = { .name = "ili9341", - .drivers = ili9341_drivers + .start = nullptr, + .stop = nullptr, + .drivers = ili9341_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ili9488-module/source/ili9488.cpp b/Drivers/ili9488-module/source/ili9488.cpp index 4d1a707e5..9977b53b9 100644 --- a/Drivers/ili9488-module/source/ili9488.cpp +++ b/Drivers/ili9488-module/source/ili9488.cpp @@ -77,8 +77,8 @@ static error_t start(Device* device) { } esp_lcd_panel_io_spi_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), - .dc_gpio_num = pin_or_unused(config->pin_dc), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), + .dc_gpio_num = static_cast(pin_or_unused(config->pin_dc)), .spi_mode = 0, .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, @@ -95,6 +95,7 @@ static error_t start(Device* device) { .octal_mode = 0, .quad_mode = 0, .sio_mode = 1, + .psram_dma_direct = 0, .lsb_first = 0, .cs_high_active = 0, }, @@ -109,13 +110,13 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = nullptr, // ILI9488's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = nullptr, }; // Unlike st7789/ili9341, ili9488 needs an internal conversion buffer: over SPI the @@ -360,6 +361,8 @@ static const DisplayApi ili9488_display_api = { .reset = ili9488_reset, .init = ili9488_init, .draw_bitmap = ili9488_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = ili9488_mirror, .swap_xy = ili9488_swap_xy, .get_swap_xy = ili9488_get_swap_xy, diff --git a/Drivers/ili9488-module/source/module.cpp b/Drivers/ili9488-module/source/module.cpp index dbd7cade0..563d6c31d 100644 --- a/Drivers/ili9488-module/source/module.cpp +++ b/Drivers/ili9488-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const ili9488_drivers[] = { Module ili9488_module = { .name = "ili9488", - .drivers = ili9488_drivers + .start = nullptr, + .stop = nullptr, + .drivers = ili9488_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ili9881c-module/source/ili9881c.cpp b/Drivers/ili9881c-module/source/ili9881c.cpp index 3a1438c35..74f7b3ba6 100644 --- a/Drivers/ili9881c-module/source/ili9881c.cpp +++ b/Drivers/ili9881c-module/source/ili9881c.cpp @@ -102,12 +102,10 @@ static int pin_or_unused(const GpioPinSpec& pin) { return pin.gpio_controller == nullptr ? -1 : static_cast(pin.pin); } +// RGB666 has no ESP-IDF 6.1 lcd_color_format_t equivalent (LL only implements RGB565/RGB888), +// so 18bpp is rejected in start() below rather than silently mis-driving the panel. static lcd_color_format_t color_format_from_bits_per_pixel(uint8_t bits_per_pixel) { - switch (bits_per_pixel) { - case 18: return LCD_COLOR_FMT_RGB666; - case 24: return LCD_COLOR_FMT_RGB888; - default: return LCD_COLOR_FMT_RGB565; - } + return bits_per_pixel == 24 ? LCD_COLOR_FMT_RGB888 : LCD_COLOR_FMT_RGB565; } // Unpacks the devicetree's flat [cmd, data_len, delay_ms, data_len bytes...] encoding (produced @@ -155,6 +153,10 @@ static bool parse_init_sequence(const uint8_t* bytes, uint32_t length, ili9881c_ static error_t start(Device* device) { const auto* config = GET_CONFIG(device); + if (config->bits_per_pixel == 18) { + LOG_E(TAG, "18bpp (RGB666) is unsupported on this ESP-IDF version"); + return ERROR_NOT_SUPPORTED; + } auto* internal = static_cast(malloc(sizeof(Ili9881cInternal))); if (internal == nullptr) { @@ -178,6 +180,7 @@ static error_t start(Device* device) { esp_ldo_channel_config_t ldo_config = { .chan_id = config->ldo_channel, .voltage_mv = config->ldo_voltage_mv, + .voltage_stable_delay_us = 0, .flags = {}, }; if (esp_ldo_acquire_channel(&ldo_config, &internal->ldo_handle) != ESP_OK) { @@ -191,7 +194,8 @@ static error_t start(Device* device) { .bus_id = config->dsi_bus_id, .num_data_lanes = config->num_data_lanes, .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, - .lane_bit_rate_mbps = config->lane_bit_rate_mbps, + .lane_bit_rate_mbps = static_cast(config->lane_bit_rate_mbps), + .flags = {}, }; if (esp_lcd_new_dsi_bus(&bus_config, &internal->dsi_bus_handle) != ESP_OK) { LOG_E(TAG, "Failed to create MIPI DSI bus"); @@ -219,8 +223,7 @@ static error_t start(Device* device) { const esp_lcd_dpi_panel_config_t dpi_config = { .virtual_channel = 0, .dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, - .dpi_clock_freq_mhz = config->dpi_clock_freq_mhz, - .pixel_format = (lcd_color_rgb_pixel_format_t)0, // deprecated field - in/out_color_format below take precedence + .dpi_clock_freq_mhz = static_cast(config->dpi_clock_freq_mhz), .in_color_format = color_format, .out_color_format = color_format, .num_fbs = config->num_fbs, @@ -235,7 +238,6 @@ static error_t start(Device* device) { .vsync_front_porch = config->vsync_front_porch, }, .flags = { - .use_dma2d = config->use_dma2d, .disable_lp = config->disable_lp, }, }; @@ -251,13 +253,13 @@ static error_t start(Device* device) { }; const esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = &vendor_config, // ILI9881C's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = &vendor_config, }; if (esp_lcd_new_panel_ili9881c(internal->io_handle, &panel_config, &internal->panel_handle) != ESP_OK) { @@ -270,6 +272,10 @@ static error_t start(Device* device) { return ERROR_RESOURCE; } + if (config->use_dma2d) { + esp_lcd_dpi_panel_enable_dma2d(internal->panel_handle); + } + // Bring-up sequence: reset() pulses (or software-resets) the panel and init() pushes // init_cmds over the DBI command interface before bringing up the underlying DPI peripheral. // swap_xy/set_gap are intentionally not called: the ILI9881C driver doesn't override them and @@ -355,7 +361,7 @@ static error_t start(Device* device) { xSemaphoreGive(internal->color_trans_done_semaphore); esp_lcd_dpi_panel_event_callbacks_t callbacks = {}; - callbacks.on_refresh_done = on_refresh_done; + callbacks.on_frame_buf_complete = on_refresh_done; callbacks.on_color_trans_done = on_color_trans_done; if (esp_lcd_dpi_panel_register_event_callbacks(internal->panel_handle, &callbacks, internal) != ESP_OK) { LOG_E(TAG, "Failed to register panel event callbacks"); @@ -559,12 +565,16 @@ static const DisplayApi ili9881c_display_api = { .reset = ili9881c_reset, .init = ili9881c_init, .draw_bitmap = ili9881c_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = ili9881c_mirror, .swap_xy = nullptr, .get_swap_xy = nullptr, .get_mirror_x = ili9881c_get_mirror_x, .get_mirror_y = ili9881c_get_mirror_y, .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = ili9881c_invert_color, .disp_on_off = ili9881c_disp_on_off, .disp_sleep = nullptr, diff --git a/Drivers/ili9881c-module/source/module.cpp b/Drivers/ili9881c-module/source/module.cpp index b4e2faf92..805cc1bcf 100644 --- a/Drivers/ili9881c-module/source/module.cpp +++ b/Drivers/ili9881c-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const ili9881c_drivers[] = { Module ili9881c_module = { .name = "ili9881c", - .drivers = ili9881c_drivers + .start = nullptr, + .stop = nullptr, + .drivers = ili9881c_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ina226-module/source/ina226.cpp b/Drivers/ina226-module/source/ina226.cpp index 2a51f1caf..fec59dfbc 100644 --- a/Drivers/ina226-module/source/ina226.cpp +++ b/Drivers/ina226-module/source/ina226.cpp @@ -113,7 +113,7 @@ Driver ina226_power_supply_driver = { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new(std::nothrow) Device { .address = 0, .name = "ina226-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new(std::nothrow) Device { .address = 0, .name = "ina226-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/ina226-module/source/module.cpp b/Drivers/ina226-module/source/module.cpp index 4159cfc76..f96e7210d 100644 --- a/Drivers/ina226-module/source/module.cpp +++ b/Drivers/ina226-module/source/module.cpp @@ -17,8 +17,11 @@ extern const ModuleSymbol ina226_module_symbols[]; Module ina226_module = { .name = "ina226", + .start = nullptr, + .stop = nullptr, .drivers = ina226_drivers, .symbols = ina226_module_symbols, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/jd9165-module/source/jd9165.cpp b/Drivers/jd9165-module/source/jd9165.cpp index ca8e6ba44..f37888782 100644 --- a/Drivers/jd9165-module/source/jd9165.cpp +++ b/Drivers/jd9165-module/source/jd9165.cpp @@ -73,12 +73,10 @@ static int pin_or_unused(const GpioPinSpec& pin) { return pin.gpio_controller == nullptr ? -1 : static_cast(pin.pin); } +// RGB666 has no ESP-IDF 6.1 lcd_color_format_t equivalent (LL only implements RGB565/RGB888), +// so 18bpp is rejected in start() below rather than silently mis-driving the panel. static lcd_color_format_t color_format_from_bits_per_pixel(uint8_t bits_per_pixel) { - switch (bits_per_pixel) { - case 18: return LCD_COLOR_FMT_RGB666; - case 24: return LCD_COLOR_FMT_RGB888; - default: return LCD_COLOR_FMT_RGB565; - } + return bits_per_pixel == 24 ? LCD_COLOR_FMT_RGB888 : LCD_COLOR_FMT_RGB565; } // Unpacks the devicetree's flat [cmd, data_len, delay_ms, data_len bytes...] encoding (produced @@ -126,6 +124,10 @@ static bool parse_init_sequence(const uint8_t* bytes, uint32_t length, jd9165_lc static error_t start(Device* device) { const auto* config = GET_CONFIG(device); + if (config->bits_per_pixel == 18) { + LOG_E(TAG, "18bpp (RGB666) is unsupported on this ESP-IDF version"); + return ERROR_NOT_SUPPORTED; + } auto* internal = static_cast(malloc(sizeof(Jd9165Internal))); if (internal == nullptr) { @@ -162,7 +164,7 @@ static error_t start(Device* device) { .bus_id = config->dsi_bus_id, .num_data_lanes = config->num_data_lanes, .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, - .lane_bit_rate_mbps = config->lane_bit_rate_mbps, + .lane_bit_rate_mbps = static_cast(config->lane_bit_rate_mbps), }; if (esp_lcd_new_dsi_bus(&bus_config, &internal->dsi_bus_handle) != ESP_OK) { LOG_E(TAG, "Failed to create MIPI DSI bus"); @@ -190,8 +192,7 @@ static error_t start(Device* device) { const esp_lcd_dpi_panel_config_t dpi_config = { .virtual_channel = 0, .dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, - .dpi_clock_freq_mhz = config->dpi_clock_freq_mhz, - .pixel_format = (lcd_color_rgb_pixel_format_t)0, // deprecated field - in/out_color_format below take precedence + .dpi_clock_freq_mhz = static_cast(config->dpi_clock_freq_mhz), .in_color_format = color_format, .out_color_format = color_format, .num_fbs = config->num_fbs, @@ -206,7 +207,6 @@ static error_t start(Device* device) { .vsync_front_porch = config->vsync_front_porch, }, .flags = { - .use_dma2d = config->use_dma2d, .disable_lp = config->disable_lp, }, }; @@ -221,13 +221,13 @@ static error_t start(Device* device) { }; const esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = &vendor_config, // JD9165's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = &vendor_config, }; if (esp_lcd_new_panel_jd9165(internal->io_handle, &panel_config, &internal->panel_handle) != ESP_OK) { @@ -240,6 +240,10 @@ static error_t start(Device* device) { return ERROR_RESOURCE; } + if (config->use_dma2d) { + esp_lcd_dpi_panel_enable_dma2d(internal->panel_handle); + } + // Bring-up sequence: reset() pulses (or software-resets) the panel and init() pushes // init_cmds over the DBI command interface before bringing up the underlying DPI peripheral. // swap_xy/set_gap are intentionally not called: the JD9165 driver doesn't override them and @@ -310,7 +314,7 @@ static error_t start(Device* device) { } esp_lcd_dpi_panel_event_callbacks_t callbacks = {}; - callbacks.on_refresh_done = on_refresh_done; + callbacks.on_frame_buf_complete = on_refresh_done; if (esp_lcd_dpi_panel_register_event_callbacks(internal->panel_handle, &callbacks, internal) != ESP_OK) { LOG_E(TAG, "Failed to register panel event callbacks"); vSemaphoreDelete(internal->frame_complete_semaphore); @@ -494,12 +498,16 @@ static const DisplayApi jd9165_display_api = { .reset = jd9165_reset, .init = jd9165_init, .draw_bitmap = jd9165_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = jd9165_mirror, .swap_xy = nullptr, .get_swap_xy = nullptr, .get_mirror_x = jd9165_get_mirror_x, .get_mirror_y = jd9165_get_mirror_y, .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = jd9165_invert_color, .disp_on_off = jd9165_disp_on_off, .disp_sleep = nullptr, diff --git a/Drivers/jd9165-module/source/module.cpp b/Drivers/jd9165-module/source/module.cpp index dd0393a37..68e968752 100644 --- a/Drivers/jd9165-module/source/module.cpp +++ b/Drivers/jd9165-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const jd9165_drivers[] = { Module jd9165_module = { .name = "jd9165", - .drivers = jd9165_drivers + .start = nullptr, + .stop = nullptr, + .drivers = jd9165_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/jd9853-module/source/esp_lcd_jd9853.c b/Drivers/jd9853-module/source/esp_lcd_jd9853.c index eb55a1847..0e4a0155d 100644 --- a/Drivers/jd9853-module/source/esp_lcd_jd9853.c +++ b/Drivers/jd9853-module/source/esp_lcd_jd9853.c @@ -76,7 +76,7 @@ esp_err_t esp_lcd_new_panel_jd9853(const esp_lcd_panel_io_handle_t io, const esp ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space"); break; } -#else +#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) switch (panel_dev_config->rgb_endian) { case LCD_RGB_ENDIAN_RGB: @@ -89,6 +89,19 @@ esp_err_t esp_lcd_new_panel_jd9853(const esp_lcd_panel_io_handle_t io, const esp ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb endian"); break; } +#else + switch (panel_dev_config->rgb_ele_order) + { + case LCD_RGB_ELEMENT_ORDER_RGB: + jd9853->madctl_val = 0; + break; + case LCD_RGB_ELEMENT_ORDER_BGR: + jd9853->madctl_val |= LCD_CMD_BGR_BIT; + break; + default: + ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb element order"); + break; + } #endif switch (panel_dev_config->bits_per_pixel) diff --git a/Drivers/jd9853-module/source/jd9853.cpp b/Drivers/jd9853-module/source/jd9853.cpp index a1d59d2c6..98ca437c9 100644 --- a/Drivers/jd9853-module/source/jd9853.cpp +++ b/Drivers/jd9853-module/source/jd9853.cpp @@ -78,8 +78,8 @@ static error_t start(Device* device) { } esp_lcd_panel_io_spi_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), - .dc_gpio_num = pin_or_unused(config->pin_dc), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), + .dc_gpio_num = static_cast(pin_or_unused(config->pin_dc)), .spi_mode = 0, .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, @@ -96,6 +96,7 @@ static error_t start(Device* device) { .octal_mode = 0, .quad_mode = 0, .sio_mode = 0, + .psram_dma_direct = 0, .lsb_first = 0, .cs_high_active = 0, }, @@ -115,13 +116,13 @@ static error_t start(Device* device) { }; esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = 16, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = &vendor_config, // JD9853's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = &vendor_config, }; ret = esp_lcd_new_panel_jd9853(internal->io_handle, &panel_config, &internal->panel_handle); @@ -343,6 +344,8 @@ static const DisplayApi jd9853_display_api = { .reset = jd9853_reset, .init = jd9853_init, .draw_bitmap = jd9853_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = jd9853_mirror, .swap_xy = jd9853_swap_xy, .get_swap_xy = jd9853_get_swap_xy, diff --git a/Drivers/jd9853-module/source/module.cpp b/Drivers/jd9853-module/source/module.cpp index 5571a427d..37439c0ca 100644 --- a/Drivers/jd9853-module/source/module.cpp +++ b/Drivers/jd9853-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const jd9853_drivers[] = { Module jd9853_module = { .name = "jd9853", - .drivers = jd9853_drivers + .start = nullptr, + .stop = nullptr, + .drivers = jd9853_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/lilygo-module/CMakeLists.txt b/Drivers/lilygo-module/CMakeLists.txt index 5c5b67056..6a4587f2a 100644 --- a/Drivers/lilygo-module/CMakeLists.txt +++ b/Drivers/lilygo-module/CMakeLists.txt @@ -7,5 +7,5 @@ file(GLOB_RECURSE SOURCE_FILES "source/*.c*") tactility_add_module(lilygo-module SRCS ${SOURCE_FILES} INCLUDE_DIRS include/ - REQUIRES TactilityKernel lvgl driver + REQUIRES TactilityKernel lvgl driver esp_driver_gpio ) diff --git a/Drivers/lilygo-module/source/module.cpp b/Drivers/lilygo-module/source/module.cpp index 32947a397..e50cd46f7 100644 --- a/Drivers/lilygo-module/source/module.cpp +++ b/Drivers/lilygo-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const lilygo_drivers[] = { Module lilygo_module = { .name = "lilygo", - .drivers = lilygo_drivers + .start = nullptr, + .stop = nullptr, + .drivers = lilygo_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/m5pm1-module/source/m5pm1.cpp b/Drivers/m5pm1-module/source/m5pm1.cpp index 2c6d96c42..3eb11b38d 100644 --- a/Drivers/m5pm1-module/source/m5pm1.cpp +++ b/Drivers/m5pm1-module/source/m5pm1.cpp @@ -147,7 +147,7 @@ struct M5pm1Internal { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new(std::nothrow) Device { .address = 0, .name = "m5pm1-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new(std::nothrow) Device { .address = 0, .name = "m5pm1-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/m5pm1-module/source/module.cpp b/Drivers/m5pm1-module/source/module.cpp index 8ca27f6fc..eb1150a11 100644 --- a/Drivers/m5pm1-module/source/module.cpp +++ b/Drivers/m5pm1-module/source/module.cpp @@ -17,8 +17,11 @@ extern const ModuleSymbol m5pm1_module_symbols[]; Module m5pm1_module = { .name = "m5pm1", + .start = nullptr, + .stop = nullptr, .drivers = m5pm1_drivers, - .symbols = m5pm1_module_symbols + .symbols = m5pm1_module_symbols, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/m5stack-module/source/module.cpp b/Drivers/m5stack-module/source/module.cpp index 9bd877cab..6dd2cda69 100644 --- a/Drivers/m5stack-module/source/module.cpp +++ b/Drivers/m5stack-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const m5stack_drivers[] = { Module m5stack_module = { .name = "m5stack", - .drivers = m5stack_drivers + .start = nullptr, + .stop = nullptr, + .drivers = m5stack_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/mpu6886-module/source/module.cpp b/Drivers/mpu6886-module/source/module.cpp index 0dfc26be9..28d0bc0ea 100644 --- a/Drivers/mpu6886-module/source/module.cpp +++ b/Drivers/mpu6886-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const mpu6886_drivers[] = { Module mpu6886_module = { .name = "mpu6886", - .drivers = mpu6886_drivers + .start = nullptr, + .stop = nullptr, + .drivers = mpu6886_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/pdm-mic-module/source/module.cpp b/Drivers/pdm-mic-module/source/module.cpp index 76ade6a1f..477e85415 100644 --- a/Drivers/pdm-mic-module/source/module.cpp +++ b/Drivers/pdm-mic-module/source/module.cpp @@ -15,8 +15,11 @@ extern const ModuleSymbol pdm_mic_module_symbols[]; Module pdm_mic_module = { .name = "pdm_mic", + .start = nullptr, + .stop = nullptr, .drivers = pdm_mic_drivers, .symbols = pdm_mic_module_symbols, + .internal = nullptr }; } diff --git a/Drivers/pi4ioe5v6408-module/source/module.cpp b/Drivers/pi4ioe5v6408-module/source/module.cpp index b13d61fa4..5293e25b2 100644 --- a/Drivers/pi4ioe5v6408-module/source/module.cpp +++ b/Drivers/pi4ioe5v6408-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const pi4ioe5v6408_drivers[] = { Module pi4ioe5v6408_module = { .name = "pi4ioe5v6408", - .drivers = pi4ioe5v6408_drivers + .start = nullptr, + .stop = nullptr, + .drivers = pi4ioe5v6408_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/py32ioexpander-module/source/module.cpp b/Drivers/py32ioexpander-module/source/module.cpp index cc26ee12c..753d11475 100644 --- a/Drivers/py32ioexpander-module/source/module.cpp +++ b/Drivers/py32ioexpander-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const py32ioexpander_drivers[] = { Module py32ioexpander_module = { .name = "py32ioexpander", - .drivers = py32ioexpander_drivers + .start = nullptr, + .stop = nullptr, + .drivers = py32ioexpander_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/qmi8658-module/source/module.cpp b/Drivers/qmi8658-module/source/module.cpp index 6f9808162..3eae6a50a 100644 --- a/Drivers/qmi8658-module/source/module.cpp +++ b/Drivers/qmi8658-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const qmi8658_drivers[] = { Module qmi8658_module = { .name = "qmi8658", - .drivers = qmi8658_drivers + .start = nullptr, + .stop = nullptr, + .drivers = qmi8658_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/rgb-display-module/source/module.cpp b/Drivers/rgb-display-module/source/module.cpp index 537bc2e1a..37ddba6f9 100644 --- a/Drivers/rgb-display-module/source/module.cpp +++ b/Drivers/rgb-display-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const rgbd_display_drivers[] = { Module rgb_display_module = { .name = "rgb_display", - .drivers = rgbd_display_drivers + .start = nullptr, + .stop = nullptr, + .drivers = rgbd_display_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/rgb-display-module/source/rgb_display.cpp b/Drivers/rgb-display-module/source/rgb_display.cpp index 7748af43e..49ec423d7 100644 --- a/Drivers/rgb-display-module/source/rgb_display.cpp +++ b/Drivers/rgb-display-module/source/rgb_display.cpp @@ -70,6 +70,14 @@ static int pin_or_unused(const GpioPinSpec& pin) { return pin.gpio_controller == nullptr ? -1 : static_cast(pin.pin); } +static lcd_color_format_t color_format_from_bpp(uint8_t bits_per_pixel) { + switch (bits_per_pixel) { + case 16: return LCD_COLOR_FMT_RGB565; + case 24: return LCD_COLOR_FMT_RGB888; + default: return static_cast(0); + } +} + // Pulses the panel's own driver-IC reset line, if configured. Transient: the descriptor is // released immediately after, since nothing else needs to touch this pin afterward. static error_t perform_hardware_reset(const RgbDisplayConfig* config) { @@ -166,33 +174,35 @@ static error_t start(Device* device) { } }, .data_width = config->data_width, - .bits_per_pixel = config->bits_per_pixel, + .in_color_format = color_format_from_bpp(config->bits_per_pixel), .num_fbs = config->num_fbs, .bounce_buffer_size_px = config->bounce_buffer_size_px, - .sram_trans_align = config->sram_trans_align, - .psram_trans_align = config->psram_trans_align, - .hsync_gpio_num = pin_or_unused(config->pin_hsync), - .vsync_gpio_num = pin_or_unused(config->pin_vsync), - .de_gpio_num = pin_or_unused(config->pin_de), - .pclk_gpio_num = pin_or_unused(config->pin_pclk), - .disp_gpio_num = pin_or_unused(config->pin_disp), + // No device configures sram-trans-align/psram-trans-align differently from their YAML + // defaults (8/64), so the single dma_burst_size that replaced both can just take the + // larger (PSRAM) alignment - safe for SRAM-only allocations too, just less tightly packed. + .dma_burst_size = config->psram_trans_align, + .hsync_gpio_num = static_cast(pin_or_unused(config->pin_hsync)), + .vsync_gpio_num = static_cast(pin_or_unused(config->pin_vsync)), + .de_gpio_num = static_cast(pin_or_unused(config->pin_de)), + .pclk_gpio_num = static_cast(pin_or_unused(config->pin_pclk)), + .disp_gpio_num = static_cast(pin_or_unused(config->pin_disp)), .data_gpio_nums = { - pin_or_unused(config->pin_data0), - pin_or_unused(config->pin_data1), - pin_or_unused(config->pin_data2), - pin_or_unused(config->pin_data3), - pin_or_unused(config->pin_data4), - pin_or_unused(config->pin_data5), - pin_or_unused(config->pin_data6), - pin_or_unused(config->pin_data7), - pin_or_unused(config->pin_data8), - pin_or_unused(config->pin_data9), - pin_or_unused(config->pin_data10), - pin_or_unused(config->pin_data11), - pin_or_unused(config->pin_data12), - pin_or_unused(config->pin_data13), - pin_or_unused(config->pin_data14), - pin_or_unused(config->pin_data15), + static_cast(pin_or_unused(config->pin_data0)), + static_cast(pin_or_unused(config->pin_data1)), + static_cast(pin_or_unused(config->pin_data2)), + static_cast(pin_or_unused(config->pin_data3)), + static_cast(pin_or_unused(config->pin_data4)), + static_cast(pin_or_unused(config->pin_data5)), + static_cast(pin_or_unused(config->pin_data6)), + static_cast(pin_or_unused(config->pin_data7)), + static_cast(pin_or_unused(config->pin_data8)), + static_cast(pin_or_unused(config->pin_data9)), + static_cast(pin_or_unused(config->pin_data10)), + static_cast(pin_or_unused(config->pin_data11)), + static_cast(pin_or_unused(config->pin_data12)), + static_cast(pin_or_unused(config->pin_data13)), + static_cast(pin_or_unused(config->pin_data14)), + static_cast(pin_or_unused(config->pin_data15)), }, .flags = { .disp_active_low = config->disp_active_low, @@ -209,7 +219,7 @@ static error_t start(Device* device) { // marked unused rather than left as the aggregate-init default of 0 (which would look like // "GPIO0 is wired to this line"). for (size_t i = 16; i < sizeof(panel_config.data_gpio_nums) / sizeof(panel_config.data_gpio_nums[0]); i++) { - panel_config.data_gpio_nums[i] = -1; + panel_config.data_gpio_nums[i] = GPIO_NUM_NC; } esp_err_t ret = esp_lcd_new_rgb_panel(&panel_config, &internal->panel_handle); @@ -469,12 +479,16 @@ static const DisplayApi rgb_display_api = { .reset = rgb_display_reset, .init = rgb_display_init, .draw_bitmap = rgb_display_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = rgb_display_mirror, .swap_xy = rgb_display_swap_xy, .get_swap_xy = rgb_display_get_swap_xy, .get_mirror_x = rgb_display_get_mirror_x, .get_mirror_y = rgb_display_get_mirror_y, .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = rgb_display_invert_color, .disp_on_off = rgb_display_disp_on_off, .disp_sleep = nullptr, diff --git a/Drivers/rx8130ce-module/source/module.cpp b/Drivers/rx8130ce-module/source/module.cpp index cf3ffaa71..a25576044 100644 --- a/Drivers/rx8130ce-module/source/module.cpp +++ b/Drivers/rx8130ce-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const rx8130ce_drivers[] = { Module rx8130ce_module = { .name = "rx8130ce", - .drivers = rx8130ce_drivers + .start = nullptr, + .stop = nullptr, + .drivers = rx8130ce_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/sc2356-module/source/module.cpp b/Drivers/sc2356-module/source/module.cpp index c82bc9281..7f307fd80 100644 --- a/Drivers/sc2356-module/source/module.cpp +++ b/Drivers/sc2356-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const sc2356_drivers[] = { Module sc2356_module = { .name = "sc2356", - .drivers = sc2356_drivers + .start = nullptr, + .stop = nullptr, + .drivers = sc2356_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/sc2356-module/source/sc2356.cpp b/Drivers/sc2356-module/source/sc2356.cpp index 0d6824263..21c0c1f0e 100644 --- a/Drivers/sc2356-module/source/sc2356.cpp +++ b/Drivers/sc2356-module/source/sc2356.cpp @@ -334,7 +334,7 @@ error_t sc2356_open(Device* device, Sc2356Handle* out_handle) { // Create hardware JPEG encoder once; reused across all sc2356_capture_jpeg() calls { - jpeg_encode_engine_cfg_t eng_cfg = { .intr_priority = 0, .timeout_ms = 1000 }; + jpeg_encode_engine_cfg_t eng_cfg = { .intr_priority = 0, .timeout_ms = 1000, .flags = {} }; esp_err_t je = jpeg_new_encoder_engine(&eng_cfg, &state->enc); if (je != ESP_OK) { LOG_E(TAG, "jpeg_new_encoder_engine failed: %s", esp_err_to_name(je)); @@ -553,6 +553,7 @@ error_t sc2356_capture_jpeg(Sc2356Handle handle, uint8_t** out_buf, size_t* out_ .src_type = JPEG_ENCODE_IN_FORMAT_RGB565, .sub_sample = JPEG_DOWN_SAMPLING_YUV420, .image_quality = quality, + .pixel_reverse = false, }; uint32_t encoded_size = 0; esp_err_t esp_err = jpeg_encoder_process(state->enc, &enc_cfg, frame, diff --git a/Drivers/ssd1306-module/source/module.cpp b/Drivers/ssd1306-module/source/module.cpp index 8e15db551..55957ee19 100644 --- a/Drivers/ssd1306-module/source/module.cpp +++ b/Drivers/ssd1306-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const ssd1306_drivers[] = { Module ssd1306_module = { .name = "ssd1306", - .drivers = ssd1306_drivers + .start = nullptr, + .stop = nullptr, + .drivers = ssd1306_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/ssd1306-module/source/ssd1306.cpp b/Drivers/ssd1306-module/source/ssd1306.cpp index c39b543a6..e8dabc062 100644 --- a/Drivers/ssd1306-module/source/ssd1306.cpp +++ b/Drivers/ssd1306-module/source/ssd1306.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -52,28 +51,24 @@ static esp_err_t create_io_handle(Device* parent, uint8_t address, esp_lcd_panel // with, unlike the multi-byte-per-command SPI/QSPI panels elsewhere in this repo. esp_lcd_panel_io_i2c_config_t io_config = { .dev_addr = address, - .on_color_trans_done = nullptr, - .user_ctx = nullptr, + .scl_speed_hz = 0, .control_phase_bytes = 1, .dc_bit_offset = 6, .lcd_cmd_bits = 0, .lcd_param_bits = 0, + .on_color_trans_done = nullptr, + .user_ctx = nullptr, .flags = { .dc_low_on_data = false, .disable_control_phase = false, }, - .scl_speed_hz = 0, }; auto* parent_driver = device_get_driver(parent); - if (driver_is_compatible(parent_driver, "espressif,esp32-i2c")) { - auto port = static_cast(parent->config)->port; - return esp_lcd_new_panel_io_i2c_v1(port, &io_config, out_handle); - } if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) { auto bus = esp32_i2c_master_get_bus_handle(parent); io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent); - return esp_lcd_new_panel_io_i2c_v2(bus, &io_config, out_handle); + return esp_lcd_new_panel_io_i2c(bus, &io_config, out_handle); } LOG_E(TAG, "Unsupported I2C driver"); @@ -164,15 +159,14 @@ static error_t start(Device* device) { .height = static_cast(config->vertical_resolution), }; - // color_space (not rgb_ele_order): this deprecated union member is the only one whose type - // can express ESP_LCD_COLOR_SPACE_MONOCHROME - rgb_ele_order's own enum only covers RGB/BGR. + // No rgb_ele_order set: the built-in ssd1306 vendor driver is monochrome and never reads it + // (only bits_per_pixel, checked to be exactly 1 - see esp_lcd_panel_ssd1306.c). esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = -1, // always -1: reset is handled manually above, not by the panel itself - .color_space = ESP_LCD_COLOR_SPACE_MONOCHROME, .data_endian = LCD_RGB_DATA_ENDIAN_BIG, .bits_per_pixel = 1, - .flags = { .reset_active_high = false }, + .reset_gpio_num = GPIO_NUM_NC, // reset is handled manually above, not by the panel itself .vendor_config = &ssd1306_config, + .flags = { .reset_active_high = false }, }; if (esp_lcd_new_panel_ssd1306(internal->io_handle, &panel_config, &internal->panel_handle) != ESP_OK) { @@ -331,12 +325,16 @@ static const DisplayApi ssd1306_display_api = { .reset = ssd1306_reset, .init = ssd1306_init, .draw_bitmap = ssd1306_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = nullptr, .swap_xy = nullptr, .get_swap_xy = nullptr, .get_mirror_x = nullptr, .get_mirror_y = nullptr, .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = ssd1306_invert_color, .disp_on_off = ssd1306_disp_on_off, .disp_sleep = nullptr, diff --git a/Drivers/st7121-module/source/module.cpp b/Drivers/st7121-module/source/module.cpp index e6b97eae1..d2931438b 100644 --- a/Drivers/st7121-module/source/module.cpp +++ b/Drivers/st7121-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const st7121_drivers[] = { Module st7121_module = { .name = "st7121", - .drivers = st7121_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7121_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7121-module/source/st7121.cpp b/Drivers/st7121-module/source/st7121.cpp index 58d73e4b9..c834ab31c 100644 --- a/Drivers/st7121-module/source/st7121.cpp +++ b/Drivers/st7121-module/source/st7121.cpp @@ -102,12 +102,10 @@ static int pin_or_unused(const GpioPinSpec& pin) { return pin.gpio_controller == nullptr ? -1 : static_cast(pin.pin); } +// RGB666 has no ESP-IDF 6.1 lcd_color_format_t equivalent (LL only implements RGB565/RGB888), +// so 18bpp is rejected in start() below rather than silently mis-driving the panel. static lcd_color_format_t color_format_from_bits_per_pixel(uint8_t bits_per_pixel) { - switch (bits_per_pixel) { - case 18: return LCD_COLOR_FMT_RGB666; - case 24: return LCD_COLOR_FMT_RGB888; - default: return LCD_COLOR_FMT_RGB565; - } + return bits_per_pixel == 24 ? LCD_COLOR_FMT_RGB888 : LCD_COLOR_FMT_RGB565; } // Unpacks the devicetree's flat [cmd, data_len, delay_ms, data_len bytes...] encoding (produced @@ -155,6 +153,10 @@ static bool parse_init_sequence(const uint8_t* bytes, uint32_t length, st7121_lc static error_t start(Device* device) { const auto* config = GET_CONFIG(device); + if (config->bits_per_pixel == 18) { + LOG_E(TAG, "18bpp (RGB666) is unsupported on this ESP-IDF version"); + return ERROR_NOT_SUPPORTED; + } auto* internal = static_cast(malloc(sizeof(St7121Internal))); if (internal == nullptr) { @@ -178,6 +180,7 @@ static error_t start(Device* device) { esp_ldo_channel_config_t ldo_config = { .chan_id = config->ldo_channel, .voltage_mv = config->ldo_voltage_mv, + .voltage_stable_delay_us = 0, .flags = {}, }; if (esp_ldo_acquire_channel(&ldo_config, &internal->ldo_handle) != ESP_OK) { @@ -191,7 +194,8 @@ static error_t start(Device* device) { .bus_id = config->dsi_bus_id, .num_data_lanes = config->num_data_lanes, .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, - .lane_bit_rate_mbps = config->lane_bit_rate_mbps, + .lane_bit_rate_mbps = static_cast(config->lane_bit_rate_mbps), + .flags = {}, }; if (esp_lcd_new_dsi_bus(&bus_config, &internal->dsi_bus_handle) != ESP_OK) { LOG_E(TAG, "Failed to create MIPI DSI bus"); @@ -219,8 +223,7 @@ static error_t start(Device* device) { const esp_lcd_dpi_panel_config_t dpi_config = { .virtual_channel = 0, .dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, - .dpi_clock_freq_mhz = config->dpi_clock_freq_mhz, - .pixel_format = (lcd_color_rgb_pixel_format_t)0, // deprecated field - in/out_color_format below take precedence + .dpi_clock_freq_mhz = static_cast(config->dpi_clock_freq_mhz), .in_color_format = color_format, .out_color_format = color_format, .num_fbs = config->num_fbs, @@ -235,7 +238,6 @@ static error_t start(Device* device) { .vsync_front_porch = config->vsync_front_porch, }, .flags = { - .use_dma2d = config->use_dma2d, .disable_lp = config->disable_lp, }, }; @@ -250,13 +252,13 @@ static error_t start(Device* device) { }; const esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = &vendor_config, // ST7121's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = &vendor_config, }; if (esp_lcd_new_panel_st7121(internal->io_handle, &panel_config, &internal->panel_handle) != ESP_OK) { @@ -269,6 +271,10 @@ static error_t start(Device* device) { return ERROR_RESOURCE; } + if (config->use_dma2d) { + esp_lcd_dpi_panel_enable_dma2d(internal->panel_handle); + } + // Bring-up sequence: reset() pulses (or software-resets) the panel and init() pushes // init_cmds over the DBI command interface before bringing up the underlying DPI peripheral. // swap_xy/set_gap are intentionally not called: the ST7121 driver doesn't override them and @@ -354,7 +360,7 @@ static error_t start(Device* device) { xSemaphoreGive(internal->color_trans_done_semaphore); esp_lcd_dpi_panel_event_callbacks_t callbacks = {}; - callbacks.on_refresh_done = on_refresh_done; + callbacks.on_frame_buf_complete = on_refresh_done; callbacks.on_color_trans_done = on_color_trans_done; if (esp_lcd_dpi_panel_register_event_callbacks(internal->panel_handle, &callbacks, internal) != ESP_OK) { LOG_E(TAG, "Failed to register panel event callbacks"); @@ -558,12 +564,16 @@ static const DisplayApi st7121_display_api = { .reset = st7121_reset, .init = st7121_init, .draw_bitmap = st7121_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7121_mirror, .swap_xy = nullptr, .get_swap_xy = nullptr, .get_mirror_x = st7121_get_mirror_x, .get_mirror_y = st7121_get_mirror_y, .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = st7121_invert_color, .disp_on_off = st7121_disp_on_off, .disp_sleep = nullptr, diff --git a/Drivers/st7123-module/source/module.cpp b/Drivers/st7123-module/source/module.cpp index d5da2da00..fcb50af30 100644 --- a/Drivers/st7123-module/source/module.cpp +++ b/Drivers/st7123-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const st7123_drivers[] = { Module st7123_module = { .name = "st7123", - .drivers = st7123_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7123_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7123-module/source/st7123.cpp b/Drivers/st7123-module/source/st7123.cpp index 583480f4a..9c6e45ce8 100644 --- a/Drivers/st7123-module/source/st7123.cpp +++ b/Drivers/st7123-module/source/st7123.cpp @@ -102,12 +102,10 @@ static int pin_or_unused(const GpioPinSpec& pin) { return pin.gpio_controller == nullptr ? -1 : static_cast(pin.pin); } +// RGB666 has no ESP-IDF 6.1 lcd_color_format_t equivalent (LL only implements RGB565/RGB888), +// so 18bpp is rejected in start() below rather than silently mis-driving the panel. static lcd_color_format_t color_format_from_bits_per_pixel(uint8_t bits_per_pixel) { - switch (bits_per_pixel) { - case 18: return LCD_COLOR_FMT_RGB666; - case 24: return LCD_COLOR_FMT_RGB888; - default: return LCD_COLOR_FMT_RGB565; - } + return bits_per_pixel == 24 ? LCD_COLOR_FMT_RGB888 : LCD_COLOR_FMT_RGB565; } // Unpacks the devicetree's flat [cmd, data_len, delay_ms, data_len bytes...] encoding (produced @@ -155,6 +153,10 @@ static bool parse_init_sequence(const uint8_t* bytes, uint32_t length, st7123_lc static error_t start(Device* device) { const auto* config = GET_CONFIG(device); + if (config->bits_per_pixel == 18) { + LOG_E(TAG, "18bpp (RGB666) is unsupported on this ESP-IDF version"); + return ERROR_NOT_SUPPORTED; + } auto* internal = static_cast(malloc(sizeof(St7123Internal))); if (internal == nullptr) { @@ -178,6 +180,7 @@ static error_t start(Device* device) { esp_ldo_channel_config_t ldo_config = { .chan_id = config->ldo_channel, .voltage_mv = config->ldo_voltage_mv, + .voltage_stable_delay_us = 0, .flags = {}, }; if (esp_ldo_acquire_channel(&ldo_config, &internal->ldo_handle) != ESP_OK) { @@ -191,7 +194,8 @@ static error_t start(Device* device) { .bus_id = config->dsi_bus_id, .num_data_lanes = config->num_data_lanes, .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, - .lane_bit_rate_mbps = config->lane_bit_rate_mbps, + .lane_bit_rate_mbps = static_cast(config->lane_bit_rate_mbps), + .flags = {}, }; if (esp_lcd_new_dsi_bus(&bus_config, &internal->dsi_bus_handle) != ESP_OK) { LOG_E(TAG, "Failed to create MIPI DSI bus"); @@ -219,8 +223,7 @@ static error_t start(Device* device) { const esp_lcd_dpi_panel_config_t dpi_config = { .virtual_channel = 0, .dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, - .dpi_clock_freq_mhz = config->dpi_clock_freq_mhz, - .pixel_format = (lcd_color_rgb_pixel_format_t)0, // deprecated field - in/out_color_format below take precedence + .dpi_clock_freq_mhz = static_cast(config->dpi_clock_freq_mhz), .in_color_format = color_format, .out_color_format = color_format, .num_fbs = config->num_fbs, @@ -235,7 +238,6 @@ static error_t start(Device* device) { .vsync_front_porch = config->vsync_front_porch, }, .flags = { - .use_dma2d = config->use_dma2d, .disable_lp = config->disable_lp, }, }; @@ -250,13 +252,13 @@ static error_t start(Device* device) { }; const esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = &vendor_config, // ST7123's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = &vendor_config, }; if (esp_lcd_new_panel_st7123(internal->io_handle, &panel_config, &internal->panel_handle) != ESP_OK) { @@ -269,6 +271,10 @@ static error_t start(Device* device) { return ERROR_RESOURCE; } + if (config->use_dma2d) { + esp_lcd_dpi_panel_enable_dma2d(internal->panel_handle); + } + // Bring-up sequence: reset() pulses (or software-resets) the panel and init() pushes // init_cmds over the DBI command interface before bringing up the underlying DPI peripheral. // swap_xy/set_gap are intentionally not called: the ST7123 driver doesn't override them and @@ -354,7 +360,7 @@ static error_t start(Device* device) { xSemaphoreGive(internal->color_trans_done_semaphore); esp_lcd_dpi_panel_event_callbacks_t callbacks = {}; - callbacks.on_refresh_done = on_refresh_done; + callbacks.on_frame_buf_complete = on_refresh_done; callbacks.on_color_trans_done = on_color_trans_done; if (esp_lcd_dpi_panel_register_event_callbacks(internal->panel_handle, &callbacks, internal) != ESP_OK) { LOG_E(TAG, "Failed to register panel event callbacks"); @@ -558,12 +564,16 @@ static const DisplayApi st7123_display_api = { .reset = st7123_reset, .init = st7123_init, .draw_bitmap = st7123_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7123_mirror, .swap_xy = nullptr, .get_swap_xy = nullptr, .get_mirror_x = st7123_get_mirror_x, .get_mirror_y = st7123_get_mirror_y, .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = st7123_invert_color, .disp_on_off = st7123_disp_on_off, .disp_sleep = nullptr, diff --git a/Drivers/st7123-module/source/st7123_touch.cpp b/Drivers/st7123-module/source/st7123_touch.cpp index ac35820b8..b7e6c140e 100644 --- a/Drivers/st7123-module/source/st7123_touch.cpp +++ b/Drivers/st7123-module/source/st7123_touch.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -39,14 +38,10 @@ static esp_err_t create_io_handle(Device* parent, esp_lcd_panel_io_handle_t* out esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_ST7123_CONFIG(); auto* parent_driver = device_get_driver(parent); - if (driver_is_compatible(parent_driver, "espressif,esp32-i2c")) { - auto port = static_cast(parent->config)->port; - return esp_lcd_new_panel_io_i2c_v1(port, &io_config, out_handle); - } if (driver_is_compatible(parent_driver, "espressif,esp32-i2c-master")) { auto bus = esp32_i2c_master_get_bus_handle(parent); io_config.scl_speed_hz = esp32_i2c_master_get_clock_frequency(parent); - return esp_lcd_new_panel_io_i2c_v2(bus, &io_config, out_handle); + return esp_lcd_new_panel_io_i2c(bus, &io_config, out_handle); } LOG_E(TAG, "Unsupported I2C driver"); diff --git a/Drivers/st7701-module/source/module.cpp b/Drivers/st7701-module/source/module.cpp index 3428bb650..88c835bf6 100644 --- a/Drivers/st7701-module/source/module.cpp +++ b/Drivers/st7701-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const st7701_drivers[] = { Module st7701_module = { .name = "st7701", - .drivers = st7701_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7701_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7701-module/source/st7701.cpp b/Drivers/st7701-module/source/st7701.cpp index 2d8b5f579..18cbdb9b5 100644 --- a/Drivers/st7701-module/source/st7701.cpp +++ b/Drivers/st7701-module/source/st7701.cpp @@ -69,6 +69,14 @@ static int pin_or_unused(const GpioPinSpec& pin) { return pin.gpio_controller == nullptr ? -1 : static_cast(pin.pin); } +static lcd_color_format_t color_format_from_bpp(uint8_t bits_per_pixel) { + switch (bits_per_pixel) { + case 16: return LCD_COLOR_FMT_RGB565; + case 24: return LCD_COLOR_FMT_RGB888; + default: return static_cast(0); + } +} + // Unpacks the devicetree's flat [cmd, data_len, delay_ms, data_len bytes...] encoding (produced // by the devicetree compiler's "array" property type - see init-sequence in // bindings/sitronix,st7701.yaml) into a heap-allocated st7701_lcd_init_cmd_t array. Each entry's @@ -177,33 +185,37 @@ static error_t start(Device* device) { } }, .data_width = config->data_width, - .bits_per_pixel = config->bits_per_pixel, + .in_color_format = color_format_from_bpp(config->bits_per_pixel), + .out_color_format = color_format_from_bpp(config->bits_per_pixel), .num_fbs = config->num_fbs, + .user_fbs = {}, .bounce_buffer_size_px = config->bounce_buffer_size_px, - .sram_trans_align = config->sram_trans_align, - .psram_trans_align = config->psram_trans_align, - .hsync_gpio_num = pin_or_unused(config->pin_hsync), - .vsync_gpio_num = pin_or_unused(config->pin_vsync), - .de_gpio_num = pin_or_unused(config->pin_de), - .pclk_gpio_num = pin_or_unused(config->pin_pclk), - .disp_gpio_num = pin_or_unused(config->pin_disp), + // No device configures sram-trans-align/psram-trans-align differently from their YAML + // defaults (8/64), so the single dma_burst_size that replaced both can just take the + // larger (PSRAM) alignment - safe for SRAM-only allocations too, just less tightly packed. + .dma_burst_size = config->psram_trans_align, + .hsync_gpio_num = static_cast(pin_or_unused(config->pin_hsync)), + .vsync_gpio_num = static_cast(pin_or_unused(config->pin_vsync)), + .de_gpio_num = static_cast(pin_or_unused(config->pin_de)), + .pclk_gpio_num = static_cast(pin_or_unused(config->pin_pclk)), + .disp_gpio_num = static_cast(pin_or_unused(config->pin_disp)), .data_gpio_nums = { - pin_or_unused(config->pin_data0), - pin_or_unused(config->pin_data1), - pin_or_unused(config->pin_data2), - pin_or_unused(config->pin_data3), - pin_or_unused(config->pin_data4), - pin_or_unused(config->pin_data5), - pin_or_unused(config->pin_data6), - pin_or_unused(config->pin_data7), - pin_or_unused(config->pin_data8), - pin_or_unused(config->pin_data9), - pin_or_unused(config->pin_data10), - pin_or_unused(config->pin_data11), - pin_or_unused(config->pin_data12), - pin_or_unused(config->pin_data13), - pin_or_unused(config->pin_data14), - pin_or_unused(config->pin_data15), + static_cast(pin_or_unused(config->pin_data0)), + static_cast(pin_or_unused(config->pin_data1)), + static_cast(pin_or_unused(config->pin_data2)), + static_cast(pin_or_unused(config->pin_data3)), + static_cast(pin_or_unused(config->pin_data4)), + static_cast(pin_or_unused(config->pin_data5)), + static_cast(pin_or_unused(config->pin_data6)), + static_cast(pin_or_unused(config->pin_data7)), + static_cast(pin_or_unused(config->pin_data8)), + static_cast(pin_or_unused(config->pin_data9)), + static_cast(pin_or_unused(config->pin_data10)), + static_cast(pin_or_unused(config->pin_data11)), + static_cast(pin_or_unused(config->pin_data12)), + static_cast(pin_or_unused(config->pin_data13)), + static_cast(pin_or_unused(config->pin_data14)), + static_cast(pin_or_unused(config->pin_data15)), }, .flags = { .disp_active_low = config->disp_active_low, @@ -219,7 +231,7 @@ static error_t start(Device* device) { // more data lines than that, the tail of the array must be explicitly marked unused rather // than left as the aggregate-init default of 0 (which would look like "GPIO0 is wired here"). for (size_t i = 16; i < sizeof(rgb_config.data_gpio_nums) / sizeof(rgb_config.data_gpio_nums[0]); i++) { - rgb_config.data_gpio_nums[i] = -1; + rgb_config.data_gpio_nums[i] = GPIO_NUM_NC; } st7701_vendor_config_t vendor_config = { @@ -234,13 +246,13 @@ static error_t start(Device* device) { }; esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = &vendor_config, // ST7701's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = &vendor_config, }; ret = esp_lcd_new_panel_st7701(internal->io_handle, &panel_config, &internal->panel_handle); @@ -278,7 +290,7 @@ static error_t start(Device* device) { internal->frame_buffer_count = 0; internal->frame_buffer_size_bytes = (size_t)config->horizontal_resolution * config->vertical_resolution * - ((config->bits_per_pixel + 7) / 8); + ((config->bits_per_pixel + 7) / 64); if (config->num_fbs > 0) { // esp_lcd_rgb_panel_get_frame_buffer() is variadic: the number of out-pointer arguments // passed must match fb_num exactly, so this can't be a loop. @@ -512,12 +524,16 @@ static const DisplayApi st7701_display_api = { .reset = st7701_reset, .init = st7701_init, .draw_bitmap = st7701_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7701_mirror, .swap_xy = st7701_swap_xy, .get_swap_xy = st7701_get_swap_xy, .get_mirror_x = st7701_get_mirror_x, .get_mirror_y = st7701_get_mirror_y, .set_gap = nullptr, + .get_gap_x = nullptr, + .get_gap_y = nullptr, .invert_color = st7701_invert_color, .disp_on_off = st7701_disp_on_off, .disp_sleep = nullptr, diff --git a/Drivers/st7735-module/source/module.cpp b/Drivers/st7735-module/source/module.cpp index a65b0fdb2..360983ab3 100644 --- a/Drivers/st7735-module/source/module.cpp +++ b/Drivers/st7735-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const st7735_drivers[] = { Module st7735_module = { .name = "st7735", - .drivers = st7735_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7735_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7735-module/source/st7735.cpp b/Drivers/st7735-module/source/st7735.cpp index bacaf6b1c..38abec9ff 100644 --- a/Drivers/st7735-module/source/st7735.cpp +++ b/Drivers/st7735-module/source/st7735.cpp @@ -83,8 +83,8 @@ static error_t start(Device* device) { } esp_lcd_panel_io_spi_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), - .dc_gpio_num = pin_or_unused(config->pin_dc), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), + .dc_gpio_num = static_cast(pin_or_unused(config->pin_dc)), .spi_mode = 0, .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, @@ -101,6 +101,7 @@ static error_t start(Device* device) { .octal_mode = 0, .quad_mode = 0, .sio_mode = 1, + .psram_dma_direct = 0, .lsb_first = 0, .cs_high_active = 0, }, @@ -115,13 +116,13 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = nullptr, // ST7735's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = nullptr, }; ret = esp_lcd_new_panel_st7735(internal->io_handle, &panel_config, &internal->panel_handle); @@ -362,6 +363,8 @@ static const DisplayApi st7735_display_api = { .reset = st7735_reset, .init = st7735_init, .draw_bitmap = st7735_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7735_mirror, .swap_xy = st7735_swap_xy, .get_swap_xy = st7735_get_swap_xy, diff --git a/Drivers/st7789-i8080-module/source/module.cpp b/Drivers/st7789-i8080-module/source/module.cpp index 335451a97..44bdbb7e7 100644 --- a/Drivers/st7789-i8080-module/source/module.cpp +++ b/Drivers/st7789-i8080-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const st7789_i8080_drivers[] = { Module st7789_i8080_module = { .name = "st7789_i8080", - .drivers = st7789_i8080_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7789_i8080_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7789-i8080-module/source/st7789_i8080.cpp b/Drivers/st7789-i8080-module/source/st7789_i8080.cpp index b000e3ec4..60e7f93eb 100644 --- a/Drivers/st7789-i8080-module/source/st7789_i8080.cpp +++ b/Drivers/st7789-i8080-module/source/st7789_i8080.cpp @@ -113,7 +113,7 @@ static error_t start(Device* device) { } esp_lcd_panel_io_i80_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, .on_color_trans_done = on_color_trans_done, @@ -144,13 +144,13 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = 16, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = nullptr, // ST7789's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = nullptr, }; ret = esp_lcd_new_panel_st7789(internal->io_handle, &panel_config, &internal->panel_handle); @@ -352,6 +352,8 @@ static const DisplayApi st7789_i8080_display_api = { .reset = st7789_i8080_reset, .init = st7789_i8080_init, .draw_bitmap = st7789_i8080_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7789_i8080_mirror, .swap_xy = st7789_i8080_swap_xy, .get_swap_xy = st7789_i8080_get_swap_xy, diff --git a/Drivers/st7789-module/source/module.cpp b/Drivers/st7789-module/source/module.cpp index 7d69faefe..da3785adc 100644 --- a/Drivers/st7789-module/source/module.cpp +++ b/Drivers/st7789-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const st7789_drivers[] = { Module st7789_module = { .name = "st7789", - .drivers = st7789_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7789_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7789-module/source/st7789.cpp b/Drivers/st7789-module/source/st7789.cpp index 801b5f12c..f71b18e66 100644 --- a/Drivers/st7789-module/source/st7789.cpp +++ b/Drivers/st7789-module/source/st7789.cpp @@ -83,8 +83,8 @@ static error_t start(Device* device) { } esp_lcd_panel_io_spi_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), - .dc_gpio_num = pin_or_unused(config->pin_dc), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), + .dc_gpio_num = static_cast(pin_or_unused(config->pin_dc)), .spi_mode = 0, .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, @@ -101,6 +101,7 @@ static error_t start(Device* device) { .octal_mode = 0, .quad_mode = 0, .sio_mode = 1, + .psram_dma_direct = 0, .lsb_first = 0, .cs_high_active = 0, }, @@ -115,13 +116,13 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = nullptr, // ST7789's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = nullptr, }; ret = esp_lcd_new_panel_st7789(internal->io_handle, &panel_config, &internal->panel_handle); @@ -362,6 +363,8 @@ static const DisplayApi st7789_display_api = { .reset = st7789_reset, .init = st7789_init, .draw_bitmap = st7789_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7789_mirror, .swap_xy = st7789_swap_xy, .get_swap_xy = st7789_get_swap_xy, diff --git a/Drivers/st7796-i8080-module/source/module.cpp b/Drivers/st7796-i8080-module/source/module.cpp index fec096c55..d66aef006 100644 --- a/Drivers/st7796-i8080-module/source/module.cpp +++ b/Drivers/st7796-i8080-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const st7796_i8080_drivers[] = { Module st7796_i8080_module = { .name = "st7796_i8080", - .drivers = st7796_i8080_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7796_i8080_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7796-i8080-module/source/st7796_i8080.cpp b/Drivers/st7796-i8080-module/source/st7796_i8080.cpp index 2af77339a..c6dd18fef 100644 --- a/Drivers/st7796-i8080-module/source/st7796_i8080.cpp +++ b/Drivers/st7796-i8080-module/source/st7796_i8080.cpp @@ -81,7 +81,7 @@ static error_t start(Device* device) { } esp_lcd_panel_io_i80_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, .on_color_trans_done = on_color_trans_done, @@ -112,13 +112,13 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = 16, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = nullptr, // ST7796's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = nullptr, }; ret = esp_lcd_new_panel_st7796(internal->io_handle, &panel_config, &internal->panel_handle); @@ -307,6 +307,8 @@ static const DisplayApi st7796_i8080_display_api = { .reset = st7796_i8080_reset, .init = st7796_i8080_init, .draw_bitmap = st7796_i8080_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7796_i8080_mirror, .swap_xy = st7796_i8080_swap_xy, .get_swap_xy = st7796_i8080_get_swap_xy, diff --git a/Drivers/st7796-module/source/module.cpp b/Drivers/st7796-module/source/module.cpp index 9322efb9b..70b9a2369 100644 --- a/Drivers/st7796-module/source/module.cpp +++ b/Drivers/st7796-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const st7796_drivers[] = { Module st7796_module = { .name = "st7796", - .drivers = st7796_drivers + .start = nullptr, + .stop = nullptr, + .drivers = st7796_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/st7796-module/source/st7796.cpp b/Drivers/st7796-module/source/st7796.cpp index e070bfb1d..f90036e93 100644 --- a/Drivers/st7796-module/source/st7796.cpp +++ b/Drivers/st7796-module/source/st7796.cpp @@ -83,8 +83,8 @@ static error_t start(Device* device) { } esp_lcd_panel_io_spi_config_t io_config = { - .cs_gpio_num = pin_or_unused(cs_pin), - .dc_gpio_num = pin_or_unused(config->pin_dc), + .cs_gpio_num = static_cast(pin_or_unused(cs_pin)), + .dc_gpio_num = static_cast(pin_or_unused(config->pin_dc)), .spi_mode = 0, .pclk_hz = config->pixel_clock_hz, .trans_queue_depth = config->transaction_queue_depth, @@ -101,6 +101,7 @@ static error_t start(Device* device) { .octal_mode = 0, .quad_mode = 0, .sio_mode = 1, + .psram_dma_direct = 0, .lsb_first = 0, .cs_high_active = 0, }, @@ -115,13 +116,13 @@ static error_t start(Device* device) { } esp_lcd_panel_dev_config_t panel_config = { - .reset_gpio_num = pin_or_unused(config->pin_reset), .rgb_ele_order = config->bgr_order ? LCD_RGB_ELEMENT_ORDER_BGR : LCD_RGB_ELEMENT_ORDER_RGB, .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE, .bits_per_pixel = config->bits_per_pixel, + .reset_gpio_num = static_cast(pin_or_unused(config->pin_reset)), + .vendor_config = nullptr, // ST7796's reset line is fixed active-low in hardware. .flags = { .reset_active_high = false }, - .vendor_config = nullptr, }; ret = esp_lcd_new_panel_st7796(internal->io_handle, &panel_config, &internal->panel_handle); @@ -362,6 +363,8 @@ static const DisplayApi st7796_display_api = { .reset = st7796_reset, .init = st7796_init, .draw_bitmap = st7796_draw_bitmap, + .clear = nullptr, + .refresh = nullptr, .mirror = st7796_mirror, .swap_xy = st7796_swap_xy, .get_swap_xy = st7796_get_swap_xy, diff --git a/Drivers/sx126x-module/source/module.cpp b/Drivers/sx126x-module/source/module.cpp index 72a11bf99..f359967d4 100644 --- a/Drivers/sx126x-module/source/module.cpp +++ b/Drivers/sx126x-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const sx126x_drivers[] = { Module sx126x_module = { .name = "sx126x", - .drivers = sx126x_drivers + .start = nullptr, + .stop = nullptr, + .drivers = sx126x_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/sy6970-module/source/module.cpp b/Drivers/sy6970-module/source/module.cpp index 770bcc0d4..2c1212f98 100644 --- a/Drivers/sy6970-module/source/module.cpp +++ b/Drivers/sy6970-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const sy6970_drivers[] = { Module sy6970_module = { .name = "sy6970", - .drivers = sy6970_drivers + .start = nullptr, + .stop = nullptr, + .drivers = sy6970_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/sy6970-module/source/sy6970.cpp b/Drivers/sy6970-module/source/sy6970.cpp index 84a935ae1..3e915f4ff 100644 --- a/Drivers/sy6970-module/source/sy6970.cpp +++ b/Drivers/sy6970-module/source/sy6970.cpp @@ -165,7 +165,7 @@ struct Sy6970Internal { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new (std::nothrow) Device { .address = 0, .name = "sy6970-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new (std::nothrow) Device { .address = 0, .name = "sy6970-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/tca8418-module/source/module.cpp b/Drivers/tca8418-module/source/module.cpp index 7ae1c09c4..e4cd348d7 100644 --- a/Drivers/tca8418-module/source/module.cpp +++ b/Drivers/tca8418-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const tca8418_drivers[] = { Module tca8418_module = { .name = "tca8418", - .drivers = tca8418_drivers + .start = nullptr, + .stop = nullptr, + .drivers = tca8418_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/tca9534-module/source/module.cpp b/Drivers/tca9534-module/source/module.cpp index 74cf0204b..dc12ddf17 100644 --- a/Drivers/tca9534-module/source/module.cpp +++ b/Drivers/tca9534-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const tca9534_drivers[] = { Module tca9534_module = { .name = "tca9534", - .drivers = tca9534_drivers + .start = nullptr, + .stop = nullptr, + .drivers = tca9534_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/tca95xx-16bit-module/source/module.cpp b/Drivers/tca95xx-16bit-module/source/module.cpp index 5c8d2b0d9..94b23678d 100644 --- a/Drivers/tca95xx-16bit-module/source/module.cpp +++ b/Drivers/tca95xx-16bit-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const tca95xx_drivers[] = { Module tca95xx_16bit_module = { .name = "tca95xx", - .drivers = tca95xx_drivers + .start = nullptr, + .stop = nullptr, + .drivers = tca95xx_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/xl9555-module/source/module.cpp b/Drivers/xl9555-module/source/module.cpp index a87b92bfb..9b50c9dfa 100644 --- a/Drivers/xl9555-module/source/module.cpp +++ b/Drivers/xl9555-module/source/module.cpp @@ -13,7 +13,11 @@ static Driver* const xl9555_drivers[] = { Module xl9555_module = { .name = "xl9555", - .drivers = xl9555_drivers + .start = nullptr, + .stop = nullptr, + .drivers = xl9555_drivers, + .symbols = nullptr, + .internal = nullptr }; } diff --git a/Drivers/xpt2046-module/source/module.cpp b/Drivers/xpt2046-module/source/module.cpp index 782d1a581..b8e758408 100644 --- a/Drivers/xpt2046-module/source/module.cpp +++ b/Drivers/xpt2046-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const xpt2046_drivers[] = { Module xpt2046_module = { .name = "xpt2046", - .drivers = xpt2046_drivers + .start = nullptr, + .stop = nullptr, + .drivers = xpt2046_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/xpt2046-module/source/xpt2046.cpp b/Drivers/xpt2046-module/source/xpt2046.cpp index 55f770acd..259491e81 100644 --- a/Drivers/xpt2046-module/source/xpt2046.cpp +++ b/Drivers/xpt2046-module/source/xpt2046.cpp @@ -122,7 +122,7 @@ Driver xpt2046_power_supply_driver = { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new(std::nothrow) Device { .address = 0, .name = "xpt2046-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new(std::nothrow) Device { .address = 0, .name = "xpt2046-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Drivers/xpt2046-softspi-module/source/module.cpp b/Drivers/xpt2046-softspi-module/source/module.cpp index 43ac4b845..e6d6b9c24 100644 --- a/Drivers/xpt2046-softspi-module/source/module.cpp +++ b/Drivers/xpt2046-softspi-module/source/module.cpp @@ -15,7 +15,11 @@ static Driver* const xpt2046_softspi_drivers[] = { Module xpt2046_softspi_module = { .name = "xpt2046_softspi", - .drivers = xpt2046_softspi_drivers + .start = nullptr, + .stop = nullptr, + .drivers = xpt2046_softspi_drivers, + .symbols = nullptr, + .internal = nullptr }; } // extern "C" diff --git a/Drivers/xpt2046-softspi-module/source/xpt2046_softspi.cpp b/Drivers/xpt2046-softspi-module/source/xpt2046_softspi.cpp index 17921f27b..e148e1d9b 100644 --- a/Drivers/xpt2046-softspi-module/source/xpt2046_softspi.cpp +++ b/Drivers/xpt2046-softspi-module/source/xpt2046_softspi.cpp @@ -250,7 +250,7 @@ Driver xpt2046_softspi_power_supply_driver = { }; static error_t create_power_supply_child(Device* parent, Device*& out_child) { - auto* child = new(std::nothrow) Device { .address = 0, .name = "xpt2046-softspi-power-supply", .config = nullptr, .parent = nullptr, .internal = nullptr }; + auto* child = new(std::nothrow) Device { .address = 0, .name = "xpt2046-softspi-power-supply", .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; if (child == nullptr) { return ERROR_OUT_OF_MEMORY; } diff --git a/Libraries/QRCode/src/qrcode.h b/Libraries/QRCode/src/qrcode.h index 6a5745e5d..e1c22c94a 100755 --- a/Libraries/QRCode/src/qrcode.h +++ b/Libraries/QRCode/src/qrcode.h @@ -37,7 +37,7 @@ #ifndef __QRCODE_H_ #define __QRCODE_H_ -#ifndef __cplusplus +#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L) typedef unsigned char bool; static const bool false = 0; static const bool true = 1; diff --git a/Libraries/mbedtls b/Libraries/mbedtls index daca7a397..0a8fda272 160000 --- a/Libraries/mbedtls +++ b/Libraries/mbedtls @@ -1 +1 @@ -Subproject commit daca7a3979c22da155ec9dce49ab1abf3b65d3a9 +Subproject commit 0a8fda272a5a0abef3b47c91bed37185d5a726b1 diff --git a/Modules/app-module/source/manager.cpp b/Modules/app-module/source/manager.cpp index f9766312b..a7f1ff8e4 100644 --- a/Modules/app-module/source/manager.cpp +++ b/Modules/app-module/source/manager.cpp @@ -84,7 +84,7 @@ error_t app_manager_add_package(const PackageManifest* package, const char* cons LOG_E(TAG, "Package with id '%s' is already registered", package->id); return ERROR_INVALID_ARGUMENT; } - AppPackageRecord record { .package = *package }; + AppPackageRecord record { .package = *package, .app_ids = {} }; record.app_ids.reserve(app_id_count); for (size_t i = 0; i < app_id_count; i++) { record.app_ids.emplace_back(app_ids[i]); @@ -324,7 +324,7 @@ void app_manager_install_path_scan(void) { mutex_lock(®istry.mutex); std::unordered_map known_packages; for (const auto& [id, record] : registry.scanned) { - KnownPackage known { .path = record->path }; + KnownPackage known { .path = record->path, .manifest_ids = {} }; for (const auto& manifest : record->manifests) { known.manifest_ids.emplace_back(manifest.id); } diff --git a/Modules/app-module/source/null_device.cpp b/Modules/app-module/source/null_device.cpp index de53d05af..2bcaaa4f2 100644 --- a/Modules/app-module/source/null_device.cpp +++ b/Modules/app-module/source/null_device.cpp @@ -30,6 +30,8 @@ const AppFileOps NULL_OPS = { .close = null_close, .await = null_await, .poll = null_poll, + .retain = nullptr, + .release = nullptr, }; constexpr AppFile NULL_FILE = { .ops = &NULL_OPS, .object = nullptr }; diff --git a/Modules/c-symbols-module/source/module.cpp b/Modules/c-symbols-module/source/module.cpp index e7b26ea0a..49f30246a 100644 --- a/Modules/c-symbols-module/source/module.cpp +++ b/Modules/c-symbols-module/source/module.cpp @@ -12,6 +12,14 @@ extern "C" { +#if CONFIG_IDF_TARGET_ESP32P4 +// Newlib doesn't provide this (only Picolibc does); a compat shim is force-linked into the +// firmware for espressif__esp_ipa's sake - see +// Platforms/platform-esp32/source/drivers/esp32p4_libc_compat.c. Side-loaded apps built against +// Newlib need it resolved the same way. +extern int __issignalingf(float); +#endif + static const ModuleSymbol SYMBOLS[] = { // stdlib.h DEFINE_MODULE_SYMBOL(malloc), @@ -61,6 +69,9 @@ static const ModuleSymbol SYMBOLS[] = { DEFINE_MODULE_SYMBOL(fmaxf), DEFINE_MODULE_SYMBOL(fminf), DEFINE_MODULE_SYMBOL(roundf), +#if CONFIG_IDF_TARGET_ESP32P4 + DEFINE_MODULE_SYMBOL(__issignalingf), +#endif // Explicit signatures: libstdc++/libc++'s float/double/long double overloads make a // bare `&acos` etc. ambiguous. esp-idf newlib's plain, unoverloaded functions match these signatures // exactly, so the cast is a no-op there - one list works for all platforms: diff --git a/Modules/cpp-symbols-module/README.md b/Modules/cpp-symbols-module/README.md index 6e1c333f4..252211a0a 100644 --- a/Modules/cpp-symbols-module/README.md +++ b/Modules/cpp-symbols-module/README.md @@ -44,8 +44,32 @@ Non-template helpers shared by every `std::map`/`std::set` instantiation: ### `std::string` -- `basic_string::_M_replace_cold` - the rarely-taken slow path of `std::string::replace`, - split out of the header-inlined fast path. +Most of the common out-of-line member set (this class ends up entirely out-of-line for any app +built at C++17 or earlier - see `extern template class basic_string` in libstdc++'s +`bits/basic_string.tcc`): + +- `_M_replace_cold`, `_M_replace`, `_M_mutate`, `_M_append`, `_M_erase`, `_M_assign`, + `_M_create`, `_M_dispose`, `_M_construct` +- `substr`, `find`, `reserve`, `append` (both overloads), `assign`, `push_back`, `pop_back`, + `operator=(basic_string&&)` +- `_S_copy`, `_S_move` (static helpers) +- Free functions returning `basic_string` by value: `__str_concat`, `operator+(basic_string + const&, const char*)` + +- `(basic_string const&, pos, len)` and `(const char*, allocator const&)` constructors - + implemented directly rather than exported by address (see below), since GCC doesn't emit a + standalone definition for either. + +**Not supported: the move constructor.** Like the two constructors above, GCC never emits a +standalone out-of-line definition for it in a C++20+ build - it's a pure header-inline forwarder +with no real function body to take the address of, even when this module's own code is made to +call it directly. If it turns out to be needed, implement it the same way as the other two: write +a small function whose body does the equivalent construction via placement-new (`new (self) +std::string(...)`), and register its address manually under the mangled name(s) in `SYMBOLS[]` +(the compiler inlines the real header logic into that function, producing a genuine addressable +symbol - the same trick used for `_M_replace_cold` and friends, except *we* supply the body +instead of pointing at one the library already provides). An app whose loaded ELF needs it will +still fail with `Can't find common ...C1.../...C2.../...C5...`. ## Adding a new symbol diff --git a/Modules/cpp-symbols-module/source/module.cpp b/Modules/cpp-symbols-module/source/module.cpp index 916f56d2a..03e9b3bd6 100644 --- a/Modules/cpp-symbols-module/source/module.cpp +++ b/Modules/cpp-symbols-module/source/module.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #if defined(__GLIBCXX__) || defined(ESP_PLATFORM) #define TT_CPP_SYMBOLS_AVAILABLE 1 @@ -42,8 +43,54 @@ extern "C" { #ifdef ESP_PLATFORM // string - same 32-bit-ABI mangling caveat as operator new/delete above. void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcjPKcjj(void*, char*, unsigned int, char const*, unsigned int, unsigned int); + void* _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEjj(void*, const void*, unsigned int, unsigned int); + char* _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj(void*, unsigned int*, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEj(void*, unsigned int); + unsigned int _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcj(const void*, char, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv(void*); + void* _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEjjPKcj(void*, unsigned int, unsigned int, const char*, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag(void*, const char*, const char*, char); + void* _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc(void*, const char*); + void* _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcj(void*, const char*, unsigned int); + void* _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKc(void*, const char*); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7_S_copyEPcPKcj(char*, const char*, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7_S_moveEPcPKcj(char*, const char*, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8_M_eraseEjj(void*, unsigned int, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8pop_backEv(void*); + void* _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcj(void*, const char*, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4_(void*, const void*); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEjjPKcj(void*, unsigned int, unsigned int, const char*, unsigned int); + void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(void*, char); + void* _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(void*, void*); + // Non-members: return basic_string by value, so the first param is the hidden + // return-value pointer (Itanium ABI), same convention as substr() above. + void* _ZSt12__str_concatINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_PKNS6_10value_typeENS6_9size_typeES9_SA_RKNS6_14allocator_typeE(void*, const char*, unsigned int, const char*, unsigned int, const void*); + void* _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(void*, const void*, const char*); #endif } + +#ifdef ESP_PLATFORM +namespace { +// basic_string(basic_string const&, pos, len) has no out-of-line definition anywhere to take the +// address of - unlike everything else above, GCC never emits one for this ctor under C++20+ (it's +// a pure header-inline forwarder around _M_construct(), confirmed by trying to force an +// instantiation and finding no resulting linkable symbol). Implemented directly instead: this +// function's placement-new triggers the compiler to inline the real construction logic here, +// producing a genuine addressable definition, registered below under the mangled name(s) the ELF +// loader actually looks up. +void construct_basic_string_from_substring(void* self, const void* str, unsigned int pos, unsigned int len) { + new (self) std::string(*static_cast(str), pos, len); +} +// Same story for basic_string(const char*, allocator const&). +void construct_basic_string_from_cstr(void* self, const char* s, const void* alloc) { + new (self) std::string(s, *static_cast*>(alloc)); +} +// Same story for the move constructor, basic_string(basic_string&&). +void construct_basic_string_move(void* self, void* other) { + new (self) std::string(std::move(*static_cast(other))); +} +} +#endif #endif static const ModuleSymbol SYMBOLS[] = { @@ -76,6 +123,37 @@ static const ModuleSymbol SYMBOLS[] = { #ifdef ESP_PLATFORM // string - Note: You have to use the mangled names here DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcjPKcjj), + DEFINE_MODULE_SYMBOL(_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEjj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEj), + DEFINE_MODULE_SYMBOL(_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEjjPKcj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKc), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7_S_copyEPcPKcj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7_S_moveEPcPKcj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8_M_eraseEjj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8pop_backEv), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4_), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEjjPKcj), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc), + DEFINE_MODULE_SYMBOL(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_), + // C1/C2/C5: complete-object, base-object, and comdat-folded aliases of the same constructor. + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_jj", (void*)&construct_basic_string_from_substring }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_jj", (void*)&construct_basic_string_from_substring }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5ERKS4_jj", (void*)&construct_basic_string_from_substring }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_", (void*)&construct_basic_string_from_cstr }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_", (void*)&construct_basic_string_from_cstr }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_", (void*)&construct_basic_string_from_cstr }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EOS4_", (void*)&construct_basic_string_move }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2EOS4_", (void*)&construct_basic_string_move }, + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5EOS4_", (void*)&construct_basic_string_move }, + DEFINE_MODULE_SYMBOL(_ZSt12__str_concatINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_PKNS6_10value_typeENS6_9size_typeES9_SA_RKNS6_14allocator_typeE), + DEFINE_MODULE_SYMBOL(_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_), #endif #endif // TT_CPP_SYMBOLS_AVAILABLE MODULE_SYMBOL_TERMINATOR diff --git a/Modules/crypt-module/CMakeLists.txt b/Modules/crypt-module/CMakeLists.txt index af2dbe1aa..8fd23775d 100644 --- a/Modules/crypt-module/CMakeLists.txt +++ b/Modules/crypt-module/CMakeLists.txt @@ -22,3 +22,7 @@ tactility_add_module(crypt-module INCLUDE_DIRS include/ REQUIRES ${REQUIRES_LIST} ) + +if (NOT DEFINED ENV{ESP_IDF_VERSION}) + target_include_directories(crypt-module PRIVATE "${CMAKE_CURRENT_LIST_DIR}/../../Libraries/mbedtls/tf-psa-crypto/drivers/builtin/include") +endif () diff --git a/Modules/crypt-module/source/crypt.cpp b/Modules/crypt-module/source/crypt.cpp index 8d63765fc..9ee477457 100644 --- a/Modules/crypt-module/source/crypt.cpp +++ b/Modules/crypt-module/source/crypt.cpp @@ -4,9 +4,14 @@ #include #include -#include +#ifdef ESP_PLATFORM +#include +#else +#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS +#include +#endif +#include #include -#include #include #include @@ -22,6 +27,9 @@ constexpr auto* TAG = "crypt"; #define TT_NVS_NAMESPACE "tt_secure" +constexpr int AES_MODE_ENCRYPT = 1; +constexpr int AES_MODE_DECRYPT = 0; + /** * Fills a buffer with cryptographically secure random bytes. * @param[out] out output buffer @@ -145,9 +153,20 @@ static void getKey(uint8_t key[32]) { #endif } +// psa_crypto_init() is safe to call more than once (subsequent calls are a cheap no-op); ESP-IDF +// calls it during startup already, but the simulator has no equivalent, so call it here too +// rather than depend on init order across callers. +static psa_status_t ensure_psa_crypto_init() { + return psa_crypto_init(); +} + void crypt_get_iv(const void* data, size_t dataLength, uint8_t iv[16]) { + check(ensure_psa_crypto_init() == PSA_SUCCESS); uint8_t hash[32]; - mbedtls_sha256(static_cast(data), dataLength, hash, 0); + size_t hash_length; + check(psa_hash_compute(PSA_ALG_SHA_256, static_cast(data), + dataLength, hash, sizeof(hash), &hash_length) == PSA_SUCCESS); + check(hash_length == sizeof(hash)); memcpy(iv, hash, 16); mbedtls_platform_zeroize(hash, sizeof(hash)); } @@ -170,15 +189,23 @@ static int aes256CryptCbc( return -1; // TODO: Proper error code from mbed lib? } +#ifdef ESP_PLATFORM + esp_aes_context master; + esp_aes_init(&master); + esp_aes_setkey(&master, key, 256); + int result = esp_aes_crypt_cbc(&master, mode, length, iv, input, output); + esp_aes_free(&master); +#else mbedtls_aes_context master; mbedtls_aes_init(&master); - if (mode == MBEDTLS_AES_ENCRYPT) { + if (mode == AES_MODE_ENCRYPT) { mbedtls_aes_setkey_enc(&master, key, 256); } else { mbedtls_aes_setkey_dec(&master, key, 256); } int result = mbedtls_aes_crypt_cbc(&master, mode, length, iv, input, output); mbedtls_aes_free(&master); +#endif return result; } @@ -190,7 +217,7 @@ int crypt_encrypt(const uint8_t iv[16], const uint8_t* inData, uint8_t* outData, uint8_t iv_copy[16]; memcpy(iv_copy, iv, sizeof(iv_copy)); - int result = aes256CryptCbc(key, MBEDTLS_AES_ENCRYPT, dataLength, iv_copy, inData, outData); + int result = aes256CryptCbc(key, AES_MODE_ENCRYPT, dataLength, iv_copy, inData, outData); mbedtls_platform_zeroize(key, sizeof(key)); mbedtls_platform_zeroize(iv_copy, sizeof(iv_copy)); return result; @@ -204,7 +231,7 @@ int crypt_decrypt(const uint8_t iv[16], const uint8_t* inData, uint8_t* outData, uint8_t iv_copy[16]; memcpy(iv_copy, iv, sizeof(iv_copy)); - int result = aes256CryptCbc(key, MBEDTLS_AES_DECRYPT, dataLength, iv_copy, inData, outData); + int result = aes256CryptCbc(key, AES_MODE_DECRYPT, dataLength, iv_copy, inData, outData); mbedtls_platform_zeroize(key, sizeof(key)); mbedtls_platform_zeroize(iv_copy, sizeof(iv_copy)); return result; diff --git a/Modules/http-module/source/download_esp.cpp b/Modules/http-module/source/download_esp.cpp index d18c11eb6..b69dda4fa 100644 --- a/Modules/http-module/source/download_esp.cpp +++ b/Modules/http-module/source/download_esp.cpp @@ -92,6 +92,7 @@ HttpDownloadEvent http_download_run(const std::string& url, const std::string& c config.method = HTTP_METHOD_GET; config.timeout_ms = 5000; config.transport_type = HTTP_TRANSPORT_OVER_SSL; + config.addr_type = HTTP_ADDR_TYPE_INET; // Total free can look fine while a fragmented heap still can't satisfy one large-enough // allocation. Logging both makes a future ALLOC_FAILED here diagnosable from the log alone. diff --git a/Modules/lvgl-module/source/devices/devices.cpp b/Modules/lvgl-module/source/devices/devices.cpp index cd18f78f6..3ecf5bd5f 100644 --- a/Modules/lvgl-module/source/devices/devices.cpp +++ b/Modules/lvgl-module/source/devices/devices.cpp @@ -98,7 +98,7 @@ void lvgl_devices_attach() { lv_disp_t* lvgl_display = NULL; bool display_updates_slowly = false; - struct LvglDeviceList display_devices = {0}; + struct LvglDeviceList display_devices = {}; device_for_each_of_type(&DISPLAY_TYPE, &display_devices, lvgl_device_list_collect); for (size_t i = 0; i < display_devices.count; i++) { struct Device* kernel_display_device = display_devices.devices[i]; @@ -126,6 +126,7 @@ void lvgl_devices_attach() { bool prefer_external_ram_buffer = display_has_capability(kernel_display_device, DISPLAY_CAPABILITY_PREFER_EXTERNAL_RAM); struct LvglDisplayConfig lvgl_display_config = { .buffer_height = (uint16_t)(vres > 10 ? vres / 10 : vres), + .double_buffer = false, .sw_rotate = !can_hw_rotate, .swap_bytes = swap_bytes, .force_full_frame = display_requires_full_frame, @@ -161,7 +162,7 @@ void lvgl_devices_attach() { } } - struct LvglDeviceList pointer_devices = {0}; + struct LvglDeviceList pointer_devices = {}; device_for_each_of_type(&POINTER_TYPE, &pointer_devices, lvgl_device_list_collect); for (size_t i = 0; i < pointer_devices.count; i++) { struct Device* kernel_pointer_device = pointer_devices.devices[i]; @@ -187,7 +188,7 @@ void lvgl_devices_attach() { } } - struct LvglDeviceList keyboard_devices = {0}; + struct LvglDeviceList keyboard_devices = {}; device_for_each_of_type(&KEYBOARD_TYPE, &keyboard_devices, lvgl_device_list_collect); for (size_t i = 0; i < keyboard_devices.count; i++) { struct Device* kernel_keyboard_device = keyboard_devices.devices[i]; diff --git a/Modules/mbedtls-module/source/module.cpp b/Modules/mbedtls-module/source/module.cpp index 2f275a688..a73117b05 100644 --- a/Modules/mbedtls-module/source/module.cpp +++ b/Modules/mbedtls-module/source/module.cpp @@ -1,42 +1,20 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include -#include -#include +// mbedTLS 4.x removed or privatized most legacy primitives with no public replacement (ctr_drbg, +// entropy, cipher, bignum, rsa, most of pk, ecp, ecdsa, ecdh - PSA Crypto is the sanctioned +// replacement now). True on both ESP-IDF's bundled mbedTLS and the simulator's vendored +// Libraries/mbedtls, now the same major version. Nothing in this repo consumes any of these +// symbols directly - this table is speculative ABI surface for side-loaded ELF apps - so it +// shrinks to what's still genuinely public: plain message-digest hashing and error strings. +// See ESP_IDF_6.1_BREAKING_CHANGES.md §6.1. #include -#include -#include -#include -#include -#include -#include #include extern "C" { static const ModuleSymbol SYMBOLS[] = { - // CTR_DRBG (random number generation) - DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_init), - DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_free), - DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_seed), - DEFINE_MODULE_SYMBOL(mbedtls_ctr_drbg_random), - // Entropy - DEFINE_MODULE_SYMBOL(mbedtls_entropy_init), - DEFINE_MODULE_SYMBOL(mbedtls_entropy_free), - DEFINE_MODULE_SYMBOL(mbedtls_entropy_func), - // Cipher - DEFINE_MODULE_SYMBOL(mbedtls_cipher_init), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_free), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_setup), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_setkey), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_set_iv), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_reset), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_update), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_finish), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_get_block_size), - DEFINE_MODULE_SYMBOL(mbedtls_cipher_info_from_type), - // Message digest / HMAC + // Message digest DEFINE_MODULE_SYMBOL(mbedtls_md), DEFINE_MODULE_SYMBOL(mbedtls_md_init), DEFINE_MODULE_SYMBOL(mbedtls_md_free), @@ -44,54 +22,7 @@ static const ModuleSymbol SYMBOLS[] = { DEFINE_MODULE_SYMBOL(mbedtls_md_starts), DEFINE_MODULE_SYMBOL(mbedtls_md_update), DEFINE_MODULE_SYMBOL(mbedtls_md_finish), - DEFINE_MODULE_SYMBOL(mbedtls_md_hmac_starts), - DEFINE_MODULE_SYMBOL(mbedtls_md_hmac_update), - DEFINE_MODULE_SYMBOL(mbedtls_md_hmac_finish), DEFINE_MODULE_SYMBOL(mbedtls_md_info_from_type), - // Bignum (MPI) - DEFINE_MODULE_SYMBOL(mbedtls_mpi_init), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_free), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_read_binary), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_write_binary), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_size), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_bitlen), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_lset), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_set_bit), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_fill_random), - DEFINE_MODULE_SYMBOL(mbedtls_mpi_exp_mod), - // RSA - DEFINE_MODULE_SYMBOL(mbedtls_rsa_init), - DEFINE_MODULE_SYMBOL(mbedtls_rsa_free), - DEFINE_MODULE_SYMBOL(mbedtls_rsa_copy), - DEFINE_MODULE_SYMBOL(mbedtls_rsa_get_len), - DEFINE_MODULE_SYMBOL(mbedtls_rsa_check_pubkey), - DEFINE_MODULE_SYMBOL(mbedtls_rsa_check_privkey), - DEFINE_MODULE_SYMBOL(mbedtls_rsa_pkcs1_sign), - DEFINE_MODULE_SYMBOL(mbedtls_rsa_pkcs1_verify), - // Public key abstraction - DEFINE_MODULE_SYMBOL(mbedtls_pk_init), - DEFINE_MODULE_SYMBOL(mbedtls_pk_free), - DEFINE_MODULE_SYMBOL(mbedtls_pk_get_type), - DEFINE_MODULE_SYMBOL(mbedtls_pk_parse_key), - DEFINE_MODULE_SYMBOL(mbedtls_pk_parse_keyfile), - // ECP (elliptic curves) - DEFINE_MODULE_SYMBOL(mbedtls_ecp_group_load), - DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_init), - DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_free), - DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_read_binary), - DEFINE_MODULE_SYMBOL(mbedtls_ecp_point_write_binary), - DEFINE_MODULE_SYMBOL(mbedtls_ecp_check_pubkey), - DEFINE_MODULE_SYMBOL(mbedtls_ecp_check_privkey), - DEFINE_MODULE_SYMBOL(mbedtls_ecp_mul), - // ECDSA - DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_init), - DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_free), - DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_genkey), - DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_from_keypair), - DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_sign), - DEFINE_MODULE_SYMBOL(mbedtls_ecdsa_verify), - // ECDH - DEFINE_MODULE_SYMBOL(mbedtls_ecdh_compute_shared), // Error strings DEFINE_MODULE_SYMBOL(mbedtls_strerror), MODULE_SYMBOL_TERMINATOR, diff --git a/Platforms/platform-esp32/CMakeLists.txt b/Platforms/platform-esp32/CMakeLists.txt index 5fa0a61cd..8ff671567 100644 --- a/Platforms/platform-esp32/CMakeLists.txt +++ b/Platforms/platform-esp32/CMakeLists.txt @@ -16,7 +16,7 @@ idf_component_register( SRCS ${SOURCES} INCLUDE_DIRS "include/" PRIV_INCLUDE_DIRS "private/" - REQUIRES TactilityKernel TactilityKernelCpp driver esp_adc esp_driver_i2c esp_lcd vfs fatfs esp_wifi esp_netif esp_event + REQUIRES TactilityKernel TactilityKernelCpp driver esp_adc esp_driver_i2c esp_driver_i2s esp_driver_ledc esp_driver_uart esp_lcd vfs fatfs esp_wifi esp_netif esp_event PRIV_REQUIRES ${PRIV_REQUIRES_LIST} ) @@ -29,3 +29,10 @@ if (DEFINED ENV{ESP_IDF_VERSION}) endif () idf_component_optional_requires(PRIVATE bt usb espressif__usb_host_hid espressif__usb_host_msc) + +if ("${IDF_TARGET}" STREQUAL "esp32p4") + # Force-links esp32p4_libc_compat.c's __issignalingf() shim - nothing references it until + # espressif__esp_ipa is scanned much later in link order, by which point this archive is + # already passed over. + target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,-u,__issignalingf") +endif () diff --git a/Platforms/platform-esp32/bindings/espressif,esp32-i2c.yaml b/Platforms/platform-esp32/bindings/espressif,esp32-i2c.yaml deleted file mode 100644 index 8e49df801..000000000 --- a/Platforms/platform-esp32/bindings/espressif,esp32-i2c.yaml +++ /dev/null @@ -1,23 +0,0 @@ -description: ESP32 I2C Controller - -include: ["i2c-controller.yaml"] - -compatible: "espressif,esp32-i2c" - -properties: - port: - type: int - required: true - description: | - The port number, defined by i2c_port_t. - Depending on the hardware, these values are available: I2C_NUM_0, I2C_NUM_1 - clock-frequency: - type: int - required: true - description: Initial clock frequency in Hz - pin-sda: - type: phandles - required: true - pin-scl: - type: phandles - required: true diff --git a/Platforms/platform-esp32/include/tactility/bindings/esp32_i2c.h b/Platforms/platform-esp32/include/tactility/bindings/esp32_i2c.h deleted file mode 100644 index 16f1e59b3..000000000 --- a/Platforms/platform-esp32/include/tactility/bindings/esp32_i2c.h +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -DEFINE_DEVICETREE(esp32_i2c, struct Esp32I2cConfig) - -#ifdef __cplusplus -} -#endif diff --git a/Platforms/platform-esp32/include/tactility/drivers/esp32_esp_hosted_ota.h b/Platforms/platform-esp32/include/tactility/drivers/esp32_esp_hosted_ota.h index 1908d4dd4..69c16597b 100644 --- a/Platforms/platform-esp32/include/tactility/drivers/esp32_esp_hosted_ota.h +++ b/Platforms/platform-esp32/include/tactility/drivers/esp32_esp_hosted_ota.h @@ -3,5 +3,5 @@ struct FirmwareOps; /** @return the esp_hosted co-processor FirmwareOps implementation. Only declared/linked when - * CONFIG_SLAVE_SOC_WIFI_SUPPORTED - callers (esp32_wifi.cpp) must guard with the same #if. */ + * CONFIG_ESP_HOSTED_ENABLED - callers (esp32_wifi.cpp) must guard with the same #if. */ const FirmwareOps* esp32_esp_hosted_ota_get_ops(); diff --git a/Platforms/platform-esp32/include/tactility/drivers/esp32_i2c.h b/Platforms/platform-esp32/include/tactility/drivers/esp32_i2c.h deleted file mode 100644 index 364198b19..000000000 --- a/Platforms/platform-esp32/include/tactility/drivers/esp32_i2c.h +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct Esp32I2cConfig { - i2c_port_t port; - uint32_t clockFrequency; - struct GpioPinSpec pinSda; - struct GpioPinSpec pinScl; -}; - -#ifdef __cplusplus -} -#endif diff --git a/Platforms/platform-esp32/include/tactility/drivers/esp32_i2s.h b/Platforms/platform-esp32/include/tactility/drivers/esp32_i2s.h index e72d0e5fa..3abfeb3cf 100644 --- a/Platforms/platform-esp32/include/tactility/drivers/esp32_i2s.h +++ b/Platforms/platform-esp32/include/tactility/drivers/esp32_i2s.h @@ -10,7 +10,7 @@ extern "C" { #endif struct Esp32I2sConfig { - i2s_port_t port; + int port; struct GpioPinSpec pin_bclk; struct GpioPinSpec pin_ws; struct GpioPinSpec pin_data_out; diff --git a/Platforms/platform-esp32/include/tactility/drivers/esp32_wifi_radio.h b/Platforms/platform-esp32/include/tactility/drivers/esp32_wifi_radio.h new file mode 100644 index 000000000..7a658e0e7 --- /dev/null +++ b/Platforms/platform-esp32/include/tactility/drivers/esp32_wifi_radio.h @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: Apache-2.0 +#pragma once + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Shared ownership over the single ESP32 WiFi radio's esp_wifi_init()/esp_wifi_start() lifecycle. + * Station mode (esp32_wifi driver) and the WebServer's Access Point mode both need the radio and + * must not blindly call esp_wifi_init()/esp_wifi_deinit() themselves - doing so unconditionally + * breaks whichever owner got there second (failing outright with ESP_ERR_INVALID_STATE, or having + * its radio torn out from under it when the other side releases). Callers acquire the mode bit they + * need (WIFI_MODE_STA or WIFI_MODE_AP); the radio is brought up on the first acquire (merging into + * WIFI_MODE_APSTA if another owner is already active) and only torn down once every owner has + * released. + * + * @param mode_bit WIFI_MODE_STA or WIFI_MODE_AP (not WIFI_MODE_APSTA/WIFI_MODE_NULL). + * @retval true the mode bit is now active (radio is initialized, started, and its current mode + * includes mode_bit) - the caller may proceed to configure and use its interface. + * @retval false failed to bring up or merge into the requested mode; the radio's state is + * unchanged from before this call. + */ +bool esp32_wifi_radio_acquire(wifi_mode_t mode_bit); + +/** + * Releases a previously-acquired mode bit. If this was the last owner (resulting mode would be + * WIFI_MODE_NULL), fully stops and deinitializes the radio; otherwise just drops that bit from the + * active mode, leaving the radio running for the remaining owner. + * + * @warning Must be called with the same mode_bit passed to a prior successful acquire() - never + * call this after a failed acquire(). + */ +void esp32_wifi_radio_release(wifi_mode_t mode_bit); + +#ifdef __cplusplus +} +#endif diff --git a/Platforms/platform-esp32/source/drivers/bluetooth/esp32_ble.cpp b/Platforms/platform-esp32/source/drivers/bluetooth/esp32_ble.cpp index 8a30aa86a..91ca4863b 100644 --- a/Platforms/platform-esp32/source/drivers/bluetooth/esp32_ble.cpp +++ b/Platforms/platform-esp32/source/drivers/bluetooth/esp32_ble.cpp @@ -31,9 +31,6 @@ constexpr auto* TAG = "esp32_ble"; #if defined(CONFIG_ESP_HOSTED_ENABLED) #include -// esp_hosted_misc.h lacks its own extern "C" guard, so its declarations get C++ -// name-mangled when included from a .cpp file, causing "undefined reference" at -// link time against the library's plain-C symbols. extern "C" { #include } @@ -685,19 +682,6 @@ static void dispatch_enable(BleCtx* ctx) { } #if defined(CONFIG_ESP_HOSTED_ENABLED) - // Over esp_hosted (SDIO to a co-processor, e.g. C6), the slave's on-chip BT - // controller is never auto-started at slave boot — it only comes up in - // response to these RPCs. Without them, HCI Reset (the first command NimBLE - // ever sends) is handed to esp_vhci_host_send_packet() on the slave with no - // controller underneath to consume it, so it's silently dropped and NimBLE - // times out (BLE_HS_ETIMEOUT_HCI) forever. Must run before nimble_port_init(). - // esp_hosted_bt_controller_init/enable() both bail out immediately (no retry, - // no blocking) if the SDIO/SPI transport to the co-processor isn't marked up - // yet. On boot, BT can auto-enable before Wi-Fi has driven that bring-up, so - // explicitly (re)connect here and let it block until the slave handshake - // (the "Attempt connection with slave" / "Card init success" sequence) - // completes — esp_hosted_connect_to_slave() is a thin wrapper that's safe to - // call again if the transport is already up. if (esp_hosted_connect_to_slave() != ESP_OK) { LOG_W(TAG, "esp_hosted_connect_to_slave failed"); } @@ -1121,7 +1105,7 @@ const BluetoothApi nimble_bluetooth_api = { static void create_child_device(struct Device* parent, const char* name, Driver* drv, struct Device*& out) { - out = new Device { .address = 0, .name = name, .config = nullptr, .parent = nullptr, .internal = nullptr }; + out = new Device { .address = 0, .name = name, .config = nullptr, .parent = nullptr, .flags = 0, .internal = nullptr }; device_construct(out); device_set_parent(out, parent); device_set_driver(out, drv); diff --git a/Platforms/platform-esp32/source/drivers/esp32_esp_hosted_ota.cpp b/Platforms/platform-esp32/source/drivers/esp32_esp_hosted_ota.cpp index 69fd6eceb..bc0aed392 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_esp_hosted_ota.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_esp_hosted_ota.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -251,4 +251,4 @@ const FirmwareOps* esp32_esp_hosted_ota_get_ops() { return &firmwareOps; } -#endif // CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_ESP_HOSTED_ENABLED diff --git a/Platforms/platform-esp32/source/drivers/esp32_grove.cpp b/Platforms/platform-esp32/source/drivers/esp32_grove.cpp index 515296784..edb7955b3 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_grove.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_grove.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include diff --git a/Platforms/platform-esp32/source/drivers/esp32_i2c.cpp b/Platforms/platform-esp32/source/drivers/esp32_i2c.cpp deleted file mode 100644 index fd328e477..000000000 --- a/Platforms/platform-esp32/source/drivers/esp32_i2c.cpp +++ /dev/null @@ -1,258 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#define TAG "esp32_i2c" -#define ACK_CHECK_EN 1 - -struct Esp32I2cInternal { - Mutex mutex {}; - GpioDescriptor* sda_descriptor = nullptr; - GpioDescriptor* scl_descriptor = nullptr; - - Esp32I2cInternal(GpioDescriptor* sda_descriptor, GpioDescriptor* scl_descriptor) : - sda_descriptor(sda_descriptor), - scl_descriptor(scl_descriptor) - { - mutex_construct(&mutex); - } - - ~Esp32I2cInternal() { - mutex_destruct(&mutex); - } -}; - -#define GET_CONFIG(device) ((Esp32I2cConfig*)device->config) -#define GET_DATA(device) ((Esp32I2cInternal*)device_get_driver_data(device)) - -#define lock(data) mutex_lock(&data->mutex); -#define unlock(data) mutex_unlock(&data->mutex); - -extern "C" { - -static error_t read(Device* device, uint8_t address, uint8_t* data, size_t data_size, TickType_t timeout) { - if (xPortInIsrContext()) return ERROR_ISR_STATUS; - if (data_size == 0) return ERROR_INVALID_ARGUMENT; - auto* driver_data = GET_DATA(device); - lock(driver_data); - const esp_err_t esp_error = i2c_master_read_from_device(GET_CONFIG(device)->port, address, data, data_size, timeout); - unlock(driver_data); - return esp_err_to_error(esp_error); -} - -static error_t write(Device* device, uint8_t address, const uint8_t* data, uint16_t data_size, TickType_t timeout) { - if (xPortInIsrContext()) return ERROR_ISR_STATUS; - if (data_size == 0) return ERROR_INVALID_ARGUMENT; - auto* driver_data = GET_DATA(device); - lock(driver_data); - const esp_err_t esp_error = i2c_master_write_to_device(GET_CONFIG(device)->port, address, data, data_size, timeout); - unlock(driver_data); - return esp_err_to_error(esp_error); -} - -static error_t write_read(Device* device, uint8_t address, const uint8_t* write_data, size_t write_data_size, uint8_t* read_data, size_t read_data_size, TickType_t timeout) { - if (xPortInIsrContext()) return ERROR_ISR_STATUS; - if (write_data_size == 0 || read_data_size == 0) return ERROR_INVALID_ARGUMENT; - auto* driver_data = GET_DATA(device); - lock(driver_data); - const esp_err_t esp_error = i2c_master_write_read_device(GET_CONFIG(device)->port, address, write_data, write_data_size, read_data, read_data_size, timeout); - unlock(driver_data); - return esp_err_to_error(esp_error); -} - -static error_t read_register(Device* device, uint8_t address, uint8_t reg, uint8_t* data, size_t data_size, TickType_t timeout) { - auto start_time = get_ticks(); - if (xPortInIsrContext()) return ERROR_ISR_STATUS; - if (data_size == 0) return ERROR_INVALID_ARGUMENT; - auto* driver_data = GET_DATA(device); - - lock(driver_data); - i2c_cmd_handle_t cmd = i2c_cmd_link_create(); - esp_err_t error = ESP_OK; - if (cmd == nullptr) { - error = ESP_ERR_NO_MEM; - goto on_error; - } - // Set address pointer - error = i2c_master_start(cmd); - if (error != ESP_OK) goto on_error; - error = i2c_master_write_byte(cmd, (address << 1) | I2C_MASTER_WRITE, ACK_CHECK_EN); - if (error != ESP_OK) goto on_error; - error = i2c_master_write(cmd, ®, 1, ACK_CHECK_EN); - if (error != ESP_OK) goto on_error; - // Read length of response from current pointer - error = i2c_master_start(cmd); - if (error != ESP_OK) goto on_error; - error = i2c_master_write_byte(cmd, (address << 1) | I2C_MASTER_READ, ACK_CHECK_EN); - if (error != ESP_OK) goto on_error; - if (data_size > 1) { - error = i2c_master_read(cmd, data, data_size - 1, I2C_MASTER_ACK); - if (error != ESP_OK) goto on_error; - } - error = i2c_master_read_byte(cmd, data + data_size - 1, I2C_MASTER_NACK); - if (error != ESP_OK) goto on_error; - error = i2c_master_stop(cmd); - if (error != ESP_OK) goto on_error; - error = i2c_master_cmd_begin(GET_CONFIG(device)->port, cmd, get_timeout_remaining_ticks(timeout, start_time)); - if (error != ESP_OK) goto on_error; - - i2c_cmd_link_delete(cmd); - unlock(driver_data); - return esp_err_to_error(error); - -on_error: - i2c_cmd_link_delete(cmd); - unlock(driver_data); - return esp_err_to_error(error); -} - -static error_t write_register(Device* device, uint8_t address, uint8_t reg, const uint8_t* data, uint16_t data_size, TickType_t timeout) { - auto start_time = get_ticks(); - if (xPortInIsrContext()) return ERROR_ISR_STATUS; - if (data_size == 0) return ERROR_INVALID_ARGUMENT; - auto* driver_data = GET_DATA(device); - - lock(driver_data); - i2c_cmd_handle_t cmd = i2c_cmd_link_create(); - esp_err_t error = ESP_OK; - if (cmd == nullptr) { - error = ESP_ERR_NO_MEM; - goto on_error; - } - error = i2c_master_start(cmd); - if (error != ESP_OK) goto on_error; - error = i2c_master_write_byte(cmd, (address << 1) | I2C_MASTER_WRITE, ACK_CHECK_EN); - if (error != ESP_OK) goto on_error; - error = i2c_master_write_byte(cmd, reg, ACK_CHECK_EN); - if (error != ESP_OK) goto on_error; - error = i2c_master_write(cmd, (uint8_t*) data, data_size, ACK_CHECK_EN); - if (error != ESP_OK) goto on_error; - error = i2c_master_stop(cmd); - if (error != ESP_OK) goto on_error; - error = i2c_master_cmd_begin(GET_CONFIG(device)->port, cmd, get_timeout_remaining_ticks(timeout, start_time)); - if (error != ESP_OK) goto on_error; - - i2c_cmd_link_delete(cmd); - unlock(driver_data); - return esp_err_to_error(error); - -on_error: - i2c_cmd_link_delete(cmd); - unlock(driver_data); - return esp_err_to_error(error); -} - - -static error_t start(Device* device) { - ESP_LOGI(TAG, "start %s", device->name); - auto dts_config = GET_CONFIG(device); - - auto& sda_spec = dts_config->pinSda; - auto* sda_descriptor = gpio_descriptor_acquire(sda_spec.gpio_controller, sda_spec.pin, sda_spec.flags | GPIO_FLAG_DIRECTION_INPUT_OUTPUT, GPIO_OWNER_GPIO); - if (!sda_descriptor) { - LOG_E(TAG, "Failed to acquire pin %u", sda_spec.pin); - return ERROR_RESOURCE; - } - - auto& scl_spec = dts_config->pinScl; - auto* scl_descriptor = gpio_descriptor_acquire(scl_spec.gpio_controller, scl_spec.pin, scl_spec.flags | GPIO_FLAG_DIRECTION_OUTPUT, GPIO_OWNER_GPIO); - if (!scl_descriptor) { - LOG_E(TAG, "Failed to acquire pin %u", scl_spec.pin); - gpio_descriptor_release(sda_descriptor); - return ERROR_RESOURCE; - } - - gpio_num_t sda_pin, scl_pin; - check(gpio_descriptor_get_native_pin_number(sda_descriptor, &sda_pin) == ERROR_NONE); - check(gpio_descriptor_get_native_pin_number(scl_descriptor, &scl_pin) == ERROR_NONE); - - i2c_config_t esp_config = { - .mode = I2C_MODE_MASTER, - .sda_io_num = sda_pin, - .scl_io_num = scl_pin, - .sda_pullup_en = (sda_spec.flags & GPIO_FLAG_PULL_UP) != 0, - .scl_pullup_en = (scl_spec.flags & GPIO_FLAG_PULL_UP) != 0, - .master { - .clk_speed = dts_config->clockFrequency - }, - .clk_flags = 0 - }; - - esp_err_t error = i2c_param_config(dts_config->port, &esp_config); - if (error != ESP_OK) { - LOG_E(TAG, "Failed to configure port %d: %s", static_cast(dts_config->port), esp_err_to_name(error)); - check(gpio_descriptor_release(sda_descriptor) == ERROR_NONE); - check(gpio_descriptor_release(scl_descriptor) == ERROR_NONE); - return ERROR_RESOURCE; - } - - error = i2c_driver_install(dts_config->port, esp_config.mode, 0, 0, 0); - if (error != ESP_OK) { - LOG_E(TAG, "Failed to install driver at port %d: %s", static_cast(dts_config->port), esp_err_to_name(error)); - check(gpio_descriptor_release(sda_descriptor) == ERROR_NONE); - check(gpio_descriptor_release(scl_descriptor) == ERROR_NONE); - return ERROR_RESOURCE; - } - - auto* data = new(std::nothrow) Esp32I2cInternal(sda_descriptor, scl_descriptor); - if (data == nullptr) { - check(gpio_descriptor_release(sda_descriptor) == ERROR_NONE); - check(gpio_descriptor_release(scl_descriptor) == ERROR_NONE); - return ERROR_OUT_OF_MEMORY; - } - - device_set_driver_data(device, data); - return ERROR_NONE; -} - -static error_t stop(Device* device) { - ESP_LOGI(TAG, "stop %s", device->name); - auto* driver_data = static_cast(device_get_driver_data(device)); - - i2c_port_t port = GET_CONFIG(device)->port; - esp_err_t result = i2c_driver_delete(port); - if (result != ESP_OK) { - LOG_E(TAG, "Failed to delete driver at port %d: %s", static_cast(port), esp_err_to_name(result)); - return ERROR_RESOURCE; - } - - check(gpio_descriptor_release(driver_data->sda_descriptor) == ERROR_NONE); - check(gpio_descriptor_release(driver_data->scl_descriptor) == ERROR_NONE); - - device_set_driver_data(device, nullptr); - delete driver_data; - return ERROR_NONE; -} - -static constexpr I2cControllerApi ESP32_I2C_API = { - .read = read, - .write = write, - .write_read = write_read, - .read_register = read_register, - .write_register = write_register, - .probe = nullptr -}; - -extern Module platform_esp32_module; - -Driver esp32_i2c_driver = { - .name = "esp32_i2c", - .compatible = (const char*[]) { "espressif,esp32-i2c", nullptr }, - .start_device = start, - .stop_device = stop, - .api = &ESP32_I2C_API, - .device_type = &I2C_CONTROLLER_TYPE, - .owner = &platform_esp32_module, - .internal = nullptr -}; - -} // extern "C" diff --git a/Platforms/platform-esp32/source/drivers/esp32_i8080.cpp b/Platforms/platform-esp32/source/drivers/esp32_i8080.cpp index 4ec072d6d..d49f597fe 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_i8080.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_i8080.cpp @@ -110,8 +110,8 @@ static error_t start(Device* device) { }, .bus_width = 8, .max_transfer_bytes = static_cast(config->max_transfer_bytes), - .psram_trans_align = 64, - .sram_trans_align = 4 + .dma_burst_size = 64, + .flags = { .allow_pd = 0 }, }; esp_err_t ret = esp_lcd_new_i80_bus(&bus_cfg, &data->bus_handle); diff --git a/Platforms/platform-esp32/source/drivers/esp32_pwm_ledc.cpp b/Platforms/platform-esp32/source/drivers/esp32_pwm_ledc.cpp index 0c55e0aa1..437ccd752 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_pwm_ledc.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_pwm_ledc.cpp @@ -97,6 +97,7 @@ static error_t apply_channel(Device* device) { .flags = { .output_invert = internal->inverted ? 1u : 0u, }, + .deconfigure = false, }; if (ledc_channel_config(&channel_config) != ESP_OK) { LOG_E(TAG, "Failed to configure LEDC channel"); diff --git a/Platforms/platform-esp32/source/drivers/esp32_spi.cpp b/Platforms/platform-esp32/source/drivers/esp32_spi.cpp index 032aab270..82445bd2d 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_spi.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_spi.cpp @@ -112,6 +112,7 @@ static error_t start(Device* device) { .data7_io_num = GPIO_NUM_NC, .data_io_default_level = false, .max_transfer_sz = dts_config->max_transfer_size, + .dma_burst_size = 0, .flags = 0, .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, .intr_flags = 0 diff --git a/Platforms/platform-esp32/source/drivers/esp32_uart.cpp b/Platforms/platform-esp32/source/drivers/esp32_uart.cpp index 56bba1a45..b4905a364 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_uart.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_uart.cpp @@ -263,6 +263,7 @@ static error_t open(Device* device) { .stop_bits = to_esp32_stop_bits(driver_data->config.stop_bits), .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, // Flow control is not yet exposed via UartConfig .rx_flow_ctrl_thresh = 0, + .rx_glitch_filt_thresh = 0, .source_clk = UART_SCLK_DEFAULT, .flags = { .allow_pd = 0, diff --git a/Platforms/platform-esp32/source/drivers/esp32_wifi.cpp b/Platforms/platform-esp32/source/drivers/esp32_wifi.cpp index 248bfa69a..cd6e25e44 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_wifi.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_wifi.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -20,7 +21,7 @@ #include -#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_ESP_HOSTED_ENABLED) #include #endif @@ -68,6 +69,14 @@ struct Esp32WifiCtx { #define GET_CTX(device) (static_cast(device_get_driver_data(device))) +// Shared radio ownership state for esp32_wifi_radio_acquire()/release() (see esp32_wifi_radio.h). +// Station mode (this driver) and the WebServer's Access Point mode both acquire/release their own +// mode bit rather than calling esp_wifi_init()/deinit() directly, so neither tears down the radio +// out from under the other. +Mutex g_radioMutex{}; +int g_radioOwnerCount = 0; +wifi_mode_t g_radioMode = WIFI_MODE_NULL; + WifiAuthenticationType to_wifi_authentication_type(wifi_auth_mode_t mode) { switch (mode) { case WIFI_AUTH_OPEN: return WIFI_AUTHENTICATION_TYPE_OPEN; @@ -81,8 +90,6 @@ WifiAuthenticationType to_wifi_authentication_type(wifi_auth_mode_t mode) { case WIFI_AUTH_WAPI_PSK: return WIFI_AUTHENTICATION_TYPE_WAPI_PSK; case WIFI_AUTH_OWE: return WIFI_AUTHENTICATION_TYPE_OWE; case WIFI_AUTH_WPA3_ENT_192: return WIFI_AUTHENTICATION_TYPE_WPA3_ENT_192; - case WIFI_AUTH_WPA3_EXT_PSK: return WIFI_AUTHENTICATION_TYPE_WPA3_EXT_PSK; - case WIFI_AUTH_WPA3_EXT_PSK_MIXED_MODE: return WIFI_AUTHENTICATION_TYPE_WPA3_EXT_PSK_MIXED_MODE; default: return WIFI_AUTHENTICATION_TYPE_OPEN; } } @@ -192,21 +199,19 @@ error_t bring_up_wifi(Esp32WifiCtx* ctx) { // Warning: this is the memory-intensive operation. It uses over 100kB of // RAM with default settings. - wifi_init_config_t init_config = WIFI_INIT_CONFIG_DEFAULT(); - esp_err_t err = esp_wifi_init(&init_config); - if (err != ESP_OK) { - LOG_E(TAG, "esp_wifi_init failed: %s", esp_err_to_name(err)); + if (!esp32_wifi_radio_acquire(WIFI_MODE_STA)) { + LOG_E(TAG, "Failed to acquire WiFi radio for station mode"); esp_netif_destroy(ctx->netif); ctx->netif = nullptr; - return esp_err_to_error(err); + return ERROR_RESOURCE; } esp_wifi_set_storage(WIFI_STORAGE_RAM); - err = esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &on_wifi_or_ip_event, ctx, &ctx->wifiEventHandler); + esp_err_t err = esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &on_wifi_or_ip_event, ctx, &ctx->wifiEventHandler); if (err != ESP_OK) { LOG_E(TAG, "Failed to register WIFI_EVENT handler: %s", esp_err_to_name(err)); - esp_wifi_deinit(); + esp32_wifi_radio_release(WIFI_MODE_STA); esp_netif_destroy(ctx->netif); ctx->netif = nullptr; return esp_err_to_error(err); @@ -217,34 +222,7 @@ error_t bring_up_wifi(Esp32WifiCtx* ctx) { LOG_E(TAG, "Failed to register IP_EVENT handler: %s", esp_err_to_name(err)); esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, ctx->wifiEventHandler); ctx->wifiEventHandler = nullptr; - esp_wifi_deinit(); - esp_netif_destroy(ctx->netif); - ctx->netif = nullptr; - return esp_err_to_error(err); - } - - err = esp_wifi_set_mode(WIFI_MODE_STA); - if (err != ESP_OK) { - LOG_E(TAG, "esp_wifi_set_mode failed: %s", esp_err_to_name(err)); - esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, ctx->ipEventHandler); - esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, ctx->wifiEventHandler); - ctx->ipEventHandler = nullptr; - ctx->wifiEventHandler = nullptr; - esp_wifi_deinit(); - esp_netif_destroy(ctx->netif); - ctx->netif = nullptr; - return esp_err_to_error(err); - } - - err = esp_wifi_start(); - if (err != ESP_OK) { - LOG_E(TAG, "esp_wifi_start failed: %s", esp_err_to_name(err)); - esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, ctx->ipEventHandler); - esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, ctx->wifiEventHandler); - ctx->ipEventHandler = nullptr; - ctx->wifiEventHandler = nullptr; - esp_wifi_set_mode(WIFI_MODE_NULL); - esp_wifi_deinit(); + esp32_wifi_radio_release(WIFI_MODE_STA); esp_netif_destroy(ctx->netif); ctx->netif = nullptr; return esp_err_to_error(err); @@ -285,9 +263,6 @@ void bring_down_wifi(Esp32WifiCtx* ctx) { esp_wifi_clear_default_wifi_driver_and_handlers(ctx->netif); } - esp_wifi_stop(); - esp_wifi_set_mode(WIFI_MODE_NULL); - if (ctx->wifiEventHandler != nullptr) { esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, ctx->wifiEventHandler); ctx->wifiEventHandler = nullptr; @@ -297,7 +272,7 @@ void bring_down_wifi(Esp32WifiCtx* ctx) { ctx->ipEventHandler = nullptr; } - esp_wifi_deinit(); + esp32_wifi_radio_release(WIFI_MODE_STA); if (ctx->netif != nullptr) { esp_netif_destroy(ctx->netif); @@ -585,7 +560,7 @@ error_t api_get_firmware_ops(Device* /*device*/, const FirmwareOps** ops, void** if (ops == nullptr || ctx == nullptr) { return ERROR_INVALID_ARGUMENT; } -#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_ESP_HOSTED_ENABLED) // Only meaningful on a hosted board (P4+C6/C5 etc.) - this wifi device is backed by a real // co-processor with its own updatable firmware there. On a native (non-hosted) chip, this // device's "radio" is the chip's own built-in WiFi, nothing to update via this interface. @@ -626,6 +601,7 @@ error_t start_device(Device* device) { ctx->device = device; mutex_construct(&ctx->mutex); mutex_construct(&ctx->subscriptionsMutex); + mutex_construct(&g_radioMutex); device_set_driver_data(device, ctx); return ERROR_NONE; @@ -659,6 +635,7 @@ error_t stop_device(Device* device) { device_set_driver_data(device, nullptr); mutex_destruct(&ctx->subscriptionsMutex); mutex_destruct(&ctx->mutex); + mutex_destruct(&g_radioMutex); ctx->~Esp32WifiCtx(); tt::OptExternalAllocator().deallocate(ctx, 1); @@ -669,6 +646,72 @@ error_t stop_device(Device* device) { extern "C" { +bool esp32_wifi_radio_acquire(wifi_mode_t mode_bit) { + mutex_lock(&g_radioMutex); + + bool first_owner = g_radioOwnerCount == 0; + if (first_owner) { + wifi_init_config_t init_config = WIFI_INIT_CONFIG_DEFAULT(); + esp_err_t err = esp_wifi_init(&init_config); + if (err != ESP_OK) { + LOG_E(TAG, "esp32_wifi_radio_acquire: esp_wifi_init failed: %s", esp_err_to_name(err)); + mutex_unlock(&g_radioMutex); + return false; + } + } + + auto new_mode = static_cast(g_radioMode | mode_bit); + esp_err_t err = esp_wifi_set_mode(new_mode); + if (err != ESP_OK) { + LOG_E(TAG, "esp32_wifi_radio_acquire: esp_wifi_set_mode failed: %s", esp_err_to_name(err)); + if (first_owner) { + esp_wifi_deinit(); + } + mutex_unlock(&g_radioMutex); + return false; + } + + if (first_owner) { + err = esp_wifi_start(); + if (err != ESP_OK) { + LOG_E(TAG, "esp32_wifi_radio_acquire: esp_wifi_start failed: %s", esp_err_to_name(err)); + esp_wifi_set_mode(WIFI_MODE_NULL); + esp_wifi_deinit(); + mutex_unlock(&g_radioMutex); + return false; + } + } + + g_radioMode = new_mode; + g_radioOwnerCount++; + mutex_unlock(&g_radioMutex); + return true; +} + +void esp32_wifi_radio_release(wifi_mode_t mode_bit) { + mutex_lock(&g_radioMutex); + + if (g_radioOwnerCount <= 0) { + mutex_unlock(&g_radioMutex); + return; // Guards against a mismatched acquire/release pair. + } + + g_radioMode = static_cast(g_radioMode & ~mode_bit); + g_radioOwnerCount--; + + if (g_radioOwnerCount <= 0) { + esp_wifi_stop(); + esp_wifi_set_mode(WIFI_MODE_NULL); + esp_wifi_deinit(); + g_radioOwnerCount = 0; + g_radioMode = WIFI_MODE_NULL; + } else { + esp_wifi_set_mode(g_radioMode); + } + + mutex_unlock(&g_radioMutex); +} + extern Module platform_esp32_module; Driver esp32_wifi_driver = { @@ -684,4 +727,4 @@ Driver esp32_wifi_driver = { } // extern "C" -#endif // CONFIG_SOC_WIFI_SUPPORTED or CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED or CONFIG_ESP_HOSTED_ENABLED diff --git a/Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp b/Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp index 340c55910..963cba34a 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include // for WIFI_TASK_CORE_ID @@ -271,7 +271,8 @@ const WifiApi esp32_wifi_pinned_api = { .station_disconnect = api_station_disconnect, .station_get_rssi = api_station_get_rssi, .event_subscribe = api_event_subscribe, - .event_unsubscribe = api_event_unsubscribe + .event_unsubscribe = api_event_unsubscribe, + .get_firmware_ops = nullptr }; // ---- Driver lifecycle ---- @@ -365,4 +366,4 @@ Driver esp32_wifi_pinned_driver = { } // extern "C" -#endif // CONFIG_SOC_WIFI_SUPPORTED or CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED or CONFIG_ESP_HOSTED_ENABLED diff --git a/Platforms/platform-esp32/source/drivers/esp32p4_libc_compat.c b/Platforms/platform-esp32/source/drivers/esp32p4_libc_compat.c new file mode 100644 index 000000000..cc3c2915f --- /dev/null +++ b/Platforms/platform-esp32/source/drivers/esp32p4_libc_compat.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: Apache-2.0 +// Tactility forces Newlib (see device.py) instead of ESP-IDF 6.x's Picolibc default, but +// managed_components/espressif__esp_ipa's prebuilt libesp_ipa.a (camera ISP auto-white-balance, +// linked in for boards with a camera sensor node, e.g. m5stack-tab5) was built against Picolibc +// and references its __issignalingf(), which Newlib doesn't provide. +#include +#if CONFIG_IDF_TARGET_ESP32P4 + +#include + +int __issignalingf(float x) { + union { float f; uint32_t i; } u = { .f = x }; + if (((u.i >> 23) & 0xff) != 0xff) { + return 0; // not NaN or Inf + } + // NaN with mantissa MSB clear is signaling; MSB set is quiet. + return (u.i & 0x007fffff) != 0 && (u.i & 0x00400000) == 0; +} + +#endif // CONFIG_IDF_TARGET_ESP32P4 diff --git a/Platforms/platform-esp32/source/drivers/usb/esp32_usb_cdc_device.cpp b/Platforms/platform-esp32/source/drivers/usb/esp32_usb_cdc_device.cpp index f4ba8b109..b83548161 100644 --- a/Platforms/platform-esp32/source/drivers/usb/esp32_usb_cdc_device.cpp +++ b/Platforms/platform-esp32/source/drivers/usb/esp32_usb_cdc_device.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -112,15 +112,14 @@ static error_t cdc_device_build_contribution(struct Device* device, struct Devic static error_t cdc_device_start_console(struct Device* device) { (void)device; const tinyusb_config_cdcacm_t acm_cfg = { - .usb_dev = TINYUSB_USBDEV_0, .cdc_port = TINYUSB_CDC_ACM_0, .callback_rx = nullptr, .callback_rx_wanted_char = nullptr, .callback_line_state_changed = nullptr, .callback_line_coding_changed = nullptr, }; - if (tusb_cdc_acm_init(&acm_cfg) != ESP_OK) { - LOG_E(TAG, "tusb_cdc_acm_init failed - CDC console unavailable"); + if (tinyusb_cdcacm_init(&acm_cfg) != ESP_OK) { + LOG_E(TAG, "tinyusb_cdcacm_init failed - CDC console unavailable"); return ERROR_RESOURCE; } previous_vprintf = esp_log_set_vprintf(cdc_mirroring_vprintf); @@ -135,7 +134,7 @@ static error_t cdc_device_stop_console(struct Device* device) { } esp_log_set_vprintf(previous_vprintf ? previous_vprintf : vprintf); previous_vprintf = nullptr; - tusb_cdc_acm_deinit(TINYUSB_CDC_ACM_0); + tinyusb_cdcacm_deinit(TINYUSB_CDC_ACM_0); cdc_console_installed = false; return ERROR_NONE; } diff --git a/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_controller.cpp b/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_controller.cpp index 344919c63..06703af50 100644 --- a/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_controller.cpp +++ b/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_controller.cpp @@ -12,8 +12,10 @@ #include #include +#include #include +#include #include #if CONFIG_IDF_TARGET_ESP32P4 @@ -33,6 +35,15 @@ static constexpr size_t COMPOSITE_CONFIG_DESCRIPTOR_MAX = TUD_CONFIG_DESC_LEN + // Worst case: primary's own table (lang/mfr/product/serial/interface = 5) + CDC's own interface string. static constexpr size_t COMPOSITE_STRING_DESCRIPTOR_MAX = 6; +// Detail for the most recent claim() failure - the console can be unreachable by the time this +// fails (route_phy_for_device_mode() already reassigned the PHY away from it), so callers read +// this instead of relying on the LOG_E above having been visible. +static char last_claim_error[48] = ""; + +extern "C" const char* usb_device_controller_get_last_error() { + return last_claim_error; +} + // ---- Controller state ---- // One TinyUSB device-mode slot, shared by every USB device class (each a separate child device // under usbdevice0 in the devicetree; \see esp32_usb_hid_device.cpp, esp32_usb_device_msc.cpp, @@ -256,13 +267,14 @@ static error_t claim(struct Device* device, enum UsbDeviceClass usb_class, const } ctx->composite_tusb_cfg = {}; - ctx->composite_tusb_cfg.device_descriptor = &ctx->composite_device_descriptor; - ctx->composite_tusb_cfg.string_descriptor = ctx->composite_string_descriptor; - ctx->composite_tusb_cfg.string_descriptor_count = string_count; - ctx->composite_tusb_cfg.external_phy = false; + ctx->composite_tusb_cfg.descriptor.device = &ctx->composite_device_descriptor; + ctx->composite_tusb_cfg.descriptor.string = ctx->composite_string_descriptor; + ctx->composite_tusb_cfg.descriptor.string_count = (int)string_count; + ctx->composite_tusb_cfg.phy.skip_setup = false; + ctx->composite_tusb_cfg.task = TINYUSB_TASK_DEFAULT(); // task.size/priority can't be left 0 - rejected by tinyusb_task_check_config() #if (TUD_OPT_HIGH_SPEED) - ctx->composite_tusb_cfg.fs_configuration_descriptor = ctx->composite_fs_config_descriptor; - ctx->composite_tusb_cfg.hs_configuration_descriptor = ctx->composite_hs_config_descriptor; + ctx->composite_tusb_cfg.descriptor.full_speed_config = ctx->composite_fs_config_descriptor; + ctx->composite_tusb_cfg.descriptor.high_speed_config = ctx->composite_hs_config_descriptor; // The qualifier descriptor's class triad must mirror the device descriptor's (same IAD // reasoning). Built here rather than supplied per-primary since its content is boilerplate // (same bMaxPacketSize0/bNumConfigurations for every class) and the controller already knows @@ -278,18 +290,20 @@ static error_t claim(struct Device* device, enum UsbDeviceClass usb_class, const .bNumConfigurations = 0x01, .bReserved = 0x00, }; - ctx->composite_tusb_cfg.qualifier_descriptor = &ctx->composite_device_qualifier; + ctx->composite_tusb_cfg.descriptor.qualifier = &ctx->composite_device_qualifier; #else - ctx->composite_tusb_cfg.configuration_descriptor = ctx->composite_fs_config_descriptor; + ctx->composite_tusb_cfg.descriptor.full_speed_config = ctx->composite_fs_config_descriptor; #endif - ctx->composite_tusb_cfg.self_powered = false; - ctx->composite_tusb_cfg.vbus_monitor_io = 0; + ctx->composite_tusb_cfg.phy.self_powered = false; + ctx->composite_tusb_cfg.phy.vbus_monitor_io = 0; route_phy_for_device_mode(); ctx->phy_routed = true; - if (tinyusb_driver_install(&ctx->composite_tusb_cfg) != ESP_OK) { - LOG_E(TAG, "claim: tinyusb_driver_install failed for class %d", usb_class); + esp_err_t install_result = tinyusb_driver_install(&ctx->composite_tusb_cfg); + if (install_result != ESP_OK) { + LOG_E(TAG, "claim: tinyusb_driver_install failed for class %d: %s", usb_class, esp_err_to_name(install_result)); + snprintf(last_claim_error, sizeof(last_claim_error), "tinyusb_driver_install: %s", esp_err_to_name(install_result)); if (ctx->phy_routed) { restore_default_phy_route(); ctx->phy_routed = false; diff --git a/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_msc.cpp b/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_msc.cpp index e9e7d5ce8..2e68aa44d 100644 --- a/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_msc.cpp +++ b/Platforms/platform-esp32/source/drivers/usb/esp32_usb_device_msc.cpp @@ -9,14 +9,24 @@ #include #include -#include +#include #include +#include #include #define TAG "esp32_usb_device_msc" #define GET_CONFIG(device) ((const Esp32UsbDeviceChildConfig*)(device)->config) +// Detail for the most recent msc_device_start() failure - the console can be unreachable by the +// time this fails (the controller already reassigned the PHY away from it), so callers read this +// instead of relying on the LOG_E calls below having been visible. +static char last_msc_error[48] = ""; + +extern "C" const char* usb_msc_device_get_last_error() { + return last_msc_error; +} + // ---- MSC device descriptor set ---- // Mutable, matching the other primary classes' descriptors, even though MSC's own @@ -62,6 +72,7 @@ static uint8_t msc_hs_configuration_descriptor[TUD_MSC_DESC_LEN]; struct UsbMscDeviceCtx { UsbMscDeviceMountChangedCallback mount_changed_cb = nullptr; void* mount_changed_context = nullptr; + tinyusb_msc_storage_handle_t storage_handle = nullptr; bool storage_active = false; }; @@ -70,12 +81,20 @@ struct UsbMscDeviceCtx { // device-mode slot the controller already enforces. static struct Device* active_msc_device = nullptr; -static void storage_mount_changed_cb(tinyusb_msc_event_t* event) { +// esp_tinyusb 2.x's MOUNT_COMPLETE event fires for either owner taking the storage. Kernel-facing +// UsbMscDeviceMountChangedCallback's `mounted` (\see usb_msc_device.h) means "mounted into our own +// filesystem" (the pre-2.x meaning, kept for callers like the boot-into-MSC flow that reboot back +// to normal OS once mounted==true) - i.e. ownership has passed to TINYUSB_MSC_STORAGE_MOUNT_APP, +// the opposite of the initial USB-owned state this driver starts storage in. +static void storage_mount_changed_cb(tinyusb_msc_storage_handle_t handle, tinyusb_msc_event_t* event, void* arg) { + (void)handle; + (void)arg; + if (event->id != TINYUSB_MSC_EVENT_MOUNT_COMPLETE) return; if (active_msc_device == nullptr) return; auto* ctx = static_cast(device_get_driver_data(active_msc_device)); if (ctx == nullptr) return; - const bool mounted = event->mount_changed_data.is_mounted; + const bool mounted = event->mount_point == TINYUSB_MSC_STORAGE_MOUNT_APP; LOG_I(TAG, "%s", mounted ? "MSC mounted" : "MSC unmounted"); if (ctx->mount_changed_cb != nullptr) { ctx->mount_changed_cb(mounted, ctx->mount_changed_context); @@ -131,6 +150,7 @@ static error_t msc_device_start(struct Device* device, enum UsbMscDeviceSource s error_t claim_result = usb_device_controller_claim(controller, USB_DEVICE_CLASS_MSC, &claim_config); if (claim_result != ERROR_NONE) { + snprintf(last_msc_error, sizeof(last_msc_error), "claim: %s", usb_device_controller_get_last_error()); return claim_result; } @@ -139,44 +159,66 @@ static error_t msc_device_start(struct Device* device, enum UsbMscDeviceSource s ctx->mount_changed_context = context; active_msc_device = device; - esp_err_t result; + // esp_tinyusb 2.x auto-remounts storage on every tud_mount_cb()/tud_umount_cb(), including + // the bus resets that happen as a normal part of USB enumeration - not just a genuine host + // eject. Left enabled, that fires a spurious "mounted into our own fs" transition almost + // immediately after claim(), which callers like the boot-into-MSC flow read as "the host is + // done with it" and act on right away. Disabling it restores the old (pre-2.x) behavior: + // mount_point only changes via an explicit host SCSI eject or our own start/stop calls. + const tinyusb_msc_driver_config_t driver_cfg = { + .user_flags = { .val = 1 }, // auto_mount_off + .callback = storage_mount_changed_cb, + .callback_arg = nullptr, + }; + esp_err_t result = tinyusb_msc_install_driver(&driver_cfg); + if (result != ESP_OK) { + LOG_E(TAG, "MSC driver install failed: %s", esp_err_to_name(result)); + snprintf(last_msc_error, sizeof(last_msc_error), "install_driver: %s", esp_err_to_name(result)); + active_msc_device = nullptr; + usb_device_controller_release(controller, USB_DEVICE_CLASS_MSC); + return ERROR_RESOURCE; + } + + const tinyusb_msc_fatfs_config_t fat_fs_config = { + .base_path = nullptr, // use CONFIG_TINYUSB_MSC_MOUNT_PATH default + .config = { + .format_if_mount_failed = false, + .max_files = 5, + .allocation_unit_size = 0, + .disk_status_check_enable = false, + .use_one_fat = false, + }, + .do_not_format = false, + .format_flags = 0, // FM_ANY + }; + + tinyusb_msc_storage_handle_t handle = nullptr; if (source == USB_MSC_DEVICE_SOURCE_SDMMC) { - const tinyusb_msc_sdmmc_config_t config_sdmmc = { - .card = static_cast(source_handle), - .callback_mount_changed = storage_mount_changed_cb, - .callback_premount_changed = nullptr, - .mount_config = { - .format_if_mount_failed = false, - .max_files = 5, - .allocation_unit_size = 0, - .disk_status_check_enable = false, - .use_one_fat = false, - }, + const tinyusb_msc_storage_config_t config_sdmmc = { + .medium = { .card = static_cast(source_handle) }, + .fat_fs = fat_fs_config, + .mount_point = TINYUSB_MSC_STORAGE_MOUNT_USB, }; - result = tinyusb_msc_storage_init_sdmmc(&config_sdmmc); + result = tinyusb_msc_new_storage_sdmmc(&config_sdmmc, &handle); } else { - const tinyusb_msc_spiflash_config_t config_flash = { - .wl_handle = *static_cast(source_handle), - .callback_mount_changed = storage_mount_changed_cb, - .callback_premount_changed = nullptr, - .mount_config = { - .format_if_mount_failed = false, - .max_files = 5, - .allocation_unit_size = 0, - .disk_status_check_enable = false, - .use_one_fat = false, - }, + const tinyusb_msc_storage_config_t config_flash = { + .medium = { .wl_handle = *static_cast(source_handle) }, + .fat_fs = fat_fs_config, + .mount_point = TINYUSB_MSC_STORAGE_MOUNT_USB, }; - result = tinyusb_msc_storage_init_spiflash(&config_flash); + result = tinyusb_msc_new_storage_spiflash(&config_flash, &handle); } if (result != ESP_OK) { LOG_E(TAG, "storage init failed: %s", esp_err_to_name(result)); + snprintf(last_msc_error, sizeof(last_msc_error), "new_storage: %s", esp_err_to_name(result)); + tinyusb_msc_uninstall_driver(); active_msc_device = nullptr; usb_device_controller_release(controller, USB_DEVICE_CLASS_MSC); return ERROR_RESOURCE; } + ctx->storage_handle = handle; ctx->storage_active = true; return ERROR_NONE; } @@ -194,8 +236,10 @@ static error_t msc_device_stop(struct Device* device) { auto* controller = device_get_parent(device); usb_device_controller_release(controller, USB_DEVICE_CLASS_MSC); - tinyusb_msc_storage_deinit(); + tinyusb_msc_delete_storage(ctx->storage_handle); + tinyusb_msc_uninstall_driver(); + ctx->storage_handle = nullptr; ctx->storage_active = false; ctx->mount_changed_cb = nullptr; ctx->mount_changed_context = nullptr; diff --git a/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_hid.cpp b/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_hid.cpp index 25b973f12..29ede7667 100644 --- a/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_hid.cpp +++ b/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_hid.cpp @@ -264,7 +264,7 @@ static void hid_interface_callback(hid_host_device_handle_t handle, publish_event(ctx, &evt); if (b2 != ctx->prev_mouse_button2) { - UsbHidEvent key_evt = { .type = USB_HID_EVENT_KEY, .key = { USB_HID_KEY_ESC, b2 } }; + UsbHidEvent key_evt = { .type = USB_HID_EVENT_KEY, .key = { USB_HID_KEY_ESC, b2, false, false } }; publish_event(ctx, &key_evt); ctx->prev_mouse_button2 = b2; } @@ -298,7 +298,7 @@ static void hid_interface_callback(hid_host_device_handle_t handle, UsbHidEventType disc_type = (params.proto == HID_PROTOCOL_KEYBOARD) ? USB_HID_EVENT_KEYBOARD_DISCONNECTED : USB_HID_EVENT_MOUSE_DISCONNECTED; - UsbHidEvent evt = { .type = disc_type }; + UsbHidEvent evt = { .type = disc_type, .scroll = {} }; publish_event(ctx, &evt); } break; diff --git a/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_midi.cpp b/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_midi.cpp index 68ac3a7db..ac9f57f5a 100644 --- a/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_midi.cpp +++ b/Platforms/platform-esp32/source/drivers/usb/esp32_usbhost_midi.cpp @@ -230,6 +230,7 @@ static error_t start_device(struct Device* device) { const usb_host_client_config_t client_cfg = { .is_synchronous = false, .max_num_event_msg = 5, + .flags = { .notify_dev_removed = 0, .reserved31 = 0 }, .async = { .client_event_callback = client_event_cb, .callback_arg = ctx, diff --git a/Platforms/platform-esp32/source/module.cpp b/Platforms/platform-esp32/source/module.cpp index a0a490c24..cb06d773b 100644 --- a/Platforms/platform-esp32/source/module.cpp +++ b/Platforms/platform-esp32/source/module.cpp @@ -323,7 +323,6 @@ static const ModuleSymbol platform_esp32_symbols[] = { extern Driver esp32_adc_oneshot_driver; extern Driver esp32_gpio_driver; -extern Driver esp32_i2c_driver; extern Driver esp32_i2c_master_driver; extern Driver esp32_i2s_driver; #if SOC_LCD_I80_SUPPORTED @@ -337,7 +336,7 @@ extern Driver esp32_sdspi_driver; extern Driver esp32_spi_driver; extern Driver esp32_uart_driver; extern Driver esp32_grove_driver; -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) extern Driver esp32_wifi_driver; extern Driver esp32_wifi_pinned_driver; #endif @@ -373,7 +372,6 @@ extern Driver esp32_usb_cdc_device_driver; static Driver* const platform_esp32_drivers[] = { &esp32_adc_oneshot_driver, &esp32_gpio_driver, - &esp32_i2c_driver, &esp32_i2c_master_driver, &esp32_i2s_driver, #if SOC_LCD_I80_SUPPORTED @@ -387,7 +385,7 @@ static Driver* const platform_esp32_drivers[] = { &esp32_spi_driver, &esp32_uart_driver, &esp32_grove_driver, -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) &esp32_wifi_driver, &esp32_wifi_pinned_driver, #endif diff --git a/Tactility/CMakeLists.txt b/Tactility/CMakeLists.txt index ad3b563f8..37d05fa91 100644 --- a/Tactility/CMakeLists.txt +++ b/Tactility/CMakeLists.txt @@ -66,7 +66,7 @@ if (DEFINED ENV{ESP_IDF_VERSION}) esp_http_client esp-tls esp_wifi - json # Effectively cJSON + espressif__cjson nvs_flash spiffs vfs diff --git a/Tactility/Include/Tactility/hal/usb/Usb.h b/Tactility/Include/Tactility/hal/usb/Usb.h index 9cc3d461f..64a37afb5 100644 --- a/Tactility/Include/Tactility/hal/usb/Usb.h +++ b/Tactility/Include/Tactility/hal/usb/Usb.h @@ -16,6 +16,8 @@ enum class BootMode { }; bool startMassStorageWithSdmmc(bool fromBootMode = false); +// Reason the most recent startMassStorageWith*() call failed, or "" if it succeeded. +const char* getLastError(); void stop(); Mode getMode(); bool isSupported(); diff --git a/Tactility/Include/Tactility/service/espnow/EspNow.h b/Tactility/Include/Tactility/service/espnow/EspNow.h index 42c2e43f8..c79c86d01 100644 --- a/Tactility/Include/Tactility/service/espnow/EspNow.h +++ b/Tactility/Include/Tactility/service/espnow/EspNow.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -66,4 +66,4 @@ size_t getMaxDataLength(); } -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED \ No newline at end of file +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED \ No newline at end of file diff --git a/Tactility/Private/Tactility/app/chat/ChatAppPrivate.h b/Tactility/Private/Tactility/app/chat/ChatAppPrivate.h index d5eece322..101a90361 100644 --- a/Tactility/Private/Tactility/app/chat/ChatAppPrivate.h +++ b/Tactility/Private/Tactility/app/chat/ChatAppPrivate.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include "ChatState.h" #include "ChatView.h" @@ -37,4 +37,4 @@ void switchChannel(Context* ctx, const std::string& chatChannel); } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Private/Tactility/app/chat/ChatProtocol.h b/Tactility/Private/Tactility/app/chat/ChatProtocol.h index dd8d397d1..6d5cf822d 100644 --- a/Tactility/Private/Tactility/app/chat/ChatProtocol.h +++ b/Tactility/Private/Tactility/app/chat/ChatProtocol.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -94,4 +94,4 @@ size_t getMaxMessageLength(size_t nicknameLen, size_t targetLen); } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Private/Tactility/app/chat/ChatSettings.h b/Tactility/Private/Tactility/app/chat/ChatSettings.h index 950841f41..2b052ab22 100644 --- a/Tactility/Private/Tactility/app/chat/ChatSettings.h +++ b/Tactility/Private/Tactility/app/chat/ChatSettings.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -28,4 +28,4 @@ bool settingsFileExists(); } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Private/Tactility/app/chat/ChatState.h b/Tactility/Private/Tactility/app/chat/ChatState.h index cf66c208c..30eb195cd 100644 --- a/Tactility/Private/Tactility/app/chat/ChatState.h +++ b/Tactility/Private/Tactility/app/chat/ChatState.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include @@ -56,4 +56,4 @@ class ChatState { } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Private/Tactility/app/chat/ChatView.h b/Tactility/Private/Tactility/app/chat/ChatView.h index b53b3b98f..a2588e980 100644 --- a/Tactility/Private/Tactility/app/chat/ChatView.h +++ b/Tactility/Private/Tactility/app/chat/ChatView.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include "ChatState.h" #include "ChatSettings.h" @@ -75,4 +75,4 @@ class ChatView { } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Private/Tactility/hal/usb/UsbTusb.h b/Tactility/Private/Tactility/hal/usb/UsbTusb.h index 68cda7623..5c9b225f9 100644 --- a/Tactility/Private/Tactility/hal/usb/UsbTusb.h +++ b/Tactility/Private/Tactility/hal/usb/UsbTusb.h @@ -4,4 +4,7 @@ bool tusbIsSupported(); bool tusbStartMassStorageWithSdmmc(bool fromBootMode = false); bool tusbStartMassStorageWithFlash(bool fromBootMode = false); void tusbStop(); -bool tusbCanStartMassStorageWithFlash(); \ No newline at end of file +bool tusbCanStartMassStorageWithFlash(); + +// Reason the most recent tusbStartMassStorageWith*() call failed, or "" if it succeeded. +const char* tusbGetLastError(); \ No newline at end of file diff --git a/Tactility/Private/Tactility/service/espnow/EspNowBackend.h b/Tactility/Private/Tactility/service/espnow/EspNowBackend.h index a30b10490..76c1be363 100644 --- a/Tactility/Private/Tactility/service/espnow/EspNowBackend.h +++ b/Tactility/Private/Tactility/service/espnow/EspNowBackend.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include @@ -29,4 +29,4 @@ uint32_t getVersion(); } -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Private/Tactility/service/espnow/EspNowHostedTransport.h b/Tactility/Private/Tactility/service/espnow/EspNowHostedTransport.h index dc0d190e0..91f90feac 100644 --- a/Tactility/Private/Tactility/service/espnow/EspNowHostedTransport.h +++ b/Tactility/Private/Tactility/service/espnow/EspNowHostedTransport.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_ESP_HOSTED_ENABLED) #include @@ -30,4 +30,4 @@ bool waitForHostedTransport(uint32_t timeoutMs); } -#endif // CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Private/Tactility/service/espnow/EspNowService.h b/Tactility/Private/Tactility/service/espnow/EspNowService.h index 24008c86c..2f69c242e 100644 --- a/Tactility/Private/Tactility/service/espnow/EspNowService.h +++ b/Tactility/Private/Tactility/service/espnow/EspNowService.h @@ -4,7 +4,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -75,4 +75,4 @@ std::shared_ptr findService(); } -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/Tactility.cpp b/Tactility/Source/Tactility.cpp index d5d132ef5..87f7c4eb8 100644 --- a/Tactility/Source/Tactility.cpp +++ b/Tactility/Source/Tactility.cpp @@ -121,7 +121,7 @@ namespace service { namespace audio { extern const ServiceManifest manifest; } namespace wifi { extern const ServiceManifest manifest; } namespace development { extern const ServiceManifest manifest; } -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) namespace espnow { extern const ServiceManifest manifest; } #endif // Secondary (UI) @@ -200,7 +200,7 @@ namespace app { namespace screenshot { extern const ::AppManifest manifest; } #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) namespace chat { extern const ::AppManifest manifest; } #endif } @@ -269,7 +269,7 @@ static void registerInternalApps() { app_manager_add(&app::screenshot::manifest); #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) app_manager_add(&app::chat::manifest); #endif @@ -319,7 +319,7 @@ static void registerAndStartServices() { addService(service::development::manifest); addService(service::webserver::manifest); -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) addService(service::espnow::manifest); #endif #if defined(ESP_PLATFORM) diff --git a/Tactility/Source/app/addgps/AddGps.cpp b/Tactility/Source/app/addgps/AddGps.cpp index f3c257232..d9d9293ba 100644 --- a/Tactility/Source/app/addgps/AddGps.cpp +++ b/Tactility/Source/app/addgps/AddGps.cpp @@ -244,6 +244,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/alertdialog/AlertDialog.cpp b/Tactility/Source/app/alertdialog/AlertDialog.cpp index 750703d43..1caf433b7 100644 --- a/Tactility/Source/app/alertdialog/AlertDialog.cpp +++ b/Tactility/Source/app/alertdialog/AlertDialog.cpp @@ -161,6 +161,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } diff --git a/Tactility/Source/app/apphub/AppHubApp.cpp b/Tactility/Source/app/apphub/AppHubApp.cpp index cc1ec12d7..670a6a696 100644 --- a/Tactility/Source/app/apphub/AppHubApp.cpp +++ b/Tactility/Source/app/apphub/AppHubApp.cpp @@ -25,6 +25,7 @@ #include #include #include +#include namespace tt::app::apphub { @@ -125,7 +126,7 @@ void showApps(Context* ctx) { std::erase_if(ctx->entries, [](const AppHubEntry& entry) { #ifdef ESP_PLATFORM return !entry.targetPlatforms.empty() && - std::ranges::find(entry.targetPlatforms, CONFIG_IDF_TARGET) == entry.targetPlatforms.end(); + std::ranges::find(entry.targetPlatforms, std::string_view(CONFIG_IDF_TARGET)) == entry.targetPlatforms.end(); #else (void)entry; return false; @@ -334,7 +335,12 @@ extern const ::AppManifest manifest = { .id = "tactility.apphub", .name = "App Hub", .category = APP_CATEGORY_SYSTEM, - .location = {APP_LOCATION_MEMORY, reinterpret_cast(appMain)} + .location = { .type = APP_LOCATION_MEMORY, .location = reinterpret_cast(appMain) }, + .flags = 0, + .stack = { + .depth = 10240, + .desired_memory_capability = 0, + }, }; } // namespace tt::app::apphub diff --git a/Tactility/Source/app/apphubdetails/AppHubDetailsApp.cpp b/Tactility/Source/app/apphubdetails/AppHubDetailsApp.cpp index cecffda15..57aaddbee 100644 --- a/Tactility/Source/app/apphubdetails/AppHubDetailsApp.cpp +++ b/Tactility/Source/app/apphubdetails/AppHubDetailsApp.cpp @@ -361,6 +361,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/apppackagedetails/AppPackageDetails.cpp b/Tactility/Source/app/apppackagedetails/AppPackageDetails.cpp index a901f9937..e5ea46084 100644 --- a/Tactility/Source/app/apppackagedetails/AppPackageDetails.cpp +++ b/Tactility/Source/app/apppackagedetails/AppPackageDetails.cpp @@ -192,6 +192,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/apppackagelist/AppPackageList.cpp b/Tactility/Source/app/apppackagelist/AppPackageList.cpp index d5c4d1348..b69b21e9e 100644 --- a/Tactility/Source/app/apppackagelist/AppPackageList.cpp +++ b/Tactility/Source/app/apppackagelist/AppPackageList.cpp @@ -28,7 +28,7 @@ namespace { struct Context { uint32_t appInstanceId; // Must outlive the widgets - button user-data points into this, not a createWidgets()-local vector. - std::vector packageIds; + std::vector packageIds = {}; }; void onPackagePressed(lv_event_t* e) { diff --git a/Tactility/Source/app/apwebserver/ApWebServer.cpp b/Tactility/Source/app/apwebserver/ApWebServer.cpp index 434525123..d489f77cd 100644 --- a/Tactility/Source/app/apwebserver/ApWebServer.cpp +++ b/Tactility/Source/app/apwebserver/ApWebServer.cpp @@ -183,6 +183,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace tt::app::apwebserver diff --git a/Tactility/Source/app/audiosettings/AudioSettings.cpp b/Tactility/Source/app/audiosettings/AudioSettings.cpp index a7a248e93..ab5653346 100644 --- a/Tactility/Source/app/audiosettings/AudioSettings.cpp +++ b/Tactility/Source/app/audiosettings/AudioSettings.cpp @@ -257,7 +257,9 @@ extern const ::AppManifest manifest = { .id = "tactility.audiosettings", .name = "Audio", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::audiosettings diff --git a/Tactility/Source/app/boot/Boot.cpp b/Tactility/Source/app/boot/Boot.cpp index 911751f02..8c5c7db8e 100644 --- a/Tactility/Source/app/boot/Boot.cpp +++ b/Tactility/Source/app/boot/Boot.cpp @@ -1,3 +1,4 @@ +#include "Tactility/app/alertdialog/AlertDialog.h" #include "tactility/memory.h" #include "tactility/system_event.h" @@ -56,6 +57,10 @@ std::atomic isUsbBootSplash = false; // window to an error screen and halts before starting the next app. std::atomic sdCardMissing = false; +// Set when setupUsbBootMode() fails +std::atomic usbBootModeFailed = false; +std::string usbBootModeFailedReason; + uint32_t bootAppInstanceId = 0; WindowId bootWindowId = 0; @@ -108,6 +113,8 @@ void setupDisplay() { device_put(display); } +// Returns true if either the MSC screen or the failure screen now owns the display, in which +// case the caller must not proceed to the normal boot path (registerApps()/startNextApp()). bool setupUsbBootMode() { if (!hal::usb::isUsbBootMode()) { return false; @@ -116,16 +123,18 @@ bool setupUsbBootMode() { LOG_I(TAG, "Rebooting into mass storage device mode"); auto mode = hal::usb::getUsbBootMode(); // Get mode before reset hal::usb::resetUsbBootMode(); + delay_millis(3000); + + bool started = false; if (mode == hal::usb::BootMode::Flash) { - if (!hal::usb::startMassStorageWithFlash(true)) { - LOG_E(TAG, "Unable to start flash mass storage"); - return false; - } + started = hal::usb::startMassStorageWithFlash(true); } else if (mode == hal::usb::BootMode::Sdmmc) { - if (!hal::usb::startMassStorageWithSdmmc(true)) { - LOG_E(TAG, "Unable to start SD mass storage"); - return false; - } + started = hal::usb::startMassStorageWithSdmmc(true); + } + + if (!started) { + usbBootModeFailedReason = hal::usb::getLastError(); + usbBootModeFailed = true; } return true; @@ -237,6 +246,36 @@ void showSdCardMissingScreen() { bootWindowId = window_manager_create(bootAppInstanceId, createSdCardMissingWidgets, nullptr); } +void createUsbBootModeFailedWidgets(lv_obj_t* root, void*) { + lvgl::obj_set_style_bg_blacken(root); + lv_obj_set_style_border_width(root, 0, LV_STATE_DEFAULT); + lv_obj_set_style_radius(root, 0, LV_STATE_DEFAULT); + lv_obj_set_flex_flow(root, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(root, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + + auto* label = lv_label_create(root); + lv_label_set_text(label, std::format("Failed to start USB mass storage:\n{}", usbBootModeFailedReason).c_str()); + lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, LV_STATE_DEFAULT); + lv_obj_set_style_text_color(label, lv_color_white(), LV_STATE_DEFAULT); + + auto* button = lv_button_create(root); + lv_obj_set_style_margin_top(button, 16, LV_STATE_DEFAULT); + auto* button_label = lv_label_create(button); + lv_label_set_text(button_label, "Reboot"); + lv_obj_add_event_cb(button, [](lv_event_t*) { +#ifdef ESP_PLATFORM + esp_restart(); +#endif + }, LV_EVENT_SHORT_CLICKED, nullptr); +} + +void showUsbBootModeFailedScreen() { + if (bootWindowId != 0) { + window_manager_remove(bootWindowId); + } + bootWindowId = window_manager_create(bootAppInstanceId, createUsbBootModeFailedWidgets, nullptr); +} + void startNextApp() { if (sdCardMissing) { showSdCardMissingScreen(); @@ -278,8 +317,10 @@ void runBootSequence(TickType_t startTime) { #endif if (setupUsbBootMode()) { - // Stay open: the splash's "Return to OS" button is this app's only way to leave mass - // storage mode, so it must not self-close here like the normal boot path does below. + if (usbBootModeFailed) { + showUsbBootModeFailedScreen(); + } + // Stay open: the splash's "Return to OS" button or the failure screen's "Reboot" button. return; } diff --git a/Tactility/Source/app/btmanage/BtManage.cpp b/Tactility/Source/app/btmanage/BtManage.cpp index eed479f21..feb96bb59 100644 --- a/Tactility/Source/app/btmanage/BtManage.cpp +++ b/Tactility/Source/app/btmanage/BtManage.cpp @@ -245,7 +245,9 @@ extern const ::AppManifest manifest = { .id = "tactility.btmanage", .name = "Bluetooth", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::btmanage diff --git a/Tactility/Source/app/btpeersettings/BtPeerSettings.cpp b/Tactility/Source/app/btpeersettings/BtPeerSettings.cpp index 7a14a6988..eeb868fa5 100644 --- a/Tactility/Source/app/btpeersettings/BtPeerSettings.cpp +++ b/Tactility/Source/app/btpeersettings/BtPeerSettings.cpp @@ -272,6 +272,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace tt::app::btpeersettings diff --git a/Tactility/Source/app/chat/ChatApp.cpp b/Tactility/Source/app/chat/ChatApp.cpp index 3556abc47..8a1495f38 100644 --- a/Tactility/Source/app/chat/ChatApp.cpp +++ b/Tactility/Source/app/chat/ChatApp.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -228,9 +228,11 @@ extern const ::AppManifest manifest = { .id = "tactility.chat", .name = "Chat", .category = APP_CATEGORY_USER, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/app/chat/ChatProtocol.cpp b/Tactility/Source/app/chat/ChatProtocol.cpp index e9b5742bb..8f5f16026 100644 --- a/Tactility/Source/app/chat/ChatProtocol.cpp +++ b/Tactility/Source/app/chat/ChatProtocol.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -171,4 +171,4 @@ size_t getMaxMessageLength(size_t nicknameLen, size_t targetLen) { } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/app/chat/ChatSettings.cpp b/Tactility/Source/app/chat/ChatSettings.cpp index 0ea685fb2..a0fd345a0 100644 --- a/Tactility/Source/app/chat/ChatSettings.cpp +++ b/Tactility/Source/app/chat/ChatSettings.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -205,4 +205,4 @@ bool settingsFileExists() { } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/app/chat/ChatState.cpp b/Tactility/Source/app/chat/ChatState.cpp index 4c8174099..8a14e47d4 100644 --- a/Tactility/Source/app/chat/ChatState.cpp +++ b/Tactility/Source/app/chat/ChatState.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include @@ -57,4 +57,4 @@ std::vector ChatState::getFilteredMessages() const { } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/app/chat/ChatView.cpp b/Tactility/Source/app/chat/ChatView.cpp index 2fbca38f6..5fc778a75 100644 --- a/Tactility/Source/app/chat/ChatView.cpp +++ b/Tactility/Source/app/chat/ChatView.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -306,4 +306,4 @@ void ChatView::onChannelCancel(lv_event_t* e) { } // namespace tt::app::chat -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/app/crashdiagnostics/CrashDiagnostics.cpp b/Tactility/Source/app/crashdiagnostics/CrashDiagnostics.cpp index ec9412b67..c3a4536cd 100644 --- a/Tactility/Source/app/crashdiagnostics/CrashDiagnostics.cpp +++ b/Tactility/Source/app/crashdiagnostics/CrashDiagnostics.cpp @@ -282,6 +282,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { .type = APP_LOCATION_MEMORY, .location = reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/development/Development.cpp b/Tactility/Source/app/development/Development.cpp index cb76f70b7..cb9e0be82 100644 --- a/Tactility/Source/app/development/Development.cpp +++ b/Tactility/Source/app/development/Development.cpp @@ -230,7 +230,9 @@ extern const ::AppManifest manifest = { .id = "tactility.development", .name = "Development", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/display/Display.cpp b/Tactility/Source/app/display/Display.cpp index 736c84da5..f115fc848 100644 --- a/Tactility/Source/app/display/Display.cpp +++ b/Tactility/Source/app/display/Display.cpp @@ -347,7 +347,9 @@ extern const ::AppManifest manifest = { .id = "tactility.display", .name = "Display", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::display diff --git a/Tactility/Source/app/files/FilesApp.cpp b/Tactility/Source/app/files/FilesApp.cpp index 16b5dd7e4..62c72acaa 100644 --- a/Tactility/Source/app/files/FilesApp.cpp +++ b/Tactility/Source/app/files/FilesApp.cpp @@ -80,6 +80,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/fileselection/FileSelection.cpp b/Tactility/Source/app/fileselection/FileSelection.cpp index f1cb15c34..63a84228b 100644 --- a/Tactility/Source/app/fileselection/FileSelection.cpp +++ b/Tactility/Source/app/fileselection/FileSelection.cpp @@ -127,6 +127,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/gpssettings/GpsSettings.cpp b/Tactility/Source/app/gpssettings/GpsSettings.cpp index 7602cdb76..02d7756ae 100644 --- a/Tactility/Source/app/gpssettings/GpsSettings.cpp +++ b/Tactility/Source/app/gpssettings/GpsSettings.cpp @@ -326,7 +326,9 @@ extern const ::AppManifest manifest = { .id = "tactility.gpssettings", .name = "GPS", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/grovesettings/GroveSettings.cpp b/Tactility/Source/app/grovesettings/GroveSettings.cpp index 730a92b19..3ddf5a15e 100644 --- a/Tactility/Source/app/grovesettings/GroveSettings.cpp +++ b/Tactility/Source/app/grovesettings/GroveSettings.cpp @@ -129,7 +129,9 @@ extern const ::AppManifest manifest = { .id = "tactility.grovesettings", .name = "Grove", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } diff --git a/Tactility/Source/app/i2cscanner/I2cScanner.cpp b/Tactility/Source/app/i2cscanner/I2cScanner.cpp index 80229b2c9..9a17b2f5b 100644 --- a/Tactility/Source/app/i2cscanner/I2cScanner.cpp +++ b/Tactility/Source/app/i2cscanner/I2cScanner.cpp @@ -426,7 +426,9 @@ extern const ::AppManifest manifest = { .id = "tactility.i2cscanner", .name = "I2C Scanner", .category = APP_CATEGORY_SYSTEM, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; uint32_t start() { diff --git a/Tactility/Source/app/imageviewer/ImageViewer.cpp b/Tactility/Source/app/imageviewer/ImageViewer.cpp index 59d1cca40..4ef72c00a 100644 --- a/Tactility/Source/app/imageviewer/ImageViewer.cpp +++ b/Tactility/Source/app/imageviewer/ImageViewer.cpp @@ -133,6 +133,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/inputdialog/InputDialog.cpp b/Tactility/Source/app/inputdialog/InputDialog.cpp index f8754f65e..f69c19f22 100644 --- a/Tactility/Source/app/inputdialog/InputDialog.cpp +++ b/Tactility/Source/app/inputdialog/InputDialog.cpp @@ -35,7 +35,7 @@ struct Context { // is a plain (non-atomic) field safely shared between the LVGL thread (writer, before // emitting APP_EVENT_CLOSE) and this dialog's own thread (reader, after waking from it). int32_t resultCode = 1; // Cancelled - safety-net default if closed without pressing a button - std::string resultText; + std::string resultText = {}; }; struct ButtonContext { @@ -166,6 +166,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } diff --git a/Tactility/Source/app/keyboard/KeyboardSettings.cpp b/Tactility/Source/app/keyboard/KeyboardSettings.cpp index 86b322232..dc31e0b3b 100644 --- a/Tactility/Source/app/keyboard/KeyboardSettings.cpp +++ b/Tactility/Source/app/keyboard/KeyboardSettings.cpp @@ -246,7 +246,9 @@ extern const ::AppManifest manifest = { .id = "tactility.keyboardsettings", .name = "Keyboard", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } diff --git a/Tactility/Source/app/launcher/Launcher.cpp b/Tactility/Source/app/launcher/Launcher.cpp index 3421f93f0..643d151cc 100644 --- a/Tactility/Source/app/launcher/Launcher.cpp +++ b/Tactility/Source/app/launcher/Launcher.cpp @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include @@ -233,9 +235,32 @@ void runAutoStart() { } } +constexpr size_t AUTO_START_STACK_DEPTH = 4096 / sizeof(StackType_t); + +struct AutoStartTaskContext { + SemaphoreHandle_t done; +}; + +void autoStartTaskMain(void* param) { + auto* context = static_cast(param); + runAutoStart(); + xSemaphoreGive(context->done); + vTaskDelete(nullptr); +} + +// runAutoStart() reads from flash, and apps run on PSRAM when available. +// Launcher stays in memory, so we prefer to keep the PSRAM task and temporarily run an IRAM task for auto start logic. +void runAutoStartIsolated() { + AutoStartTaskContext context { .done = xSemaphoreCreateBinary() }; + check(context.done != nullptr); + TaskHandle_t auto_start_task = nullptr; + check(xTaskCreate(autoStartTaskMain, "LauncherAutoStart", AUTO_START_STACK_DEPTH, &context, tskIDLE_PRIORITY, &auto_start_task) == pdPASS); + xSemaphoreTake(context.done, portMAX_DELAY); + vSemaphoreDelete(context.done); +} + int32_t appMain(int argc, char* argv[]) { uint32_t appInstanceId = app_scheduler_current_app_id(); - runAutoStart(); TaskEventGroup event_group {}; task_event_group_construct(&event_group); @@ -245,6 +270,8 @@ int32_t appMain(int argc, char* argv[]) { WindowId window = window_manager_create(appInstanceId, createWidgets, nullptr); + runAutoStartIsolated(); + // The launcher is meant to stay resident (it's the home screen) - it only gives up its // thread when app-module's scheduler asks it to (e.g. another new-model app is started). while (true) { diff --git a/Tactility/Source/app/localesettings/LocaleSettings.cpp b/Tactility/Source/app/localesettings/LocaleSettings.cpp index 46767fffe..338860eca 100644 --- a/Tactility/Source/app/localesettings/LocaleSettings.cpp +++ b/Tactility/Source/app/localesettings/LocaleSettings.cpp @@ -182,7 +182,9 @@ extern const ::AppManifest manifest = { .id = "tactility.localesettings", .name = "Region & Language", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::localesettings diff --git a/Tactility/Source/app/notes/Notes.cpp b/Tactility/Source/app/notes/Notes.cpp index 4608624d6..132e7b457 100644 --- a/Tactility/Source/app/notes/Notes.cpp +++ b/Tactility/Source/app/notes/Notes.cpp @@ -276,7 +276,9 @@ extern const ::AppManifest manifest = { .id = "tactility.notes", .name = "Notes", .category = APP_CATEGORY_USER, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::notes diff --git a/Tactility/Source/app/power/Power.cpp b/Tactility/Source/app/power/Power.cpp index f193817e8..81a7c7bd7 100644 --- a/Tactility/Source/app/power/Power.cpp +++ b/Tactility/Source/app/power/Power.cpp @@ -278,7 +278,9 @@ extern const ::AppManifest manifest = { .id = "tactility.power", .name = "Power", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/poweroff/PowerOff.cpp b/Tactility/Source/app/poweroff/PowerOff.cpp index f82522035..fb66ef0e7 100644 --- a/Tactility/Source/app/poweroff/PowerOff.cpp +++ b/Tactility/Source/app/poweroff/PowerOff.cpp @@ -174,6 +174,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/screenshot/Screenshot.cpp b/Tactility/Source/app/screenshot/Screenshot.cpp index 6e2a79166..8dfa67e44 100644 --- a/Tactility/Source/app/screenshot/Screenshot.cpp +++ b/Tactility/Source/app/screenshot/Screenshot.cpp @@ -290,7 +290,9 @@ extern const ::AppManifest manifest = { .id = "tactility.screenshot", .name = "Screenshot", .category = APP_CATEGORY_SYSTEM, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/selectiondialog/SelectionDialog.cpp b/Tactility/Source/app/selectiondialog/SelectionDialog.cpp index f2d70f9ae..62f14cfc3 100644 --- a/Tactility/Source/app/selectiondialog/SelectionDialog.cpp +++ b/Tactility/Source/app/selectiondialog/SelectionDialog.cpp @@ -158,6 +158,7 @@ extern const AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } diff --git a/Tactility/Source/app/setup/Setup.cpp b/Tactility/Source/app/setup/Setup.cpp index e746252ca..d976fd30d 100644 --- a/Tactility/Source/app/setup/Setup.cpp +++ b/Tactility/Source/app/setup/Setup.cpp @@ -279,6 +279,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } diff --git a/Tactility/Source/app/systeminfo/SystemInfo.cpp b/Tactility/Source/app/systeminfo/SystemInfo.cpp index 635291d13..0d8ba505d 100644 --- a/Tactility/Source/app/systeminfo/SystemInfo.cpp +++ b/Tactility/Source/app/systeminfo/SystemInfo.cpp @@ -457,7 +457,9 @@ extern const ::AppManifest manifest = { .id = "tactility.systeminfo", .name = "System Info", .category = APP_CATEGORY_SYSTEM, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/timedatesettings/TimeDateSettings.cpp b/Tactility/Source/app/timedatesettings/TimeDateSettings.cpp index 8e51db221..0262c6be8 100644 --- a/Tactility/Source/app/timedatesettings/TimeDateSettings.cpp +++ b/Tactility/Source/app/timedatesettings/TimeDateSettings.cpp @@ -215,7 +215,9 @@ extern const ::AppManifest manifest = { .id = "tactility.timedatesettings", .name = "Time & Date", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::timedatesettings diff --git a/Tactility/Source/app/timezone/TimeZone.cpp b/Tactility/Source/app/timezone/TimeZone.cpp index ad5615547..6f329fb9a 100644 --- a/Tactility/Source/app/timezone/TimeZone.cpp +++ b/Tactility/Source/app/timezone/TimeZone.cpp @@ -292,6 +292,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } diff --git a/Tactility/Source/app/touchcalibration/TouchCalibration.cpp b/Tactility/Source/app/touchcalibration/TouchCalibration.cpp index 7db51338f..368f54fbf 100644 --- a/Tactility/Source/app/touchcalibration/TouchCalibration.cpp +++ b/Tactility/Source/app/touchcalibration/TouchCalibration.cpp @@ -294,7 +294,9 @@ extern const ::AppManifest manifest = { .id = "tactility.touchcalibration", .name = "Touch Calibration", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::touchcalibration diff --git a/Tactility/Source/app/trackball/TrackballSettings.cpp b/Tactility/Source/app/trackball/TrackballSettings.cpp index 6a60dc327..152500e0b 100644 --- a/Tactility/Source/app/trackball/TrackballSettings.cpp +++ b/Tactility/Source/app/trackball/TrackballSettings.cpp @@ -309,7 +309,9 @@ extern const ::AppManifest manifest = { .id = "tactility.trackballsettings", .name = "Trackball", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } diff --git a/Tactility/Source/app/usbsettings/UsbSettings.cpp b/Tactility/Source/app/usbsettings/UsbSettings.cpp index 51ea92e2f..ace954752 100644 --- a/Tactility/Source/app/usbsettings/UsbSettings.cpp +++ b/Tactility/Source/app/usbsettings/UsbSettings.cpp @@ -122,7 +122,9 @@ extern const ::AppManifest manifest = { .id = "tactility.usbsettings", .name = "USB", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/webserversettings/WebServerSettings.cpp b/Tactility/Source/app/webserversettings/WebServerSettings.cpp index ccefd0353..ebc24b8d4 100644 --- a/Tactility/Source/app/webserversettings/WebServerSettings.cpp +++ b/Tactility/Source/app/webserversettings/WebServerSettings.cpp @@ -424,7 +424,9 @@ extern const ::AppManifest manifest = { .id = "tactility.webserversettings", .name = "Web Server", .category = APP_CATEGORY_SYSTEM, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } diff --git a/Tactility/Source/app/wifiapsettings/WifiApSettings.cpp b/Tactility/Source/app/wifiapsettings/WifiApSettings.cpp index 4f801aa52..1bb0053d5 100644 --- a/Tactility/Source/app/wifiapsettings/WifiApSettings.cpp +++ b/Tactility/Source/app/wifiapsettings/WifiApSettings.cpp @@ -327,6 +327,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/wificonnect/WifiConnect.cpp b/Tactility/Source/app/wificonnect/WifiConnect.cpp index 0c6ff7b09..ceb8c1720 100644 --- a/Tactility/Source/app/wificonnect/WifiConnect.cpp +++ b/Tactility/Source/app/wificonnect/WifiConnect.cpp @@ -387,6 +387,7 @@ extern const ::AppManifest manifest = { .category = APP_CATEGORY_SYSTEM, .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, .flags = APP_MANIFEST_FLAG_HIDDEN, + .stack = {} }; } // namespace diff --git a/Tactility/Source/app/wifimanage/WifiManage.cpp b/Tactility/Source/app/wifimanage/WifiManage.cpp index 53d62b4a0..206d177d2 100644 --- a/Tactility/Source/app/wifimanage/WifiManage.cpp +++ b/Tactility/Source/app/wifimanage/WifiManage.cpp @@ -249,7 +249,9 @@ extern const ::AppManifest manifest = { .id = "tactility.wifimanage", .name = "Wi-Fi", .category = APP_CATEGORY_SETTINGS, - .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) } + .location = { APP_LOCATION_MEMORY, reinterpret_cast(appMain) }, + .flags = 0, + .stack = {} }; } // namespace tt::app::wifimanage diff --git a/Tactility/Source/file/File.cpp b/Tactility/Source/file/File.cpp index 7de422a64..570636649 100644 --- a/Tactility/Source/file/File.cpp +++ b/Tactility/Source/file/File.cpp @@ -1,5 +1,6 @@ #include +#include #include #include #include @@ -186,25 +187,19 @@ bool writeString(const std::string& filepath, const std::string& content) { return true; } -static bool findOrCreateDirectoryInternal(std::string path, mode_t mode) { +static bool findOrCreateDirectoryInternal(const std::string& path, mode_t mode) { + // Checked before creating, not after: on the SD card's mount root, the FATFS VFS's mkdir() + // doesn't fail with EEXIST for an already-mounted root (it returns some other errno), so an + // mkdir-first/errno-check approach never recognizes it as already there. struct stat dir_stat; - if (mkdir(path.c_str(), mode) == 0) { - return true; + if (stat(path.c_str(), &dir_stat) == 0) { + return S_ISDIR(dir_stat.st_mode); } - if (errno != EEXIST) { - return false; - } - - if (stat(path.c_str(), &dir_stat) != 0) { - return false; - } - - if (!S_ISDIR(dir_stat.st_mode)) { - return false; + if (mkdir(path.c_str(), mode) == 0) { + return true; } - - return true; + return errno == EEXIST && stat(path.c_str(), &dir_stat) == 0 && S_ISDIR(dir_stat.st_mode); } std::string getLastPathSegment(const std::string& path) { diff --git a/Tactility/Source/hal/usb/Usb.cpp b/Tactility/Source/hal/usb/Usb.cpp index f02a0b866..4c5bcf86b 100644 --- a/Tactility/Source/hal/usb/Usb.cpp +++ b/Tactility/Source/hal/usb/Usb.cpp @@ -67,6 +67,10 @@ bool startMassStorageWithSdmmc(bool fromBootMode) { } } +const char* getLastError() { + return tusbGetLastError(); +} + void stop() { if (canStartNewMode()) { return; diff --git a/Tactility/Source/hal/usb/UsbMock.cpp b/Tactility/Source/hal/usb/UsbMock.cpp index d18dddb57..9738ad31a 100644 --- a/Tactility/Source/hal/usb/UsbMock.cpp +++ b/Tactility/Source/hal/usb/UsbMock.cpp @@ -5,6 +5,7 @@ namespace tt::hal::usb { bool startMassStorageWithSdmmc(bool /*fromBootMode*/) { return false; } +const char* getLastError() { return ""; } void stop() {} Mode getMode() { return Mode::Default; } BootMode getUsbBootMode() { return BootMode::None; } diff --git a/Tactility/Source/hal/usb/UsbTusb.cpp b/Tactility/Source/hal/usb/UsbTusb.cpp index ed2fc796c..06a831194 100644 --- a/Tactility/Source/hal/usb/UsbTusb.cpp +++ b/Tactility/Source/hal/usb/UsbTusb.cpp @@ -12,6 +12,8 @@ #include #include +#include + #include #include #include @@ -25,6 +27,8 @@ namespace tt::hal::usb { // Used to decide whether ejecting the volume should automatically reboot back to normal OS. static bool startedFromBootMode = false; +static char lastErrorMessage[96] = ""; + static sdmmc_card_t* getCard() { sdmmc_card_t* card = nullptr; @@ -70,12 +74,14 @@ bool tusbStartMassStorageWithSdmmc(bool fromBootMode) { auto* device = usb_msc_device_get(); if (device == nullptr) { LOG_E(TAG, "USB MSC device not available"); + snprintf(tt::hal::usb::lastErrorMessage, sizeof(tt::hal::usb::lastErrorMessage), "USB MSC device not available"); return false; } auto* card = tt::hal::usb::getCard(); if (card == nullptr) { LOG_E(TAG, "SD card not mounted"); + snprintf(tt::hal::usb::lastErrorMessage, sizeof(tt::hal::usb::lastErrorMessage), "SD card not mounted"); device_put(device); return false; } @@ -86,6 +92,7 @@ bool tusbStartMassStorageWithSdmmc(bool fromBootMode) { tt::hal::usb::onMountChanged, nullptr); if (result != ERROR_NONE) { LOG_E(TAG, "TinyUSB SDMMC init failed: %s", error_to_string(result)); + snprintf(tt::hal::usb::lastErrorMessage, sizeof(tt::hal::usb::lastErrorMessage), "SDMMC init failed: %s (%s)", error_to_string(result), usb_msc_device_get_last_error()); } else { LOG_I(TAG, "TinyUSB SDMMC init success"); } @@ -100,12 +107,14 @@ bool tusbStartMassStorageWithFlash(bool fromBootMode) { auto* device = usb_msc_device_get(); if (device == nullptr) { LOG_E(TAG, "USB MSC device not available"); + snprintf(tt::hal::usb::lastErrorMessage, sizeof(tt::hal::usb::lastErrorMessage), "USB MSC device not available"); return false; } wl_handle_t handle = tt::getDataPartitionWlHandle(); if (handle == WL_INVALID_HANDLE) { LOG_E(TAG, "WL not mounted for /data"); + snprintf(tt::hal::usb::lastErrorMessage, sizeof(tt::hal::usb::lastErrorMessage), "WL not mounted for /data"); device_put(device); return false; } @@ -116,6 +125,7 @@ bool tusbStartMassStorageWithFlash(bool fromBootMode) { &handle, tt::hal::usb::onMountChanged, nullptr); if (result != ERROR_NONE) { LOG_E(TAG, "TinyUSB flash init failed: %s", error_to_string(result)); + snprintf(tt::hal::usb::lastErrorMessage, sizeof(tt::hal::usb::lastErrorMessage), "Flash init failed: %s (%s)", error_to_string(result), usb_msc_device_get_last_error()); } else { LOG_I(TAG, "TinyUSB flash init success"); } @@ -123,6 +133,10 @@ bool tusbStartMassStorageWithFlash(bool fromBootMode) { return result == ERROR_NONE; } +const char* tusbGetLastError() { + return tt::hal::usb::lastErrorMessage; +} + void tusbStop() { auto* device = usb_msc_device_get(); if (device != nullptr) { @@ -142,6 +156,7 @@ bool tusbStartMassStorageWithSdmmc(bool /*fromBootMode*/) { return false; } bool tusbStartMassStorageWithFlash(bool /*fromBootMode*/) { return false; } void tusbStop() {} bool tusbCanStartMassStorageWithFlash() { return false; } +const char* tusbGetLastError() { return ""; } #endif // CONFIG_TINYUSB_MSC_ENABLED diff --git a/Tactility/Source/service/espnow/EspNow.cpp b/Tactility/Source/service/espnow/EspNow.cpp index d0797ec67..61156b83e 100644 --- a/Tactility/Source/service/espnow/EspNow.cpp +++ b/Tactility/Source/service/espnow/EspNow.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -97,4 +97,4 @@ size_t getMaxDataLength() { } -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/service/espnow/EspNowBackendHosted.cpp b/Tactility/Source/service/espnow/EspNowBackendHosted.cpp index b6966795e..ca48054b2 100644 --- a/Tactility/Source/service/espnow/EspNowBackendHosted.cpp +++ b/Tactility/Source/service/espnow/EspNowBackendHosted.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -310,4 +310,4 @@ uint32_t getVersion() { } -#endif // CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/service/espnow/EspNowBackendNative.cpp b/Tactility/Source/service/espnow/EspNowBackendNative.cpp index 93b8bc65f..10597cdf7 100644 --- a/Tactility/Source/service/espnow/EspNowBackendNative.cpp +++ b/Tactility/Source/service/espnow/EspNowBackendNative.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) && !defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) && !defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -205,4 +205,4 @@ uint32_t getVersion() { } -#endif // CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/service/espnow/EspNowHostedTransport.cpp b/Tactility/Source/service/espnow/EspNowHostedTransport.cpp index 751ffe11e..718e53da6 100644 --- a/Tactility/Source/service/espnow/EspNowHostedTransport.cpp +++ b/Tactility/Source/service/espnow/EspNowHostedTransport.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_ESP_HOSTED_ENABLED) #include @@ -34,4 +34,4 @@ bool waitForHostedTransport(uint32_t timeoutMs) { } -#endif // CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/service/espnow/EspNowService.cpp b/Tactility/Source/service/espnow/EspNowService.cpp index f9ec858b6..eadf2a22e 100644 --- a/Tactility/Source/service/espnow/EspNowService.cpp +++ b/Tactility/Source/service/espnow/EspNowService.cpp @@ -2,7 +2,7 @@ #include #endif -#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED) +#if defined(CONFIG_SOC_WIFI_SUPPORTED) || defined(CONFIG_ESP_HOSTED_ENABLED) #include #include @@ -199,4 +199,4 @@ extern const ServiceManifest manifest = { } -#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_SLAVE_SOC_WIFI_SUPPORTED +#endif // CONFIG_SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED diff --git a/Tactility/Source/service/webserver/WebServerService.cpp b/Tactility/Source/service/webserver/WebServerService.cpp index 4aad7b0df..6dac8a451 100644 --- a/Tactility/Source/service/webserver/WebServerService.cpp +++ b/Tactility/Source/service/webserver/WebServerService.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #endif @@ -295,9 +296,11 @@ bool WebServerService::startApMode() { LOG_I(TAG, "Starting WiFi in Access Point mode..."); - wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - if (esp_wifi_init(&cfg) != ESP_OK) { - LOG_E(TAG, "esp_wifi_init() failed"); + // Acquires the shared radio (see esp32_wifi_radio.h): merges into WIFI_MODE_APSTA if Station + // mode already owns the radio, instead of calling esp_wifi_init()/start() ourselves and + // colliding with it. + if (!esp32_wifi_radio_acquire(WIFI_MODE_AP)) { + LOG_E(TAG, "Failed to acquire WiFi radio for AP mode"); return false; } apWifiInitialized = true; @@ -306,13 +309,6 @@ bool WebServerService::startApMode() { apNetif = esp_netif_create_default_wifi_ap(); if (apNetif == nullptr) { LOG_E(TAG, "esp_netif_create_default_wifi_ap() failed"); - esp_wifi_deinit(); - apWifiInitialized = false; - return false; - } - - if (esp_wifi_set_mode(WIFI_MODE_AP) != ESP_OK) { - LOG_E(TAG, "esp_wifi_set_mode(AP) failed"); stopApMode(); return false; } @@ -378,34 +374,20 @@ bool WebServerService::startApMode() { return false; } - if (esp_wifi_start() != ESP_OK) { - LOG_E(TAG, "esp_wifi_start() failed"); - stopApMode(); - return false; - } - LOG_I(TAG, "WiFi AP started - SSID: '%s', Channel: %u, IP: 192.168.4.1", settings.apSsid.c_str(), (unsigned)settings.apChannel); return true; } void WebServerService::stopApMode() { if (apWifiInitialized) { - esp_err_t err; + // Detach netif from the internal WiFi event handlers before releasing the radio, otherwise + // esp_netif_destroy() can race with esp_wifi_stop()'s own netif teardown (matches the same + // guard in esp32_wifi.cpp's bring_down_wifi()). if (apNetif != nullptr) { esp_wifi_clear_default_wifi_driver_and_handlers(apNetif); } - err = esp_wifi_stop(); - if (err != ESP_OK && err != ESP_ERR_WIFI_NOT_STARTED) { - LOG_W(TAG, "esp_wifi_stop() in cleanup: %s", esp_err_to_name(err)); - } + esp32_wifi_radio_release(WIFI_MODE_AP); LOG_I(TAG, "WiFi AP stopped"); - - err = esp_wifi_set_mode(WIFI_MODE_STA); - if (err != ESP_OK) { - LOG_W(TAG, "esp_wifi_set_mode() in cleanup: %s", esp_err_to_name(err)); - } - LOG_I(TAG, "Wifi mode set back to STA"); - apWifiInitialized = false; } diff --git a/Tactility/idf_component.yml b/Tactility/idf_component.yml index 962baf3ed..eeb25b3bd 100644 --- a/Tactility/idf_component.yml +++ b/Tactility/idf_component.yml @@ -1,4 +1,5 @@ dependencies: + espressif/cjson: "^1.7.19" espressif/esp_codec_dev: "1.5.10" espressif/esp_video: version: "2.2.0" @@ -9,19 +10,19 @@ dependencies: rules: - if: "target == esp32p4" espressif/esp_wifi_remote: - version: "1.2.3" + version: "1.6.4" rules: - if: "target == esp32p4" espressif/esp_lcd_ili9341: - version: "2.0.1" + version: "2.1.0" rules: - if: "target in [esp32, esp32s3]" atanisoft/esp_lcd_ili9488: - version: "1.0.10" + version: "1.1.1" rules: - if: "target in [esp32, esp32s3]" - teriyakigod/esp_lcd_st7735: - version: "0.0.1" + waveshare/esp_lcd_st7735: + version: "2.0.0" rules: - if: "target in [esp32, esp32s3]" espressif/elf_loader: "1.3.3" @@ -30,22 +31,22 @@ dependencies: version: "1.0.6" rules: - if: "target in [esp32, esp32s3]" - espressif/esp_lcd_touch_cst816s: "1.0.3" - espressif/esp_lcd_touch_gt911: "1.1.3" + espressif/esp_lcd_touch_cst816s: "1.1.2" + espressif/esp_lcd_touch_gt911: "1.2.1" espressif/esp_lcd_touch_ft5x06: "1.0.6~1" espressif/esp_lcd_axs15231b: "2.0.2" lambage/esp_lcd_touch_ft6336u: "1.0.8" espressif/esp_lcd_st7701: - version: "1.1.3" + version: "2.0.2~2" rules: - if: "target in [esp32s3, esp32p4]" espressif/esp_lcd_st7796: version: "1.3.4" rules: - if: "target in [esp32, esp32s3]" - espressif/esp_lcd_gc9a01: "2.0.3" + espressif/esp_lcd_gc9a01: "2.0.4" espressif/esp_lcd_jd9165: - version: "1.0.3" + version: "2.0.2" rules: # More hardware seems to be supported - enable as needed - if: "target in [esp32p4]" @@ -71,7 +72,7 @@ dependencies: - if: "target in [esp32p4]" espressif/esp_lcd_panel_io_additions: "1.0.1" espressif/esp_tinyusb: - version: "1.7.6~1" + version: "2.2.1" rules: - if: "target in [esp32s3, esp32p4]" espressif/esp_lvgl_port: "2.7.2" @@ -91,8 +92,8 @@ dependencies: rules: - if: "target in [esp32s3, esp32p4]" jgromes/radiolib: - version: "7.3.0" + version: "7.7.1" rules: - if: "target in [esp32, esp32s3, esp32p4]" - idf: '5.5.2' + idf: '6.1.0' diff --git a/TactilityKernel/include/tactility/drivers/usb_device_controller.h b/TactilityKernel/include/tactility/drivers/usb_device_controller.h index e91c9b0b7..7782bb0c4 100644 --- a/TactilityKernel/include/tactility/drivers/usb_device_controller.h +++ b/TactilityKernel/include/tactility/drivers/usb_device_controller.h @@ -183,6 +183,9 @@ error_t usb_device_controller_allocate_interfaces(struct Device* device, uint8_t struct UsbInterfaceAllocation* out_allocation); error_t usb_device_controller_claim(struct Device* device, enum UsbDeviceClass usb_class, const struct UsbDeviceClaimConfig* config); + +/** Detail string (e.g. an esp_err_t name) for the most recent claim() failure, or "" if none. */ +const char* usb_device_controller_get_last_error(void); error_t usb_device_controller_release(struct Device* device, enum UsbDeviceClass usb_class); enum UsbDeviceClass usb_device_controller_get_active_class(struct Device* device); bool usb_device_controller_is_cdc_enabled(struct Device* device); diff --git a/TactilityKernel/include/tactility/drivers/usb_msc_device.h b/TactilityKernel/include/tactility/drivers/usb_msc_device.h index d9805549b..4bb410ffc 100644 --- a/TactilityKernel/include/tactility/drivers/usb_msc_device.h +++ b/TactilityKernel/include/tactility/drivers/usb_msc_device.h @@ -85,6 +85,9 @@ error_t usb_msc_device_start(struct Device* device, enum UsbMscDeviceSource sour error_t usb_msc_device_stop(struct Device* device); bool usb_msc_device_is_connected(struct Device* device); +/** Detail string for the most recent usb_msc_device_start() failure, or "" if none. */ +const char* usb_msc_device_get_last_error(void); + #ifdef __cplusplus } #endif diff --git a/device.py b/device.py index aaa6c58e7..8bd34c47b 100644 --- a/device.py +++ b/device.py @@ -118,6 +118,12 @@ def write_partition_table(output_file, device_properties: dict, is_dev: bool): output_file.write("CONFIG_PARTITION_TABLE_CUSTOM=y\n") output_file.write(f"CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"{partition_filename}\"\n") output_file.write(f"CONFIG_PARTITION_TABLE_FILENAME=\"{partition_filename}\"\n") + idf_target = get_property_or_exit(device_properties, "hardware.target").lower() + if idf_target == "esp32p4": + # ESP-IDF 6.1's P4 bootloader (0x6140 bytes) no longer fits under the default + # CONFIG_PARTITION_TABLE_OFFSET=0x8000 budget (max 0x6000), regardless of device config. + # The partition CSVs leave their offsets blank so they auto-place relative to this value. + output_file.write("CONFIG_PARTITION_TABLE_OFFSET=0x10000\n") def write_tactility_variables(output_file, device_properties: dict, device_id: str): # Board and vendor @@ -150,6 +156,13 @@ def write_core_variables(output_file, device_properties: dict): idf_target = get_property_or_exit(device_properties, "hardware.target").lower() output_file.write("# Target\n") output_file.write(f"CONFIG_IDF_TARGET=\"{idf_target}\"\n") + # ESP-IDF 6.x defaults default warnings (incl. -Wmissing-field-initializers) to errors; + # this codebase's designated initializers rely on the old warn-only behavior. + output_file.write("CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y\n") + # ESP-IDF 6.x defaults to Picolibc, which drops per-task stdio redirection and some + # newlib-internal symbols (_ctype_, __getreent) this repo's ELF-loader ABI exports. + # Stay on Newlib rather than re-auditing every per-task stdio assumption. + output_file.write("CONFIG_LIBC_NEWLIB=y\n") output_file.write("# CPU\n") output_file.write("CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y\n") output_file.write("CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240\n") @@ -157,8 +170,8 @@ def write_core_variables(output_file, device_properties: dict): output_file.write(f"CONFIG_{idf_target.upper()}_DEFAULT_CPU_FREQ_MHZ=240\n") if idf_target != "esp32": # Not available on original ESP32 output_file.write("# Enable usage of MALLOC_CAP_EXEC on IRAM:\n") - output_file.write("CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n\n") - output_file.write("CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK=n\n") + output_file.write("CONFIG_ESP_SYSTEM_MEMPROT=n\n") + output_file.write("CONFIG_ESP_SYSTEM_MEMPROT_PMS_LOCK=n\n") else: # Original ESP32 has very limited IRAM (~328KB shared with Wi-Fi/BT). # Disable Wi-Fi IRAM optimizations to free ~27KB; throughput impact is @@ -169,6 +182,14 @@ def write_core_variables(output_file, device_properties: dict): output_file.write("CONFIG_ESP_WIFI_RX_IRAM_OPT=n\n") output_file.write("CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH=y\n") output_file.write("CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y\n") + if idf_target == "esp32p4": + # EspNowBackendHosted.cpp's esp_hosted_send_custom_data()/esp_hosted_register_custom_callback() + # need esp_hosted's peer-data feature enabled to exist at all. + output_file.write("CONFIG_ESP_HOSTED_HOST_FEAT_PEER_DATA=y\n") + # ESP-IDF 6.1 defaults to requiring chip rev >=v3.1; boards in this repo (e.g. m5stack-tab5) + # ship v1.0 silicon, which that bootloader refuses to boot. + output_file.write("CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y\n") + output_file.write("CONFIG_ESP32P4_REV_MIN_100=y\n") def write_flash_variables(output_file, device_properties: dict): flash_size = get_property_or_exit(device_properties, "hardware.flashSize") if not flash_size.endswith("MB"): @@ -181,6 +202,13 @@ def write_flash_variables(output_file, device_properties: dict): esptool_flash_freq = get_property_or_none(device_properties, "hardware.esptoolFlashFreq") if esptool_flash_freq is not None: output_file.write(f"CONFIG_ESPTOOLPY_FLASHFREQ_{esptool_flash_freq}=y\n") + if esptool_flash_freq == "120M": + # >80MHz flash needs HPM; HPM-DC (dummy-cycle auto-tuning) requires a bootloader + # built with BOOTLOADER_FLASH_DC_AWARE, which existing units in the field don't have - + # disable it rather than force a bootloader reflash. + output_file.write("CONFIG_SPI_FLASH_HPM_ENA=y\n") + output_file.write("# CONFIG_SPI_FLASH_HPM_AUTO is not set\n") + output_file.write("CONFIG_SPI_FLASH_HPM_DC_DISABLE=y\n") def write_spiram_variables(output_file, device_properties: dict): idf_target = get_property_or_exit(device_properties, "hardware.target").lower() diff --git a/partitions-16mb-no-sd-dev.csv b/partitions-16mb-no-sd-dev.csv index 5d69f3878..2a508da19 100644 --- a/partitions-16mb-no-sd-dev.csv +++ b/partitions-16mb-no-sd-dev.csv @@ -1,7 +1,7 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k, data, data, fat, , 1000k, diff --git a/partitions-16mb-no-sd.csv b/partitions-16mb-no-sd.csv index 65eeb5a8a..dd442eed9 100644 --- a/partitions-16mb-no-sd.csv +++ b/partitions-16mb-no-sd.csv @@ -1,7 +1,7 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k, data, data, fat, , 11800k, diff --git a/partitions-16mb-with-sd.csv b/partitions-16mb-with-sd.csv index 6e011704c..f5795298c 100644 --- a/partitions-16mb-with-sd.csv +++ b/partitions-16mb-with-sd.csv @@ -1,6 +1,6 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k, diff --git a/partitions-32mb-no-sd-dev.csv b/partitions-32mb-no-sd-dev.csv index 5d69f3878..2a508da19 100644 --- a/partitions-32mb-no-sd-dev.csv +++ b/partitions-32mb-no-sd-dev.csv @@ -1,7 +1,7 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k, data, data, fat, , 1000k, diff --git a/partitions-32mb-no-sd.csv b/partitions-32mb-no-sd.csv index 21f89df11..3c0b8b6a7 100644 --- a/partitions-32mb-no-sd.csv +++ b/partitions-32mb-no-sd.csv @@ -1,7 +1,7 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k, data, data, fat, , 28480k, diff --git a/partitions-4mb-with-sd.csv b/partitions-4mb-with-sd.csv index bf83015c4..5b9085582 100644 --- a/partitions-4mb-with-sd.csv +++ b/partitions-4mb-with-sd.csv @@ -1,6 +1,6 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 3800k, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 3800k, system, data, fat, , 128k, diff --git a/partitions-8mb-no-sd-dev.csv b/partitions-8mb-no-sd-dev.csv index 5d69f3878..2a508da19 100644 --- a/partitions-8mb-no-sd-dev.csv +++ b/partitions-8mb-no-sd-dev.csv @@ -1,7 +1,7 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k, data, data, fat, , 1000k, diff --git a/partitions-8mb-no-sd.csv b/partitions-8mb-no-sd.csv index bdc40599e..87c19cf6a 100644 --- a/partitions-8mb-no-sd.csv +++ b/partitions-8mb-no-sd.csv @@ -1,7 +1,7 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k, data, data, fat, , 3800k, diff --git a/partitions-8mb-with-sd.csv b/partitions-8mb-with-sd.csv index 6e011704c..f5795298c 100644 --- a/partitions-8mb-with-sd.csv +++ b/partitions-8mb-with-sd.csv @@ -1,6 +1,6 @@ # Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 4M, +# Offsets are left blank so the build auto-places partitions relative to CONFIG_PARTITION_TABLE_OFFSET (see device.py), including on targets where that offset is bumped to fit a larger bootloader. +nvs, data, nvs, , 0x6000, +phy_init, data, phy, , 0x1000, +factory, app, factory, , 4M, system, data, fat, , 128k,