diff --git a/.gitignore b/.gitignore index cbec28e3..eb05fa36 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ build/ buildsim/ -build-sim/ -cmake-build-*/ +build-*/ +cmake-*/ CMakeCache.txt *.cbp CMakeFiles diff --git a/Buildscripts/DevicetreeCompiler/source/transformer.py b/Buildscripts/DevicetreeCompiler/source/transformer.py index b4478543..13183769 100644 --- a/Buildscripts/DevicetreeCompiler/source/transformer.py +++ b/Buildscripts/DevicetreeCompiler/source/transformer.py @@ -33,8 +33,8 @@ class DtsTransformer(Transformer): return Device(identifier, properties, devices) def device_property(self, objects: List[object]): name = objects[0] - if len(objects) == 1: - # Boolean property with no value + # Boolean property has no value as the value is implied to be true + if (len(objects) == 1) or (objects[1] is None): return DeviceProperty(name, "boolean", True) if type(objects[1]) is not PropertyValue: raise Exception(f"Object was not converted to PropertyValue: {objects[1]}") diff --git a/Buildscripts/build-all.py b/Buildscripts/build-all.py new file mode 100644 index 00000000..f8395e39 --- /dev/null +++ b/Buildscripts/build-all.py @@ -0,0 +1,38 @@ +import os +import subprocess +import shutil +import time + +def build(device: str) -> bool: + print(f"Building {device}...") + shutil.rmtree(os.path.join('Firmware', 'Generated'), ignore_errors=True) + result = subprocess.run(['python', 'device.py', device], capture_output=True, text=True) + if result.returncode != 0: + print(f"Failed to select device {device}") + return False + result = subprocess.run(['idf.py', f"-Bbuild-all-{device}", 'build'], capture_output=True, text=True) + if result.returncode != 0: + print(f"Build failed for {device}:") + print(result.stdout) + print(result.stderr) + return result.returncode == 0 + +def main(): + start_time = time.time() + buildscripts_dir = 'Devices' + if not os.path.exists(buildscripts_dir): + print(f"Directory '{buildscripts_dir}' not found.") + return + + for item in os.listdir(buildscripts_dir): + item_path = os.path.join(buildscripts_dir, item) + if os.path.isdir(item_path) and item != 'simulator': + if not build(item): + return + + print("All builds succeeded.") + end_time = time.time() + print(f"Elapsed time: {end_time - start_time:.2f} seconds") + +if __name__ == "__main__": + main() diff --git a/Devices/btt-panda-touch/Source/Configuration.cpp b/Devices/btt-panda-touch/Source/Configuration.cpp index 19dd1884..443fbb3f 100644 --- a/Devices/btt-panda-touch/Source/Configuration.cpp +++ b/Devices/btt-panda-touch/Source/Configuration.cpp @@ -27,43 +27,5 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, - .createDevices = createDevices, - .i2c = { - //Touch - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_2, - .scl_io_num = GPIO_NUM_1, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - //Rear header, JST PH 2.0, SDA IO4 / SCL IO3 / GND / 3.3V - i2c::Configuration { - .name = "External", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_4, - .scl_io_num = GPIO_NUM_3, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - } + .createDevices = createDevices }; diff --git a/Devices/btt-panda-touch/bigtreetech,panda-touch.dts b/Devices/btt-panda-touch/bigtreetech,panda-touch.dts new file mode 100644 index 00000000..058694a8 --- /dev/null +++ b/Devices/btt-panda-touch/bigtreetech,panda-touch.dts @@ -0,0 +1,33 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "BigTreeTech Panda Touch"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <2>; + pin-scl = <1>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_external { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <4>; + pin-scl = <3>; + }; +}; diff --git a/Devices/btt-panda-touch/devicetree.yaml b/Devices/btt-panda-touch/devicetree.yaml index a1f5d125..7497f5c0 100644 --- a/Devices/btt-panda-touch/devicetree.yaml +++ b/Devices/btt-panda-touch/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: bigtreetech,panda-touch.dts diff --git a/Devices/cyd-2432s024c/Source/Configuration.cpp b/Devices/cyd-2432s024c/Source/Configuration.cpp index 1a467822..2b9ccad6 100644 --- a/Devices/cyd-2432s024c/Source/Configuration.cpp +++ b/Devices/cyd-2432s024c/Source/Configuration.cpp @@ -29,42 +29,6 @@ static tt::hal::DeviceVector createDevices() { extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - tt::hal::i2c::Configuration { - .name = "First", - .port = I2C_NUM_0, - .initMode = tt::hal::i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_33, - .scl_io_num = GPIO_NUM_32, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - tt::hal::i2c::Configuration { - .name = "Second", - .port = I2C_NUM_1, - .initMode = tt::hal::i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_NC, - .scl_io_num = GPIO_NUM_NC, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { tt::hal::spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/cyd-2432s024c/cyd,2432s024c.dts b/Devices/cyd-2432s024c/cyd,2432s024c.dts new file mode 100644 index 00000000..3791a4b5 --- /dev/null +++ b/Devices/cyd-2432s024c/cyd,2432s024c.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "CYD 2432S024C"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <33>; + pin-scl = <32>; + }; +}; diff --git a/Devices/cyd-2432s024c/devicetree.yaml b/Devices/cyd-2432s024c/devicetree.yaml index a1f5d125..1080dfcd 100644 --- a/Devices/cyd-2432s024c/devicetree.yaml +++ b/Devices/cyd-2432s024c/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,2432s024c.dts diff --git a/Devices/cyd-2432s028r/Source/Configuration.cpp b/Devices/cyd-2432s028r/Source/Configuration.cpp index 7c88c72f..6469188a 100644 --- a/Devices/cyd-2432s028r/Source/Configuration.cpp +++ b/Devices/cyd-2432s028r/Source/Configuration.cpp @@ -31,25 +31,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "CN1", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_27, - .scl_io_num = GPIO_NUM_22, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/cyd-2432s028r/cyd,2432s028r.dts b/Devices/cyd-2432s028r/cyd,2432s028r.dts new file mode 100644 index 00000000..75d49819 --- /dev/null +++ b/Devices/cyd-2432s028r/cyd,2432s028r.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "CYD 2432S028R"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c_cn1 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <27>; + pin-scl = <22>; + }; +}; diff --git a/Devices/cyd-2432s028r/devicetree.yaml b/Devices/cyd-2432s028r/devicetree.yaml index a1f5d125..56c2aa3f 100644 --- a/Devices/cyd-2432s028r/devicetree.yaml +++ b/Devices/cyd-2432s028r/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,2432s028r.dts diff --git a/Devices/cyd-2432s028rv3/Source/Configuration.cpp b/Devices/cyd-2432s028rv3/Source/Configuration.cpp index 7c88c72f..bb410444 100644 --- a/Devices/cyd-2432s028rv3/Source/Configuration.cpp +++ b/Devices/cyd-2432s028rv3/Source/Configuration.cpp @@ -31,25 +31,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "CN1", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_27, - .scl_io_num = GPIO_NUM_22, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { @@ -100,7 +81,6 @@ extern const Configuration hardwareConfiguration = { .lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display }, }, - .uart { uart::Configuration { .name = "P1", diff --git a/Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts b/Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts new file mode 100644 index 00000000..d0219b0d --- /dev/null +++ b/Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "CYD 2432S028R v3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c_cn1 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <27>; + pin-scl = <22>; + }; +}; diff --git a/Devices/cyd-2432s028rv3/devicetree.yaml b/Devices/cyd-2432s028rv3/devicetree.yaml index a1f5d125..03b0114b 100644 --- a/Devices/cyd-2432s028rv3/devicetree.yaml +++ b/Devices/cyd-2432s028rv3/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,2432s028rv3.dts diff --git a/Devices/cyd-2432s032c/Source/Configuration.cpp b/Devices/cyd-2432s032c/Source/Configuration.cpp index e3eec843..75f46e60 100644 --- a/Devices/cyd-2432s032c/Source/Configuration.cpp +++ b/Devices/cyd-2432s032c/Source/Configuration.cpp @@ -45,25 +45,6 @@ static tt::hal::DeviceVector createDevices() { extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - tt::hal::i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = tt::hal::i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_33, - .scl_io_num = GPIO_NUM_32, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display tt::hal::spi::Configuration { diff --git a/Devices/cyd-2432s032c/cyd,2432s032c.dts b/Devices/cyd-2432s032c/cyd,2432s032c.dts new file mode 100644 index 00000000..3b9864d6 --- /dev/null +++ b/Devices/cyd-2432s032c/cyd,2432s032c.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "CYD 2432S032C"; + + gpio1 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <33>; + pin-scl = <32>; + }; +}; diff --git a/Devices/cyd-2432s032c/devicetree.yaml b/Devices/cyd-2432s032c/devicetree.yaml index a1f5d125..c36ab500 100644 --- a/Devices/cyd-2432s032c/devicetree.yaml +++ b/Devices/cyd-2432s032c/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,2432s032c.dts diff --git a/Devices/cyd-4848s040c/Source/Configuration.cpp b/Devices/cyd-4848s040c/Source/Configuration.cpp index a8bb1830..42d914fd 100644 --- a/Devices/cyd-4848s040c/Source/Configuration.cpp +++ b/Devices/cyd-4848s040c/Source/Configuration.cpp @@ -22,44 +22,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - //Touch - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_19, - .scl_io_num = GPIO_NUM_45, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - //H1 header, - i2c::Configuration { - .name = "External", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_NC, - .scl_io_num = GPIO_NUM_NC, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // SD Card & display init spi::Configuration { diff --git a/Devices/cyd-4848s040c/cyd,4848s040c.dts b/Devices/cyd-4848s040c/cyd,4848s040c.dts new file mode 100644 index 00000000..ac13b2e3 --- /dev/null +++ b/Devices/cyd-4848s040c/cyd,4848s040c.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "CYD 4848S040C"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <19>; + pin-scl = <45>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/cyd-4848s040c/devicetree.yaml b/Devices/cyd-4848s040c/devicetree.yaml index a1f5d125..5cf83ae9 100644 --- a/Devices/cyd-4848s040c/devicetree.yaml +++ b/Devices/cyd-4848s040c/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,4848s040c.dts diff --git a/Devices/cyd-8048s043c/Source/Configuration.cpp b/Devices/cyd-8048s043c/Source/Configuration.cpp index 266447e1..045826bd 100644 --- a/Devices/cyd-8048s043c/Source/Configuration.cpp +++ b/Devices/cyd-8048s043c/Source/Configuration.cpp @@ -21,44 +21,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - // Touch - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_19, - .scl_io_num = GPIO_NUM_20, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - // P4 header, JST SH 1.0, GND / 3.3V / IO17 / IO18 - i2c::Configuration { - .name = "External", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_17, - .scl_io_num = GPIO_NUM_18, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // SD Card spi::Configuration { diff --git a/Devices/cyd-8048s043c/cyd,8048s043c.dts b/Devices/cyd-8048s043c/cyd,8048s043c.dts new file mode 100644 index 00000000..9ae77bbf --- /dev/null +++ b/Devices/cyd-8048s043c/cyd,8048s043c.dts @@ -0,0 +1,33 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "CYD 8048S043C"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <19>; + pin-scl = <20>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_external { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <17>; + pin-scl = <18>; + }; +}; diff --git a/Devices/cyd-8048s043c/devicetree.yaml b/Devices/cyd-8048s043c/devicetree.yaml index a1f5d125..a3390e0f 100644 --- a/Devices/cyd-8048s043c/devicetree.yaml +++ b/Devices/cyd-8048s043c/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,8048s043c.dts diff --git a/Devices/cyd-e32r28t/Source/Configuration.cpp b/Devices/cyd-e32r28t/Source/Configuration.cpp index 3a0e573a..986d3420 100644 --- a/Devices/cyd-e32r28t/Source/Configuration.cpp +++ b/Devices/cyd-e32r28t/Source/Configuration.cpp @@ -19,7 +19,6 @@ static tt::hal::DeviceVector createDevices() { extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = {}, .spi = { tt::hal::spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/cyd-e32r28t/cyd,e32r28t.dts b/Devices/cyd-e32r28t/cyd,e32r28t.dts new file mode 100644 index 00000000..3693ecf0 --- /dev/null +++ b/Devices/cyd-e32r28t/cyd,e32r28t.dts @@ -0,0 +1,14 @@ +/dts-v1/; + +#include +#include + +/ { + compatible = "root"; + model = "CYD E32R28T"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; +}; diff --git a/Devices/cyd-e32r28t/devicetree.yaml b/Devices/cyd-e32r28t/devicetree.yaml index a1f5d125..9474d017 100644 --- a/Devices/cyd-e32r28t/devicetree.yaml +++ b/Devices/cyd-e32r28t/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,e32r28t.dts diff --git a/Devices/cyd-e32r32p/Source/Configuration.cpp b/Devices/cyd-e32r32p/Source/Configuration.cpp index 370d8211..795ca4cc 100644 --- a/Devices/cyd-e32r32p/Source/Configuration.cpp +++ b/Devices/cyd-e32r32p/Source/Configuration.cpp @@ -23,25 +23,6 @@ static tt::hal::DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - tt::hal::i2c::Configuration { - .name = "External", - .port = I2C_NUM_0, - .initMode = tt::hal::i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_32, - .scl_io_num = GPIO_NUM_25, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - }, // Display .spi = { tt::hal::spi::Configuration { diff --git a/Devices/cyd-e32r32p/cyd,e32r32p.dts b/Devices/cyd-e32r32p/cyd,e32r32p.dts new file mode 100644 index 00000000..e673b923 --- /dev/null +++ b/Devices/cyd-e32r32p/cyd,e32r32p.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "CYD E32R32P"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c_external { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <32>; + pin-scl = <25>; + }; +}; diff --git a/Devices/cyd-e32r32p/devicetree.yaml b/Devices/cyd-e32r32p/devicetree.yaml index a1f5d125..62572876 100644 --- a/Devices/cyd-e32r32p/devicetree.yaml +++ b/Devices/cyd-e32r32p/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: cyd,e32r32p.dts diff --git a/Devices/elecrow-crowpanel-advance-28/Source/Configuration.cpp b/Devices/elecrow-crowpanel-advance-28/Source/Configuration.cpp index 7704e0a7..65f0050f 100644 --- a/Devices/elecrow-crowpanel-advance-28/Source/Configuration.cpp +++ b/Devices/elecrow-crowpanel-advance-28/Source/Configuration.cpp @@ -21,27 +21,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - // There is only 1 (internal for touch, and also serves as "I2C-OUT" port) - // Note: You could repurpose 1 or more UART interfaces as I2C interfaces - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_15, - .scl_io_num = GPIO_NUM_16, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/elecrow-crowpanel-advance-28/devicetree.yaml b/Devices/elecrow-crowpanel-advance-28/devicetree.yaml index a1f5d125..b9dab81e 100644 --- a/Devices/elecrow-crowpanel-advance-28/devicetree.yaml +++ b/Devices/elecrow-crowpanel-advance-28/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: elecrow,crowpanel-advance-28.dts diff --git a/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts b/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts new file mode 100644 index 00000000..2b241345 --- /dev/null +++ b/Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Elecrow CrowPanel Advance 2.8"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <15>; + pin-scl = <16>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/elecrow-crowpanel-advance-35/Source/Configuration.cpp b/Devices/elecrow-crowpanel-advance-35/Source/Configuration.cpp index 2473c2b1..366e7f1e 100644 --- a/Devices/elecrow-crowpanel-advance-35/Source/Configuration.cpp +++ b/Devices/elecrow-crowpanel-advance-35/Source/Configuration.cpp @@ -23,27 +23,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - // There is only 1 (internal for touch, and also serves as "I2C-OUT" port) - // Note: You could repurpose 1 or more UART interfaces as I2C interfaces - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_15, - .scl_io_num = GPIO_NUM_16, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/elecrow-crowpanel-advance-35/devicetree.yaml b/Devices/elecrow-crowpanel-advance-35/devicetree.yaml index a1f5d125..e1db137b 100644 --- a/Devices/elecrow-crowpanel-advance-35/devicetree.yaml +++ b/Devices/elecrow-crowpanel-advance-35/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: elecrow,crowpanel-advance-35.dts diff --git a/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts b/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts new file mode 100644 index 00000000..f68edd52 --- /dev/null +++ b/Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Elecrow CrowPanel Advance 3.5"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <15>; + pin-scl = <16>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/elecrow-crowpanel-advance-50/Source/Configuration.cpp b/Devices/elecrow-crowpanel-advance-50/Source/Configuration.cpp index a725bc84..9953173f 100644 --- a/Devices/elecrow-crowpanel-advance-50/Source/Configuration.cpp +++ b/Devices/elecrow-crowpanel-advance-50/Source/Configuration.cpp @@ -31,27 +31,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - // There is only 1 (internal for touch, and also serves as "I2C-OUT" port) - // Note: You could repurpose 1 or more UART interfaces as I2C interfaces - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_15, - .scl_io_num = GPIO_NUM_16, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // SD card spi::Configuration { diff --git a/Devices/elecrow-crowpanel-advance-50/devicetree.yaml b/Devices/elecrow-crowpanel-advance-50/devicetree.yaml index a1f5d125..fcea222d 100644 --- a/Devices/elecrow-crowpanel-advance-50/devicetree.yaml +++ b/Devices/elecrow-crowpanel-advance-50/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: elecrow,crowpanel-advance-50.dts diff --git a/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts b/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts new file mode 100644 index 00000000..c4ad962c --- /dev/null +++ b/Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Elecrow CrowPanel Advance 5.0"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <15>; + pin-scl = <16>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp b/Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp index cb99eb68..163679fb 100644 --- a/Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp +++ b/Devices/elecrow-crowpanel-basic-28/Source/Configuration.cpp @@ -23,27 +23,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - // There is only 1 (internal for touch, and also serves as "I2C-OUT" port) - // Note: You could repurpose 1 or more UART interfaces as I2C interfaces - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_22, - .scl_io_num = GPIO_NUM_21, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/elecrow-crowpanel-basic-28/devicetree.yaml b/Devices/elecrow-crowpanel-basic-28/devicetree.yaml index a1f5d125..d2f7ac46 100644 --- a/Devices/elecrow-crowpanel-basic-28/devicetree.yaml +++ b/Devices/elecrow-crowpanel-basic-28/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: elecrow,crowpanel-basic-28.dts diff --git a/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts b/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts new file mode 100644 index 00000000..3ad279f9 --- /dev/null +++ b/Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Elecrow CrowPanel Basic 2.8"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <22>; + pin-scl = <21>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/elecrow-crowpanel-basic-35/Source/Configuration.cpp b/Devices/elecrow-crowpanel-basic-35/Source/Configuration.cpp index bf58810b..8459cb7a 100644 --- a/Devices/elecrow-crowpanel-basic-35/Source/Configuration.cpp +++ b/Devices/elecrow-crowpanel-basic-35/Source/Configuration.cpp @@ -25,27 +25,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - // There is only 1 (internal for touch, and also serves as "I2C-OUT" port) - // Note: You could repurpose 1 or more UART interfaces as I2C interfaces - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_22, - .scl_io_num = GPIO_NUM_21, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/elecrow-crowpanel-basic-35/devicetree.yaml b/Devices/elecrow-crowpanel-basic-35/devicetree.yaml index a1f5d125..fde7e421 100644 --- a/Devices/elecrow-crowpanel-basic-35/devicetree.yaml +++ b/Devices/elecrow-crowpanel-basic-35/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: elecrow,crowpanel-basic-35.dts diff --git a/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts b/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts new file mode 100644 index 00000000..df62cb93 --- /dev/null +++ b/Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Elecrow CrowPanel Basic 3.5"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <22>; + pin-scl = <21>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/elecrow-crowpanel-basic-50/Source/Configuration.cpp b/Devices/elecrow-crowpanel-basic-50/Source/Configuration.cpp index 0b9287a7..012b3b3f 100644 --- a/Devices/elecrow-crowpanel-basic-50/Source/Configuration.cpp +++ b/Devices/elecrow-crowpanel-basic-50/Source/Configuration.cpp @@ -21,27 +21,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - // There is only 1 (internal for touch, and also serves as "I2C-OUT" port) - // Note: You could repurpose 1 or more UART interfaces as I2C interfaces - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_19, - .scl_io_num = GPIO_NUM_20, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // SD card spi::Configuration { diff --git a/Devices/elecrow-crowpanel-basic-50/devicetree.yaml b/Devices/elecrow-crowpanel-basic-50/devicetree.yaml index a1f5d125..054029d7 100644 --- a/Devices/elecrow-crowpanel-basic-50/devicetree.yaml +++ b/Devices/elecrow-crowpanel-basic-50/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: elecrow,crowpanel-basic-50.dts diff --git a/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts b/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts new file mode 100644 index 00000000..18092795 --- /dev/null +++ b/Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Elecrow CrowPanel Basic 5.0"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <19>; + pin-scl = <20>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/generic-esp32/devicetree.yaml b/Devices/generic-esp32/devicetree.yaml index a1f5d125..24e199c8 100644 --- a/Devices/generic-esp32/devicetree.yaml +++ b/Devices/generic-esp32/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: generic,esp32.dts diff --git a/Devices/generic-esp32/generic,esp32.dts b/Devices/generic-esp32/generic,esp32.dts new file mode 100644 index 00000000..65e17365 --- /dev/null +++ b/Devices/generic-esp32/generic,esp32.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Generic ESP32"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; +}; diff --git a/Devices/generic-esp32c6/devicetree.yaml b/Devices/generic-esp32c6/devicetree.yaml index a1f5d125..751f4cb3 100644 --- a/Devices/generic-esp32c6/devicetree.yaml +++ b/Devices/generic-esp32c6/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: generic,esp32c6.dts diff --git a/Devices/generic-esp32c6/generic,esp32c6.dts b/Devices/generic-esp32c6/generic,esp32c6.dts new file mode 100644 index 00000000..42618d62 --- /dev/null +++ b/Devices/generic-esp32c6/generic,esp32c6.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Generic ESP32 C6"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <31>; + }; +}; diff --git a/Devices/generic-esp32p4/devicetree.yaml b/Devices/generic-esp32p4/devicetree.yaml index a1f5d125..a87db210 100644 --- a/Devices/generic-esp32p4/devicetree.yaml +++ b/Devices/generic-esp32p4/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: generic,esp32p4.dts diff --git a/Devices/generic-esp32p4/generic,esp32p4.dts b/Devices/generic-esp32p4/generic,esp32p4.dts new file mode 100644 index 00000000..44ec7a76 --- /dev/null +++ b/Devices/generic-esp32p4/generic,esp32p4.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Generic ESP32 P4"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <57>; + }; +}; diff --git a/Devices/generic-esp32s3/devicetree.yaml b/Devices/generic-esp32s3/devicetree.yaml index a1f5d125..ed8b5b83 100644 --- a/Devices/generic-esp32s3/devicetree.yaml +++ b/Devices/generic-esp32s3/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: generic,esp32s3.dts diff --git a/Devices/generic-esp32s3/generic,esp32s3.dts b/Devices/generic-esp32s3/generic,esp32s3.dts new file mode 100644 index 00000000..ed11aa7f --- /dev/null +++ b/Devices/generic-esp32s3/generic,esp32s3.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Generic ESP32 S3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; +}; diff --git a/Devices/guition-jc1060p470ciwy/Source/Configuration.cpp b/Devices/guition-jc1060p470ciwy/Source/Configuration.cpp index 69f05b30..e43b7a87 100644 --- a/Devices/guition-jc1060p470ciwy/Source/Configuration.cpp +++ b/Devices/guition-jc1060p470ciwy/Source/Configuration.cpp @@ -16,23 +16,4 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_7, - .scl_io_num = GPIO_NUM_8, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - } }; diff --git a/Devices/guition-jc1060p470ciwy/devicetree.yaml b/Devices/guition-jc1060p470ciwy/devicetree.yaml index a1f5d125..211048d4 100644 --- a/Devices/guition-jc1060p470ciwy/devicetree.yaml +++ b/Devices/guition-jc1060p470ciwy/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: guition,jc1060p470ciwy.dts diff --git a/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts b/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts new file mode 100644 index 00000000..36429b1c --- /dev/null +++ b/Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Guition JC1060P470C-I-W-Y"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <57>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <7>; + pin-scl = <8>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/guition-jc2432w328c/Source/Configuration.cpp b/Devices/guition-jc2432w328c/Source/Configuration.cpp index 324147ad..2e2e3d21 100644 --- a/Devices/guition-jc2432w328c/Source/Configuration.cpp +++ b/Devices/guition-jc2432w328c/Source/Configuration.cpp @@ -31,44 +31,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - //Touch - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_33, - .scl_io_num = GPIO_NUM_32, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - //CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V - i2c::Configuration { - .name = "External", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_21, - .scl_io_num = GPIO_NUM_22, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { //Display spi::Configuration { diff --git a/Devices/guition-jc2432w328c/devicetree.yaml b/Devices/guition-jc2432w328c/devicetree.yaml index a1f5d125..0a6b0f25 100644 --- a/Devices/guition-jc2432w328c/devicetree.yaml +++ b/Devices/guition-jc2432w328c/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: guition,jc2432w328c.dts diff --git a/Devices/guition-jc2432w328c/guition,jc2432w328c.dts b/Devices/guition-jc2432w328c/guition,jc2432w328c.dts new file mode 100644 index 00000000..beee8c65 --- /dev/null +++ b/Devices/guition-jc2432w328c/guition,jc2432w328c.dts @@ -0,0 +1,32 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Guition JC2432W328C"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <33>; + pin-scl = <32>; + }; + + /* CN1 header */ + i2c_external { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <21>; + pin-scl = <22>; + }; +}; diff --git a/Devices/guition-jc8048w550c/Source/Configuration.cpp b/Devices/guition-jc8048w550c/Source/Configuration.cpp index 9d418c9f..af29c62a 100644 --- a/Devices/guition-jc8048w550c/Source/Configuration.cpp +++ b/Devices/guition-jc8048w550c/Source/Configuration.cpp @@ -20,45 +20,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - //Touch - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_19, - .scl_io_num = GPIO_NUM_20, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - //P4 header, JST SH 1.25, GND / 3.3V / IO17 / IO18 or - //P5 header, JST SH 1.0, GND / 3.3V / IO17 / IO18 - i2c::Configuration { - .name = "External", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_17, - .scl_io_num = GPIO_NUM_18, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { //SD Card spi::Configuration { diff --git a/Devices/guition-jc8048w550c/devicetree.yaml b/Devices/guition-jc8048w550c/devicetree.yaml index a1f5d125..22a293c7 100644 --- a/Devices/guition-jc8048w550c/devicetree.yaml +++ b/Devices/guition-jc8048w550c/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: guition,jc8048w550c.dts diff --git a/Devices/guition-jc8048w550c/guition,jc8048w550c.dts b/Devices/guition-jc8048w550c/guition,jc8048w550c.dts new file mode 100644 index 00000000..f253f164 --- /dev/null +++ b/Devices/guition-jc8048w550c/guition,jc8048w550c.dts @@ -0,0 +1,35 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Guition JC8048W550C"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <19>; + pin-scl = <20>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_external { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <17>; + pin-scl = <18>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/heltec-wifi-lora-32-v3/Source/Configuration.cpp b/Devices/heltec-wifi-lora-32-v3/Source/Configuration.cpp index 06792bc0..fc020c7f 100644 --- a/Devices/heltec-wifi-lora-32-v3/Source/Configuration.cpp +++ b/Devices/heltec-wifi-lora-32-v3/Source/Configuration.cpp @@ -48,24 +48,5 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - tt::hal::i2c::Configuration { - .name = "Internal", - .port = DISPLAY_I2C_PORT, - .initMode = tt::hal::i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = DISPLAY_PIN_SDA, - .scl_io_num = DISPLAY_PIN_SCL, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master = { - .clk_speed = DISPLAY_I2C_SPEED - }, - .clk_flags = 0 - } - } - }, .spi {}, }; diff --git a/Devices/heltec-wifi-lora-32-v3/devicetree.yaml b/Devices/heltec-wifi-lora-32-v3/devicetree.yaml index a1f5d125..0a5a13f1 100644 --- a/Devices/heltec-wifi-lora-32-v3/devicetree.yaml +++ b/Devices/heltec-wifi-lora-32-v3/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: heltec,wifi-lora-32-v3.dts 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 new file mode 100644 index 00000000..0a54fd48 --- /dev/null +++ b/Devices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Heltec WiFi LoRa 32 V3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <200000>; + pin-sda = <17>; + pin-scl = <18>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/lilygo-tdeck/Source/Configuration.cpp b/Devices/lilygo-tdeck/Source/Configuration.cpp index 6c44b135..8ca07536 100644 --- a/Devices/lilygo-tdeck/Source/Configuration.cpp +++ b/Devices/lilygo-tdeck/Source/Configuration.cpp @@ -26,42 +26,6 @@ static std::vector> createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_18, - .scl_io_num = GPIO_NUM_8, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "External", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_43, - .scl_io_num = GPIO_NUM_44, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/lilygo-tdeck/devicetree.yaml b/Devices/lilygo-tdeck/devicetree.yaml index a1f5d125..ff23f99a 100644 --- a/Devices/lilygo-tdeck/devicetree.yaml +++ b/Devices/lilygo-tdeck/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: lilygo,tdeck.dts diff --git a/Devices/lilygo-tdeck/lilygo,tdeck.dts b/Devices/lilygo-tdeck/lilygo,tdeck.dts new file mode 100644 index 00000000..2676a913 --- /dev/null +++ b/Devices/lilygo-tdeck/lilygo,tdeck.dts @@ -0,0 +1,31 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "LilyGO T-Deck"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <18>; + pin-scl = <8>; + }; + + i2c_external { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <43>; + pin-scl = <44>; + }; +}; diff --git a/Devices/lilygo-tdisplay-s3/Source/Configuration.cpp b/Devices/lilygo-tdisplay-s3/Source/Configuration.cpp index 64e76a15..021fca93 100644 --- a/Devices/lilygo-tdisplay-s3/Source/Configuration.cpp +++ b/Devices/lilygo-tdisplay-s3/Source/Configuration.cpp @@ -20,7 +20,6 @@ static std::vector> createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = {}, .spi { spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/lilygo-tdisplay-s3/devicetree.yaml b/Devices/lilygo-tdisplay-s3/devicetree.yaml index a1f5d125..dbaf4c62 100644 --- a/Devices/lilygo-tdisplay-s3/devicetree.yaml +++ b/Devices/lilygo-tdisplay-s3/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: lilygo,tdisplay-s3.dts diff --git a/Devices/lilygo-tdisplay-s3/lilygo,tdisplay-s3.dts b/Devices/lilygo-tdisplay-s3/lilygo,tdisplay-s3.dts new file mode 100644 index 00000000..d626d6b3 --- /dev/null +++ b/Devices/lilygo-tdisplay-s3/lilygo,tdisplay-s3.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "LilyGO T-Display S3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; +}; diff --git a/Devices/lilygo-tdisplay/Source/Configuration.cpp b/Devices/lilygo-tdisplay/Source/Configuration.cpp index 125bf3e5..996a5b12 100644 --- a/Devices/lilygo-tdisplay/Source/Configuration.cpp +++ b/Devices/lilygo-tdisplay/Source/Configuration.cpp @@ -22,7 +22,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = {}, .spi { spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/lilygo-tdisplay/devicetree.yaml b/Devices/lilygo-tdisplay/devicetree.yaml index a1f5d125..668b09a4 100644 --- a/Devices/lilygo-tdisplay/devicetree.yaml +++ b/Devices/lilygo-tdisplay/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: lilygo,tdisplay.dts diff --git a/Devices/lilygo-tdisplay/lilygo,tdisplay.dts b/Devices/lilygo-tdisplay/lilygo,tdisplay.dts new file mode 100644 index 00000000..b7002491 --- /dev/null +++ b/Devices/lilygo-tdisplay/lilygo,tdisplay.dts @@ -0,0 +1,15 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "LilyGO T-Display"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; +}; diff --git a/Devices/lilygo-tdongle-s3/Source/Configuration.cpp b/Devices/lilygo-tdongle-s3/Source/Configuration.cpp index 837ff7fb..1882d256 100644 --- a/Devices/lilygo-tdongle-s3/Source/Configuration.cpp +++ b/Devices/lilygo-tdongle-s3/Source/Configuration.cpp @@ -21,25 +21,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "STEMMA QT", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_44, - .scl_io_num = GPIO_NUM_43, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { spi::Configuration { .device = SPI3_HOST, diff --git a/Devices/lilygo-tdongle-s3/devicetree.yaml b/Devices/lilygo-tdongle-s3/devicetree.yaml index a1f5d125..53c6ca9c 100644 --- a/Devices/lilygo-tdongle-s3/devicetree.yaml +++ b/Devices/lilygo-tdongle-s3/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: lilygo,tdongle-s3.dts diff --git a/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts b/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts new file mode 100644 index 00000000..de2eb43e --- /dev/null +++ b/Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "LilyGO T-Dongle S3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <44>; + pin-scl = <43>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/m5stack-cardputer-adv/Source/Configuration.cpp b/Devices/m5stack-cardputer-adv/Source/Configuration.cpp index ea973c7b..f2382e36 100644 --- a/Devices/m5stack-cardputer-adv/Source/Configuration.cpp +++ b/Devices/m5stack-cardputer-adv/Source/Configuration.cpp @@ -30,42 +30,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c { - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_8, - .scl_io_num = GPIO_NUM_9, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Port A", // Grove - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_2, - .scl_io_num = GPIO_NUM_1, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - }, .spi { // Display spi::Configuration { diff --git a/Devices/m5stack-cardputer-adv/devicetree.yaml b/Devices/m5stack-cardputer-adv/devicetree.yaml index a1f5d125..a14c75f4 100644 --- a/Devices/m5stack-cardputer-adv/devicetree.yaml +++ b/Devices/m5stack-cardputer-adv/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: m5stack,cardputer-adv.dts diff --git a/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts b/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts new file mode 100644 index 00000000..92625589 --- /dev/null +++ b/Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts @@ -0,0 +1,35 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "M5Stack Cardputer Adv"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <8>; + pin-scl = <9>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_port_a { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <2>; + pin-scl = <1>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/m5stack-cardputer/Source/Configuration.cpp b/Devices/m5stack-cardputer/Source/Configuration.cpp index 980d1e5a..818975a3 100644 --- a/Devices/m5stack-cardputer/Source/Configuration.cpp +++ b/Devices/m5stack-cardputer/Source/Configuration.cpp @@ -28,25 +28,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c { - i2c::Configuration { - .name = "Port A", // Grove - .port = I2C_NUM_0, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_2, - .scl_io_num = GPIO_NUM_1, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - }, .spi { // Display spi::Configuration { diff --git a/Devices/m5stack-cardputer/devicetree.yaml b/Devices/m5stack-cardputer/devicetree.yaml index a1f5d125..bc62574f 100644 --- a/Devices/m5stack-cardputer/devicetree.yaml +++ b/Devices/m5stack-cardputer/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: m5stack,cardputer.dts diff --git a/Devices/m5stack-cardputer/m5stack,cardputer.dts b/Devices/m5stack-cardputer/m5stack,cardputer.dts new file mode 100644 index 00000000..107b2695 --- /dev/null +++ b/Devices/m5stack-cardputer/m5stack,cardputer.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "M5Stack Cardputer"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_port_a { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <2>; + pin-scl = <1>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/m5stack-core2/Source/Configuration.cpp b/Devices/m5stack-core2/Source/Configuration.cpp index 2c956f5e..5ffdc673 100644 --- a/Devices/m5stack-core2/Source/Configuration.cpp +++ b/Devices/m5stack-core2/Source/Configuration.cpp @@ -22,42 +22,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_21, - .scl_io_num = GPIO_NUM_22, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Port A", // Grove - .port = I2C_NUM_1, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_32, - .scl_io_num = GPIO_NUM_33, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/m5stack-core2/devicetree.yaml b/Devices/m5stack-core2/devicetree.yaml index a1f5d125..a245dbaa 100644 --- a/Devices/m5stack-core2/devicetree.yaml +++ b/Devices/m5stack-core2/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: m5stack,core2.dts diff --git a/Devices/m5stack-core2/m5stack,core2.dts b/Devices/m5stack-core2/m5stack,core2.dts new file mode 100644 index 00000000..adff2a8b --- /dev/null +++ b/Devices/m5stack-core2/m5stack,core2.dts @@ -0,0 +1,35 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "M5Stack Core2"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <21>; + pin-scl = <22>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_port_a { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <32>; + pin-scl = <33>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/m5stack-cores3/Source/Configuration.cpp b/Devices/m5stack-cores3/Source/Configuration.cpp index b5742a9e..331923d6 100644 --- a/Devices/m5stack-cores3/Source/Configuration.cpp +++ b/Devices/m5stack-cores3/Source/Configuration.cpp @@ -22,76 +22,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_12, - .scl_io_num = GPIO_NUM_11, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Port A", // Grove - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_2, - .scl_io_num = GPIO_NUM_1, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Port B", // Grove - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_9, - .scl_io_num = GPIO_NUM_8, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Port C", // Grove - .port = I2C_NUM_1, - .initMode = i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_18, - .scl_io_num = GPIO_NUM_17, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { spi::Configuration { .device = SPI3_HOST, diff --git a/Devices/m5stack-cores3/devicetree.yaml b/Devices/m5stack-cores3/devicetree.yaml index a1f5d125..d352fc41 100644 --- a/Devices/m5stack-cores3/devicetree.yaml +++ b/Devices/m5stack-cores3/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: m5stack,cores3.dts diff --git a/Devices/m5stack-cores3/m5stack,cores3.dts b/Devices/m5stack-cores3/m5stack,cores3.dts new file mode 100644 index 00000000..eab71b33 --- /dev/null +++ b/Devices/m5stack-cores3/m5stack,cores3.dts @@ -0,0 +1,55 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "M5Stack CoreS3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <12>; + pin-scl = <11>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_port_a { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <2>; + pin-scl = <1>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_port_b { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <9>; + pin-scl = <8>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_port_c { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <18>; + pin-scl = <17>; + sda-pullup; + scl-pullup; + }; +}; diff --git a/Devices/m5stack-stickc-plus/Source/Configuration.cpp b/Devices/m5stack-stickc-plus/Source/Configuration.cpp index 6ee25488..abd85833 100644 --- a/Devices/m5stack-stickc-plus/Source/Configuration.cpp +++ b/Devices/m5stack-stickc-plus/Source/Configuration.cpp @@ -28,42 +28,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_21, - .scl_io_num = GPIO_NUM_22, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Grove", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_32, - .scl_io_num = GPIO_NUM_33, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/m5stack-stickc-plus/devicetree.yaml b/Devices/m5stack-stickc-plus/devicetree.yaml index a1f5d125..cdf52486 100644 --- a/Devices/m5stack-stickc-plus/devicetree.yaml +++ b/Devices/m5stack-stickc-plus/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: m5stack,stickc-plus.dts diff --git a/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts b/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts new file mode 100644 index 00000000..762794ba --- /dev/null +++ b/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts @@ -0,0 +1,35 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "M5Stack StickC Plus"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <21>; + pin-scl = <22>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_grove { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <32>; + pin-scl = <33>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/m5stack-stickc-plus2/Source/Configuration.cpp b/Devices/m5stack-stickc-plus2/Source/Configuration.cpp index 9c233234..d6c907ae 100644 --- a/Devices/m5stack-stickc-plus2/Source/Configuration.cpp +++ b/Devices/m5stack-stickc-plus2/Source/Configuration.cpp @@ -30,42 +30,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_21, - .scl_io_num = GPIO_NUM_22, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Grove", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_32, - .scl_io_num = GPIO_NUM_33, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/m5stack-stickc-plus2/devicetree.yaml b/Devices/m5stack-stickc-plus2/devicetree.yaml index a1f5d125..2e21c419 100644 --- a/Devices/m5stack-stickc-plus2/devicetree.yaml +++ b/Devices/m5stack-stickc-plus2/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: m5stack,stickc-plus2.dts diff --git a/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts b/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts new file mode 100644 index 00000000..162a18e5 --- /dev/null +++ b/Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts @@ -0,0 +1,34 @@ +/dts-v1/; +#include +#include +#include + +/ { + compatible = "root"; + model = "M5Stack StickC Plus2"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <40>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <21>; + pin-scl = <22>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_grove { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <32>; + pin-scl = <33>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/m5stack-tab5/Source/Configuration.cpp b/Devices/m5stack-tab5/Source/Configuration.cpp index 344a497b..f9016d56 100644 --- a/Devices/m5stack-tab5/Source/Configuration.cpp +++ b/Devices/m5stack-tab5/Source/Configuration.cpp @@ -87,42 +87,6 @@ static bool initBoot() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_31, - .scl_io_num = GPIO_NUM_32, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "Port A", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_53, - .scl_io_num = GPIO_NUM_54, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi = { // SDCard spi::Configuration { diff --git a/Devices/m5stack-tab5/devicetree.yaml b/Devices/m5stack-tab5/devicetree.yaml index a1f5d125..87a600ac 100644 --- a/Devices/m5stack-tab5/devicetree.yaml +++ b/Devices/m5stack-tab5/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: m5stack,tab5.dts diff --git a/Devices/m5stack-tab5/m5stack,tab5.dts b/Devices/m5stack-tab5/m5stack,tab5.dts new file mode 100644 index 00000000..d4576ad9 --- /dev/null +++ b/Devices/m5stack-tab5/m5stack,tab5.dts @@ -0,0 +1,35 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Tab5"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <57>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <31>; + pin-scl = <32>; + pin-sda-pullup; + pin-scl-pullup; + }; + + i2c_port_a { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <53>; + pin-scl = <54>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/placeholder.dts b/Devices/placeholder.dts deleted file mode 100644 index 52596c73..00000000 --- a/Devices/placeholder.dts +++ /dev/null @@ -1,8 +0,0 @@ -/dts-v1/; - -#include - -/ { - compatible = "root"; - model = "Placeholder"; -}; diff --git a/Devices/simulator/Source/Simulator.cpp b/Devices/simulator/Source/Simulator.cpp index e712b27f..be0ac920 100644 --- a/Devices/simulator/Source/Simulator.cpp +++ b/Devices/simulator/Source/Simulator.cpp @@ -40,42 +40,6 @@ static std::vector> createDevices() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = 1, - .scl_io_num = 2, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - i2c::Configuration { - .name = "External", - .port = I2C_NUM_1, - .initMode = i2c::InitMode::ByTactility, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = 3, - .scl_io_num = 2, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .uart = { uart::Configuration { .name = "/dev/ttyUSB0", diff --git a/Devices/simulator/devicetree.yaml b/Devices/simulator/devicetree.yaml index 72523d12..a64ac4e1 100644 --- a/Devices/simulator/devicetree.yaml +++ b/Devices/simulator/devicetree.yaml @@ -1,4 +1,3 @@ dependencies: - - TactilityKernel - Platforms/PlatformPosix -dts: ../placeholder.dts +dts: simulator.dts diff --git a/Devices/unphone/Source/Configuration.cpp b/Devices/unphone/Source/Configuration.cpp index b100729e..a55f02f1 100644 --- a/Devices/unphone/Source/Configuration.cpp +++ b/Devices/unphone/Source/Configuration.cpp @@ -21,42 +21,6 @@ static tt::hal::DeviceVector createDevices() { extern const tt::hal::Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - tt::hal::i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = tt::hal::i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_3, - .scl_io_num = GPIO_NUM_4, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - }, - tt::hal::i2c::Configuration { - .name = "Unused", - .port = I2C_NUM_1, - .initMode = tt::hal::i2c::InitMode::Disabled, - .isMutable = true, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_NC, - .scl_io_num = GPIO_NUM_NC, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { tt::hal::spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/unphone/devicetree.yaml b/Devices/unphone/devicetree.yaml index a1f5d125..b1d3970c 100644 --- a/Devices/unphone/devicetree.yaml +++ b/Devices/unphone/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: unphone.dts diff --git a/Devices/unphone/unphone.dts b/Devices/unphone/unphone.dts new file mode 100644 index 00000000..0da8e2c2 --- /dev/null +++ b/Devices/unphone/unphone.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "unPhone"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <3>; + pin-scl = <4>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp b/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp index ce2934ac..bb631733 100644 --- a/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp +++ b/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp @@ -24,26 +24,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - //I2C Header - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::Disabled, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_16, - .scl_io_num = GPIO_NUM_17, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/waveshare-esp32-s3-geek/devicetree.yaml b/Devices/waveshare-esp32-s3-geek/devicetree.yaml index a1f5d125..e6a28236 100644 --- a/Devices/waveshare-esp32-s3-geek/devicetree.yaml +++ b/Devices/waveshare-esp32-s3-geek/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: waveshare,esp32-s3-geek.dts diff --git a/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts b/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts new file mode 100644 index 00000000..2654dfc3 --- /dev/null +++ b/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Waveshare ESP32-S3-Geek"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <16>; + pin-scl = <17>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp b/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp index 72f90993..6105c253 100644 --- a/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp +++ b/Devices/waveshare-s3-lcd-13/Source/Configuration.cpp @@ -22,26 +22,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - //IMU - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_47, - .scl_io_num = GPIO_NUM_48, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/waveshare-s3-lcd-13/devicetree.yaml b/Devices/waveshare-s3-lcd-13/devicetree.yaml index a1f5d125..5b6d6f6f 100644 --- a/Devices/waveshare-s3-lcd-13/devicetree.yaml +++ b/Devices/waveshare-s3-lcd-13/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: waveshare,s3-lcd-13.dts diff --git a/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts b/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts new file mode 100644 index 00000000..3f8839e7 --- /dev/null +++ b/Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Waveshare S3 LCD 1.3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_main { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <47>; + pin-scl = <48>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp b/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp index 89300ca5..7a6e4107 100644 --- a/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp +++ b/Devices/waveshare-s3-touch-lcd-128/Source/Configuration.cpp @@ -24,25 +24,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_6, - .scl_io_num = GPIO_NUM_7, - .sda_pullup_en = false, - .scl_pullup_en = false, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // Display spi::Configuration { diff --git a/Devices/waveshare-s3-touch-lcd-128/devicetree.yaml b/Devices/waveshare-s3-touch-lcd-128/devicetree.yaml index a1f5d125..a46f5865 100644 --- a/Devices/waveshare-s3-touch-lcd-128/devicetree.yaml +++ b/Devices/waveshare-s3-touch-lcd-128/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: waveshare,s3-touch-lcd-128.dts 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 new file mode 100644 index 00000000..a6b95330 --- /dev/null +++ b/Devices/waveshare-s3-touch-lcd-128/waveshare,s3-touch-lcd-128.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Waveshare S3 Touch LCD 1.28"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_main { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <6>; + pin-scl = <7>; + }; +}; diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp b/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp index 782c60a3..086bb564 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/Source/Configuration.cpp @@ -21,25 +21,6 @@ extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .uiScale = UiScale::Smallest, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_42, - .scl_io_num = GPIO_NUM_41, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { spi::Configuration { .device = SPI2_HOST, diff --git a/Devices/waveshare-s3-touch-lcd-147/devicetree.yaml b/Devices/waveshare-s3-touch-lcd-147/devicetree.yaml index a1f5d125..784d0525 100644 --- a/Devices/waveshare-s3-touch-lcd-147/devicetree.yaml +++ b/Devices/waveshare-s3-touch-lcd-147/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: waveshare,s3-touch-lcd-147.dts 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 new file mode 100644 index 00000000..463e34f0 --- /dev/null +++ b/Devices/waveshare-s3-touch-lcd-147/waveshare,s3-touch-lcd-147.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Waveshare S3 Touch LCD 1.47"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c_internal { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <42>; + pin-scl = <41>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp b/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp index 3c3f2060..2d133577 100644 --- a/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp +++ b/Devices/waveshare-s3-touch-lcd-43/Source/Configuration.cpp @@ -14,27 +14,6 @@ static DeviceVector createDevices() { extern const Configuration hardwareConfiguration = { .createDevices = createDevices, - .i2c = { - // There is only 1 (internal for touch, and also serves as "I2C-OUT" port) - // Note: You could repurpose 1 or more UART interfaces as I2C interfaces - i2c::Configuration { - .name = "Main", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_8, - .scl_io_num = GPIO_NUM_9, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // SD card spi::Configuration { diff --git a/Devices/waveshare-s3-touch-lcd-43/devicetree.yaml b/Devices/waveshare-s3-touch-lcd-43/devicetree.yaml index a1f5d125..50d9c1a0 100644 --- a/Devices/waveshare-s3-touch-lcd-43/devicetree.yaml +++ b/Devices/waveshare-s3-touch-lcd-43/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: waveshare,s3-touch-lcd-43.dts 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 new file mode 100644 index 00000000..4c2826f0 --- /dev/null +++ b/Devices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Waveshare ESP32-S3-Touch-LCD-4.3"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <8>; + pin-scl = <9>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Devices/wireless-tag-wt32-sc01-plus/Source/Configuration.cpp b/Devices/wireless-tag-wt32-sc01-plus/Source/Configuration.cpp index 66f1c6e9..fdf44b16 100644 --- a/Devices/wireless-tag-wt32-sc01-plus/Source/Configuration.cpp +++ b/Devices/wireless-tag-wt32-sc01-plus/Source/Configuration.cpp @@ -21,25 +21,6 @@ static bool initBoot() { extern const Configuration hardwareConfiguration = { .initBoot = initBoot, .createDevices = createDevices, - .i2c = { - i2c::Configuration { - .name = "Internal", - .port = I2C_NUM_0, - .initMode = i2c::InitMode::ByTactility, - .isMutable = false, - .config = (i2c_config_t) { - .mode = I2C_MODE_MASTER, - .sda_io_num = GPIO_NUM_6, - .scl_io_num = GPIO_NUM_5, - .sda_pullup_en = true, - .scl_pullup_en = true, - .master = { - .clk_speed = 400000 - }, - .clk_flags = 0 - } - } - }, .spi { // SD card spi::Configuration { diff --git a/Devices/wireless-tag-wt32-sc01-plus/devicetree.yaml b/Devices/wireless-tag-wt32-sc01-plus/devicetree.yaml index a1f5d125..f40d8931 100644 --- a/Devices/wireless-tag-wt32-sc01-plus/devicetree.yaml +++ b/Devices/wireless-tag-wt32-sc01-plus/devicetree.yaml @@ -1,3 +1,3 @@ dependencies: - - TactilityKernel -dts: ../placeholder.dts + - Platforms/PlatformEsp32 +dts: wireless-tag,wt32-sc01-plus.dts 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 new file mode 100644 index 00000000..6c98b020 --- /dev/null +++ b/Devices/wireless-tag-wt32-sc01-plus/wireless-tag,wt32-sc01-plus.dts @@ -0,0 +1,25 @@ +/dts-v1/; + +#include +#include +#include + +/ { + compatible = "root"; + model = "Wireless-Tag WT32-SC01 Plus"; + + gpio0 { + compatible = "espressif,esp32-gpio"; + gpio-count = <49>; + }; + + i2c0 { + compatible = "espressif,esp32-i2c"; + port = ; + clock-frequency = <400000>; + pin-sda = <6>; + pin-scl = <5>; + pin-sda-pullup; + pin-scl-pullup; + }; +}; diff --git a/Tactility/Include/Tactility/hal/Configuration.h b/Tactility/Include/Tactility/hal/Configuration.h index ee2353a9..f78f2d56 100644 --- a/Tactility/Include/Tactility/hal/Configuration.h +++ b/Tactility/Include/Tactility/hal/Configuration.h @@ -41,9 +41,6 @@ struct Configuration { std::function createDevices = [] { return std::vector>(); }; - /** A list of I2C interface configurations */ - const std::vector i2c = {}; - /** A list of SPI interface configurations */ const std::vector spi = {}; diff --git a/Tactility/Include/Tactility/hal/i2c/I2c.h b/Tactility/Include/Tactility/hal/i2c/I2c.h index 9e7ab4f5..f4f9c34f 100644 --- a/Tactility/Include/Tactility/hal/i2c/I2c.h +++ b/Tactility/Include/Tactility/hal/i2c/I2c.h @@ -12,36 +12,13 @@ namespace tt::hal::i2c { constexpr TickType_t defaultTimeout = 10 / portTICK_PERIOD_MS; -enum class InitMode { - ByTactility, // Tactility will initialize it in the correct bootup phase - Disabled // Not initialized by default -}; - -struct Configuration { - std::string name; - /** The port to operate on */ - i2c_port_t port; - /** Whether this bus should be initialized when device starts up */ - InitMode initMode; - /** - * Whether this bus can be changed after booting. - * If the bus is internal and/or used for core features like touch screen, then it can be declared static. - */ - bool isMutable; - /** Configuration that must be valid when initAtBoot is set to true. */ - i2c_config_t config; -}; - enum class Status { Started, Stopped, Unknown }; -/** - * Start the bus for the specified port. - * Devices might be started automatically at boot if their HAL configuration requires it. - */ +/** Start the bus for the specified port. */ bool start(i2c_port_t port); /** Stop the bus for the specified port. */ diff --git a/Tactility/Include/Tactility/kernel/SystemEvents.h b/Tactility/Include/Tactility/kernel/SystemEvents.h index 9d53f9df..80f3e485 100644 --- a/Tactility/Include/Tactility/kernel/SystemEvents.h +++ b/Tactility/Include/Tactility/kernel/SystemEvents.h @@ -8,12 +8,6 @@ namespace tt::kernel { enum class SystemEvent { BootInitHalBegin, BootInitHalEnd, - BootInitI2cBegin, - BootInitI2cEnd, - BootInitSpiBegin, - BootInitSpiEnd, - BootInitUartBegin, - BootInitUartEnd, BootSplash, /** Gained IP address */ NetworkConnected, diff --git a/Tactility/Private/Tactility/hal/i2c/I2cInit.h b/Tactility/Private/Tactility/hal/i2c/I2cInit.h deleted file mode 100644 index 717473c6..00000000 --- a/Tactility/Private/Tactility/hal/i2c/I2cInit.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "Tactility/hal/i2c/I2c.h" -#include - -namespace tt::hal::i2c { - -/** - * Called by main HAL init to ready the internal state of the I2C HAL. - * @param[in] configurations HAL configuration for a board - * @return true on success - */ -bool init(const std::vector& configurations); - -} \ No newline at end of file diff --git a/Tactility/Source/Tactility.cpp b/Tactility/Source/Tactility.cpp index c262797d..83a1e83b 100644 --- a/Tactility/Source/Tactility.cpp +++ b/Tactility/Source/Tactility.cpp @@ -87,7 +87,6 @@ namespace app { namespace fileselection { extern const AppManifest manifest; } namespace gpssettings { extern const AppManifest manifest; } namespace i2cscanner { extern const AppManifest manifest; } - namespace i2csettings { extern const AppManifest manifest; } namespace imageviewer { extern const AppManifest manifest; } namespace inputdialog { extern const AppManifest manifest; } namespace launcher { extern const AppManifest manifest; } @@ -139,7 +138,6 @@ static void registerInternalApps() { addAppManifest(app::files::manifest); addAppManifest(app::fileselection::manifest); addAppManifest(app::i2cscanner::manifest); - addAppManifest(app::i2csettings::manifest); addAppManifest(app::imageviewer::manifest); addAppManifest(app::inputdialog::manifest); addAppManifest(app::launcher::manifest); diff --git a/Tactility/Source/app/i2csettings/I2cSettings.cpp b/Tactility/Source/app/i2csettings/I2cSettings.cpp deleted file mode 100644 index bd1690fb..00000000 --- a/Tactility/Source/app/i2csettings/I2cSettings.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "Tactility/lvgl/Style.h" -#include "Tactility/lvgl/Toolbar.h" - -#include -#include -#include - -#include - -namespace tt::app::i2csettings { - -static void onSwitchToggled(lv_event_t* event) { - lv_event_code_t code = lv_event_get_code(event); - auto* state_switch = static_cast(lv_event_get_target(event)); - const hal::i2c::Configuration* configuration = static_cast(lv_event_get_user_data(event)); - if (code == LV_EVENT_VALUE_CHANGED) { - bool should_enable = lv_obj_get_state(state_switch) & LV_STATE_CHECKED; - bool is_enabled = hal::i2c::isStarted(configuration->port); - if (is_enabled && !should_enable) { - if (!hal::i2c::stop(configuration->port)) { - lv_obj_add_state(state_switch, LV_STATE_CHECKED); - } - } else if (!is_enabled && should_enable) { - if (!hal::i2c::start(configuration->port)) { - lv_obj_remove_state(state_switch, LV_STATE_CHECKED); - } - } - } -} - -static void show(lv_obj_t* parent, const hal::i2c::Configuration& configuration) { - auto* card = lv_obj_create(parent); - lv_obj_set_height(card, LV_SIZE_CONTENT); - lv_obj_set_style_margin_hor(card, 16, 0); - lv_obj_set_style_margin_bottom(card, 16, 0); - lv_obj_set_width(card, LV_PCT(100)); - auto* port_label = lv_label_create(card); - const char* name = configuration.name.empty() ? "Unnamed" : configuration.name.c_str(); - lv_label_set_text_fmt(port_label, "%s (port %d)", name, configuration.port); - - // On-off switch - - if (configuration.isMutable) { - auto* state_switch = lv_switch_create(card); - lv_obj_align(state_switch, LV_ALIGN_TOP_RIGHT, 0, 0); - - if (hal::i2c::isStarted(configuration.port)) { - lv_obj_add_state(state_switch, LV_STATE_CHECKED); - } - - lv_obj_add_event_cb(state_switch, onSwitchToggled, LV_EVENT_VALUE_CHANGED, (void*) &configuration); - } - - // SDA label - auto* sda_pin_label = lv_label_create(card); - const char* sda_pullup_text = configuration.config.sda_pullup_en ? "yes" : "no"; - lv_label_set_text_fmt(sda_pin_label, "SDA: pin %d, pullup: %s", configuration.config.sda_io_num, sda_pullup_text ); - lv_obj_align_to(sda_pin_label, port_label, LV_ALIGN_OUT_BOTTOM_LEFT, 16, 8); - - // SCL label - auto* scl_pin_label = lv_label_create(card); - const char* scl_pullup_text = configuration.config.scl_pullup_en ? "yes" : "no"; - lv_label_set_text_fmt(scl_pin_label, "SCL: pin %d, pullup: %s", configuration.config.scl_io_num, scl_pullup_text); - lv_obj_align_to(scl_pin_label, sda_pin_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0); - - // Frequency: - if (configuration.config.mode == I2C_MODE_MASTER) { - auto* frequency_label = lv_label_create(card); - lv_label_set_text_fmt(frequency_label, "Frequency: %lu Hz", configuration.config.master.clk_speed); - lv_obj_align_to(frequency_label, scl_pin_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0); - } -} - -class I2cSettingsApp : public App { - - void onShow(AppContext& app, lv_obj_t* parent) override { - lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT); - lvgl::toolbar_create(parent, app); - - auto* wrapper = lv_obj_create(parent); - lv_obj_set_width(wrapper, LV_PCT(100)); - lv_obj_set_flex_grow(wrapper, 1); - lv_obj_set_flex_flow(wrapper, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_all(wrapper, LV_STATE_DEFAULT, 0); - lv_obj_set_style_pad_gap(wrapper, LV_STATE_DEFAULT, 0); - lvgl::obj_set_style_bg_invisible(wrapper); - - for (const auto& configuration: getConfiguration()->hardware->i2c) { - show(wrapper, configuration); - } - } -}; - -extern const AppManifest manifest = { - .appId = "I2cSettings", - .appName = "I2C", - .appIcon = TT_ASSETS_APP_ICON_I2C_SETTINGS, - .appCategory = Category::Settings, - .createApp = create -}; - -} // namespace diff --git a/Tactility/Source/hal/Hal.cpp b/Tactility/Source/hal/Hal.cpp index 3423470c..11d19216 100644 --- a/Tactility/Source/hal/Hal.cpp +++ b/Tactility/Source/hal/Hal.cpp @@ -3,8 +3,6 @@ #include #include #include -#include -#include #include #include #include @@ -68,17 +66,8 @@ static void startDisplays() { void init(const Configuration& configuration) { kernel::publishSystemEvent(kernel::SystemEvent::BootInitHalBegin); - kernel::publishSystemEvent(kernel::SystemEvent::BootInitI2cBegin); - check(i2c::init(configuration.i2c), "I2C init failed"); - kernel::publishSystemEvent(kernel::SystemEvent::BootInitI2cEnd); - - kernel::publishSystemEvent(kernel::SystemEvent::BootInitSpiBegin); check(spi::init(configuration.spi), "SPI init failed"); - kernel::publishSystemEvent(kernel::SystemEvent::BootInitSpiEnd); - - kernel::publishSystemEvent(kernel::SystemEvent::BootInitUartBegin); check(uart::init(configuration.uart), "UART init failed"); - kernel::publishSystemEvent(kernel::SystemEvent::BootInitUartEnd); if (configuration.initBoot != nullptr) { check(configuration.initBoot(), "Init boot failed"); diff --git a/Tactility/Source/hal/i2c/I2c.cpp b/Tactility/Source/hal/i2c/I2c.cpp index 8679b4b2..44a980d8 100644 --- a/Tactility/Source/hal/i2c/I2c.cpp +++ b/Tactility/Source/hal/i2c/I2c.cpp @@ -13,49 +13,15 @@ namespace tt::hal::i2c { -static const auto LOGGER = Logger("I2C"); - -struct Data { - Mutex mutex; - bool isConfigured = false; - Device* device = nullptr; -#ifdef ESP_PLATFORM - Esp32I2cConfig config = { - .port = I2C_NUM_0, - .clockFrequency = 0, - .pinSda = 0, - .pinScl = 0, - .pinSdaPullUp = false, - .pinSclPullUp = false - }; -#endif +class NoLock final : public tt::Lock { + bool lock(TickType_t timeout) const override { return true; } + void unlock() const override { /* NO-OP */ } }; -static Data dataArray[I2C_NUM_MAX]; +static NoLock NO_LOCK; +Device* findDevice(i2c_port_t port) { #ifdef ESP_PLATFORM -void registerDriver(Data& data, const Configuration& configuration) { - // Should only be called on init - check(data.device == nullptr); - - data.config.port = configuration.port; - data.config.clockFrequency = configuration.config.master.clk_speed; - data.config.pinSda = configuration.config.sda_io_num; - data.config.pinScl = configuration.config.scl_io_num; - data.config.pinSdaPullUp = configuration.config.sda_pullup_en; - data.config.pinSclPullUp = configuration.config.scl_pullup_en; - - data.device = new Device(); - data.device->name = configuration.name.c_str(); - data.device->config = &data.config; - data.device->parent = nullptr; - - if (device_construct_add(data.device, "espressif,esp32-i2c") == ERROR_NONE) { - data.isConfigured = true; - } -} - -Device* findExistingKernelDevice(i2c_port_t port) { struct Params { i2c_port_t port; Device* device; @@ -80,192 +46,67 @@ Device* findExistingKernelDevice(i2c_port_t port) { }); return params.device; -} -#endif - -bool init(const std::vector& configurations) { - LOGGER.info("Init"); -#ifdef ESP_PLATFORM - bool found_existing = false; - for (int port = 0; port < I2C_NUM_MAX; ++port) { - auto native_port = static_cast(port); - auto existing_device = findExistingKernelDevice(native_port); - if (existing_device != nullptr) { - LOGGER.info("Initialized port {} with existing kernel device", port); - auto& data = dataArray[port]; - data.device = existing_device; - data.isConfigured = true; - memcpy(&data.config, existing_device->config, sizeof(Esp32I2cConfig)); - // Ensure we don't initialize - found_existing = true; - } - } - - // Nothing found in HAL, so try configuration - for (const auto& configuration: configurations) { - check(!found_existing, "hal::Configuration specifies I2C, but I2C was already initialized by devicetree. Remove the hal::Configuration I2C entries!"); - if (configuration.config.mode != I2C_MODE_MASTER) { - LOGGER.error("Currently only master mode is supported"); - return false; - } - Data& data = dataArray[configuration.port]; - registerDriver(data, configuration); - } - - if (!found_existing) { - for (const auto& config: configurations) { - if (config.initMode == InitMode::ByTactility) { - if (!start(config.port)) { - return false; - } - } - } - } - -#endif - return true; -} - -bool start(i2c_port_t port) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - - Data& data = dataArray[port]; - - if (!data.isConfigured) { - LOGGER.error("({}) Starting: Not configured", static_cast(port)); - return false; - } - - check(data.device); - - error_t error = device_start(data.device); - if (error != ERROR_NONE) { - LOGGER.error("Failed to start device {}: {}", data.device->name, error_to_string(error)); - return false; - } - - return true; -#else - return false; -#endif -} - -bool stop(i2c_port_t port) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - - Data& data = dataArray[port]; - if (!dataArray[port].isConfigured) return false; - return device_stop(data.device) == ERROR_NONE; -#else - return false; -#endif -} - -bool isStarted(i2c_port_t port) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return device_is_ready(dataArray[port].device); -#else - return false; -#endif -} - -const char* getName(i2c_port_t port) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return nullptr; - return dataArray[port].device->name; #else return nullptr; #endif } +bool isStarted(i2c_port_t port) { + auto* device = findDevice(port); + if (device == nullptr) return false; + return device_is_ready(device); +} + +const char* getName(i2c_port_t port) { + auto* device = findDevice(port); + if (device == nullptr) return nullptr; + return device->name; +} + bool masterRead(i2c_port_t port, uint8_t address, uint8_t* data, size_t dataSize, TickType_t timeout) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return i2c_controller_read(dataArray[port].device, address, data, dataSize, timeout) == ERROR_NONE; -#else - return false; -#endif + auto* device = findDevice(port); + if (device == nullptr) return false; + return i2c_controller_read(device, address, data, dataSize, timeout) == ERROR_NONE; } bool masterReadRegister(i2c_port_t port, uint8_t address, uint8_t reg, uint8_t* data, size_t dataSize, TickType_t timeout) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return i2c_controller_read_register(dataArray[port].device, address, reg, data, dataSize, timeout) == ERROR_NONE; -#else - return false; -#endif + auto* device = findDevice(port); + if (device == nullptr) return false; + return i2c_controller_read_register(device, address, reg, data, dataSize, timeout) == ERROR_NONE; } bool masterWrite(i2c_port_t port, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return i2c_controller_write(dataArray[port].device, address, data, dataSize, timeout) == ERROR_NONE; -#else - return false; -#endif + auto* device = findDevice(port); + if (device == nullptr) return false; + return i2c_controller_write(device, address, data, dataSize, timeout) == ERROR_NONE; } bool masterWriteRegister(i2c_port_t port, uint8_t address, uint8_t reg, const uint8_t* data, uint16_t dataSize, TickType_t timeout) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return i2c_controller_write_register(dataArray[port].device, address, reg, data, dataSize, timeout) == ERROR_NONE; -#else - return false; -#endif + auto* device = findDevice(port); + if (device == nullptr) return false; + return i2c_controller_write_register(device, address, reg, data, dataSize, timeout) == ERROR_NONE; } bool masterWriteRegisterArray(i2c_port_t port, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return i2c_controller_write_register_array(dataArray[port].device, address, data, dataSize, timeout) == ERROR_NONE; -#else - return false; -#endif + auto* device = findDevice(port); + if (device == nullptr) return false; + return i2c_controller_write_register_array(device, address, data, dataSize, timeout) == ERROR_NONE; } bool masterWriteRead(i2c_port_t port, uint8_t address, const uint8_t* writeData, size_t writeDataSize, uint8_t* readData, size_t readDataSize, TickType_t timeout) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return i2c_controller_write_read(dataArray[port].device, address, writeData, writeDataSize, readData, readDataSize, timeout) == ERROR_NONE; -#else - return false; -#endif + auto* device = findDevice(port); + if (device == nullptr) return false; + return i2c_controller_write_read(device, address, writeData, writeDataSize, readData, readDataSize, timeout) == ERROR_NONE; } bool masterHasDeviceAtAddress(i2c_port_t port, uint8_t address, TickType_t timeout) { -#ifdef ESP_PLATFORM - auto lock = getLock(port).asScopedLock(); - lock.lock(); - if (!dataArray[port].isConfigured) return false; - return i2c_controller_has_device_at_address(dataArray[port].device, address, timeout) == ERROR_NONE; -#else - return false; -#endif + auto* device = findDevice(port); + if (device == nullptr) return false; + return i2c_controller_has_device_at_address(device, address, timeout) == ERROR_NONE; } Lock& getLock(i2c_port_t port) { - return dataArray[port].mutex; + return NO_LOCK; } } // namespace diff --git a/Tactility/Source/kernel/SystemEvents.cpp b/Tactility/Source/kernel/SystemEvents.cpp index e1e0bd3c..e4ad94a1 100644 --- a/Tactility/Source/kernel/SystemEvents.cpp +++ b/Tactility/Source/kernel/SystemEvents.cpp @@ -28,18 +28,6 @@ static const char* getEventName(SystemEvent event) { return TT_STRINGIFY(BootInitHalBegin); case BootInitHalEnd: return TT_STRINGIFY(BootInitHalEnd); - case BootInitI2cBegin: - return TT_STRINGIFY(BootInitI2cBegin); - case BootInitI2cEnd: - return TT_STRINGIFY(BootInitI2cEnd); - case BootInitSpiBegin: - return TT_STRINGIFY(BootInitSpiBegin); - case BootInitSpiEnd: - return TT_STRINGIFY(BootInitSpiEnd); - case BootInitUartBegin: - return TT_STRINGIFY(BootInitUartBegin); - case BootInitUartEnd: - return TT_STRINGIFY(BootInitUartEnd); case BootSplash: return TT_STRINGIFY(BootSplash); case NetworkConnected: diff --git a/TactilityC/Include/tt_hal_gpio.h b/TactilityC/Include/tt_hal_gpio.h deleted file mode 100644 index 58230139..00000000 --- a/TactilityC/Include/tt_hal_gpio.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** Logical GPIO pin identifier used by the HAL. Typically maps to the SoC GPIO number. */ -typedef unsigned int GpioPin; -/** Value indicating that no GPIO pin is used/applicable. */ -#define GPIO_NO_PIN -1 - -/** GPIO pin mode used by the HAL. - * @warning The order must match tt::hal::gpio::Mode - */ -typedef enum { - /** Pin is disabled (high-impedance). */ - GpioModeDisable = 0, - /** Pin configured as input only. */ - GpioModeInput, - /** Pin configured as push-pull output only. */ - GpioModeOutput, - /** Pin configured as open-drain output only. */ - GpioModeOutputOpenDrain, - /** Pin configured for both input and output (push-pull). */ - GpioModeInputOutput, - /** Pin configured for both input and output (open-drain). */ - GpioModeInputOutputOpenDrain -} GpioMode; - -/** Configure a single GPIO pin. - * @param[in] pin GPIO number to configure. - * @param[in] mode Desired I/O mode for the pin. - * @param[in] pullUp Enable internal pull-up if true. - * @param[in] pullDown Enable internal pull-down if true. - * @return true on success, false if the pin is invalid or configuration failed. - */ -bool tt_hal_gpio_configure(GpioPin pin, GpioMode mode, bool pullUp, bool pullDown); - -/** Configure a set of GPIO pins in one call. - * The bit index of pin N is (1ULL << N). - * @param[in] pinBitMask Bit mask of pins to configure. - * @param[in] mode Desired I/O mode for the pins. - * @param[in] pullUp Enable internal pull-up on the selected pins if true. - * @param[in] pullDown Enable internal pull-down on the selected pins if true. - * @return true on success, false if any pin is invalid or configuration failed. - */ -bool tt_hal_gpio_configure_with_pin_bitmask(uint64_t pinBitMask, GpioMode mode, bool pullUp, bool pullDown); - -/** Set the input/output mode for the specified pin. - * @param[in] pin The pin to configure. - * @param[in] mode The mode to set. - * @return true on success, false if the pin is invalid or mode not supported. - */ -bool tt_hal_gpio_set_mode(GpioPin pin, GpioMode mode); - -/** Read the current logic level of a pin. - * The pin should be configured for input or input/output. - * @param[in] pin The pin to read. - * @return true if the level is high, false if low. If the pin is invalid, the - * behavior is implementation-defined and may return false. - */ -bool tt_hal_gpio_get_level(GpioPin pin); - -/** Drive the output level of a pin. - * The pin should be configured for output or input/output. - * @param[in] pin The pin to drive. - * @param[in] level Output level to set (true = high, false = low). - * @return true on success, false if the pin is invalid or not configured as output. - */ -bool tt_hal_gpio_set_level(GpioPin pin, bool level); - -/** Get the number of GPIO pins available on this platform. - * @return The count of valid GPIO pins. - */ -int tt_hal_gpio_get_pin_count(); - -#ifdef __cplusplus -} -#endif diff --git a/TactilityC/Include/tt_hal_i2c.h b/TactilityC/Include/tt_hal_i2c.h deleted file mode 100644 index c12d5f52..00000000 --- a/TactilityC/Include/tt_hal_i2c.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Start I2C communications for the specified port - * @param[in] port the I2C port to init - * @return true on success - */ -bool tt_hal_i2c_start(i2c_port_t port); - -/** - * Stop I2C communications for the specified port - * @param[in] port the I2C port to deinit - * @return true on success - */ -bool tt_hal_i2c_stop(i2c_port_t port); - -/** - * Check if the port was successfully started. - * @param[in] port the port to check - * @return true when the port was successfully started - */ -bool tt_hal_i2c_is_started(i2c_port_t port); - -/** - * Read from an I2C port in master mode. - * @param[in] port the I2C port to read from - * @param[in] address - * @param[in] data - * @param[in] dataSize - * @param[in] timeout - */ -bool tt_hal_i2c_master_read(i2c_port_t port, uint8_t address, uint8_t* data, size_t dataSize, TickType_t timeout); - -/** - * Read a register from an I2C port in master mode. - * @param[in] port the I2C port to read from - * @param[in] address - * @param[in] reg - * @param[in] data - * @param[in] dataSize - * @param[in] timeout - */ -bool tt_hal_i2c_master_read_register(i2c_port_t port, uint8_t address, uint8_t reg, uint8_t* data, size_t dataSize, TickType_t timeout); - -/** - * Write to an I2C port in master mode. - * @param[in] port the I2C port to write to - * @param[in] address - * @param[in] data - * @param[in] dataSize - * @param[in] timeout - */ -bool tt_hal_i2c_master_write(i2c_port_t port, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout); - -/** - * Write to a register of an I2C port in master mode. - * @param[in] port the I2C port to write to - * @param[in] address - * @param[in] reg - * @param[in] data - * @param[in] dataSize - * @param[in] timeout - */ -bool tt_hal_i2c_master_write_register(i2c_port_t port, uint8_t address, uint8_t reg, const uint8_t* data, uint16_t dataSize, TickType_t timeout); - -/** - * Write then read from an I2C port in master mode. - * @param[in] port the I2C port to communicate with - * @param[in] address - * @param[in] writeData - * @param[in] writeDataSize - * @param[in] readData - * @param[in] readDataSize - * @param[in] timeout - */ -bool tt_hal_i2c_master_write_read(i2c_port_t port, uint8_t address, const uint8_t* writeData, size_t writeDataSize, uint8_t* readData, size_t readDataSize, TickType_t timeout); - -/** - * Check if an I2C port has a device at the specified address. - * @param[in] port the I2C port to communicate with - * @param[in] address - * @param[in] timeout - */ -bool tt_hal_i2c_master_has_device_at_address(i2c_port_t port, uint8_t address, TickType_t timeout); - -/** - * Used to lock an I2C port. - * This is useful for creating thread-safe I2C calls while calling ESP-IDF directly of third party I2C APIs. - * @param[in] port the I2C port to lock - * @param[in] timeout - */ -bool tt_hal_i2c_lock(i2c_port_t port, TickType_t timeout); - -/** - * Used to unlock an I2C port. - * This is useful for creating thread-safe I2C calls while calling ESP-IDF directly of third party I2C APIs. - */ -void tt_hal_i2c_unlock(i2c_port_t port); - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/TactilityC/Source/tt_hal_gpio.cpp b/TactilityC/Source/tt_hal_gpio.cpp deleted file mode 100644 index 8a72527a..00000000 --- a/TactilityC/Source/tt_hal_gpio.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "tt_hal_gpio.h" -#include - -extern "C" { - -using namespace tt::hal; - -bool tt_hal_gpio_configure(GpioPin pin, GpioMode mode, bool pullUp, bool pullDown) { - return gpio::configure(pin, static_cast(mode), pullUp, pullDown); -} - -bool tt_hal_gpio_configure_with_pin_bitmask(uint64_t pinBitMask, GpioMode mode, bool pullUp, bool pullDown) { - return gpio::configureWithPinBitmask(pinBitMask, static_cast(mode), pullUp, pullDown); -} - -bool tt_hal_gpio_set_mode(GpioPin pin, GpioMode mode) { - return gpio::setMode(pin, static_cast(mode)); -} - -bool tt_hal_gpio_get_level(GpioPin pin) { - return gpio::getLevel(pin); -} - -bool tt_hal_gpio_set_level(GpioPin pin, bool level) { - return gpio::setLevel(pin, level); -} - -int tt_hal_gpio_get_pin_count() { - return gpio::getPinCount(); -} - -} diff --git a/TactilityC/Source/tt_hal_i2c.cpp b/TactilityC/Source/tt_hal_i2c.cpp deleted file mode 100644 index ea80824f..00000000 --- a/TactilityC/Source/tt_hal_i2c.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "tt_hal_i2c.h" -#include - -extern "C" { - -bool tt_hal_i2c_start(i2c_port_t port) { - return tt::hal::i2c::start(port); -} - -bool tt_hal_i2c_stop(i2c_port_t port) { - return tt::hal::i2c::stop(port); -} - -bool tt_hal_i2c_is_started(i2c_port_t port) { - return tt::hal::i2c::isStarted(port); -} - -bool tt_hal_i2c_master_read(i2c_port_t port, uint8_t address, uint8_t* data, size_t dataSize, TickType_t timeout) { - return tt::hal::i2c::masterRead(port, address, data, dataSize, timeout); -} - -bool tt_hal_i2c_master_read_register(i2c_port_t port, uint8_t address, uint8_t reg, uint8_t* data, size_t dataSize, TickType_t timeout) { - return tt::hal::i2c::masterReadRegister(port, address, reg, data, dataSize, timeout); -} - -bool tt_hal_i2c_master_write(i2c_port_t port, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout) { - return tt::hal::i2c::masterWrite(port, address, data, dataSize, timeout); -} - -bool tt_hal_i2c_master_write_register(i2c_port_t port, uint8_t address, uint8_t reg, const uint8_t* data, uint16_t dataSize, TickType_t timeout) { - return tt::hal::i2c::masterWriteRegister(port, address, reg, data, dataSize, timeout); -} - -bool tt_hal_i2c_master_write_read(i2c_port_t port, uint8_t address, const uint8_t* writeData, size_t writeDataSize, uint8_t* readData, size_t readDataSize, TickType_t timeout) { - return tt::hal::i2c::masterWriteRead(port, address, writeData, writeDataSize, readData, readDataSize, timeout); -} - -bool tt_hal_i2c_master_has_device_at_address(i2c_port_t port, uint8_t address, TickType_t timeout) { - return tt::hal::i2c::masterHasDeviceAtAddress(port, address, timeout); -} - -bool tt_hal_i2c_lock(i2c_port_t port, TickType_t timeout) { - return tt::hal::i2c::getLock(port).lock(timeout); -} - -void tt_hal_i2c_unlock(i2c_port_t port) { - tt::hal::i2c::getLock(port).unlock(); -} - -} \ No newline at end of file diff --git a/TactilityC/Source/tt_init.cpp b/TactilityC/Source/tt_init.cpp index 68a66188..9b02aac2 100644 --- a/TactilityC/Source/tt_init.cpp +++ b/TactilityC/Source/tt_init.cpp @@ -8,8 +8,6 @@ #include "tt_hal.h" #include "tt_hal_device.h" #include "tt_hal_display.h" -#include "tt_hal_gpio.h" -#include "tt_hal_i2c.h" #include "tt_hal_touch.h" #include "tt_hal_uart.h" #include @@ -219,23 +217,6 @@ const esp_elfsym main_symbols[] { ESP_ELFSYM_EXPORT(tt_hal_display_driver_lock), ESP_ELFSYM_EXPORT(tt_hal_display_driver_unlock), ESP_ELFSYM_EXPORT(tt_hal_display_driver_supported), - ESP_ELFSYM_EXPORT(tt_hal_gpio_configure), - ESP_ELFSYM_EXPORT(tt_hal_gpio_configure_with_pin_bitmask), - ESP_ELFSYM_EXPORT(tt_hal_gpio_set_mode), - ESP_ELFSYM_EXPORT(tt_hal_gpio_get_level), - ESP_ELFSYM_EXPORT(tt_hal_gpio_set_level), - ESP_ELFSYM_EXPORT(tt_hal_gpio_get_pin_count), - ESP_ELFSYM_EXPORT(tt_hal_i2c_start), - ESP_ELFSYM_EXPORT(tt_hal_i2c_stop), - ESP_ELFSYM_EXPORT(tt_hal_i2c_is_started), - ESP_ELFSYM_EXPORT(tt_hal_i2c_master_read), - ESP_ELFSYM_EXPORT(tt_hal_i2c_master_read_register), - ESP_ELFSYM_EXPORT(tt_hal_i2c_master_write), - ESP_ELFSYM_EXPORT(tt_hal_i2c_master_write_register), - ESP_ELFSYM_EXPORT(tt_hal_i2c_master_write_read), - ESP_ELFSYM_EXPORT(tt_hal_i2c_master_has_device_at_address), - ESP_ELFSYM_EXPORT(tt_hal_i2c_lock), - ESP_ELFSYM_EXPORT(tt_hal_i2c_unlock), ESP_ELFSYM_EXPORT(tt_hal_touch_driver_supported), ESP_ELFSYM_EXPORT(tt_hal_touch_driver_alloc), ESP_ELFSYM_EXPORT(tt_hal_touch_driver_free),