From 9a6328688dc0725c6fa912a5e075b139e08c5c0e Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 15 Feb 2026 22:03:24 +0100 Subject: [PATCH 01/10] CMakeLists.txt cleanup --- Firmware/CMakeLists.txt | 44 +++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/Firmware/CMakeLists.txt b/Firmware/CMakeLists.txt index c9048351b..e437f1446 100644 --- a/Firmware/CMakeLists.txt +++ b/Firmware/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20) file(GLOB_RECURSE SOURCE_FILES "Source/*.c*") -# For Generate target below +# Get the project and device id if (DEFINED ENV{ESP_IDF_VERSION}) include("../Buildscripts/device.cmake") init_tactility_globals("../sdkconfig") @@ -10,10 +10,15 @@ if (DEFINED ENV{ESP_IDF_VERSION}) else () set(TACTILITY_DEVICE_ID simulator) set(COMPONENT_LIB FirmwareSim) + set(TACTILITY_DEVICE_PROJECT Simulator) endif () set(DEVICETREE_LOCATION "${CMAKE_SOURCE_DIR}/Devices/${TACTILITY_DEVICE_ID}") +# =============================== +# Generated/ directory creation +# =============================== + set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/Generated") # Ensure the directory is built in the correct CMake build phase # If the check is not done, then another directory is created in the root of the build folder. @@ -21,30 +26,43 @@ if (DEFINED CMAKE_CURRENT_BINARY_DIR) file(MAKE_DIRECTORY "${GENERATED_DIR}") endif () -if (DEFINED ENV{ESP_IDF_VERSION}) +# =============================== +# Component +# =============================== + +list(APPEND REQUIRES_LIST + Tactility + TactilityKernel + ${TACTILITY_DEVICE_PROJECT} +) +if (DEFINED ENV{ESP_IDF_VERSION}) + list(APPEND REQUIRES_LIST + TactilityC + platform-esp32 + ) idf_component_register( SRCS ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c" - REQUIRES Tactility TactilityC TactilityKernel platform-esp32 ${TACTILITY_DEVICE_PROJECT} + REQUIRES ${REQUIRES_LIST} ) - else () - - add_executable(FirmwareSim ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c") - target_link_libraries(FirmwareSim PRIVATE - Tactility + list(APPEND REQUIRES_LIST TactilityCore TactilityFreeRtos - TactilityKernel + platform-posix hal-device-module lvgl-module - Simulator - platform-posix - SDL2::SDL2-static SDL2-static + SDL2::SDL2-static + SDL2-static ) - + add_executable(FirmwareSim ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c") + target_link_libraries(FirmwareSim PRIVATE ${REQUIRES_LIST}) endif () +# =============================== +# Devicetree code generation +# =============================== + add_custom_target(AlwaysRun COMMAND ${CMAKE_COMMAND} -E rm -f "${GENERATED_DIR}/devicetree.c" ) From ca3e9a7cb5a5b77832f211bec2ebcfefb3e86356 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Mon, 16 Feb 2026 22:40:49 +0100 Subject: [PATCH 02/10] Add PI4IOE5V6408 driver module and improve devicetree parsing --- .../DevicetreeCompiler/dependencies.py | 31 +++ .../DevicetreeCompiler/source/generator.py | 30 ++- .../DevicetreeCompiler/source/main.py | 2 +- Devices/m5stack-tab5/Source/module.cpp | 2 +- Devices/m5stack-tab5/devicetree.yaml | 1 + Devices/m5stack-tab5/m5stack,tab5.dts | 11 + Drivers/pi4ioe5v6408-module/CMakeLists.txt | 11 + .../pi4ioe5v6408-module/LICENSE-Apache-2.0.md | 195 ++++++++++++++++++ Drivers/pi4ioe5v6408-module/README.md | 7 + .../bindings/diodes,pi4ioe5v6408.yaml | 5 + Drivers/pi4ioe5v6408-module/devicetree.yaml | 3 + .../include/bindings/pi4ioe5v6408.h | 15 ++ .../include/drivers/pi4ioe5v6408.h | 17 ++ .../include/pi4ioe5v6408_module.h | 14 ++ Drivers/pi4ioe5v6408-module/source/module.cpp | 32 +++ .../source/pi4ioe5v6408.cpp | 41 ++++ Firmware/CMakeLists.txt | 49 ++++- Firmware/Source/Main.cpp | 4 +- .../source/drivers/esp32_gpio.cpp | 4 +- .../source/drivers/esp32_i2c.cpp | 4 +- .../source/drivers/esp32_i2s.cpp | 4 +- .../source/drivers/esp32_spi.cpp | 4 +- .../source/drivers/esp32_uart.cpp | 4 +- Platforms/platform-esp32/source/module.cpp | 2 +- Platforms/platform-posix/source/module.cpp | 2 +- Tactility/Include/Tactility/Tactility.h | 4 +- Tactility/Source/Tactility.cpp | 6 +- .../include/tactility/kernel_init.h | 3 +- TactilityKernel/source/kernel_init.cpp | 12 +- Tests/Tactility/Source/Main.cpp | 5 +- Tests/TactilityKernel/Source/Main.cpp | 7 +- 31 files changed, 485 insertions(+), 46 deletions(-) create mode 100644 Buildscripts/DevicetreeCompiler/dependencies.py create mode 100644 Drivers/pi4ioe5v6408-module/CMakeLists.txt create mode 100644 Drivers/pi4ioe5v6408-module/LICENSE-Apache-2.0.md create mode 100644 Drivers/pi4ioe5v6408-module/README.md create mode 100644 Drivers/pi4ioe5v6408-module/bindings/diodes,pi4ioe5v6408.yaml create mode 100644 Drivers/pi4ioe5v6408-module/devicetree.yaml create mode 100644 Drivers/pi4ioe5v6408-module/include/bindings/pi4ioe5v6408.h create mode 100644 Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h create mode 100644 Drivers/pi4ioe5v6408-module/include/pi4ioe5v6408_module.h create mode 100644 Drivers/pi4ioe5v6408-module/source/module.cpp create mode 100644 Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp diff --git a/Buildscripts/DevicetreeCompiler/dependencies.py b/Buildscripts/DevicetreeCompiler/dependencies.py new file mode 100644 index 000000000..de5c89e6c --- /dev/null +++ b/Buildscripts/DevicetreeCompiler/dependencies.py @@ -0,0 +1,31 @@ +import sys +import os + +from source.printing import print_error +from source.config import parse_config + +def print_help(): + print("Usage: python dependencies.py [in_file]\n") + print(f"\t[in_file] the path where the root devicetree.yaml file is") + +if __name__ == "__main__": + if "--help" in sys.argv: + print_help() + sys.exit() + args = [a for a in sys.argv[1:] if not a.startswith("--")] + if len(args) < 1: + print_error("Missing argument") + print_help() + sys.exit() + + devicetree_yaml_config = args[0] + + if not os.path.exists(devicetree_yaml_config): + print_error(f"Path not found: {devicetree_yaml_config}") + sys.exit(1) + + config = parse_config(devicetree_yaml_config, os.getcwd()) + + for dependency in config.dependencies: + dependency_name = os.path.basename(os.path.normpath(dependency)) + print(dependency_name) diff --git a/Buildscripts/DevicetreeCompiler/source/generator.py b/Buildscripts/DevicetreeCompiler/source/generator.py index 62c8b633c..0e6db71df 100644 --- a/Buildscripts/DevicetreeCompiler/source/generator.py +++ b/Buildscripts/DevicetreeCompiler/source/generator.py @@ -212,7 +212,7 @@ def gather_devices(device: Device, output: list[Device]): for child_device in device.devices: gather_devices(child_device, output) -def generate_devicetree_c(filename: str, items: list[object], bindings: list[Binding], verbose: bool): +def generate_devicetree_c(filename: str, items: list[object], bindings: list[Binding], config, verbose: bool): # Create a cache for looking up device names and aliases easily # We still want to traverse it as a tree during code generation because of parent-setting devices = list() @@ -225,6 +225,7 @@ def generate_devicetree_c(filename: str, items: list[object], bindings: list[Bin // Default headers #include #include + #include // DTS headers ''')) @@ -246,6 +247,25 @@ def generate_devicetree_c(filename: str, items: list[object], bindings: list[Bin write_device_list_entry(file, item, bindings, verbose) file.write("\tDTS_DEVICE_TERMINATOR\n") file.write("};\n") + # Gather module symbols + module_symbol_names = [] + for dependency in config.dependencies: + dependency_name = os.path.basename(os.path.normpath(dependency)) + module_symbol_name = f"{dependency_name.replace('-', '_')}" + if not module_symbol_name.endswith("_module"): + module_symbol_name += "_module" + module_symbol_names.append(module_symbol_name) + file.write("\n") + # Forward declaration of symbol variables + for symbol in module_symbol_names: + file.write(f"extern struct Module {symbol};\n") + file.write("\n") + # Create array of symbol variables + file.write("struct Module* dts_modules[] = {\n") + for symbol in module_symbol_names: + file.write(f"\t&{symbol},\n") + file.write("\tNULL\n") + file.write("};\n") def generate_devicetree_h(filename: str): with open(filename, "w") as file: @@ -258,17 +278,21 @@ def generate_devicetree_h(filename: str): extern "C" { #endif + // Array of device tree modules terminated with DTS_MODULE_TERMINATOR extern struct DtsDevice dts_devices[]; + // Array of module symbols terminated with NULL + extern struct Module* dts_modules[]; + #ifdef __cplusplus } #endif ''')) -def generate(output_path: str, items: list[object], bindings: list[Binding], verbose: bool): +def generate(output_path: str, items: list[object], bindings: list[Binding], config, verbose: bool): if not os.path.exists(output_path): os.makedirs(output_path) devicetree_c_filename = os.path.join(output_path, "devicetree.c") - generate_devicetree_c(devicetree_c_filename, items, bindings, verbose) + generate_devicetree_c(devicetree_c_filename, items, bindings, config, verbose) devicetree_h_filename = os.path.join(output_path, "devicetree.h") generate_devicetree_h(devicetree_h_filename) diff --git a/Buildscripts/DevicetreeCompiler/source/main.py b/Buildscripts/DevicetreeCompiler/source/main.py index b26deba7e..7df473eff 100644 --- a/Buildscripts/DevicetreeCompiler/source/main.py +++ b/Buildscripts/DevicetreeCompiler/source/main.py @@ -46,7 +46,7 @@ def main(config_path: str, output_path: str, verbose: bool) -> int: if verbose: for binding in bindings: pprint(binding) - generate(output_path, transformed, bindings, verbose) + generate(output_path, transformed, bindings, config, verbose) return 0 except DevicetreeException as caught: print("\033[31mError: ", caught, "\033[0m") diff --git a/Devices/m5stack-tab5/Source/module.cpp b/Devices/m5stack-tab5/Source/module.cpp index fc9e2675f..5d4a2258c 100644 --- a/Devices/m5stack-tab5/Source/module.cpp +++ b/Devices/m5stack-tab5/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +Module device_module = { .name = "m5stack-tab5", .start = start, .stop = stop, diff --git a/Devices/m5stack-tab5/devicetree.yaml b/Devices/m5stack-tab5/devicetree.yaml index 82cc35c49..516236386 100644 --- a/Devices/m5stack-tab5/devicetree.yaml +++ b/Devices/m5stack-tab5/devicetree.yaml @@ -1,3 +1,4 @@ dependencies: - Platforms/platform-esp32 + - Drivers/pi4ioe5v6408-module dts: m5stack,tab5.dts diff --git a/Devices/m5stack-tab5/m5stack,tab5.dts b/Devices/m5stack-tab5/m5stack,tab5.dts index ecc811759..8942eaf27 100644 --- a/Devices/m5stack-tab5/m5stack,tab5.dts +++ b/Devices/m5stack-tab5/m5stack,tab5.dts @@ -5,6 +5,7 @@ #include #include #include +#include / { compatible = "root"; @@ -21,6 +22,16 @@ clock-frequency = <400000>; pin-sda = <&gpio0 31 GPIO_FLAG_NONE>; pin-scl = <&gpio0 32 GPIO_FLAG_NONE>; + + io_expander0 { + compatible = "diodes,pi4ioe5v6408"; + register = <0x43>; + }; + + io_expander1 { + compatible = "diodes,pi4ioe5v6408"; + register = <0x44>; + }; }; i2c_port_a: i2c1 { diff --git a/Drivers/pi4ioe5v6408-module/CMakeLists.txt b/Drivers/pi4ioe5v6408-module/CMakeLists.txt new file mode 100644 index 000000000..2bb2469d0 --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.20) + +include("${CMAKE_CURRENT_LIST_DIR}/../../Buildscripts/module.cmake") + +file(GLOB_RECURSE SOURCE_FILES "source/*.c*") + +tactility_add_module(pi4ioe5v6408-module + SRCS ${SOURCE_FILES} + INCLUDE_DIRS include/ + REQUIRES TactilityKernel +) diff --git a/Drivers/pi4ioe5v6408-module/LICENSE-Apache-2.0.md b/Drivers/pi4ioe5v6408-module/LICENSE-Apache-2.0.md new file mode 100644 index 000000000..f5f4b8b5e --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/LICENSE-Apache-2.0.md @@ -0,0 +1,195 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/Drivers/pi4ioe5v6408-module/README.md b/Drivers/pi4ioe5v6408-module/README.md new file mode 100644 index 000000000..e8756122d --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/README.md @@ -0,0 +1,7 @@ +# PI4IOE5V6408 I/O expander + +A driver for the `PI4IOE5V6408` low-voltage translating 8-bit I2C-bus I/O expander by Diodes Incorporated. + +See https://www.diodes.com/part/view/PI4IOE5V6408 + +License: [Apache v2.0](LICENSE-Apache-2.0.md) diff --git a/Drivers/pi4ioe5v6408-module/bindings/diodes,pi4ioe5v6408.yaml b/Drivers/pi4ioe5v6408-module/bindings/diodes,pi4ioe5v6408.yaml new file mode 100644 index 000000000..fe1515e2d --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/bindings/diodes,pi4ioe5v6408.yaml @@ -0,0 +1,5 @@ +description: Diodes Incorporated PI4IOE5V6408 low-voltage translating 8-bit I2C-bus I/O expander + +include: ["i2c-device.yaml"] + +compatible: "diodes,pi4ioe5v6408" diff --git a/Drivers/pi4ioe5v6408-module/devicetree.yaml b/Drivers/pi4ioe5v6408-module/devicetree.yaml new file mode 100644 index 000000000..99f3dfd7e --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/devicetree.yaml @@ -0,0 +1,3 @@ +dependencies: + - TactilityKernel +bindings: bindings \ No newline at end of file diff --git a/Drivers/pi4ioe5v6408-module/include/bindings/pi4ioe5v6408.h b/Drivers/pi4ioe5v6408-module/include/bindings/pi4ioe5v6408.h new file mode 100644 index 000000000..e52687c4d --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/include/bindings/pi4ioe5v6408.h @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +DEFINE_DEVICETREE(pi4ioe5v6408, struct Pi4ioe5v6408Config) + +#ifdef __cplusplus +} +#endif diff --git a/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h new file mode 100644 index 000000000..9cf580299 --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct Pi4ioe5v6408Config { + /** Register */ + uint8_t reg; +}; + +#ifdef __cplusplus +} +#endif diff --git a/Drivers/pi4ioe5v6408-module/include/pi4ioe5v6408_module.h b/Drivers/pi4ioe5v6408-module/include/pi4ioe5v6408_module.h new file mode 100644 index 000000000..eaaf49bfc --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/include/pi4ioe5v6408_module.h @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct Module pi4ioe5v6408_module; + +#ifdef __cplusplus +} +#endif diff --git a/Drivers/pi4ioe5v6408-module/source/module.cpp b/Drivers/pi4ioe5v6408-module/source/module.cpp new file mode 100644 index 000000000..bb744edcb --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/source/module.cpp @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 +#include +#include +#include + +extern "C" { + +extern Driver pi4ioe5v6408_driver; + +static error_t start() { + /* We crash when construct fails, because if a single driver fails to construct, + * there is no guarantee that the previously constructed drivers can be destroyed */ + check(driver_construct_add(&pi4ioe5v6408_driver) == ERROR_NONE); + return ERROR_NONE; +} + +static error_t stop() { + /* We crash when destruct fails, because if a single driver fails to destruct, + * there is no guarantee that the previously destroyed drivers can be recovered */ + check(driver_remove_destruct(&pi4ioe5v6408_driver) == ERROR_NONE); + return ERROR_NONE; +} + +Module pi4ioe5v6408_module = { + .name = "pi4ioe5v6408", + .start = start, + .stop = stop, + .symbols = nullptr, + .internal = nullptr +}; + +} diff --git a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp new file mode 100644 index 000000000..7602bac66 --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: Apache-2.0 +#include +#include +#include +#include + +#include +#include + +#define TAG "PI4IOE5V6408" + +#define GET_DATA(device) ((Pi4DevicePrivate*)device_get_driver_data(device)) + +static error_t start(Device* device) { + auto* parent = device_get_parent(device); + if (device_get_type(parent) != &I2C_CONTROLLER_TYPE) { + LOG_E(TAG, "Parent device is not I2C"); + return ERROR_RESOURCE; + } + LOG_I(TAG, "Started PI4IOE5V6408 device %s", device->name); + return ERROR_NONE; +} + +static error_t stop(Device* device) { + return ERROR_NONE; +} + +extern "C" { + +Driver pi4ioe5v6408_driver = { + .name = "pi4ioe5v6408", + .compatible = (const char*[]) { "diodes,pi4ioe5v6408", nullptr}, + .start_device = start, + .stop_device = stop, + .api = nullptr, + .device_type = nullptr, + .owner = &pi4ioe5v6408_module, + .internal = nullptr +}; + +} \ No newline at end of file diff --git a/Firmware/CMakeLists.txt b/Firmware/CMakeLists.txt index e437f1446..2bd26108c 100644 --- a/Firmware/CMakeLists.txt +++ b/Firmware/CMakeLists.txt @@ -7,17 +7,41 @@ if (DEFINED ENV{ESP_IDF_VERSION}) include("../Buildscripts/device.cmake") init_tactility_globals("../sdkconfig") get_property(TACTILITY_DEVICE_PROJECT GLOBAL PROPERTY TACTILITY_DEVICE_PROJECT) + get_property(TACTILITY_DEVICE_ID GLOBAL PROPERTY TACTILITY_DEVICE_ID) else () set(TACTILITY_DEVICE_ID simulator) set(COMPONENT_LIB FirmwareSim) set(TACTILITY_DEVICE_PROJECT Simulator) endif () -set(DEVICETREE_LOCATION "${CMAKE_SOURCE_DIR}/Devices/${TACTILITY_DEVICE_ID}") +get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) +set(DEVICETREE_LOCATION "${PROJECT_ROOT}/Devices/${TACTILITY_DEVICE_ID}") -# =============================== -# Generated/ directory creation -# =============================== +# +# DTS compiler python dependencies +# + +execute_process( + COMMAND python -m pip install lark==1.3.1 pyyaml==6.0.3 + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) + +# +# Devicetree dependency collection +# + +execute_process( + COMMAND python "${PROJECT_ROOT}/Buildscripts/DevicetreeCompiler/dependencies.py" "${DEVICETREE_LOCATION}" + WORKING_DIRECTORY "${PROJECT_ROOT}" + OUTPUT_VARIABLE DEVICE_DEPENDENCIES + OUTPUT_STRIP_TRAILING_WHITESPACE +) +# Tokenize to array of lines +separate_arguments(DEVICE_DEPENDENCIES UNIX_COMMAND "${DEVICE_DEPENDENCIES}") + +# +# "Generated/" directory creation +# set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/Generated") # Ensure the directory is built in the correct CMake build phase @@ -26,9 +50,9 @@ if (DEFINED CMAKE_CURRENT_BINARY_DIR) file(MAKE_DIRECTORY "${GENERATED_DIR}") endif () -# =============================== +# # Component -# =============================== +# list(APPEND REQUIRES_LIST Tactility @@ -39,8 +63,14 @@ list(APPEND REQUIRES_LIST if (DEFINED ENV{ESP_IDF_VERSION}) list(APPEND REQUIRES_LIST TactilityC - platform-esp32 ) + + # Add devicetree dependencies + foreach(dts_dependency IN LISTS DEVICE_DEPENDENCIES) + message("Adding DTS dependency ${dts_dependency}") + list(APPEND REQUIRES_LIST ${dts_dependency}) + endforeach() + idf_component_register( SRCS ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c" REQUIRES ${REQUIRES_LIST} @@ -59,9 +89,9 @@ else () target_link_libraries(FirmwareSim PRIVATE ${REQUIRES_LIST}) endif () -# =============================== +# # Devicetree code generation -# =============================== +# add_custom_target(AlwaysRun COMMAND ${CMAKE_COMMAND} -E rm -f "${GENERATED_DIR}/devicetree.c" @@ -69,7 +99,6 @@ add_custom_target(AlwaysRun add_custom_command( OUTPUT "${GENERATED_DIR}/devicetree.c" "${GENERATED_DIR}/devicetree.h" - COMMAND pip install lark==1.3.1 pyyaml==6.0.3 COMMAND python "${CMAKE_SOURCE_DIR}/Buildscripts/DevicetreeCompiler/compile.py" "${DEVICETREE_LOCATION}" "${GENERATED_DIR}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" diff --git a/Firmware/Source/Main.cpp b/Firmware/Source/Main.cpp index de6d764c6..3b0c48c31 100644 --- a/Firmware/Source/Main.cpp +++ b/Firmware/Source/Main.cpp @@ -3,8 +3,6 @@ #include #include -// From the relevant platform -extern struct Module platform_module; // From the relevant device extern struct Module device_module; @@ -32,7 +30,7 @@ void app_main() { tt_init_tactility_c(); // ELF bindings for side-loading on ESP32 #endif - tt::run(config, &platform_module, &device_module, dts_devices); + tt::run(config, &device_module, dts_modules, dts_devices); } } // extern \ No newline at end of file diff --git a/Platforms/platform-esp32/source/drivers/esp32_gpio.cpp b/Platforms/platform-esp32/source/drivers/esp32_gpio.cpp index 66bd876a7..d0b39a296 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_gpio.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_gpio.cpp @@ -116,7 +116,7 @@ const static GpioControllerApi esp32_gpio_api = { .get_native_pin_number = get_native_pin_number }; -extern struct Module platform_module; +extern struct Module platform_esp32_module; Driver esp32_gpio_driver = { .name = "esp32_gpio", @@ -125,7 +125,7 @@ Driver esp32_gpio_driver = { .stop_device = stop, .api = (void*)&esp32_gpio_api, .device_type = &GPIO_CONTROLLER_TYPE, - .owner = &platform_module, + .owner = &platform_esp32_module, .internal = nullptr }; diff --git a/Platforms/platform-esp32/source/drivers/esp32_i2c.cpp b/Platforms/platform-esp32/source/drivers/esp32_i2c.cpp index 163597414..5a515ed58 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_i2c.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_i2c.cpp @@ -245,7 +245,7 @@ static constexpr I2cControllerApi ESP32_I2C_API = { .write_register = write_register }; -extern Module platform_module; +extern Module platform_esp32_module; Driver esp32_i2c_driver = { .name = "esp32_i2c", @@ -254,7 +254,7 @@ Driver esp32_i2c_driver = { .stop_device = stop, .api = &ESP32_I2C_API, .device_type = &I2C_CONTROLLER_TYPE, - .owner = &platform_module, + .owner = &platform_esp32_module, .internal = nullptr }; diff --git a/Platforms/platform-esp32/source/drivers/esp32_i2s.cpp b/Platforms/platform-esp32/source/drivers/esp32_i2s.cpp index 8e46a4dd0..b9c350269 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_i2s.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_i2s.cpp @@ -287,7 +287,7 @@ const static I2sControllerApi esp32_i2s_api = { .reset = reset }; -extern struct Module platform_module; +extern struct Module platform_esp32_module; Driver esp32_i2s_driver = { .name = "esp32_i2s", @@ -296,7 +296,7 @@ Driver esp32_i2s_driver = { .stop_device = stop, .api = (void*)&esp32_i2s_api, .device_type = &I2S_CONTROLLER_TYPE, - .owner = &platform_module, + .owner = &platform_esp32_module, .internal = nullptr }; diff --git a/Platforms/platform-esp32/source/drivers/esp32_spi.cpp b/Platforms/platform-esp32/source/drivers/esp32_spi.cpp index 618df8159..e3f5440cf 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_spi.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_spi.cpp @@ -142,7 +142,7 @@ const static struct SpiControllerApi esp32_spi_api = { .unlock = unlock }; -extern struct Module platform_module; +extern struct Module platform_esp32_module; Driver esp32_spi_driver = { .name = "esp32_spi", @@ -151,7 +151,7 @@ Driver esp32_spi_driver = { .stop_device = stop, .api = (void*)&esp32_spi_api, .device_type = &SPI_CONTROLLER_TYPE, - .owner = &platform_module, + .owner = &platform_esp32_module, .internal = nullptr }; diff --git a/Platforms/platform-esp32/source/drivers/esp32_uart.cpp b/Platforms/platform-esp32/source/drivers/esp32_uart.cpp index 784d41516..b7c863efb 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_uart.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_uart.cpp @@ -402,7 +402,7 @@ const static UartControllerApi esp32_uart_api = { .flush_input = flush_input }; -extern struct Module platform_module; +extern struct Module platform_esp32_module; Driver esp32_uart_driver = { .name = "esp32_uart", @@ -411,7 +411,7 @@ Driver esp32_uart_driver = { .stop_device = stop, .api = (void*)&esp32_uart_api, .device_type = &UART_CONTROLLER_TYPE, - .owner = &platform_module, + .owner = &platform_esp32_module, .internal = nullptr }; diff --git a/Platforms/platform-esp32/source/module.cpp b/Platforms/platform-esp32/source/module.cpp index 576006967..036ad42fa 100644 --- a/Platforms/platform-esp32/source/module.cpp +++ b/Platforms/platform-esp32/source/module.cpp @@ -33,7 +33,7 @@ static error_t stop() { } // The name must be exactly "platform_module" -struct Module platform_module = { +struct Module platform_esp32_module = { .name = "platform-esp32", .start = start, .stop = stop, diff --git a/Platforms/platform-posix/source/module.cpp b/Platforms/platform-posix/source/module.cpp index 0dec030cd..1fe01141e 100644 --- a/Platforms/platform-posix/source/module.cpp +++ b/Platforms/platform-posix/source/module.cpp @@ -14,7 +14,7 @@ static error_t stop() { } // The name must be exactly "platform_module" -struct Module platform_module = { +struct Module platform_posix_module = { .name = "platform-posix", .start = start, .stop = stop, diff --git a/Tactility/Include/Tactility/Tactility.h b/Tactility/Include/Tactility/Tactility.h index 16632311d..f0df8def9 100644 --- a/Tactility/Include/Tactility/Tactility.h +++ b/Tactility/Include/Tactility/Tactility.h @@ -24,10 +24,10 @@ struct Configuration { /** * @brief Main entry point for Tactility. * @param platformModule Platform module to start (non-null). - * @param deviceModule Device module to start (non-null). + * @param dtsModules List of modules from devicetree, null-terminated, non-null parameter * @param dtsDevices Array that is terminated with DTS_DEVICE_TERMINATOR */ -void run(const Configuration& config, Module* platformModule, Module* deviceModule, struct DtsDevice dtsDevices[]); +void run(const Configuration& config, Module* deviceModule, Module* dtsModules[], DtsDevice dtsDevices[]); /** * While technically nullable, this instance is always set if tt_init() succeeds. diff --git a/Tactility/Source/Tactility.cpp b/Tactility/Source/Tactility.cpp index 845bde2b6..27be61027 100644 --- a/Tactility/Source/Tactility.cpp +++ b/Tactility/Source/Tactility.cpp @@ -323,13 +323,13 @@ void registerApps() { registerInstalledAppsFromSdCards(); } -void run(const Configuration& config, Module* platformModule, Module* deviceModule, DtsDevice dtsDevices[]) { +void run(const Configuration& config, Module* deviceModule, Module* dtsModules[], DtsDevice dtsDevices[]) { LOGGER.info("Tactility v{} on {} ({})", TT_VERSION, CONFIG_TT_DEVICE_NAME, CONFIG_TT_DEVICE_ID); assert(config.hardware); - LOGGER.info(R"(Calling kernel_init with modules: "{}" and "{}")", platformModule->name, deviceModule->name); - if (kernel_init(platformModule, deviceModule, dtsDevices) != ERROR_NONE) { + LOGGER.info(R"(Calling kernel_init with modules "{}")", deviceModule->name); + if (kernel_init(deviceModule, dtsModules, dtsDevices) != ERROR_NONE) { LOGGER.error("Failed to initialize kernel"); return; } diff --git a/TactilityKernel/include/tactility/kernel_init.h b/TactilityKernel/include/tactility/kernel_init.h index 595b484df..e7a18c93d 100644 --- a/TactilityKernel/include/tactility/kernel_init.h +++ b/TactilityKernel/include/tactility/kernel_init.h @@ -12,10 +12,11 @@ extern "C" { * Initialize the kernel with platform and device modules, and a device tree. * @param platform_module The platform module to start. This module should not be constructed yet. * @param device_module The device module to start. This module should not be constructed yet. This parameter can be NULL. + * @param dts_modules List of modules from devicetree, null-terminated, non-null parameter * @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. This parameter can be NULL. * @return ERROR_NONE on success, otherwise an error code */ -error_t kernel_init(struct Module* platform_module, struct Module* device_module, struct DtsDevice dts_devices[]); +error_t kernel_init(struct Module* device_module, struct Module* dts_modules[], struct DtsDevice dts_devices[]); #ifdef __cplusplus } diff --git a/TactilityKernel/source/kernel_init.cpp b/TactilityKernel/source/kernel_init.cpp index f330061fe..9f1729385 100644 --- a/TactilityKernel/source/kernel_init.cpp +++ b/TactilityKernel/source/kernel_init.cpp @@ -28,7 +28,7 @@ struct Module root_module = { .internal = nullptr }; -error_t kernel_init(struct Module* platform_module, struct Module* device_module, struct DtsDevice dts_devices[]) { +error_t kernel_init(Module* device_module, Module* dts_modules[], DtsDevice dts_devices[]) { LOG_I(TAG, "init"); if (module_construct_add_start(&root_module) != ERROR_NONE) { @@ -36,9 +36,13 @@ error_t kernel_init(struct Module* platform_module, struct Module* device_module return ERROR_RESOURCE; } - if (module_construct_add_start(platform_module) != ERROR_NONE) { - LOG_E(TAG, "platform module init failed"); - return ERROR_RESOURCE; + Module** dts_module = dts_modules; + while (*dts_module != nullptr) { + if (module_construct_add_start(*dts_module) != ERROR_NONE) { + LOG_E(TAG, "dts module init failed: %s", (*dts_module)->name); + return ERROR_RESOURCE; + } + dts_module++; } if (device_module != nullptr) { diff --git a/Tests/Tactility/Source/Main.cpp b/Tests/Tactility/Source/Main.cpp index af411bead..04bfa2215 100644 --- a/Tests/Tactility/Source/Main.cpp +++ b/Tests/Tactility/Source/Main.cpp @@ -15,7 +15,7 @@ typedef struct { } TestTaskData; // From the relevant platform -extern "C" struct Module platform_module; +extern "C" struct Module platform_posix_module; void test_task(void* parameter) { auto* data = (TestTaskData*)parameter; @@ -27,7 +27,8 @@ void test_task(void* parameter) { // overrides context.setOption("no-breaks", true); // don't break in the debugger when assertions fail - check(kernel_init(&platform_module, &hal_device_module, nullptr) == ERROR_NONE); + Module* dts_modules[] = { &platform_posix_module, nullptr }; + check(kernel_init(&hal_device_module, dts_modules, nullptr) == ERROR_NONE); data->result = context.run(); diff --git a/Tests/TactilityKernel/Source/Main.cpp b/Tests/TactilityKernel/Source/Main.cpp index ed234f762..4243aa266 100644 --- a/Tests/TactilityKernel/Source/Main.cpp +++ b/Tests/TactilityKernel/Source/Main.cpp @@ -11,10 +11,8 @@ typedef struct { int result; } TestTaskData; -extern "C" { // From the relevant platform -extern struct Module platform_module; -} +extern "C" struct Module platform_posix_module; void test_task(void* parameter) { auto* data = (TestTaskData*)parameter; @@ -26,7 +24,8 @@ void test_task(void* parameter) { // overrides context.setOption("no-breaks", true); // don't break in the debugger when assertions fail - check(kernel_init(&platform_module, nullptr, nullptr) == ERROR_NONE); + Module* dts_modules[] = { &platform_posix_module, nullptr }; + check(kernel_init(nullptr, dts_modules, nullptr) == ERROR_NONE); data->result = context.run(); From f024bfde62f367e8304f561e28ea2f0cfa0745d1 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Mon, 16 Feb 2026 23:30:42 +0100 Subject: [PATCH 03/10] Driver WIP --- Drivers/pi4ioe5v6408-module/README.md | 1 + .../include/drivers/pi4ioe5v6408.h | 14 ++++++- Drivers/pi4ioe5v6408-module/source/module.cpp | 3 +- .../source/pi4ioe5v6408.cpp | 42 +++++++++++++++++-- Drivers/pi4ioe5v6408-module/source/symbols.c | 11 +++++ Firmware/CMakeLists.txt | 3 +- TactilityKernel/include/tactility/module.h | 1 + 7 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 Drivers/pi4ioe5v6408-module/source/symbols.c diff --git a/Drivers/pi4ioe5v6408-module/README.md b/Drivers/pi4ioe5v6408-module/README.md index e8756122d..38f65bad2 100644 --- a/Drivers/pi4ioe5v6408-module/README.md +++ b/Drivers/pi4ioe5v6408-module/README.md @@ -3,5 +3,6 @@ A driver for the `PI4IOE5V6408` low-voltage translating 8-bit I2C-bus I/O expander by Diodes Incorporated. See https://www.diodes.com/part/view/PI4IOE5V6408 +And: https://www.digikey.com/htmldatasheets/production/3031904/0/0/1/pi4ioe5v6408.html License: [Apache v2.0](LICENSE-Apache-2.0.md) diff --git a/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h index 9cf580299..b3d529bad 100644 --- a/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h +++ b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h @@ -2,16 +2,28 @@ #pragma once #include +#include +#include #ifdef __cplusplus extern "C" { #endif struct Pi4ioe5v6408Config { - /** Register */ + /** Address on bus */ uint8_t reg; }; +error_t pi4ioe5v6408_get_input_level(struct Device* device, uint8_t* bits, TickType_t timeout); + +error_t pi4ioe5v6408_set_output_level(struct Device* device, uint8_t bits, TickType_t timeout); + +error_t pi4ioe5v6408_set_output_high_impedance(struct Device* device, uint8_t bits, TickType_t timeout); + +error_t pi4ioe5v6408_set_input_default_level(struct Device* device, uint8_t bits, TickType_t timeout); + +error_t pi4ioe5v6408_set_direction(struct Device* device, uint8_t bits, TickType_t timeout); + #ifdef __cplusplus } #endif diff --git a/Drivers/pi4ioe5v6408-module/source/module.cpp b/Drivers/pi4ioe5v6408-module/source/module.cpp index bb744edcb..d5c31f458 100644 --- a/Drivers/pi4ioe5v6408-module/source/module.cpp +++ b/Drivers/pi4ioe5v6408-module/source/module.cpp @@ -6,6 +6,7 @@ extern "C" { extern Driver pi4ioe5v6408_driver; +extern const ModuleSymbol pi4ioe5v6408_module_symbols[]; static error_t start() { /* We crash when construct fails, because if a single driver fails to construct, @@ -25,7 +26,7 @@ Module pi4ioe5v6408_module = { .name = "pi4ioe5v6408", .start = start, .stop = stop, - .symbols = nullptr, + .symbols = pi4ioe5v6408_module_symbols, .internal = nullptr }; diff --git a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp index 7602bac66..fba535773 100644 --- a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp +++ b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp @@ -1,15 +1,24 @@ // SPDX-License-Identifier: Apache-2.0 +#include +#include #include #include #include -#include - #include -#include #define TAG "PI4IOE5V6408" -#define GET_DATA(device) ((Pi4DevicePrivate*)device_get_driver_data(device)) +#define GET_CONFIG(device) (static_cast((device)->config)) + +constexpr auto PI4_REGISTER_DIRECTION = 0x03; +constexpr auto PI4_REGISTER_OUTPUT_LEVEL = 0x05; +constexpr auto PI4_REGISTER_OUTPUT_HIGH_IMPEDANCE = 0x07; +constexpr auto PI4_REGISTER_INPUT_DEFAULT_LEVEL = 0x09; +constexpr auto PI4_REGISTER_PULL_ENABLE = 0x0B; +constexpr auto PI4_REGISTER_PULL_SELECT = 0x0D; +constexpr auto PI4_REGISTER_INPUT_LEVEL = 0x0F; +constexpr auto PI4_REGISTER_INTERRUPT_MASK = 0x11; +constexpr auto PI4_REGISTER_INTERRUPT_LEVEL = 0x13; static error_t start(Device* device) { auto* parent = device_get_parent(device); @@ -27,6 +36,31 @@ static error_t stop(Device* device) { extern "C" { +error_t pi4ioe5v6408_get_input_level(struct Device* device, uint8_t* bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_LEVEL, bits, timeout); +} + +error_t pi4ioe5v6408_set_output_level(Device* device, uint8_t bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); +} + +error_t pi4ioe5v6408_set_output_high_impedance(struct Device* device, uint8_t bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_HIGH_IMPEDANCE, bits, timeout); +} + +error_t pi4ioe5v6408_set_input_default_level(struct Device* device, uint8_t bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_DEFAULT_LEVEL, bits, timeout); +} + +error_t pi4ioe5v6408_set_direction(Device* device, uint8_t bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_DIRECTION, bits, timeout); +} + Driver pi4ioe5v6408_driver = { .name = "pi4ioe5v6408", .compatible = (const char*[]) { "diodes,pi4ioe5v6408", nullptr}, diff --git a/Drivers/pi4ioe5v6408-module/source/symbols.c b/Drivers/pi4ioe5v6408-module/source/symbols.c new file mode 100644 index 000000000..1debb71b9 --- /dev/null +++ b/Drivers/pi4ioe5v6408-module/source/symbols.c @@ -0,0 +1,11 @@ +#include +#include + +const struct ModuleSymbol pi4ioe5v6408_module_symbols[] = { + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_get_input_level), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_output_level), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_direction), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_input_default_level), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_output_high_impedance), + MODULE_SYMBOL_TERMINATOR +}; diff --git a/Firmware/CMakeLists.txt b/Firmware/CMakeLists.txt index 2bd26108c..67176675b 100644 --- a/Firmware/CMakeLists.txt +++ b/Firmware/CMakeLists.txt @@ -85,7 +85,8 @@ else () SDL2::SDL2-static SDL2-static ) - add_executable(FirmwareSim ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c") + add_executable(FirmwareSim ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c" + ../Drivers/pi4ioe5v6408-module/source/symbols.c) target_link_libraries(FirmwareSim PRIVATE ${REQUIRES_LIST}) endif () diff --git a/TactilityKernel/include/tactility/module.h b/TactilityKernel/include/tactility/module.h index aa49ba054..345a762c4 100644 --- a/TactilityKernel/include/tactility/module.h +++ b/TactilityKernel/include/tactility/module.h @@ -3,6 +3,7 @@ #include "error.h" #include +#include #include #ifdef __cplusplus From e54ea16b374b5e7676455e89491773bcc3eaa383 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Mon, 16 Feb 2026 23:36:37 +0100 Subject: [PATCH 04/10] Fixes --- Buildscripts/DevicetreeCompiler/dependencies.py | 4 ++-- Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp | 6 +++--- Platforms/platform-esp32/source/module.cpp | 1 - Platforms/platform-posix/source/module.cpp | 1 - Tactility/Include/Tactility/Tactility.h | 2 +- TactilityKernel/include/tactility/kernel_init.h | 1 - 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Buildscripts/DevicetreeCompiler/dependencies.py b/Buildscripts/DevicetreeCompiler/dependencies.py index de5c89e6c..22cf8fa5c 100644 --- a/Buildscripts/DevicetreeCompiler/dependencies.py +++ b/Buildscripts/DevicetreeCompiler/dependencies.py @@ -6,7 +6,7 @@ def print_help(): print("Usage: python dependencies.py [in_file]\n") - print(f"\t[in_file] the path where the root devicetree.yaml file is") + print("\t[in_file] the path where the root devicetree.yaml file is") if __name__ == "__main__": if "--help" in sys.argv: @@ -16,7 +16,7 @@ def print_help(): if len(args) < 1: print_error("Missing argument") print_help() - sys.exit() + sys.exit(1) devicetree_yaml_config = args[0] diff --git a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp index fba535773..9b8544f57 100644 --- a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp +++ b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp @@ -21,17 +21,17 @@ constexpr auto PI4_REGISTER_INTERRUPT_MASK = 0x11; constexpr auto PI4_REGISTER_INTERRUPT_LEVEL = 0x13; static error_t start(Device* device) { - auto* parent = device_get_parent(device); + auto* parent = device_get_parent(device); if (device_get_type(parent) != &I2C_CONTROLLER_TYPE) { LOG_E(TAG, "Parent device is not I2C"); return ERROR_RESOURCE; } LOG_I(TAG, "Started PI4IOE5V6408 device %s", device->name); - return ERROR_NONE; + return ERROR_NONE; } static error_t stop(Device* device) { - return ERROR_NONE; + return ERROR_NONE; } extern "C" { diff --git a/Platforms/platform-esp32/source/module.cpp b/Platforms/platform-esp32/source/module.cpp index 036ad42fa..f75fbb09e 100644 --- a/Platforms/platform-esp32/source/module.cpp +++ b/Platforms/platform-esp32/source/module.cpp @@ -32,7 +32,6 @@ static error_t stop() { return ERROR_NONE; } -// The name must be exactly "platform_module" struct Module platform_esp32_module = { .name = "platform-esp32", .start = start, diff --git a/Platforms/platform-posix/source/module.cpp b/Platforms/platform-posix/source/module.cpp index 1fe01141e..a61b078e6 100644 --- a/Platforms/platform-posix/source/module.cpp +++ b/Platforms/platform-posix/source/module.cpp @@ -13,7 +13,6 @@ static error_t stop() { return ERROR_NONE; } -// The name must be exactly "platform_module" struct Module platform_posix_module = { .name = "platform-posix", .start = start, diff --git a/Tactility/Include/Tactility/Tactility.h b/Tactility/Include/Tactility/Tactility.h index f0df8def9..56bebe865 100644 --- a/Tactility/Include/Tactility/Tactility.h +++ b/Tactility/Include/Tactility/Tactility.h @@ -23,7 +23,7 @@ struct Configuration { /** * @brief Main entry point for Tactility. - * @param platformModule Platform module to start (non-null). + * @param deviceModule Module for the device * @param dtsModules List of modules from devicetree, null-terminated, non-null parameter * @param dtsDevices Array that is terminated with DTS_DEVICE_TERMINATOR */ diff --git a/TactilityKernel/include/tactility/kernel_init.h b/TactilityKernel/include/tactility/kernel_init.h index e7a18c93d..fcfeea741 100644 --- a/TactilityKernel/include/tactility/kernel_init.h +++ b/TactilityKernel/include/tactility/kernel_init.h @@ -10,7 +10,6 @@ extern "C" { /** * Initialize the kernel with platform and device modules, and a device tree. - * @param platform_module The platform module to start. This module should not be constructed yet. * @param device_module The device module to start. This module should not be constructed yet. This parameter can be NULL. * @param dts_modules List of modules from devicetree, null-terminated, non-null parameter * @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. This parameter can be NULL. From 69b828af50b5571a78e3159c97b1905f46272c46 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Feb 2026 21:47:40 +0100 Subject: [PATCH 05/10] Implement IO expander and auto-dependency discovery for devices --- .../DevicetreeCompiler/dependencies.py | 16 +-- Devices/btt-panda-touch/Source/module.cpp | 2 +- Devices/cyd-2432s024c/Source/module.cpp | 2 +- Devices/cyd-2432s028r/Source/module.cpp | 2 +- Devices/cyd-2432s028rv3/Source/module.cpp | 2 +- Devices/cyd-2432s032c/Source/module.cpp | 2 +- Devices/cyd-4848s040c/Source/module.cpp | 2 +- Devices/cyd-8048s043c/Source/module.cpp | 2 +- Devices/cyd-e32r28t/Source/module.cpp | 2 +- Devices/cyd-e32r32p/Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- Devices/generic-esp32/Source/module.cpp | 2 +- Devices/generic-esp32c6/Source/module.cpp | 2 +- Devices/generic-esp32p4/Source/module.cpp | 2 +- Devices/generic-esp32s3/Source/module.cpp | 2 +- .../guition-jc1060p470ciwy/Source/module.cpp | 2 +- Devices/guition-jc2432w328c/Source/module.cpp | 2 +- Devices/guition-jc3248w535c/Source/module.cpp | 2 +- Devices/guition-jc8048w550c/Source/module.cpp | 2 +- .../heltec-wifi-lora-32-v3/Source/module.cpp | 2 +- Devices/lilygo-tdeck/Source/module.cpp | 2 +- Devices/lilygo-tdisplay-s3/Source/module.cpp | 2 +- Devices/lilygo-tdisplay/Source/module.cpp | 2 +- Devices/lilygo-tdongle-s3/Source/module.cpp | 2 +- Devices/lilygo-tlora-pager/Source/module.cpp | 2 +- .../m5stack-cardputer-adv/Source/module.cpp | 2 +- Devices/m5stack-cardputer/Source/module.cpp | 2 +- Devices/m5stack-core2/Source/module.cpp | 2 +- Devices/m5stack-cores3/Source/module.cpp | 2 +- Devices/m5stack-papers3/Source/module.cpp | 2 +- Devices/m5stack-stickc-plus/Source/module.cpp | 2 +- .../m5stack-stickc-plus2/Source/module.cpp | 2 +- Devices/m5stack-tab5/CMakeLists.txt | 2 +- Devices/m5stack-tab5/Source/Configuration.cpp | 99 +++++++------------ Devices/m5stack-tab5/Source/module.cpp | 2 +- Devices/m5stack-tab5/m5stack,tab5.dts | 24 ++++- Devices/simulator/CMakeLists.txt | 8 +- Devices/simulator/Source/module.cpp | 2 +- Devices/unphone/Source/module.cpp | 2 +- .../waveshare-esp32-s3-geek/Source/module.cpp | 2 +- Devices/waveshare-s3-lcd-13/Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../Source/module.cpp | 2 +- .../include/drivers/pi4ioe5v6408.h | 16 ++- .../source/pi4ioe5v6408.cpp | 39 ++++++-- Drivers/pi4ioe5v6408-module/source/symbols.c | 10 +- Firmware/CMakeLists.txt | 20 ++-- Firmware/Source/Main.cpp | 5 +- Tactility/Include/Tactility/Tactility.h | 3 +- Tactility/Source/Tactility.cpp | 12 +-- TactilityKernel/bindings/i2c-device.yaml | 2 +- .../include/tactility/kernel_init.h | 11 +-- TactilityKernel/source/kernel_init.cpp | 16 +-- 60 files changed, 199 insertions(+), 174 deletions(-) diff --git a/Buildscripts/DevicetreeCompiler/dependencies.py b/Buildscripts/DevicetreeCompiler/dependencies.py index 22cf8fa5c..5e5580690 100644 --- a/Buildscripts/DevicetreeCompiler/dependencies.py +++ b/Buildscripts/DevicetreeCompiler/dependencies.py @@ -5,7 +5,7 @@ from source.config import parse_config def print_help(): - print("Usage: python dependencies.py [in_file]\n") + print("Usage: python dependencies.py [path]\n") print("\t[in_file] the path where the root devicetree.yaml file is") if __name__ == "__main__": @@ -18,14 +18,18 @@ def print_help(): print_help() sys.exit(1) - devicetree_yaml_config = args[0] + yaml_directory = args[0] - if not os.path.exists(devicetree_yaml_config): - print_error(f"Path not found: {devicetree_yaml_config}") + if not os.path.exists(yaml_directory): + print_error(f"Path not found: {yaml_directory}") sys.exit(1) - config = parse_config(devicetree_yaml_config, os.getcwd()) - + config = parse_config(yaml_directory, os.getcwd()) + + # Device module is added first because it's started first: + # It creates the root device, so it must exist before its children. + device_dependency = os.path.basename(os.path.normpath(yaml_directory)) + print(device_dependency) for dependency in config.dependencies: dependency_name = os.path.basename(os.path.normpath(dependency)) print(dependency_name) diff --git a/Devices/btt-panda-touch/Source/module.cpp b/Devices/btt-panda-touch/Source/module.cpp index f0b278280..a3083c5ea 100644 --- a/Devices/btt-panda-touch/Source/module.cpp +++ b/Devices/btt-panda-touch/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module btt_panda_touch_module = { .name = "btt-panda-touch", .start = start, .stop = stop, diff --git a/Devices/cyd-2432s024c/Source/module.cpp b/Devices/cyd-2432s024c/Source/module.cpp index cd632d310..582d2ddb1 100644 --- a/Devices/cyd-2432s024c/Source/module.cpp +++ b/Devices/cyd-2432s024c/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_2432s024c_module = { .name = "cyd-2432s024c", .start = start, .stop = stop, diff --git a/Devices/cyd-2432s028r/Source/module.cpp b/Devices/cyd-2432s028r/Source/module.cpp index d5642eee5..e9bffcc9d 100644 --- a/Devices/cyd-2432s028r/Source/module.cpp +++ b/Devices/cyd-2432s028r/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_2432s028r_module = { .name = "cyd-2432s028r", .start = start, .stop = stop, diff --git a/Devices/cyd-2432s028rv3/Source/module.cpp b/Devices/cyd-2432s028rv3/Source/module.cpp index e6633689e..0edef933d 100644 --- a/Devices/cyd-2432s028rv3/Source/module.cpp +++ b/Devices/cyd-2432s028rv3/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_2432s028rv3_module = { .name = "cyd-2432s028rv3", .start = start, .stop = stop, diff --git a/Devices/cyd-2432s032c/Source/module.cpp b/Devices/cyd-2432s032c/Source/module.cpp index 239c5c0f6..0db17a2cc 100644 --- a/Devices/cyd-2432s032c/Source/module.cpp +++ b/Devices/cyd-2432s032c/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_2432s032c_module = { .name = "cyd-2432s032c", .start = start, .stop = stop, diff --git a/Devices/cyd-4848s040c/Source/module.cpp b/Devices/cyd-4848s040c/Source/module.cpp index 44b6b3270..cdb7c4b8d 100644 --- a/Devices/cyd-4848s040c/Source/module.cpp +++ b/Devices/cyd-4848s040c/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_4848s040c_module = { .name = "cyd-4848s040c", .start = start, .stop = stop, diff --git a/Devices/cyd-8048s043c/Source/module.cpp b/Devices/cyd-8048s043c/Source/module.cpp index 58e041160..5fe9733a8 100644 --- a/Devices/cyd-8048s043c/Source/module.cpp +++ b/Devices/cyd-8048s043c/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_8048s043c_module = { .name = "cyd-8048s043c", .start = start, .stop = stop, diff --git a/Devices/cyd-e32r28t/Source/module.cpp b/Devices/cyd-e32r28t/Source/module.cpp index 615d412ca..abdc63841 100644 --- a/Devices/cyd-e32r28t/Source/module.cpp +++ b/Devices/cyd-e32r28t/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_e32r28t_module = { .name = "cyd-e32r28t", .start = start, .stop = stop, diff --git a/Devices/cyd-e32r32p/Source/module.cpp b/Devices/cyd-e32r32p/Source/module.cpp index 62e4d2936..a0030fba8 100644 --- a/Devices/cyd-e32r32p/Source/module.cpp +++ b/Devices/cyd-e32r32p/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module cyd_e32r32p_module = { .name = "cyd-e32r32p", .start = start, .stop = stop, diff --git a/Devices/elecrow-crowpanel-advance-28/Source/module.cpp b/Devices/elecrow-crowpanel-advance-28/Source/module.cpp index 82221ebcf..e920f8a34 100644 --- a/Devices/elecrow-crowpanel-advance-28/Source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-28/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module elecrow_crowpanel_advance_28_module = { .name = "elecrow-crowpanel-advance-28", .start = start, .stop = stop, diff --git a/Devices/elecrow-crowpanel-advance-35/Source/module.cpp b/Devices/elecrow-crowpanel-advance-35/Source/module.cpp index 34048139e..1d4b85f25 100644 --- a/Devices/elecrow-crowpanel-advance-35/Source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-35/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module elecrow_crowpanel_advance_35_module = { .name = "elecrow-crowpanel-advance-35", .start = start, .stop = stop, diff --git a/Devices/elecrow-crowpanel-advance-50/Source/module.cpp b/Devices/elecrow-crowpanel-advance-50/Source/module.cpp index ec449848e..be19de5a4 100644 --- a/Devices/elecrow-crowpanel-advance-50/Source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-50/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module elecrow_crowpanel_advance_50_module = { .name = "elecrow-crowpanel-advance-50", .start = start, .stop = stop, diff --git a/Devices/elecrow-crowpanel-basic-28/Source/module.cpp b/Devices/elecrow-crowpanel-basic-28/Source/module.cpp index eed3d132e..d8534fdfe 100644 --- a/Devices/elecrow-crowpanel-basic-28/Source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-28/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module elecrow_crowpanel_basic_28_module = { .name = "elecrow-crowpanel-basic-28", .start = start, .stop = stop, diff --git a/Devices/elecrow-crowpanel-basic-35/Source/module.cpp b/Devices/elecrow-crowpanel-basic-35/Source/module.cpp index 0af55e096..45664068f 100644 --- a/Devices/elecrow-crowpanel-basic-35/Source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-35/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module elecrow_crowpanel_basic_35_module = { .name = "elecrow-crowpanel-basic-35", .start = start, .stop = stop, diff --git a/Devices/elecrow-crowpanel-basic-50/Source/module.cpp b/Devices/elecrow-crowpanel-basic-50/Source/module.cpp index e38e0036e..5ff31e6f6 100644 --- a/Devices/elecrow-crowpanel-basic-50/Source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-50/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module elecrow_crowpanel_basic_50_module = { .name = "elecrow-crowpanel-basic-50", .start = start, .stop = stop, diff --git a/Devices/generic-esp32/Source/module.cpp b/Devices/generic-esp32/Source/module.cpp index d21e23654..3fb508405 100644 --- a/Devices/generic-esp32/Source/module.cpp +++ b/Devices/generic-esp32/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module generic_esp32_module = { .name = "generic-esp32", .start = start, .stop = stop, diff --git a/Devices/generic-esp32c6/Source/module.cpp b/Devices/generic-esp32c6/Source/module.cpp index 231208d4d..c29b8156e 100644 --- a/Devices/generic-esp32c6/Source/module.cpp +++ b/Devices/generic-esp32c6/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module generic_esp32c6_module = { .name = "generic-esp32c6", .start = start, .stop = stop, diff --git a/Devices/generic-esp32p4/Source/module.cpp b/Devices/generic-esp32p4/Source/module.cpp index 82290049f..090360a40 100644 --- a/Devices/generic-esp32p4/Source/module.cpp +++ b/Devices/generic-esp32p4/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module generic_esp32p4_module = { .name = "generic-esp32p4", .start = start, .stop = stop, diff --git a/Devices/generic-esp32s3/Source/module.cpp b/Devices/generic-esp32s3/Source/module.cpp index 7efaed5eb..7b943d251 100644 --- a/Devices/generic-esp32s3/Source/module.cpp +++ b/Devices/generic-esp32s3/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module generic_esp32s3_module = { .name = "generic-esp32s3", .start = start, .stop = stop, diff --git a/Devices/guition-jc1060p470ciwy/Source/module.cpp b/Devices/guition-jc1060p470ciwy/Source/module.cpp index 71a565f20..ced400f22 100644 --- a/Devices/guition-jc1060p470ciwy/Source/module.cpp +++ b/Devices/guition-jc1060p470ciwy/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module guition_jc1060p470ciwy_module = { .name = "guition-jc1060p470ciwy", .start = start, .stop = stop, diff --git a/Devices/guition-jc2432w328c/Source/module.cpp b/Devices/guition-jc2432w328c/Source/module.cpp index e33a90c0a..eb6cf8ad7 100644 --- a/Devices/guition-jc2432w328c/Source/module.cpp +++ b/Devices/guition-jc2432w328c/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module guition_jc2432w328c_module = { .name = "guition-jc2432w328c", .start = start, .stop = stop, diff --git a/Devices/guition-jc3248w535c/Source/module.cpp b/Devices/guition-jc3248w535c/Source/module.cpp index f9c906503..7024c59ef 100644 --- a/Devices/guition-jc3248w535c/Source/module.cpp +++ b/Devices/guition-jc3248w535c/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module guition_jc3248w535c_module = { .name = "guition-jc3248w535c", .start = start, .stop = stop, diff --git a/Devices/guition-jc8048w550c/Source/module.cpp b/Devices/guition-jc8048w550c/Source/module.cpp index a4406fb7b..4ad11735d 100644 --- a/Devices/guition-jc8048w550c/Source/module.cpp +++ b/Devices/guition-jc8048w550c/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module guition_jc8048w550c_module = { .name = "guition-jc8048w550c", .start = start, .stop = stop, diff --git a/Devices/heltec-wifi-lora-32-v3/Source/module.cpp b/Devices/heltec-wifi-lora-32-v3/Source/module.cpp index ecb336ab9..030dc8a76 100644 --- a/Devices/heltec-wifi-lora-32-v3/Source/module.cpp +++ b/Devices/heltec-wifi-lora-32-v3/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module heltec_wifi_lora_32_v3_module = { .name = "heltec-wifi-lora-32-v3", .start = start, .stop = stop, diff --git a/Devices/lilygo-tdeck/Source/module.cpp b/Devices/lilygo-tdeck/Source/module.cpp index 298c614e9..0f8452148 100644 --- a/Devices/lilygo-tdeck/Source/module.cpp +++ b/Devices/lilygo-tdeck/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module lilygo_tdeck_module = { .name = "lilygo-tdeck", .start = start, .stop = stop, diff --git a/Devices/lilygo-tdisplay-s3/Source/module.cpp b/Devices/lilygo-tdisplay-s3/Source/module.cpp index fa3624ba1..f9018b539 100644 --- a/Devices/lilygo-tdisplay-s3/Source/module.cpp +++ b/Devices/lilygo-tdisplay-s3/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module lilygo_tdisplay_s3_module = { .name = "lilygo-tdisplay-s3", .start = start, .stop = stop, diff --git a/Devices/lilygo-tdisplay/Source/module.cpp b/Devices/lilygo-tdisplay/Source/module.cpp index e0db7dcc0..0b7a1df35 100644 --- a/Devices/lilygo-tdisplay/Source/module.cpp +++ b/Devices/lilygo-tdisplay/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module lilygo_tdisplay_module = { .name = "lilygo-tdisplay", .start = start, .stop = stop, diff --git a/Devices/lilygo-tdongle-s3/Source/module.cpp b/Devices/lilygo-tdongle-s3/Source/module.cpp index b1ef5fb34..7935e802a 100644 --- a/Devices/lilygo-tdongle-s3/Source/module.cpp +++ b/Devices/lilygo-tdongle-s3/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module lilygo_tdongle_s3_module = { .name = "lilygo-tdongle-s3", .start = start, .stop = stop, diff --git a/Devices/lilygo-tlora-pager/Source/module.cpp b/Devices/lilygo-tlora-pager/Source/module.cpp index 23a4de5e6..67616f743 100644 --- a/Devices/lilygo-tlora-pager/Source/module.cpp +++ b/Devices/lilygo-tlora-pager/Source/module.cpp @@ -21,7 +21,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module lilygo_tlora_pager_module = { .name = "lilygo-tlora-pager", .start = start, .stop = stop, diff --git a/Devices/m5stack-cardputer-adv/Source/module.cpp b/Devices/m5stack-cardputer-adv/Source/module.cpp index e49f44b45..1a8247ad6 100644 --- a/Devices/m5stack-cardputer-adv/Source/module.cpp +++ b/Devices/m5stack-cardputer-adv/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module m5stack_cardputer_adv_module = { .name = "m5stack-cardputer-adv", .start = start, .stop = stop, diff --git a/Devices/m5stack-cardputer/Source/module.cpp b/Devices/m5stack-cardputer/Source/module.cpp index 4cb38034f..801b020a5 100644 --- a/Devices/m5stack-cardputer/Source/module.cpp +++ b/Devices/m5stack-cardputer/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module m5stack_cardputer_module = { .name = "m5stack-cardputer", .start = start, .stop = stop, diff --git a/Devices/m5stack-core2/Source/module.cpp b/Devices/m5stack-core2/Source/module.cpp index abe981865..6703f7f4f 100644 --- a/Devices/m5stack-core2/Source/module.cpp +++ b/Devices/m5stack-core2/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module m5stack_core2_module = { .name = "m5stack-core2", .start = start, .stop = stop, diff --git a/Devices/m5stack-cores3/Source/module.cpp b/Devices/m5stack-cores3/Source/module.cpp index 393fbf3f0..b9a3c2694 100644 --- a/Devices/m5stack-cores3/Source/module.cpp +++ b/Devices/m5stack-cores3/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module m5stack_cores3_module = { .name = "m5stack-cores3", .start = start, .stop = stop, diff --git a/Devices/m5stack-papers3/Source/module.cpp b/Devices/m5stack-papers3/Source/module.cpp index 7334626b4..be90897a1 100644 --- a/Devices/m5stack-papers3/Source/module.cpp +++ b/Devices/m5stack-papers3/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module m5stack_papers3_module = { .name = "m5stack-papers3", .start = start, .stop = stop, diff --git a/Devices/m5stack-stickc-plus/Source/module.cpp b/Devices/m5stack-stickc-plus/Source/module.cpp index 9fab289f9..29b2b2003 100644 --- a/Devices/m5stack-stickc-plus/Source/module.cpp +++ b/Devices/m5stack-stickc-plus/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module m5stack_stickc_plus_module = { .name = "m5stack-stickc-plus", .start = start, .stop = stop, diff --git a/Devices/m5stack-stickc-plus2/Source/module.cpp b/Devices/m5stack-stickc-plus2/Source/module.cpp index 9374ef772..13785db73 100644 --- a/Devices/m5stack-stickc-plus2/Source/module.cpp +++ b/Devices/m5stack-stickc-plus2/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module m5stack_stickc_plus2_module = { .name = "m5stack-stickc-plus2", .start = start, .stop = stop, diff --git a/Devices/m5stack-tab5/CMakeLists.txt b/Devices/m5stack-tab5/CMakeLists.txt index c84b1ada3..53e5abbeb 100644 --- a/Devices/m5stack-tab5/CMakeLists.txt +++ b/Devices/m5stack-tab5/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*) idf_component_register( SRCS ${SOURCE_FILES} INCLUDE_DIRS "Source" - REQUIRES Tactility esp_lvgl_port esp_lcd EspLcdCompat esp_lcd_ili9881c GT911 PwmBacklight driver vfs fatfs + REQUIRES Tactility esp_lvgl_port esp_lcd EspLcdCompat esp_lcd_ili9881c GT911 PwmBacklight driver vfs fatfs pi4ioe5v6408-module ) diff --git a/Devices/m5stack-tab5/Source/Configuration.cpp b/Devices/m5stack-tab5/Source/Configuration.cpp index 1d31ba39b..d17d47e4b 100644 --- a/Devices/m5stack-tab5/Source/Configuration.cpp +++ b/Devices/m5stack-tab5/Source/Configuration.cpp @@ -6,6 +6,7 @@ #include #include +#include using namespace tt::hal; @@ -18,9 +19,11 @@ static DeviceVector createDevices() { }; } -static error_t initPower(::Device* i2c_controller) { +static error_t initPower(::Device* io_expander0, ::Device* io_expander1) { + constexpr TickType_t i2c_timeout = pdMS_TO_TICKS(10); + /* - PI4IOE5V6408-1 (0x43) + PI4IOE5V6408-0 (0x43) - Bit 0: RF internal/external switch - Bit 1: Speaker enable - Bit 2: External 5V bus enable @@ -29,8 +32,18 @@ static error_t initPower(::Device* i2c_controller) { - Bit 5: Touch reset - Bit 6: Camera reset - Bit 7: Headphone detect + */ + + check(pi4ioe5v6408_set_direction(io_expander0, 0b01111111, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_output_level(io_expander0, 0b01000110, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_output_high_impedance(io_expander0, 0b00000000, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_pull_select(io_expander0, 0b01111111, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_pull_enable(io_expander0, 0b01111111, i2c_timeout) == ERROR_NONE); + vTaskDelay(pdMS_TO_TICKS(10)); + check(pi4ioe5v6408_set_output_level(io_expander0, 0b01110110, i2c_timeout) == ERROR_NONE); - PI4IOE5V6408-2 (0x44) + /* + PI4IOE5V6408-1 (0x44) - Bit 0: C6 WLAN enable - Bit 1: / - Bit 2: / @@ -41,57 +54,18 @@ static error_t initPower(::Device* i2c_controller) { - Bit 7: IP2326: CHG_EN */ - // Init byte arrays adapted from https://github.com/m5stack/M5GFX/blob/03565ccc96cb0b73c8b157f5ec3fbde439b034ad/src/M5GFX.cpp - static constexpr uint8_t reg_data_io1_1[] = { - 0x03, 0b01111111, // PI4IO_REG_IO_DIR - 0x05, 0b01000110, // PI4IO_REG_OUT_SET (bit4=LCD Reset, bit5=GT911 TouchReset -> LOW) - 0x07, 0b00000000, // PI4IO_REG_OUT_H_IM - 0x0D, 0b01111111, // PI4IO_REG_PULL_SEL - 0x0B, 0b01111111, // PI4IO_REG_PULL_EN - }; - - static constexpr uint8_t reg_data_io1_2[] = { - 0x05, 0b01110110, // PI4IO_REG_OUT_SET (bit4=LCD Reset, bit5=GT911 TouchReset -> HIGH) - }; - - static constexpr uint8_t reg_data_io2[] = { - 0x03, 0b10111001, // PI4IO_REG_IO_DIR - 0x07, 0b00000110, // PI4IO_REG_OUT_H_IM - 0x0D, 0b10111001, // PI4IO_REG_PULL_SEL - 0x0B, 0b11111001, // PI4IO_REG_PULL_EN - 0x09, 0b01000000, // PI4IO_REG_IN_DEF_STA - 0x11, 0b10111111, // PI4IO_REG_INT_MASK - 0x05, 0b10001001, // PI4IO_REG_OUT_SET (enable WiFi, USB-A 5V and CHG_EN) - }; - - constexpr auto IO_EXPANDER1_ADDRESS = 0x43; - auto error = i2c_controller_write_register_array(i2c_controller, IO_EXPANDER1_ADDRESS, reg_data_io1_1, sizeof(reg_data_io1_1), pdMS_TO_TICKS(100)); - if (error != ERROR_NONE) { - LOG_E(TAG, "IO expander 1 init failed in phase 1"); - return ERROR_UNDEFINED; - } - - constexpr auto IO_EXPANDER2_ADDRESS = 0x44; - error = i2c_controller_write_register_array(i2c_controller, IO_EXPANDER2_ADDRESS, reg_data_io2, sizeof(reg_data_io2), pdMS_TO_TICKS(100)); - if (error != ERROR_NONE) { - LOG_E(TAG, "IO expander 2 init failed"); - return ERROR_UNDEFINED; - } - - // The M5Stack code applies this, but it's not known why - // TODO: Remove and test it extensively - tt::kernel::delayTicks(10); - - error = i2c_controller_write_register_array(i2c_controller, IO_EXPANDER1_ADDRESS, reg_data_io1_2, sizeof(reg_data_io1_2), pdMS_TO_TICKS(100)); - if (error != ERROR_NONE) { - LOG_E(TAG, "IO expander 1 init failed in phase 2"); - return ERROR_UNDEFINED; - } + check(pi4ioe5v6408_set_direction(io_expander1, 0b10111001, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_output_high_impedance(io_expander1, 0b00000110, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_pull_select(io_expander1, 0b10111001, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_pull_enable(io_expander1, 0b11111001, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_input_default_level(io_expander1, 0b01000000, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_interrupt_mask(io_expander1, 0b10111111, i2c_timeout) == ERROR_NONE); + check(pi4ioe5v6408_set_output_level(io_expander1, 0b10001001, i2c_timeout) == ERROR_NONE); return ERROR_NONE; } -static error_t initSound(::Device* i2c_controller) { +static error_t initSound(::Device* i2c_controller, ::Device* io_expander0 = nullptr) { // Init data from M5Unified: // https://github.com/m5stack/M5Unified/blob/master/src/M5Unified.cpp static constexpr uint8_t ES8388_I2C_ADDR = 0x10; @@ -139,13 +113,15 @@ static error_t initSound(::Device* i2c_controller) { return error; } - constexpr auto IO_EXPANDER1_ADDRESS = 0x43; - constexpr auto AMP_REGISTER = 0x05; - // Note: to disable the amplifier, reset the bits - error = i2c_controller_register8_set_bits(i2c_controller, IO_EXPANDER1_ADDRESS, AMP_REGISTER, 0b00000010, pdMS_TO_TICKS(100)); - if (error != ERROR_NONE) { + uint8_t output_level = 0; + if (pi4ioe5v6408_get_output_level(io_expander0, &output_level, pdMS_TO_TICKS(100)) != ERROR_NONE) { + LOG_E(TAG, "Failed to read power level: %s", error_to_string(error)); + return ERROR_RESOURCE; + } + + if (pi4ioe5v6408_set_output_level(io_expander0, output_level | 0b00000010, pdMS_TO_TICKS(100)) != ERROR_NONE) { LOG_E(TAG, "Failed to enable amplifier: %s", error_to_string(error)); - return error; + return ERROR_RESOURCE; } return ERROR_NONE; @@ -155,12 +131,13 @@ static bool initBoot() { auto* i2c0 = device_find_by_name("i2c0"); check(i2c0, "i2c0 not found"); - auto error = initPower(i2c0); - if (error != ERROR_NONE) { - return false; - } + auto* io_expander0 = device_find_by_name("io_expander0"); + auto* io_expander1 = device_find_by_name("io_expander1"); + check(i2c0, "i2c0 not found"); + + initPower(io_expander0, io_expander1); - error = initSound(i2c0); + error_t error = initSound(i2c0, io_expander0); if (error != ERROR_NONE) { LOG_E(TAG, "Failed to enable ES8388"); } diff --git a/Devices/m5stack-tab5/Source/module.cpp b/Devices/m5stack-tab5/Source/module.cpp index 5d4a2258c..8cc5188fd 100644 --- a/Devices/m5stack-tab5/Source/module.cpp +++ b/Devices/m5stack-tab5/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -Module device_module = { +Module m5stack_tab5_module = { .name = "m5stack-tab5", .start = start, .stop = stop, diff --git a/Devices/m5stack-tab5/m5stack,tab5.dts b/Devices/m5stack-tab5/m5stack,tab5.dts index 8942eaf27..04be1ce2e 100644 --- a/Devices/m5stack-tab5/m5stack,tab5.dts +++ b/Devices/m5stack-tab5/m5stack,tab5.dts @@ -23,14 +23,34 @@ pin-sda = <&gpio0 31 GPIO_FLAG_NONE>; pin-scl = <&gpio0 32 GPIO_FLAG_NONE>; + /* + - Bit 0: RF internal/external switch + - Bit 1: Speaker enable + - Bit 2: External 5V bus enable + - Bit 3: / + - Bit 4: LCD reset + - Bit 5: Touch reset + - Bit 6: Camera reset + - Bit 7: Headphone detect + */ io_expander0 { compatible = "diodes,pi4ioe5v6408"; - register = <0x43>; + reg = <0x43>; }; + /* + - Bit 0: C6 WLAN enable + - Bit 1: / + - Bit 2: / + - Bit 3: USB-A 5V enable + - Bit 4: Device power: PWROFF_PLUSE + - Bit 5: IP2326: nCHG_QC_EN + - Bit 6: IP2326: CHG_STAT_LED + - Bit 7: IP2326: CHG_EN + */ io_expander1 { compatible = "diodes,pi4ioe5v6408"; - register = <0x44>; + reg = <0x44>; }; }; diff --git a/Devices/simulator/CMakeLists.txt b/Devices/simulator/CMakeLists.txt index 6e0dc4a37..f4b825c71 100644 --- a/Devices/simulator/CMakeLists.txt +++ b/Devices/simulator/CMakeLists.txt @@ -5,20 +5,20 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION}) file(GLOB_RECURSE SOURCES "Source/*.c*") file(GLOB_RECURSE HEADERS "Source/*.h*") - add_library(Simulator OBJECT) + add_library(simulator OBJECT) - target_sources(Simulator + target_sources(simulator PRIVATE ${SOURCES} PUBLIC ${HEADERS} ) - target_link_libraries(Simulator + target_link_libraries(simulator PRIVATE Tactility PRIVATE TactilityCore PRIVATE lvgl PRIVATE SDL2-static ) - target_link_libraries(Simulator PRIVATE ${SDL2_LIBRARIES}) + target_link_libraries(simulator PRIVATE ${SDL2_LIBRARIES}) endif() diff --git a/Devices/simulator/Source/module.cpp b/Devices/simulator/Source/module.cpp index 8ae3a55ee..b587216b0 100644 --- a/Devices/simulator/Source/module.cpp +++ b/Devices/simulator/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module simulator_module = { .name = "simulator", .start = start, .stop = stop, diff --git a/Devices/unphone/Source/module.cpp b/Devices/unphone/Source/module.cpp index 19de73945..934b08b37 100644 --- a/Devices/unphone/Source/module.cpp +++ b/Devices/unphone/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module unphone_module = { .name = "unphone", .start = start, .stop = stop, diff --git a/Devices/waveshare-esp32-s3-geek/Source/module.cpp b/Devices/waveshare-esp32-s3-geek/Source/module.cpp index 5eef7d465..e481e2995 100644 --- a/Devices/waveshare-esp32-s3-geek/Source/module.cpp +++ b/Devices/waveshare-esp32-s3-geek/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module waveshare_esp32_s3_geek_module = { .name = "waveshare-esp32-s3-geek", .start = start, .stop = stop, diff --git a/Devices/waveshare-s3-lcd-13/Source/module.cpp b/Devices/waveshare-s3-lcd-13/Source/module.cpp index ca7a21c67..38c1b4d4e 100644 --- a/Devices/waveshare-s3-lcd-13/Source/module.cpp +++ b/Devices/waveshare-s3-lcd-13/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module waveshare_s3_lcd_13_module = { .name = "waveshare-s3-lcd-13", .start = start, .stop = stop, diff --git a/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp b/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp index a5b15030c..cd0708b19 100644 --- a/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module waveshare_s3_touch_lcd_128_module = { .name = "waveshare-s3-touch-lcd-128", .start = start, .stop = stop, diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp b/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp index b53792e31..dec0d0416 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module waveshare_s3_touch_lcd_147_module = { .name = "waveshare-s3-touch-lcd-147", .start = start, .stop = stop, diff --git a/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp b/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp index 2019004c6..b79ac15f1 100644 --- a/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module waveshare_s3_touch_lcd_43_module = { .name = "waveshare-s3-touch-lcd-43", .start = start, .stop = stop, diff --git a/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp b/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp index ff0aa0abc..bfceaed93 100644 --- a/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp +++ b/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp @@ -13,7 +13,7 @@ static error_t stop() { } /** @warning The variable name must be exactly "device_module" */ -struct Module device_module = { +struct Module wireless_tag_wt32_sc01_plus_module = { .name = "wireless-tag-wt32-sc01-plus", .start = start, .stop = stop, diff --git a/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h index b3d529bad..9d0d1cc10 100644 --- a/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h +++ b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h @@ -9,20 +9,32 @@ extern "C" { #endif +struct Device; + struct Pi4ioe5v6408Config { /** Address on bus */ uint8_t reg; }; -error_t pi4ioe5v6408_get_input_level(struct Device* device, uint8_t* bits, TickType_t timeout); +error_t pi4ioe5v6408_set_direction(struct Device* device, uint8_t bits, TickType_t timeout); error_t pi4ioe5v6408_set_output_level(struct Device* device, uint8_t bits, TickType_t timeout); +error_t pi4ioe5v6408_get_output_level(struct Device* device, uint8_t* bits, TickType_t timeout); + error_t pi4ioe5v6408_set_output_high_impedance(struct Device* device, uint8_t bits, TickType_t timeout); error_t pi4ioe5v6408_set_input_default_level(struct Device* device, uint8_t bits, TickType_t timeout); -error_t pi4ioe5v6408_set_direction(struct Device* device, uint8_t bits, TickType_t timeout); +error_t pi4ioe5v6408_set_pull_enable(struct Device* device, uint8_t bits, TickType_t timeout); + +error_t pi4ioe5v6408_set_pull_select(struct Device* device, uint8_t bits, TickType_t timeout); + +error_t pi4ioe5v6408_get_input_level(struct Device* device, uint8_t* bits, TickType_t timeout); + +error_t pi4ioe5v6408_set_interrupt_mask(struct Device* device, uint8_t bits, TickType_t timeout); + +error_t pi4ioe5v6408_get_interrupt_level(struct Device* device, uint8_t* bits, TickType_t timeout); #ifdef __cplusplus } diff --git a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp index 9b8544f57..b61449c0e 100644 --- a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp +++ b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp @@ -36,29 +36,54 @@ static error_t stop(Device* device) { extern "C" { -error_t pi4ioe5v6408_get_input_level(struct Device* device, uint8_t* bits, TickType_t timeout) { +error_t pi4ioe5v6408_set_direction(Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_LEVEL, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_DIRECTION, bits, timeout); } error_t pi4ioe5v6408_set_output_level(Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); +} + +error_t pi4ioe5v6408_get_output_level(Device* device, uint8_t* bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); } error_t pi4ioe5v6408_set_output_high_impedance(struct Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_HIGH_IMPEDANCE, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_HIGH_IMPEDANCE, bits, timeout); } error_t pi4ioe5v6408_set_input_default_level(struct Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_DEFAULT_LEVEL, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_DEFAULT_LEVEL, bits, timeout); } -error_t pi4ioe5v6408_set_direction(Device* device, uint8_t bits, TickType_t timeout) { +error_t pi4ioe5v6408_set_pull_enable(struct Device* device, uint8_t bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_PULL_ENABLE, bits, timeout); +} + +error_t pi4ioe5v6408_set_pull_select(struct Device* device, uint8_t bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_PULL_SELECT, bits, timeout); +} + +error_t pi4ioe5v6408_get_input_level(struct Device* device, uint8_t* bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_LEVEL, bits, timeout); +} + +error_t pi4ioe5v6408_set_interrupt_mask(struct Device* device, uint8_t bits, TickType_t timeout) { + auto* parent = device_get_parent(device); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INTERRUPT_MASK, bits, timeout); +} + +error_t pi4ioe5v6408_get_interrupt_level(struct Device* device, uint8_t* bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set_bits(parent, GET_CONFIG(device)->reg, PI4_REGISTER_DIRECTION, bits, timeout); + return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INTERRUPT_LEVEL, bits, timeout); } Driver pi4ioe5v6408_driver = { diff --git a/Drivers/pi4ioe5v6408-module/source/symbols.c b/Drivers/pi4ioe5v6408-module/source/symbols.c index 1debb71b9..ea1dc7a38 100644 --- a/Drivers/pi4ioe5v6408-module/source/symbols.c +++ b/Drivers/pi4ioe5v6408-module/source/symbols.c @@ -2,10 +2,14 @@ #include const struct ModuleSymbol pi4ioe5v6408_module_symbols[] = { - DEFINE_MODULE_SYMBOL(pi4ioe5v6408_get_input_level), - DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_output_level), DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_direction), - DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_input_default_level), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_output_level), DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_output_high_impedance), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_input_default_level), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_pull_enable), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_pull_select), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_get_input_level), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_set_interrupt_mask), + DEFINE_MODULE_SYMBOL(pi4ioe5v6408_get_interrupt_level), MODULE_SYMBOL_TERMINATOR }; diff --git a/Firmware/CMakeLists.txt b/Firmware/CMakeLists.txt index 67176675b..27d739be4 100644 --- a/Firmware/CMakeLists.txt +++ b/Firmware/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.20) file(GLOB_RECURSE SOURCE_FILES "Source/*.c*") +get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) + # Get the project and device id if (DEFINED ENV{ESP_IDF_VERSION}) include("../Buildscripts/device.cmake") @@ -14,7 +16,6 @@ else () set(TACTILITY_DEVICE_PROJECT Simulator) endif () -get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) set(DEVICETREE_LOCATION "${PROJECT_ROOT}/Devices/${TACTILITY_DEVICE_ID}") # @@ -57,20 +58,19 @@ endif () list(APPEND REQUIRES_LIST Tactility TactilityKernel - ${TACTILITY_DEVICE_PROJECT} ) +# Add devicetree dependencies +foreach(dts_dependency IN LISTS DEVICE_DEPENDENCIES) + message("Adding DTS dependency ${dts_dependency}") + list(APPEND REQUIRES_LIST ${dts_dependency}) +endforeach() + if (DEFINED ENV{ESP_IDF_VERSION}) list(APPEND REQUIRES_LIST TactilityC ) - # Add devicetree dependencies - foreach(dts_dependency IN LISTS DEVICE_DEPENDENCIES) - message("Adding DTS dependency ${dts_dependency}") - list(APPEND REQUIRES_LIST ${dts_dependency}) - endforeach() - idf_component_register( SRCS ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c" REQUIRES ${REQUIRES_LIST} @@ -79,14 +79,12 @@ else () list(APPEND REQUIRES_LIST TactilityCore TactilityFreeRtos - platform-posix hal-device-module lvgl-module SDL2::SDL2-static SDL2-static ) - add_executable(FirmwareSim ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c" - ../Drivers/pi4ioe5v6408-module/source/symbols.c) + add_executable(FirmwareSim ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c") target_link_libraries(FirmwareSim PRIVATE ${REQUIRES_LIST}) endif () diff --git a/Firmware/Source/Main.cpp b/Firmware/Source/Main.cpp index 3b0c48c31..67ca7b8ad 100644 --- a/Firmware/Source/Main.cpp +++ b/Firmware/Source/Main.cpp @@ -3,9 +3,6 @@ #include #include -// From the relevant device -extern struct Module device_module; - #ifdef ESP_PLATFORM #include #else @@ -30,7 +27,7 @@ void app_main() { tt_init_tactility_c(); // ELF bindings for side-loading on ESP32 #endif - tt::run(config, &device_module, dts_modules, dts_devices); + tt::run(config, dts_modules, dts_devices); } } // extern \ No newline at end of file diff --git a/Tactility/Include/Tactility/Tactility.h b/Tactility/Include/Tactility/Tactility.h index 56bebe865..66b40257d 100644 --- a/Tactility/Include/Tactility/Tactility.h +++ b/Tactility/Include/Tactility/Tactility.h @@ -23,11 +23,10 @@ struct Configuration { /** * @brief Main entry point for Tactility. - * @param deviceModule Module for the device * @param dtsModules List of modules from devicetree, null-terminated, non-null parameter * @param dtsDevices Array that is terminated with DTS_DEVICE_TERMINATOR */ -void run(const Configuration& config, Module* deviceModule, Module* dtsModules[], DtsDevice dtsDevices[]); +void run(const Configuration& config, Module* dtsModules[], DtsDevice dtsDevices[]); /** * While technically nullable, this instance is always set if tt_init() succeeds. diff --git a/Tactility/Source/Tactility.cpp b/Tactility/Source/Tactility.cpp index 27be61027..85b81afe1 100644 --- a/Tactility/Source/Tactility.cpp +++ b/Tactility/Source/Tactility.cpp @@ -323,23 +323,19 @@ void registerApps() { registerInstalledAppsFromSdCards(); } -void run(const Configuration& config, Module* deviceModule, Module* dtsModules[], DtsDevice dtsDevices[]) { +void run(const Configuration& config, Module* dtsModules[], DtsDevice dtsDevices[]) { LOGGER.info("Tactility v{} on {} ({})", TT_VERSION, CONFIG_TT_DEVICE_NAME, CONFIG_TT_DEVICE_ID); assert(config.hardware); - LOGGER.info(R"(Calling kernel_init with modules "{}")", deviceModule->name); - if (kernel_init(deviceModule, dtsModules, dtsDevices) != ERROR_NONE) { + LOGGER.info("Initializing kernel"); + if (kernel_init(dtsModules, dtsDevices) != ERROR_NONE) { LOGGER.error("Failed to initialize kernel"); return; } // hal-device-module - check(module_construct(&hal_device_module) == ERROR_NONE); - check(module_add(&hal_device_module) == ERROR_NONE); - check(module_start(&hal_device_module) == ERROR_NONE); - - const hal::Configuration& hardware = *config.hardware; + check(module_construct_add_start(&hal_device_module) == ERROR_NONE); // Assign early so starting services can use it config_instance = &config; diff --git a/TactilityKernel/bindings/i2c-device.yaml b/TactilityKernel/bindings/i2c-device.yaml index e2c4f1ddc..cb9232a2d 100644 --- a/TactilityKernel/bindings/i2c-device.yaml +++ b/TactilityKernel/bindings/i2c-device.yaml @@ -1,6 +1,6 @@ description: I2C device properties: - register: + reg: required: true description: device address on the bus \ No newline at end of file diff --git a/TactilityKernel/include/tactility/kernel_init.h b/TactilityKernel/include/tactility/kernel_init.h index fcfeea741..36b5da7f3 100644 --- a/TactilityKernel/include/tactility/kernel_init.h +++ b/TactilityKernel/include/tactility/kernel_init.h @@ -1,21 +1,20 @@ #pragma once +#include +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include -#include - /** * Initialize the kernel with platform and device modules, and a device tree. - * @param device_module The device module to start. This module should not be constructed yet. This parameter can be NULL. * @param dts_modules List of modules from devicetree, null-terminated, non-null parameter * @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. This parameter can be NULL. * @return ERROR_NONE on success, otherwise an error code */ -error_t kernel_init(struct Module* device_module, struct Module* dts_modules[], struct DtsDevice dts_devices[]); +error_t kernel_init(struct Module* dts_modules[], struct DtsDevice dts_devices[]); #ifdef __cplusplus } diff --git a/TactilityKernel/source/kernel_init.cpp b/TactilityKernel/source/kernel_init.cpp index 9f1729385..7c0f712db 100644 --- a/TactilityKernel/source/kernel_init.cpp +++ b/TactilityKernel/source/kernel_init.cpp @@ -1,5 +1,6 @@ -#include "tactility/dts.h" #include + +#include #include #ifdef __cplusplus @@ -8,7 +9,7 @@ extern "C" { #define TAG "kernel" -extern const struct ModuleSymbol KERNEL_SYMBOLS[]; +extern const ModuleSymbol KERNEL_SYMBOLS[]; static error_t start() { extern Driver root_driver; @@ -20,7 +21,7 @@ static error_t stop() { return ERROR_NONE; } -struct Module root_module = { +Module root_module = { .name = "kernel", .start = start, .stop = stop, @@ -28,7 +29,7 @@ struct Module root_module = { .internal = nullptr }; -error_t kernel_init(Module* device_module, Module* dts_modules[], DtsDevice dts_devices[]) { +error_t kernel_init(Module* dts_modules[], DtsDevice dts_devices[]) { LOG_I(TAG, "init"); if (module_construct_add_start(&root_module) != ERROR_NONE) { @@ -45,13 +46,6 @@ error_t kernel_init(Module* device_module, Module* dts_modules[], DtsDevice dts_ dts_module++; } - if (device_module != nullptr) { - if (module_construct_add_start(device_module) != ERROR_NONE) { - LOG_E(TAG, "device module init failed"); - return ERROR_RESOURCE; - } - } - if (dts_devices) { DtsDevice* dts_device = dts_devices; while (dts_device->device != nullptr) { From bd877bf9250c4865cb139edae7bfc12c861bdcd6 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Feb 2026 22:03:21 +0100 Subject: [PATCH 06/10] Fix tests --- TactilityKernel/include/tactility/kernel_init.h | 2 +- Tests/Tactility/Source/Main.cpp | 9 ++++++--- Tests/TactilityKernel/Source/Main.cpp | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/TactilityKernel/include/tactility/kernel_init.h b/TactilityKernel/include/tactility/kernel_init.h index 36b5da7f3..dcaa9b501 100644 --- a/TactilityKernel/include/tactility/kernel_init.h +++ b/TactilityKernel/include/tactility/kernel_init.h @@ -9,7 +9,7 @@ extern "C" { #endif /** - * Initialize the kernel with platform and device modules, and a device tree. + * Initialize the kernel with the provided modules from the device tree * @param dts_modules List of modules from devicetree, null-terminated, non-null parameter * @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. This parameter can be NULL. * @return ERROR_NONE on success, otherwise an error code diff --git a/Tests/Tactility/Source/Main.cpp b/Tests/Tactility/Source/Main.cpp index 04bfa2215..6a4d923f6 100644 --- a/Tests/Tactility/Source/Main.cpp +++ b/Tests/Tactility/Source/Main.cpp @@ -5,8 +5,10 @@ #include "FreeRTOS.h" #include "task.h" -#include +#include +#include #include +#include typedef struct { int argc; @@ -27,8 +29,9 @@ void test_task(void* parameter) { // overrides context.setOption("no-breaks", true); // don't break in the debugger when assertions fail - Module* dts_modules[] = { &platform_posix_module, nullptr }; - check(kernel_init(&hal_device_module, dts_modules, nullptr) == ERROR_NONE); + Module* dts_modules[] = { &platform_posix_module, &hal_device_module, nullptr }; + DtsDevice dts_devices[] = { DTS_DEVICE_TERMINATOR }; + check(kernel_init(dts_modules, dts_devices) == ERROR_NONE); data->result = context.run(); diff --git a/Tests/TactilityKernel/Source/Main.cpp b/Tests/TactilityKernel/Source/Main.cpp index 4243aa266..76d53be00 100644 --- a/Tests/TactilityKernel/Source/Main.cpp +++ b/Tests/TactilityKernel/Source/Main.cpp @@ -1,7 +1,9 @@ #define DOCTEST_CONFIG_IMPLEMENT #include "doctest.h" #include +#include +#include #include #include @@ -25,7 +27,8 @@ void test_task(void* parameter) { context.setOption("no-breaks", true); // don't break in the debugger when assertions fail Module* dts_modules[] = { &platform_posix_module, nullptr }; - check(kernel_init(nullptr, dts_modules, nullptr) == ERROR_NONE); + DtsDevice dts_devices[] = { DTS_DEVICE_TERMINATOR }; + check(kernel_init(dts_modules, dts_devices) == ERROR_NONE); data->result = context.run(); From b0ad3e89126b4b7431ef95eea9543635944c7187 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Feb 2026 22:10:10 +0100 Subject: [PATCH 07/10] Cleanup old comments --- Devices/btt-panda-touch/Source/module.cpp | 1 - Devices/cyd-2432s024c/Source/module.cpp | 1 - Devices/cyd-2432s028r/Source/module.cpp | 1 - Devices/cyd-2432s028rv3/Source/module.cpp | 1 - Devices/cyd-2432s032c/Source/module.cpp | 1 - Devices/cyd-4848s040c/Source/module.cpp | 1 - Devices/cyd-8048s043c/Source/module.cpp | 1 - Devices/cyd-e32r28t/Source/module.cpp | 1 - Devices/cyd-e32r32p/Source/module.cpp | 1 - Devices/elecrow-crowpanel-advance-28/Source/module.cpp | 1 - Devices/elecrow-crowpanel-advance-35/Source/module.cpp | 1 - Devices/elecrow-crowpanel-advance-50/Source/module.cpp | 1 - Devices/elecrow-crowpanel-basic-28/Source/module.cpp | 1 - Devices/elecrow-crowpanel-basic-35/Source/module.cpp | 1 - Devices/elecrow-crowpanel-basic-50/Source/module.cpp | 1 - Devices/generic-esp32/Source/module.cpp | 1 - Devices/generic-esp32c6/Source/module.cpp | 1 - Devices/generic-esp32p4/Source/module.cpp | 1 - Devices/generic-esp32s3/Source/module.cpp | 1 - Devices/guition-jc1060p470ciwy/Source/module.cpp | 1 - Devices/guition-jc2432w328c/Source/module.cpp | 1 - Devices/guition-jc3248w535c/Source/module.cpp | 1 - Devices/guition-jc8048w550c/Source/module.cpp | 1 - Devices/heltec-wifi-lora-32-v3/Source/module.cpp | 1 - Devices/lilygo-tdeck/Source/module.cpp | 1 - Devices/lilygo-tdisplay-s3/Source/module.cpp | 1 - Devices/lilygo-tdisplay/Source/module.cpp | 1 - Devices/lilygo-tdongle-s3/Source/module.cpp | 1 - Devices/lilygo-tlora-pager/Source/module.cpp | 1 - Devices/m5stack-cardputer-adv/Source/module.cpp | 1 - Devices/m5stack-cardputer/Source/module.cpp | 1 - Devices/m5stack-core2/Source/module.cpp | 1 - Devices/m5stack-cores3/Source/module.cpp | 1 - Devices/m5stack-papers3/Source/module.cpp | 1 - Devices/m5stack-stickc-plus/Source/module.cpp | 1 - Devices/m5stack-stickc-plus2/Source/module.cpp | 1 - Devices/m5stack-tab5/Source/module.cpp | 1 - Devices/simulator/Source/module.cpp | 1 - Devices/unphone/Source/module.cpp | 1 - Devices/waveshare-esp32-s3-geek/Source/module.cpp | 1 - Devices/waveshare-s3-lcd-13/Source/module.cpp | 1 - Devices/waveshare-s3-touch-lcd-128/Source/module.cpp | 1 - Devices/waveshare-s3-touch-lcd-147/Source/module.cpp | 1 - Devices/waveshare-s3-touch-lcd-43/Source/module.cpp | 1 - Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp | 1 - 45 files changed, 45 deletions(-) diff --git a/Devices/btt-panda-touch/Source/module.cpp b/Devices/btt-panda-touch/Source/module.cpp index a3083c5ea..798a66c63 100644 --- a/Devices/btt-panda-touch/Source/module.cpp +++ b/Devices/btt-panda-touch/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module btt_panda_touch_module = { .name = "btt-panda-touch", .start = start, diff --git a/Devices/cyd-2432s024c/Source/module.cpp b/Devices/cyd-2432s024c/Source/module.cpp index 582d2ddb1..cf80884a4 100644 --- a/Devices/cyd-2432s024c/Source/module.cpp +++ b/Devices/cyd-2432s024c/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_2432s024c_module = { .name = "cyd-2432s024c", .start = start, diff --git a/Devices/cyd-2432s028r/Source/module.cpp b/Devices/cyd-2432s028r/Source/module.cpp index e9bffcc9d..82789f73d 100644 --- a/Devices/cyd-2432s028r/Source/module.cpp +++ b/Devices/cyd-2432s028r/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_2432s028r_module = { .name = "cyd-2432s028r", .start = start, diff --git a/Devices/cyd-2432s028rv3/Source/module.cpp b/Devices/cyd-2432s028rv3/Source/module.cpp index 0edef933d..e0eda01c7 100644 --- a/Devices/cyd-2432s028rv3/Source/module.cpp +++ b/Devices/cyd-2432s028rv3/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_2432s028rv3_module = { .name = "cyd-2432s028rv3", .start = start, diff --git a/Devices/cyd-2432s032c/Source/module.cpp b/Devices/cyd-2432s032c/Source/module.cpp index 0db17a2cc..348f0204d 100644 --- a/Devices/cyd-2432s032c/Source/module.cpp +++ b/Devices/cyd-2432s032c/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_2432s032c_module = { .name = "cyd-2432s032c", .start = start, diff --git a/Devices/cyd-4848s040c/Source/module.cpp b/Devices/cyd-4848s040c/Source/module.cpp index cdb7c4b8d..164c2fced 100644 --- a/Devices/cyd-4848s040c/Source/module.cpp +++ b/Devices/cyd-4848s040c/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_4848s040c_module = { .name = "cyd-4848s040c", .start = start, diff --git a/Devices/cyd-8048s043c/Source/module.cpp b/Devices/cyd-8048s043c/Source/module.cpp index 5fe9733a8..acb29a758 100644 --- a/Devices/cyd-8048s043c/Source/module.cpp +++ b/Devices/cyd-8048s043c/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_8048s043c_module = { .name = "cyd-8048s043c", .start = start, diff --git a/Devices/cyd-e32r28t/Source/module.cpp b/Devices/cyd-e32r28t/Source/module.cpp index abdc63841..7806af3d0 100644 --- a/Devices/cyd-e32r28t/Source/module.cpp +++ b/Devices/cyd-e32r28t/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_e32r28t_module = { .name = "cyd-e32r28t", .start = start, diff --git a/Devices/cyd-e32r32p/Source/module.cpp b/Devices/cyd-e32r32p/Source/module.cpp index a0030fba8..65488c2b9 100644 --- a/Devices/cyd-e32r32p/Source/module.cpp +++ b/Devices/cyd-e32r32p/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module cyd_e32r32p_module = { .name = "cyd-e32r32p", .start = start, diff --git a/Devices/elecrow-crowpanel-advance-28/Source/module.cpp b/Devices/elecrow-crowpanel-advance-28/Source/module.cpp index e920f8a34..e7bd2bba3 100644 --- a/Devices/elecrow-crowpanel-advance-28/Source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-28/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module elecrow_crowpanel_advance_28_module = { .name = "elecrow-crowpanel-advance-28", .start = start, diff --git a/Devices/elecrow-crowpanel-advance-35/Source/module.cpp b/Devices/elecrow-crowpanel-advance-35/Source/module.cpp index 1d4b85f25..b25d82be5 100644 --- a/Devices/elecrow-crowpanel-advance-35/Source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-35/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module elecrow_crowpanel_advance_35_module = { .name = "elecrow-crowpanel-advance-35", .start = start, diff --git a/Devices/elecrow-crowpanel-advance-50/Source/module.cpp b/Devices/elecrow-crowpanel-advance-50/Source/module.cpp index be19de5a4..e89e37654 100644 --- a/Devices/elecrow-crowpanel-advance-50/Source/module.cpp +++ b/Devices/elecrow-crowpanel-advance-50/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module elecrow_crowpanel_advance_50_module = { .name = "elecrow-crowpanel-advance-50", .start = start, diff --git a/Devices/elecrow-crowpanel-basic-28/Source/module.cpp b/Devices/elecrow-crowpanel-basic-28/Source/module.cpp index d8534fdfe..e9cdd36d4 100644 --- a/Devices/elecrow-crowpanel-basic-28/Source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-28/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module elecrow_crowpanel_basic_28_module = { .name = "elecrow-crowpanel-basic-28", .start = start, diff --git a/Devices/elecrow-crowpanel-basic-35/Source/module.cpp b/Devices/elecrow-crowpanel-basic-35/Source/module.cpp index 45664068f..736f03f78 100644 --- a/Devices/elecrow-crowpanel-basic-35/Source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-35/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module elecrow_crowpanel_basic_35_module = { .name = "elecrow-crowpanel-basic-35", .start = start, diff --git a/Devices/elecrow-crowpanel-basic-50/Source/module.cpp b/Devices/elecrow-crowpanel-basic-50/Source/module.cpp index 5ff31e6f6..b1e495e06 100644 --- a/Devices/elecrow-crowpanel-basic-50/Source/module.cpp +++ b/Devices/elecrow-crowpanel-basic-50/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module elecrow_crowpanel_basic_50_module = { .name = "elecrow-crowpanel-basic-50", .start = start, diff --git a/Devices/generic-esp32/Source/module.cpp b/Devices/generic-esp32/Source/module.cpp index 3fb508405..6b0d3d849 100644 --- a/Devices/generic-esp32/Source/module.cpp +++ b/Devices/generic-esp32/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module generic_esp32_module = { .name = "generic-esp32", .start = start, diff --git a/Devices/generic-esp32c6/Source/module.cpp b/Devices/generic-esp32c6/Source/module.cpp index c29b8156e..fb7def5f9 100644 --- a/Devices/generic-esp32c6/Source/module.cpp +++ b/Devices/generic-esp32c6/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module generic_esp32c6_module = { .name = "generic-esp32c6", .start = start, diff --git a/Devices/generic-esp32p4/Source/module.cpp b/Devices/generic-esp32p4/Source/module.cpp index 090360a40..00f8cf7db 100644 --- a/Devices/generic-esp32p4/Source/module.cpp +++ b/Devices/generic-esp32p4/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module generic_esp32p4_module = { .name = "generic-esp32p4", .start = start, diff --git a/Devices/generic-esp32s3/Source/module.cpp b/Devices/generic-esp32s3/Source/module.cpp index 7b943d251..566d17c3b 100644 --- a/Devices/generic-esp32s3/Source/module.cpp +++ b/Devices/generic-esp32s3/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module generic_esp32s3_module = { .name = "generic-esp32s3", .start = start, diff --git a/Devices/guition-jc1060p470ciwy/Source/module.cpp b/Devices/guition-jc1060p470ciwy/Source/module.cpp index ced400f22..efecf6632 100644 --- a/Devices/guition-jc1060p470ciwy/Source/module.cpp +++ b/Devices/guition-jc1060p470ciwy/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module guition_jc1060p470ciwy_module = { .name = "guition-jc1060p470ciwy", .start = start, diff --git a/Devices/guition-jc2432w328c/Source/module.cpp b/Devices/guition-jc2432w328c/Source/module.cpp index eb6cf8ad7..0abd3887e 100644 --- a/Devices/guition-jc2432w328c/Source/module.cpp +++ b/Devices/guition-jc2432w328c/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module guition_jc2432w328c_module = { .name = "guition-jc2432w328c", .start = start, diff --git a/Devices/guition-jc3248w535c/Source/module.cpp b/Devices/guition-jc3248w535c/Source/module.cpp index 7024c59ef..a8ef4696a 100644 --- a/Devices/guition-jc3248w535c/Source/module.cpp +++ b/Devices/guition-jc3248w535c/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module guition_jc3248w535c_module = { .name = "guition-jc3248w535c", .start = start, diff --git a/Devices/guition-jc8048w550c/Source/module.cpp b/Devices/guition-jc8048w550c/Source/module.cpp index 4ad11735d..2772cd6ca 100644 --- a/Devices/guition-jc8048w550c/Source/module.cpp +++ b/Devices/guition-jc8048w550c/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module guition_jc8048w550c_module = { .name = "guition-jc8048w550c", .start = start, diff --git a/Devices/heltec-wifi-lora-32-v3/Source/module.cpp b/Devices/heltec-wifi-lora-32-v3/Source/module.cpp index 030dc8a76..725a5efcb 100644 --- a/Devices/heltec-wifi-lora-32-v3/Source/module.cpp +++ b/Devices/heltec-wifi-lora-32-v3/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module heltec_wifi_lora_32_v3_module = { .name = "heltec-wifi-lora-32-v3", .start = start, diff --git a/Devices/lilygo-tdeck/Source/module.cpp b/Devices/lilygo-tdeck/Source/module.cpp index 0f8452148..3048f642f 100644 --- a/Devices/lilygo-tdeck/Source/module.cpp +++ b/Devices/lilygo-tdeck/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module lilygo_tdeck_module = { .name = "lilygo-tdeck", .start = start, diff --git a/Devices/lilygo-tdisplay-s3/Source/module.cpp b/Devices/lilygo-tdisplay-s3/Source/module.cpp index f9018b539..06b55e106 100644 --- a/Devices/lilygo-tdisplay-s3/Source/module.cpp +++ b/Devices/lilygo-tdisplay-s3/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module lilygo_tdisplay_s3_module = { .name = "lilygo-tdisplay-s3", .start = start, diff --git a/Devices/lilygo-tdisplay/Source/module.cpp b/Devices/lilygo-tdisplay/Source/module.cpp index 0b7a1df35..6a3010f52 100644 --- a/Devices/lilygo-tdisplay/Source/module.cpp +++ b/Devices/lilygo-tdisplay/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module lilygo_tdisplay_module = { .name = "lilygo-tdisplay", .start = start, diff --git a/Devices/lilygo-tdongle-s3/Source/module.cpp b/Devices/lilygo-tdongle-s3/Source/module.cpp index 7935e802a..ee0732cd0 100644 --- a/Devices/lilygo-tdongle-s3/Source/module.cpp +++ b/Devices/lilygo-tdongle-s3/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module lilygo_tdongle_s3_module = { .name = "lilygo-tdongle-s3", .start = start, diff --git a/Devices/lilygo-tlora-pager/Source/module.cpp b/Devices/lilygo-tlora-pager/Source/module.cpp index 67616f743..5153f1fbf 100644 --- a/Devices/lilygo-tlora-pager/Source/module.cpp +++ b/Devices/lilygo-tlora-pager/Source/module.cpp @@ -20,7 +20,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module lilygo_tlora_pager_module = { .name = "lilygo-tlora-pager", .start = start, diff --git a/Devices/m5stack-cardputer-adv/Source/module.cpp b/Devices/m5stack-cardputer-adv/Source/module.cpp index 1a8247ad6..e582ab610 100644 --- a/Devices/m5stack-cardputer-adv/Source/module.cpp +++ b/Devices/m5stack-cardputer-adv/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module m5stack_cardputer_adv_module = { .name = "m5stack-cardputer-adv", .start = start, diff --git a/Devices/m5stack-cardputer/Source/module.cpp b/Devices/m5stack-cardputer/Source/module.cpp index 801b020a5..3f8245ada 100644 --- a/Devices/m5stack-cardputer/Source/module.cpp +++ b/Devices/m5stack-cardputer/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module m5stack_cardputer_module = { .name = "m5stack-cardputer", .start = start, diff --git a/Devices/m5stack-core2/Source/module.cpp b/Devices/m5stack-core2/Source/module.cpp index 6703f7f4f..04abb3f7a 100644 --- a/Devices/m5stack-core2/Source/module.cpp +++ b/Devices/m5stack-core2/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module m5stack_core2_module = { .name = "m5stack-core2", .start = start, diff --git a/Devices/m5stack-cores3/Source/module.cpp b/Devices/m5stack-cores3/Source/module.cpp index b9a3c2694..db26f6cc2 100644 --- a/Devices/m5stack-cores3/Source/module.cpp +++ b/Devices/m5stack-cores3/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module m5stack_cores3_module = { .name = "m5stack-cores3", .start = start, diff --git a/Devices/m5stack-papers3/Source/module.cpp b/Devices/m5stack-papers3/Source/module.cpp index be90897a1..1a7cf0822 100644 --- a/Devices/m5stack-papers3/Source/module.cpp +++ b/Devices/m5stack-papers3/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module m5stack_papers3_module = { .name = "m5stack-papers3", .start = start, diff --git a/Devices/m5stack-stickc-plus/Source/module.cpp b/Devices/m5stack-stickc-plus/Source/module.cpp index 29b2b2003..caaf12df7 100644 --- a/Devices/m5stack-stickc-plus/Source/module.cpp +++ b/Devices/m5stack-stickc-plus/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module m5stack_stickc_plus_module = { .name = "m5stack-stickc-plus", .start = start, diff --git a/Devices/m5stack-stickc-plus2/Source/module.cpp b/Devices/m5stack-stickc-plus2/Source/module.cpp index 13785db73..9c0e96f73 100644 --- a/Devices/m5stack-stickc-plus2/Source/module.cpp +++ b/Devices/m5stack-stickc-plus2/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module m5stack_stickc_plus2_module = { .name = "m5stack-stickc-plus2", .start = start, diff --git a/Devices/m5stack-tab5/Source/module.cpp b/Devices/m5stack-tab5/Source/module.cpp index 8cc5188fd..bad9c9c94 100644 --- a/Devices/m5stack-tab5/Source/module.cpp +++ b/Devices/m5stack-tab5/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ Module m5stack_tab5_module = { .name = "m5stack-tab5", .start = start, diff --git a/Devices/simulator/Source/module.cpp b/Devices/simulator/Source/module.cpp index b587216b0..3d1008a83 100644 --- a/Devices/simulator/Source/module.cpp +++ b/Devices/simulator/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module simulator_module = { .name = "simulator", .start = start, diff --git a/Devices/unphone/Source/module.cpp b/Devices/unphone/Source/module.cpp index 934b08b37..0c28db5a0 100644 --- a/Devices/unphone/Source/module.cpp +++ b/Devices/unphone/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module unphone_module = { .name = "unphone", .start = start, diff --git a/Devices/waveshare-esp32-s3-geek/Source/module.cpp b/Devices/waveshare-esp32-s3-geek/Source/module.cpp index e481e2995..b216db42d 100644 --- a/Devices/waveshare-esp32-s3-geek/Source/module.cpp +++ b/Devices/waveshare-esp32-s3-geek/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module waveshare_esp32_s3_geek_module = { .name = "waveshare-esp32-s3-geek", .start = start, diff --git a/Devices/waveshare-s3-lcd-13/Source/module.cpp b/Devices/waveshare-s3-lcd-13/Source/module.cpp index 38c1b4d4e..20187b5c3 100644 --- a/Devices/waveshare-s3-lcd-13/Source/module.cpp +++ b/Devices/waveshare-s3-lcd-13/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module waveshare_s3_lcd_13_module = { .name = "waveshare-s3-lcd-13", .start = start, diff --git a/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp b/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp index cd0708b19..5423ad639 100644 --- a/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-128/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module waveshare_s3_touch_lcd_128_module = { .name = "waveshare-s3-touch-lcd-128", .start = start, diff --git a/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp b/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp index dec0d0416..202a510ae 100644 --- a/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-147/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module waveshare_s3_touch_lcd_147_module = { .name = "waveshare-s3-touch-lcd-147", .start = start, diff --git a/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp b/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp index b79ac15f1..b616be693 100644 --- a/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp +++ b/Devices/waveshare-s3-touch-lcd-43/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module waveshare_s3_touch_lcd_43_module = { .name = "waveshare-s3-touch-lcd-43", .start = start, diff --git a/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp b/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp index bfceaed93..139234a11 100644 --- a/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp +++ b/Devices/wireless-tag-wt32-sc01-plus/Source/module.cpp @@ -12,7 +12,6 @@ static error_t stop() { return ERROR_NONE; } -/** @warning The variable name must be exactly "device_module" */ struct Module wireless_tag_wt32_sc01_plus_module = { .name = "wireless-tag-wt32-sc01-plus", .start = start, From d546041a14c947788035220c5a851aec015a0a98 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Feb 2026 22:11:56 +0100 Subject: [PATCH 08/10] kernel_init accepts non-null only --- .../include/tactility/kernel_init.h | 4 +-- TactilityKernel/source/kernel_init.cpp | 30 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/TactilityKernel/include/tactility/kernel_init.h b/TactilityKernel/include/tactility/kernel_init.h index dcaa9b501..f75dcb579 100644 --- a/TactilityKernel/include/tactility/kernel_init.h +++ b/TactilityKernel/include/tactility/kernel_init.h @@ -10,8 +10,8 @@ extern "C" { /** * Initialize the kernel with the provided modules from the device tree - * @param dts_modules List of modules from devicetree, null-terminated, non-null parameter - * @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. This parameter can be NULL. + * @param dts_modules List of modules from devicetree, null-terminated. Non-null parameter. + * @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. Non-null parameter. * @return ERROR_NONE on success, otherwise an error code */ error_t kernel_init(struct Module* dts_modules[], struct DtsDevice dts_devices[]); diff --git a/TactilityKernel/source/kernel_init.cpp b/TactilityKernel/source/kernel_init.cpp index 7c0f712db..b13ed71b5 100644 --- a/TactilityKernel/source/kernel_init.cpp +++ b/TactilityKernel/source/kernel_init.cpp @@ -46,24 +46,22 @@ error_t kernel_init(Module* dts_modules[], DtsDevice dts_devices[]) { dts_module++; } - if (dts_devices) { - DtsDevice* dts_device = dts_devices; - while (dts_device->device != nullptr) { - if (dts_device->status == DTS_DEVICE_STATUS_OKAY) { - if (device_construct_add_start(dts_device->device, dts_device->compatible) != ERROR_NONE) { - LOG_E(TAG, "kernel_init failed to construct+add+start device: %s (%s)", dts_device->device->name, dts_device->compatible); - return ERROR_RESOURCE; - } - } else if (dts_device->status == DTS_DEVICE_STATUS_DISABLED) { - if (device_construct_add(dts_device->device, dts_device->compatible) != ERROR_NONE) { - LOG_E(TAG, "kernel_init failed to construct+add device: %s (%s)", dts_device->device->name, dts_device->compatible); - return ERROR_RESOURCE; - } - } else { - check(false, "DTS status not implemented"); + DtsDevice* dts_device = dts_devices; + while (dts_device->device != nullptr) { + if (dts_device->status == DTS_DEVICE_STATUS_OKAY) { + if (device_construct_add_start(dts_device->device, dts_device->compatible) != ERROR_NONE) { + LOG_E(TAG, "kernel_init failed to construct+add+start device: %s (%s)", dts_device->device->name, dts_device->compatible); + return ERROR_RESOURCE; } - dts_device++; + } else if (dts_device->status == DTS_DEVICE_STATUS_DISABLED) { + if (device_construct_add(dts_device->device, dts_device->compatible) != ERROR_NONE) { + LOG_E(TAG, "kernel_init failed to construct+add device: %s (%s)", dts_device->device->name, dts_device->compatible); + return ERROR_RESOURCE; + } + } else { + check(false, "DTS status not implemented"); } + dts_device++; } LOG_I(TAG, "init done"); From a440ec1437162d6b7d1d9f31f68fc8ad547102af Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Feb 2026 22:13:09 +0100 Subject: [PATCH 09/10] Rename reg to address Keep the binding "reg" for consistency with common dts naming --- .../include/drivers/pi4ioe5v6408.h | 2 +- .../source/pi4ioe5v6408.cpp | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h index 9d0d1cc10..93f982746 100644 --- a/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h +++ b/Drivers/pi4ioe5v6408-module/include/drivers/pi4ioe5v6408.h @@ -13,7 +13,7 @@ struct Device; struct Pi4ioe5v6408Config { /** Address on bus */ - uint8_t reg; + uint8_t address; }; error_t pi4ioe5v6408_set_direction(struct Device* device, uint8_t bits, TickType_t timeout); diff --git a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp index b61449c0e..fdc1e94aa 100644 --- a/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp +++ b/Drivers/pi4ioe5v6408-module/source/pi4ioe5v6408.cpp @@ -38,52 +38,52 @@ extern "C" { error_t pi4ioe5v6408_set_direction(Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_DIRECTION, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->address, PI4_REGISTER_DIRECTION, bits, timeout); } error_t pi4ioe5v6408_set_output_level(Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->address, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); } error_t pi4ioe5v6408_get_output_level(Device* device, uint8_t* bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); + return i2c_controller_register8_get(parent, GET_CONFIG(device)->address, PI4_REGISTER_OUTPUT_LEVEL, bits, timeout); } error_t pi4ioe5v6408_set_output_high_impedance(struct Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_OUTPUT_HIGH_IMPEDANCE, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->address, PI4_REGISTER_OUTPUT_HIGH_IMPEDANCE, bits, timeout); } error_t pi4ioe5v6408_set_input_default_level(struct Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_DEFAULT_LEVEL, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->address, PI4_REGISTER_INPUT_DEFAULT_LEVEL, bits, timeout); } error_t pi4ioe5v6408_set_pull_enable(struct Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_PULL_ENABLE, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->address, PI4_REGISTER_PULL_ENABLE, bits, timeout); } error_t pi4ioe5v6408_set_pull_select(struct Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_PULL_SELECT, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->address, PI4_REGISTER_PULL_SELECT, bits, timeout); } error_t pi4ioe5v6408_get_input_level(struct Device* device, uint8_t* bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INPUT_LEVEL, bits, timeout); + return i2c_controller_register8_get(parent, GET_CONFIG(device)->address, PI4_REGISTER_INPUT_LEVEL, bits, timeout); } error_t pi4ioe5v6408_set_interrupt_mask(struct Device* device, uint8_t bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_set(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INTERRUPT_MASK, bits, timeout); + return i2c_controller_register8_set(parent, GET_CONFIG(device)->address, PI4_REGISTER_INTERRUPT_MASK, bits, timeout); } error_t pi4ioe5v6408_get_interrupt_level(struct Device* device, uint8_t* bits, TickType_t timeout) { auto* parent = device_get_parent(device); - return i2c_controller_register8_get(parent, GET_CONFIG(device)->reg, PI4_REGISTER_INTERRUPT_LEVEL, bits, timeout); + return i2c_controller_register8_get(parent, GET_CONFIG(device)->address, PI4_REGISTER_INTERRUPT_LEVEL, bits, timeout); } Driver pi4ioe5v6408_driver = { From d07fec00bb11d40cbee82e388f42fa9e3fe21af6 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Feb 2026 22:25:41 +0100 Subject: [PATCH 10/10] Cleanup unused cmake include attachment --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b56c51c32..044bca2bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,9 +99,6 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION}) set(FREERTOS_PORT GCC_POSIX CACHE STRING "") add_subdirectory(Libraries/FreeRTOS-Kernel) target_compile_definitions(freertos_kernel PUBLIC "projCOVERAGE_TEST=0") - target_include_directories(freertos_kernel - PUBLIC Devices/Simulator/Source # for FreeRTOSConfig.h - ) # EmbedTLS set(ENABLE_TESTING OFF)