Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Buildscripts/TactilitySDK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ idf_component_register(
INCLUDE_DIRS
"Libraries/TactilityC/include"
"Libraries/TactilityKernel/include"
"Libraries/TactilityFreeRtos/include"
"Libraries/lvgl/include"
"Libraries/lvgl-module/include"
REQUIRES esp_timer
)

# Regular and core features
add_prebuilt_library(TactilityC Libraries/TactilityC/binary/libTactilityC.a)
add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/binary/libTactilityKernel.a)
add_prebuilt_library(lvgl Libraries/lvgl/binary/liblvgl.a)
add_prebuilt_library(lvgl-module Libraries/lvgl-module/binary/liblvgl-module.a)

target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC)
target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel)
target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl)
target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl-module)
18 changes: 18 additions & 0 deletions Buildscripts/TactilitySDK/TactilitySDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,22 @@ macro(tactility_project project_name)
if (NOT "$ENV{ESP_IDF_VERSION}" STREQUAL "${TACTILITY_SDK_IDF_VERSION}")
message(FATAL_ERROR "ESP-IDF version of Tactility SDK (${TACTILITY_SDK_IDF_VERSION}) does not match current ESP-IDF version ($ENV{ESP_IDF_VERSION})")
endif()

set(EXTRA_COMPONENT_DIRS
"Libraries/TactilityFreeRtos"
"Modules"
"Drivers"
)
Comment on lines +18 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Relative paths in EXTRA_COMPONENT_DIRS may not resolve correctly.

The paths set here (Libraries/TactilityFreeRtos, Modules, Drivers) are relative but don't use ${TACTILITY_SDK_PATH} as a base. When the macro is invoked from an SDK consumer project, these paths will be resolved relative to the consumer's project directory rather than the SDK directory.

🐛 Proposed fix
     set(EXTRA_COMPONENT_DIRS
-        "Libraries/TactilityFreeRtos"
-        "Modules"
-        "Drivers"
+        "${TACTILITY_SDK_PATH}/Libraries/TactilityFreeRtos"
+        "${TACTILITY_SDK_PATH}/Modules"
+        "${TACTILITY_SDK_PATH}/Drivers"
     )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
set(EXTRA_COMPONENT_DIRS
"Libraries/TactilityFreeRtos"
"Modules"
"Drivers"
)
set(EXTRA_COMPONENT_DIRS
"${TACTILITY_SDK_PATH}/Libraries/TactilityFreeRtos"
"${TACTILITY_SDK_PATH}/Modules"
"${TACTILITY_SDK_PATH}/Drivers"
)


set(COMPONENTS
TactilityFreeRtos
bm8563-module
bm8563-module
Comment on lines +26 to +27
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Duplicate entry: bm8563-module is listed twice.

Lines 26 and 27 both include bm8563-module in the COMPONENTS list. This appears to be a copy-paste error and should be removed to avoid potential issues with ESP-IDF's component resolution.

🐛 Proposed fix
     set(COMPONENTS
         TactilityFreeRtos
         bm8563-module
-        bm8563-module
         bmi270-module
         mpu6886-module
         pi4ioe5v6408-module
         qmi8658-module
         rx8130ce-module
     )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
bm8563-module
bm8563-module
set(COMPONENTS
TactilityFreeRtos
bm8563-module
bmi270-module
mpu6886-module
pi4ioe5v6408-module
qmi8658-module
rx8130ce-module
)

bmi270-module
mpu6886-module
pi4ioe5v6408-module
qmi8658-module
rx8130ce-module
)

endmacro()
59 changes: 53 additions & 6 deletions Buildscripts/release-sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import glob
import subprocess
import sys
from textwrap import dedent

def map_copy(mappings, target_base):
"""
Expand Down Expand Up @@ -59,6 +60,45 @@ def map_copy(mappings, target_base):

os.makedirs(os.path.dirname(final_dst), exist_ok=True)
shutil.copy2(src, final_dst)

def get_driver_mappings(driver_name):
return [
{'src': f'Drivers/{driver_name}/include/**', 'dst': f'Drivers/{driver_name}/include/'},
{'src': f'Drivers/{driver_name}/*.md', 'dst': f'Drivers/{driver_name}/'},
{'src': f'build/esp-idf/{driver_name}/lib{driver_name}.a', 'dst': f'Drivers/{driver_name}/binary/lib{driver_name}.a'},
]

def get_module_mappings(module_name):
return [
{'src': f'Modules/{module_name}/include/**', 'dst': f'Modules/{module_name}/include/'},
{'src': f'Modules/{module_name}/*.md', 'dst': f'Modules/{module_name}/'},
{'src': f'build/esp-idf/{module_name}/lib{module_name}.a', 'dst': f'Modules/{module_name}/binary/lib{module_name}.a'},
]

def create_module_cmakelists(module_name):
return dedent(f'''
cmake_minimum_required(VERSION 3.20)
idf_component_register(
INCLUDE_DIRS "include"
)
add_prebuilt_library({module_name} "binary/lib{module_name}.a")
'''.format(module_name=module_name))
Comment on lines +78 to +85
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Redundant .format() call on f-string; also missing target_link_libraries.

  1. Line 85 uses .format(module_name=module_name) on an f-string, which is redundant since the f-string already interpolates {module_name}.

  2. The generated CMakeLists.txt registers the prebuilt library but doesn't link it to ${COMPONENT_LIB}, so consumers won't automatically get the library linked.

🐛 Proposed fix
 def create_module_cmakelists(module_name):
     return dedent(f'''
     cmake_minimum_required(VERSION 3.20)
     idf_component_register(
         INCLUDE_DIRS "include"
     )
     add_prebuilt_library({module_name} "binary/lib{module_name}.a")
-    '''.format(module_name=module_name))
+    target_link_libraries(${{COMPONENT_LIB}} INTERFACE {module_name})
+    ''')

Note: ${{COMPONENT_LIB}} uses double braces to escape the CMake variable from Python f-string interpolation.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def create_module_cmakelists(module_name):
return dedent(f'''
cmake_minimum_required(VERSION 3.20)
idf_component_register(
INCLUDE_DIRS "include"
)
add_prebuilt_library({module_name} "binary/lib{module_name}.a")
'''.format(module_name=module_name))
def create_module_cmakelists(module_name):
return dedent(f'''
cmake_minimum_required(VERSION 3.20)
idf_component_register(
INCLUDE_DIRS "include"
)
add_prebuilt_library({module_name} "binary/lib{module_name}.a")
target_link_libraries(${{COMPONENT_LIB}} INTERFACE {module_name})
''')


def write_module_cmakelists(path, content):
with open(path, 'w') as f:
f.write(content)

def add_driver(target_path, driver_name):
mappings = get_driver_mappings(driver_name)
map_copy(mappings, target_path)
cmakelists_content = create_module_cmakelists(driver_name)
write_module_cmakelists(os.path.join(target_path, f"Drivers/{driver_name}/CMakeLists.txt"), cmakelists_content)

def add_module(target_path, module_name):
mappings = get_module_mappings(module_name)
map_copy(mappings, target_path)
cmakelists_content = create_module_cmakelists(module_name)
write_module_cmakelists(os.path.join(target_path, f"Modules/{module_name}/CMakeLists.txt"), cmakelists_content)

def main():
if len(sys.argv) < 2:
Expand All @@ -85,12 +125,7 @@ def main():
{'src': 'build/esp-idf/TactilityKernel/libTactilityKernel.a', 'dst': 'Libraries/TactilityKernel/binary/'},
{'src': 'TactilityKernel/include/**', 'dst': 'Libraries/TactilityKernel/include/'},
{'src': 'TactilityKernel/CMakeLists.txt', 'dst': 'Libraries/TactilityKernel/'},
{'src': 'TactilityKernel/LICENSE*.*', 'dst': 'Libraries/TactilityKernel/'},
# lvgl-module
{'src': 'build/esp-idf/lvgl-module/liblvgl-module.a', 'dst': 'Libraries/lvgl-module/binary/'},
{'src': 'Modules/lvgl-module/include/**', 'dst': 'Libraries/lvgl-module/include/'},
{'src': 'Modules/lvgl-module/CMakeLists.txt', 'dst': 'Libraries/lvgl-module/'},
{'src': 'Modules/lvgl-module/LICENSE*.*', 'dst': 'Libraries/lvgl-module/'},
{'src': 'TactilityKernel/*.md', 'dst': 'Libraries/TactilityKernel/'},
# lvgl (basics)
{'src': 'build/esp-idf/lvgl__lvgl/liblvgl__lvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'},
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'},
Expand All @@ -108,6 +143,18 @@ def main():

map_copy(mappings, target_path)

# Modules
add_module(target_path, "lvgl-module")

# Drivers
add_driver(target_path, "bm8563-module")
add_driver(target_path, "bm8563-module")
add_driver(target_path, "bmi270-module")
add_driver(target_path, "mpu6886-module")
add_driver(target_path, "pi4ioe5v6408-module")
add_driver(target_path, "qmi8658-module")
add_driver(target_path, "rx8130ce-module")
Comment on lines +149 to +156
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Duplicate entry: bm8563-module is added twice.

Lines 150-151 both call add_driver(target_path, "bm8563-module"). This mirrors the same duplicate in CMakeLists.txt and appears to be a copy-paste error.

🐛 Proposed fix
     # Drivers
     add_driver(target_path, "bm8563-module")
-    add_driver(target_path, "bm8563-module")
     add_driver(target_path, "bmi270-module")
     add_driver(target_path, "mpu6886-module")
     add_driver(target_path, "pi4ioe5v6408-module")
     add_driver(target_path, "qmi8658-module")
     add_driver(target_path, "rx8130ce-module")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Drivers
add_driver(target_path, "bm8563-module")
add_driver(target_path, "bm8563-module")
add_driver(target_path, "bmi270-module")
add_driver(target_path, "mpu6886-module")
add_driver(target_path, "pi4ioe5v6408-module")
add_driver(target_path, "qmi8658-module")
add_driver(target_path, "rx8130ce-module")
# Drivers
add_driver(target_path, "bm8563-module")
add_driver(target_path, "bmi270-module")
add_driver(target_path, "mpu6886-module")
add_driver(target_path, "pi4ioe5v6408-module")
add_driver(target_path, "qmi8658-module")
add_driver(target_path, "rx8130ce-module")


# Output ESP-IDF SDK version to file
esp_idf_version = os.environ.get("ESP_IDF_VERSION", "")
with open(os.path.join(target_path, "idf-version.txt"), "a") as f:
Expand Down
7 changes: 7 additions & 0 deletions Devices/generic-esp32/devicetree.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
dependencies:
- Platforms/platform-esp32
# Add all driver modules because the generic devices are used to build the SDK
- Drivers/bm8563-module
- Drivers/bmi270-module
- Drivers/mpu6886-module
- Drivers/pi4ioe5v6408-module
- Drivers/qmi8658-module
- Drivers/rx8130ce-module
dts: generic,esp32.dts
7 changes: 7 additions & 0 deletions Devices/generic-esp32c6/devicetree.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
dependencies:
- Platforms/platform-esp32
# Add all driver modules because the generic devices are used to build the SDK
- Drivers/bm8563-module
- Drivers/bmi270-module
- Drivers/mpu6886-module
- Drivers/pi4ioe5v6408-module
- Drivers/qmi8658-module
- Drivers/rx8130ce-module
dts: generic,esp32c6.dts
7 changes: 7 additions & 0 deletions Devices/generic-esp32p4/devicetree.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
dependencies:
- Platforms/platform-esp32
# Add all driver modules because the generic devices are used to build the SDK
- Drivers/bm8563-module
- Drivers/bmi270-module
- Drivers/mpu6886-module
- Drivers/pi4ioe5v6408-module
- Drivers/qmi8658-module
- Drivers/rx8130ce-module
dts: generic,esp32p4.dts
7 changes: 7 additions & 0 deletions Devices/generic-esp32s3/devicetree.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
dependencies:
- Platforms/platform-esp32
# Add all driver modules because the generic devices are used to build the SDK
- Drivers/bm8563-module
- Drivers/bmi270-module
- Drivers/mpu6886-module
- Drivers/pi4ioe5v6408-module
- Drivers/qmi8658-module
- Drivers/rx8130ce-module
dts: generic,esp32s3.dts
1 change: 1 addition & 0 deletions Devices/lilygo-thmi/lilygo,thmi.dts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>;
pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>;
bus-width = <1>;
pullups;
};
};
10 changes: 9 additions & 1 deletion Platforms/platform-esp32/bindings/espressif,esp32-sdmmc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ properties:
enable-uhs:
type: boolean
default: false
description: Enable UHS mode
description: Enable UHS mode
pullups:
type: boolean
default: false
description: Enable internal pullups for SDMMC pins
on-chip-ldo-chan:
type: int
default: -1
description: On-chip LDO channel for SD power (e.g. 4 for LDO4). Set to -1 to disable.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct Esp32SdmmcConfig {
uint8_t bus_width;
bool wp_active_high;
bool enable_uhs;
bool pullups;
int32_t on_chip_ldo_chan;
};

/**
Expand Down
21 changes: 13 additions & 8 deletions Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,24 @@ static error_t mount(void* data) {
sdmmc_host_t host = SDMMC_HOST_DEFAULT();

#if SOC_SD_PWR_CTRL_SUPPORTED
sd_pwr_ctrl_ldo_config_t ldo_config = {
.ldo_chan_id = 4, // LDO4 is typically used for SDMMC on ESP32-S3
};
esp_err_t pwr_err = sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &fs_data->pwr_ctrl_handle);
if (pwr_err != ESP_OK) {
LOG_E(TAG, "Failed to create SD power control driver, err=0x%x", pwr_err);
return ERROR_NOT_SUPPORTED;
// Treat non-positive values as disabled to remain safe with zero-initialized configs.
if (config->on_chip_ldo_chan > 0) {
sd_pwr_ctrl_ldo_config_t ldo_config = {
.ldo_chan_id = (uint32_t)config->on_chip_ldo_chan,
};
esp_err_t pwr_err = sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &fs_data->pwr_ctrl_handle);
if (pwr_err != ESP_OK) {
LOG_E(TAG, "Failed to create SD power control driver, err=0x%x", pwr_err);
return ERROR_NOT_SUPPORTED;
}
host.pwr_ctrl_handle = fs_data->pwr_ctrl_handle;
}
host.pwr_ctrl_handle = fs_data->pwr_ctrl_handle;
#endif

uint32_t slot_config_flags = 0;
if (config->enable_uhs) slot_config_flags |= SDMMC_SLOT_FLAG_UHS1;
if (config->wp_active_high) slot_config_flags |= SDMMC_SLOT_FLAG_WP_ACTIVE_HIGH;
if (config->pullups) slot_config_flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;

sdmmc_slot_config_t slot_config = {
.clk = to_native_pin(config->pin_clk),
Expand Down Expand Up @@ -127,6 +131,7 @@ static error_t mount(void* data) {
return ERROR_UNDEFINED;
}

sdmmc_card_print_info(stdout, fs_data->card);
LOG_I(TAG, "Mounted %s", fs_data->mount_path.c_str());

return ERROR_NONE;
Expand Down
6 changes: 3 additions & 3 deletions Tests/SdkIntegration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
if (DEFINED ENV{TACTILITY_SDK_PATH})
set(TACTILITY_SDK_PATH $ENV{TACTILITY_SDK_PATH})
else()
set(TACTILITY_SDK_PATH "../../release/TactilitySDK")
message(WARNING "⚠️ TACTILITY_SDK_PATH environment variable is not set, defaulting to ${TACTILITY_SDK_PATH}")
set(TACTILITY_SDK_PATH ../../release/TactilitySDK)
message(WARNING "TACTILITY_SDK_PATH environment variable is not set, defaulting to ${TACTILITY_SDK_PATH}")
endif()

include("${TACTILITY_SDK_PATH}/TactilitySDK.cmake")
set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH})
set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH} ${TACTILITY_SDK_PATH}/Modules ${TACTILITY_SDK_PATH}/Drivers)

project(SdkTest)
tactility_project(SdkTest)
Comment on lines +13 to 16
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

EXTRA_COMPONENT_DIRS will be overwritten by tactility_project macro.

Line 13 sets EXTRA_COMPONENT_DIRS, but the tactility_project macro (line 16) also sets this variable unconditionally (see lines 18-22 in TactilitySDK.cmake). The macro's assignment will override the test's paths.

Consider either:

  1. Having the macro append to EXTRA_COMPONENT_DIRS instead of replacing it
  2. Moving this assignment after the macro call
  3. Setting paths within the macro using ${TACTILITY_SDK_PATH} as suggested in the other review

7 changes: 7 additions & 0 deletions Tests/SdkIntegration/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c)
idf_component_register(
SRCS ${SOURCE_FILES}
REQUIRES TactilitySDK
lvgl-module
bm8563-module
bmi270-module
mpu6886-module
pi4ioe5v6408-module
qmi8658-module
rx8130ce-module
)
8 changes: 8 additions & 0 deletions Tests/SdkIntegration/main/Source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@

#include <tactility/lvgl_module.h>

#include <drivers/bm8563.h>
#include <drivers/bmi270.h>
#include <drivers/mpu6886.h>
#include <drivers/mpu6886.h>
Comment on lines +29 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Duplicate include: mpu6886.h is included twice.

Lines 29 and 30 both include <drivers/mpu6886.h>. Remove the duplicate.

🐛 Proposed fix
 `#include` <drivers/bmi270.h>
 `#include` <drivers/mpu6886.h>
-#include <drivers/mpu6886.h>
 `#include` <drivers/pi4ioe5v6408.h>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#include <drivers/mpu6886.h>
#include <drivers/mpu6886.h>
`#include` <drivers/bmi270.h>
`#include` <drivers/mpu6886.h>
`#include` <drivers/pi4ioe5v6408.h>

#include <drivers/pi4ioe5v6408.h>
#include <drivers/qmi8658.h>
#include <drivers/rx8130ce.h>

static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) {
lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, app);
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
Expand Down
Loading