mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-22 03:15:05 +00:00
Compare commits
17 Commits
0426081eb0
...
099753ff99
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
099753ff99 | ||
|
|
abe07c9651 | ||
|
|
53eff3f32a | ||
|
|
2b4398856e | ||
|
|
5eb7285b38 | ||
|
|
0521462ffc | ||
|
|
e61023e087 | ||
|
|
219970c2ac | ||
|
|
5a42bb7d03 | ||
|
|
69878b4395 | ||
|
|
73319c7ba4 | ||
|
|
2cf5c3c853 | ||
|
|
56bb9fcc82 | ||
|
|
827f5034d5 | ||
|
|
4b02a98ba2 | ||
|
|
7e3d178315 | ||
|
|
7c9c6e5798 |
@ -1,29 +0,0 @@
|
|||||||
if (COMMAND tactility_add_module)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
macro(tactility_add_module NAME)
|
|
||||||
set(options)
|
|
||||||
set(oneValueArgs)
|
|
||||||
set(multiValueArgs SRCS INCLUDE_DIRS PRIV_INCLUDE_DIRS REQUIRES PRIV_REQUIRES)
|
|
||||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
||||||
idf_component_register(
|
|
||||||
SRCS ${ARG_SRCS}
|
|
||||||
INCLUDE_DIRS ${ARG_INCLUDE_DIRS}
|
|
||||||
PRIV_INCLUDE_DIRS ${ARG_PRIV_INCLUDE_DIRS}
|
|
||||||
REQUIRES ${ARG_REQUIRES}
|
|
||||||
PRIV_REQUIRES ${ARG_PRIV_REQUIRES}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
add_library(${NAME} OBJECT)
|
|
||||||
target_sources(${NAME} PRIVATE ${ARG_SRCS})
|
|
||||||
target_include_directories(${NAME}
|
|
||||||
PRIVATE ${ARG_PRIV_INCLUDE_DIRS}
|
|
||||||
PUBLIC ${ARG_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
target_link_libraries(${NAME} PUBLIC ${ARG_REQUIRES})
|
|
||||||
target_link_libraries(${NAME} PRIVATE ${ARG_PRIV_REQUIRES})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
@ -12,14 +12,16 @@ set(Cyan "${Esc}[36m")
|
|||||||
file(READ version.txt TACTILITY_VERSION)
|
file(READ version.txt TACTILITY_VERSION)
|
||||||
add_compile_definitions(TT_VERSION="${TACTILITY_VERSION}")
|
add_compile_definitions(TT_VERSION="${TACTILITY_VERSION}")
|
||||||
|
|
||||||
# tactility_add_module() macro
|
|
||||||
include("Buildscripts/module.cmake")
|
|
||||||
|
|
||||||
# Determine device identifier and project location
|
# Determine device identifier and project location
|
||||||
include("Buildscripts/device.cmake")
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
init_tactility_globals("sdkconfig")
|
include("Buildscripts/device.cmake")
|
||||||
get_property(TACTILITY_DEVICE_PROJECT GLOBAL PROPERTY TACTILITY_DEVICE_PROJECT)
|
init_tactility_globals("sdkconfig")
|
||||||
get_property(TACTILITY_DEVICE_ID GLOBAL PROPERTY TACTILITY_DEVICE_ID)
|
get_property(TACTILITY_DEVICE_PROJECT GLOBAL PROPERTY TACTILITY_DEVICE_PROJECT)
|
||||||
|
get_property(TACTILITY_DEVICE_ID GLOBAL PROPERTY TACTILITY_DEVICE_ID)
|
||||||
|
else ()
|
||||||
|
set(TACTILITY_DEVICE_PROJECT "Devices/simulator")
|
||||||
|
set(TACTILITY_DEVICE_ID "simulator")
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
message("Using ESP-IDF ${Cyan}v$ENV{ESP_IDF_VERSION}${ColorReset}")
|
message("Using ESP-IDF ${Cyan}v$ENV{ESP_IDF_VERSION}${ColorReset}")
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "btt-panda-touch",
|
.name = "btt-panda-touch",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-2432s024c",
|
.name = "cyd-2432s024c",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-2432s028r",
|
.name = "cyd-2432s028r",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-2432s028rv3",
|
.name = "cyd-2432s028rv3",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-2432s032c",
|
.name = "cyd-2432s032c",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-4848s040c",
|
.name = "cyd-4848s040c",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-8048s043c",
|
.name = "cyd-8048s043c",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-e32r28t",
|
.name = "cyd-e32r28t",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "cyd-e32r32p",
|
.name = "cyd-e32r32p",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "elecrow-crowpanel-advance-28",
|
.name = "elecrow-crowpanel-advance-28",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "elecrow-crowpanel-advance-35",
|
.name = "elecrow-crowpanel-advance-35",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "elecrow-crowpanel-advance-50",
|
.name = "elecrow-crowpanel-advance-50",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "elecrow-crowpanel-basic-28",
|
.name = "elecrow-crowpanel-basic-28",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "elecrow-crowpanel-basic-35",
|
.name = "elecrow-crowpanel-basic-35",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "elecrow-crowpanel-basic-50",
|
.name = "elecrow-crowpanel-basic-50",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "generic-esp32",
|
.name = "generic-esp32",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "generic-esp32c6",
|
.name = "generic-esp32c6",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "generic-esp32p4",
|
.name = "generic-esp32p4",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "generic-esp32s3",
|
.name = "generic-esp32s3",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "guition-jc1060p470ciwy",
|
.name = "guition-jc1060p470ciwy",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "guition-jc2432w328c",
|
.name = "guition-jc2432w328c",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "guition-jc3248w535c",
|
.name = "guition-jc3248w535c",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "guition-jc8048w550c",
|
.name = "guition-jc8048w550c",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "heltec-wifi-lora-32-v3",
|
.name = "heltec-wifi-lora-32-v3",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "lilygo-tdeck",
|
.name = "lilygo-tdeck",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "lilygo-tdisplay-s3",
|
.name = "lilygo-tdisplay-s3",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "lilygo-tdisplay",
|
.name = "lilygo-tdisplay",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "lilygo-tdongle-s3",
|
.name = "lilygo-tdongle-s3",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "lilygo-tlora-pager",
|
.name = "lilygo-tlora-pager",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "m5stack-cardputer-adv",
|
.name = "m5stack-cardputer-adv",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "m5stack-cardputer",
|
.name = "m5stack-cardputer",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "m5stack-core2",
|
.name = "m5stack-core2",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "m5stack-cores3",
|
.name = "m5stack-cores3",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "m5stack-stickc-plus",
|
.name = "m5stack-stickc-plus",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "m5stack-stickc-plus2",
|
.name = "m5stack-stickc-plus2",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "m5stack-tab5",
|
.name = "m5stack-tab5",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "simulator",
|
.name = "simulator",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "unphone",
|
.name = "unphone",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "waveshare-esp32-s3-geek",
|
.name = "waveshare-esp32-s3-geek",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "waveshare-s3-lcd-13",
|
.name = "waveshare-s3-lcd-13",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "waveshare-s3-touch-lcd-128",
|
.name = "waveshare-s3-touch-lcd-128",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "waveshare-s3-touch-lcd-147",
|
.name = "waveshare-s3-touch-lcd-147",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "waveshare-s3-touch-lcd-43",
|
.name = "waveshare-s3-touch-lcd-43",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@ static error_t stop() {
|
|||||||
struct Module device_module = {
|
struct Module device_module = {
|
||||||
.name = "wireless-tag-wt32-sc01-plus",
|
.name = "wireless-tag-wt32-sc01-plus",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,41 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/../../Buildscripts/module.cmake")
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCE_FILES "Source/*.c*")
|
file(GLOB_RECURSE SOURCE_FILES "Source/*.c*")
|
||||||
|
|
||||||
list(APPEND REQUIRES_LIST
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
|
|
||||||
|
list(APPEND REQUIRES_LIST
|
||||||
TactilityKernel
|
TactilityKernel
|
||||||
TactilityCore
|
TactilityCore
|
||||||
TactilityFreeRtos
|
TactilityFreeRtos
|
||||||
)
|
)
|
||||||
|
|
||||||
|
idf_component_register(
|
||||||
|
SRCS ${SOURCE_FILES}
|
||||||
|
INCLUDE_DIRS "Include/"
|
||||||
|
REQUIRES ${REQUIRES_LIST}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-unused-variable)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
add_library(hal-device-module OBJECT)
|
||||||
|
|
||||||
|
target_sources(hal-device-module PRIVATE ${SOURCE_FILES})
|
||||||
|
|
||||||
|
target_include_directories(hal-device-module
|
||||||
|
PUBLIC Include/
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(hal-device-module PUBLIC
|
||||||
|
TactilityFreeRtos
|
||||||
|
TactilityCore
|
||||||
|
TactilityKernel
|
||||||
|
freertos_kernel
|
||||||
|
)
|
||||||
|
|
||||||
if (NOT DEFINED ENV{ESP_IDF_VERSION})
|
|
||||||
list(APPEND REQUIRES_LIST freertos_kernel)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
tactility_add_module(hal-device-module
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS Include/
|
|
||||||
REQUIRES ${REQUIRES_LIST}
|
|
||||||
)
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#define TAG "HalDevice"
|
#define TAG LOG_TAG(HalDevice)
|
||||||
|
|
||||||
struct HalDevicePrivate {
|
struct HalDevicePrivate {
|
||||||
std::shared_ptr<tt::hal::Device> halDevice;
|
std::shared_ptr<tt::hal::Device> halDevice;
|
||||||
|
|||||||
@ -17,15 +17,15 @@ static error_t start() {
|
|||||||
static error_t stop() {
|
static error_t stop() {
|
||||||
/* We crash when destruct fails, because if a single driver fails to destruct,
|
/* 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 */
|
* there is no guarantee that the previously destroyed drivers can be recovered */
|
||||||
check(driver_remove_destruct(&hal_device_driver) == ERROR_NONE);
|
check(driver_remove(&hal_device_driver) == ERROR_NONE);
|
||||||
|
check(driver_destruct(&hal_device_driver) == ERROR_NONE);
|
||||||
return ERROR_NONE;
|
return ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Module hal_device_module = {
|
struct Module hal_device_module = {
|
||||||
.name = "hal-device",
|
.name = "hal-device",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,30 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCE_FILES "Source/*.c*")
|
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||||
|
|
||||||
list(APPEND REQUIRES_LIST
|
|
||||||
TactilityKernel
|
|
||||||
lvgl
|
|
||||||
)
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
list(APPEND REQUIRES_LIST esp_lvgl_port)
|
|
||||||
|
idf_component_register(
|
||||||
|
SRCS ${SOURCE_FILES}
|
||||||
|
INCLUDE_DIRS "Include/"
|
||||||
|
REQUIRES TactilityKernel lvgl esp_lvgl_port
|
||||||
|
)
|
||||||
|
|
||||||
else ()
|
else ()
|
||||||
list(APPEND REQUIRES_LIST freertos_kernel)
|
|
||||||
|
add_library(lvgl-module OBJECT)
|
||||||
|
|
||||||
|
target_sources(lvgl-module PRIVATE ${SOURCE_FILES})
|
||||||
|
|
||||||
|
target_include_directories(lvgl-module
|
||||||
|
PUBLIC Include/
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(lvgl-module PUBLIC
|
||||||
|
TactilityKernel
|
||||||
|
freertos_kernel
|
||||||
|
lvgl
|
||||||
|
)
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/../../Buildscripts/module.cmake")
|
|
||||||
|
|
||||||
tactility_add_module(lvgl-module
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS Include/
|
|
||||||
REQUIRES ${REQUIRES_LIST}
|
|
||||||
)
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#include <tactility/module.h>
|
#include <tactility/module.h>
|
||||||
#include <tactility/lvgl_module.h>
|
#include <tactility/lvgl_module.h>
|
||||||
|
|
||||||
extern const struct ModuleSymbol lvgl_module_symbols[];
|
|
||||||
error_t lvgl_arch_start();
|
error_t lvgl_arch_start();
|
||||||
error_t lvgl_arch_stop();
|
error_t lvgl_arch_stop();
|
||||||
|
|
||||||
@ -63,6 +63,5 @@ bool lvgl_is_running() {
|
|||||||
struct Module lvgl_module = {
|
struct Module lvgl_module = {
|
||||||
.name = "lvgl",
|
.name = "lvgl",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = (const struct ModuleSymbol*)lvgl_module_symbols
|
|
||||||
};
|
};
|
||||||
@ -1,364 +0,0 @@
|
|||||||
#include <tactility/module.h>
|
|
||||||
#include <lvgl.h>
|
|
||||||
|
|
||||||
const struct ModuleSymbol lvgl_module_symbols[] = {
|
|
||||||
// lv_event
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_code),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_indev),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_key),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_param),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_scroll_anim),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_user_data),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_target_obj),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_target),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_current_target_obj),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_get_draw_task),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_event_stop_bubbling),
|
|
||||||
// lv_obj
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_color_hex),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_color_make),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_color_black),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_color_white),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_center),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_clean),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_clear_flag),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_delete),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_add_event_cb),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_add_flag),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_add_state),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_clear_state),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_state),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_align),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_align_to),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_parent),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_height),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_coords),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_x),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_display),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_y),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_content_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_content_height),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_group),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_user_data),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_state),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_has_flag),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_has_flag_any),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_has_state),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_invalidate),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_is_valid),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_remove_event_cb),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_remove_flag),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_remove_state),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_pos),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_flex_align),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_flex_flow),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_flex_grow),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_layout),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_is_layout_positioned),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_mark_layout_as_dirty),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_style_layout),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_update_layout),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_scroll_dir),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_scroll_to_view),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_radius),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_border_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_border_color),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_border_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_line_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_line_color),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_line_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_line_rounded),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_bg_color),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_bg_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_bg_image_src),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_bg_image_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_bg_image_recolor),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_bg_image_recolor_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_margin_hor),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_margin_ver),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_margin_top),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_margin_bottom),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_margin_left),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_margin_right),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_margin_all),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_all),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_hor),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_ver),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_top),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_bottom),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_left),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_right),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_column),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_row),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_border_post),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_border_side),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_align),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_color),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_font),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_decor),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_letter_space),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_line_space),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_outline_stroke_color),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_outline_stroke_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_text_outline_stroke_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_user_data),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_align),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_x),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_y),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_size),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_height),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_send_event),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_outline_color),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_outline_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_outline_pad),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_outline_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_flex_cross_place),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_image_recolor_opa),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_pad_gap),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_shadow_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_size),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_transform_pivot_x),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_transform_pivot_y),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_style_transform_rotation),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_scroll_to_y),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_scrollbar_mode),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_child_count),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_child),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_get_index),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_remove_style_all),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_content_height),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_set_content_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_event_base),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_class_create_obj),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_obj_class_init_obj),
|
|
||||||
// lv_font
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_font_get_default),
|
|
||||||
// lv_theme
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_theme_get_color_primary),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_theme_get_color_secondary),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_theme_get_font_small),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_theme_get_font_normal),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_theme_get_font_large),
|
|
||||||
// lv_button
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_button_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_btn_create),
|
|
||||||
// lv_buttonmatrix
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_get_button_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_get_map),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_get_one_checked),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_get_selected_button),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_button_ctrl),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_button_ctrl_all),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_ctrl_map),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_map),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_one_checked),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_button_width),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_selected_button),
|
|
||||||
// lv_canvas
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_canvas_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_canvas_set_draw_buf),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_canvas_set_px),
|
|
||||||
// lv_label
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_label_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_label_cut_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_label_get_long_mode),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_label_set_long_mode),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_label_get_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_label_set_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_label_set_text_fmt),
|
|
||||||
// lv_switch
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_switch_create),
|
|
||||||
// lv_checkbox
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_checkbox_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_checkbox_set_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_checkbox_get_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_checkbox_set_text_static),
|
|
||||||
// lv_bar
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_get_max_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_get_min_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_get_mode),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_get_start_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_get_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_set_mode),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_set_range),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_set_start_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_set_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_bar_is_symmetrical),
|
|
||||||
// lv_dropdown
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_add_option),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_clear_options),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_close),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_dir),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_list),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_option_count),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_option_index),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_options),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_selected),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_selected_str),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_get_selected_highlight),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_set_dir),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_set_options),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_set_options_static),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_set_selected),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_set_selected_highlight),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_set_symbol),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_set_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_dropdown_open),
|
|
||||||
// lv_list
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_list_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_list_add_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_list_add_button),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_list_get_button_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_list_set_button_text),
|
|
||||||
// lv_keyboard
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_keyboard_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_keyboard_set_textarea),
|
|
||||||
// lv_textarea
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_get_accepted_chars),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_get_label),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_get_max_length),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_get_one_line),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_get_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_get_text_selection),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_one_line),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_accepted_chars),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_align),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_password_bullet),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_password_mode),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_password_show_time),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_placeholder_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_text),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_text_selection),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_max_length),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_set_cursor_click_pos),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_textarea_add_text),
|
|
||||||
// lv_palette
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_palette_main),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_palette_darken),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_palette_lighten),
|
|
||||||
// lv_display
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_get_default),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_get_horizontal_resolution),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_get_vertical_resolution),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_get_physical_horizontal_resolution),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_get_physical_vertical_resolution),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_dpx),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_get_inactive_time),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_get_rotation),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_set_rotation),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_set_offset),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_display_trigger_activity),
|
|
||||||
// lv_pct
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_pct),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_pct_to_px),
|
|
||||||
// lv_spinbox
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_decrement),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_get_rollover),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_get_step),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_get_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_increment),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_set_rollover),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_set_step),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_set_range),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_set_digit_format),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_set_digit_step_direction),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_set_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_set_cursor_pos),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_step_next),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_spinbox_step_prev),
|
|
||||||
// lv_indev
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_get_type),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_get_point),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_get_display),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_get_key),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_get_gesture_dir),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_get_state),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_active),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_get_next),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_indev_set_group),
|
|
||||||
// lv_timer
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_handler),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_handler_run_in_period),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_periodic_handler),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_handler_set_resume_cb),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_create_basic),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_delete),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_pause),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_resume),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_set_cb),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_set_period),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_ready),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_set_repeat_count),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_set_auto_delete),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_set_user_data),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_reset),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_enable),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_get_idle),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_get_time_until_next),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_get_next),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_get_user_data),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_timer_get_paused),
|
|
||||||
// lvgl other
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_refr_now),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_line_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_line_set_points),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_line_set_points_mutable),
|
|
||||||
// lv_slider
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_slider_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_slider_get_value),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_slider_set_range),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_slider_set_value),
|
|
||||||
// lv_tabview
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_tabview_add_tab),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_tabview_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_tabview_set_tab_bar_position),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_tabview_set_tab_bar_size),
|
|
||||||
// lv_screen
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_scr_act),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_screen_active),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_layer_top),
|
|
||||||
// lv_group
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_remove_obj),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_focus_obj),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_get_default),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_add_obj),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_set_default),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_set_editing),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_group_delete),
|
|
||||||
// lv_mem
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_free),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_malloc),
|
|
||||||
// lv_draw
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_draw_task_get_draw_dsc),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_draw_task_get_label_dsc),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_draw_task_get_fill_dsc),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_draw_buf_create),
|
|
||||||
// lv_image
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_image_create),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_image_set_src),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_img_set_src),
|
|
||||||
// lv_anim
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_init),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_set_duration),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_set_exec_cb),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_set_repeat_count),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_set_values),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_set_var),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_set_path_cb),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_start),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_path_ease_in_out),
|
|
||||||
DEFINE_MODULE_SYMBOL(lv_anim_path_linear),
|
|
||||||
MODULE_SYMBOL_TERMINATOR
|
|
||||||
};
|
|
||||||
@ -2,8 +2,19 @@ cmake_minimum_required(VERSION 3.20)
|
|||||||
|
|
||||||
file(GLOB_RECURSE SOURCES "Source/*.c**")
|
file(GLOB_RECURSE SOURCES "Source/*.c**")
|
||||||
|
|
||||||
idf_component_register(
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
|
|
||||||
|
idf_component_register(
|
||||||
SRCS ${SOURCES}
|
SRCS ${SOURCES}
|
||||||
INCLUDE_DIRS "Include/"
|
INCLUDE_DIRS "Include/"
|
||||||
REQUIRES TactilityKernel driver
|
REQUIRES TactilityKernel driver
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
add_library(PlatformEsp32 OBJECT)
|
||||||
|
target_sources(PlatformEsp32 PRIVATE ${SOURCES})
|
||||||
|
target_include_directories(PlatformEsp32 PUBLIC Include/)
|
||||||
|
target_link_libraries(PlatformEsp32 PUBLIC TactilityKernel)
|
||||||
|
|
||||||
|
endif ()
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include <tactility/drivers/gpio.h>
|
#include <tactility/drivers/gpio.h>
|
||||||
#include <tactility/drivers/gpio_controller.h>
|
#include <tactility/drivers/gpio_controller.h>
|
||||||
|
|
||||||
#define TAG "esp32_gpio"
|
#define TAG LOG_TAG(esp32_gpio)
|
||||||
|
|
||||||
#define GET_CONFIG(device) ((struct Esp32GpioConfig*)device->config)
|
#define GET_CONFIG(device) ((struct Esp32GpioConfig*)device->config)
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#include <tactility/error_esp32.h>
|
#include <tactility/error_esp32.h>
|
||||||
#include <tactility/drivers/esp32_i2c.h>
|
#include <tactility/drivers/esp32_i2c.h>
|
||||||
|
|
||||||
#define TAG "esp32_i2c"
|
#define TAG LOG_TAG(esp32_i2c)
|
||||||
#define ACK_CHECK_EN 1
|
#define ACK_CHECK_EN 1
|
||||||
|
|
||||||
struct InternalData {
|
struct InternalData {
|
||||||
|
|||||||
@ -27,8 +27,7 @@ static error_t stop() {
|
|||||||
struct Module platform_module = {
|
struct Module platform_module = {
|
||||||
.name = "platform-esp32",
|
.name = "platform-esp32",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,19 @@ cmake_minimum_required(VERSION 3.20)
|
|||||||
|
|
||||||
file(GLOB_RECURSE SOURCES "Source/*.c**")
|
file(GLOB_RECURSE SOURCES "Source/*.c**")
|
||||||
|
|
||||||
add_library(PlatformPosix OBJECT)
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
target_sources(PlatformPosix PRIVATE ${SOURCES})
|
|
||||||
#target_include_directories(PlatformPosix PUBLIC Include/)
|
idf_component_register(
|
||||||
target_link_libraries(PlatformPosix PUBLIC TactilityKernel)
|
SRCS ${SOURCES}
|
||||||
|
# INCLUDE_DIRS "Include/"
|
||||||
|
REQUIRES TactilityKernel driver
|
||||||
|
)
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
add_library(PlatformPosix OBJECT)
|
||||||
|
target_sources(PlatformPosix PRIVATE ${SOURCES})
|
||||||
|
# target_include_directories(PlatformPosix PUBLIC Include/)
|
||||||
|
target_link_libraries(PlatformPosix PUBLIC TactilityKernel)
|
||||||
|
|
||||||
|
endif ()
|
||||||
@ -5,7 +5,7 @@
|
|||||||
#include <tactility/freertos/task.h>
|
#include <tactility/freertos/task.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#define TAG "freertos"
|
#define TAG LOG_TAG(freertos)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assert implementation as defined in the FreeRTOSConfig.h
|
* Assert implementation as defined in the FreeRTOSConfig.h
|
||||||
|
|||||||
@ -17,8 +17,7 @@ static error_t stop() {
|
|||||||
struct Module platform_module = {
|
struct Module platform_module = {
|
||||||
.name = "platform-posix",
|
.name = "platform-posix",
|
||||||
.start = start,
|
.start = start,
|
||||||
.stop = stop,
|
.stop = stop
|
||||||
.symbols = nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,26 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/../Buildscripts/module.cmake")
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
|
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
list(APPEND REQUIRES_LIST
|
||||||
|
|
||||||
list(APPEND REQUIRES_LIST
|
|
||||||
TactilityKernel
|
TactilityKernel
|
||||||
|
PlatformEsp32
|
||||||
TactilityCore
|
TactilityCore
|
||||||
TactilityFreeRtos
|
TactilityFreeRtos
|
||||||
hal-device-module
|
hal-device-module
|
||||||
lvgl-module
|
lvgl-module
|
||||||
lv_screenshot
|
|
||||||
minitar
|
|
||||||
minmea
|
|
||||||
)
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
||||||
|
|
||||||
list(APPEND REQUIRES_LIST
|
|
||||||
PlatformEsp32
|
|
||||||
driver
|
driver
|
||||||
elf_loader
|
elf_loader
|
||||||
|
lv_screenshot
|
||||||
QRCode
|
QRCode
|
||||||
esp_http_server
|
esp_http_server
|
||||||
esp_http_client
|
esp_http_client
|
||||||
esp-tls
|
esp-tls
|
||||||
esp_wifi
|
esp_wifi
|
||||||
json # Effectively cJSON
|
json
|
||||||
|
minitar
|
||||||
|
minmea
|
||||||
nvs_flash
|
nvs_flash
|
||||||
spiffs
|
spiffs
|
||||||
vfs
|
vfs
|
||||||
@ -39,25 +33,13 @@ if (DEFINED ENV{ESP_IDF_VERSION})
|
|||||||
list(APPEND REQUIRES_LIST esp_tinyusb)
|
list(APPEND REQUIRES_LIST esp_tinyusb)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
else ()
|
idf_component_register(
|
||||||
|
SRCS ${SOURCE_FILES}
|
||||||
list(APPEND REQUIRES_LIST
|
INCLUDE_DIRS "Include/"
|
||||||
PlatformPosix
|
PRIV_INCLUDE_DIRS "Private/"
|
||||||
freertos_kernel
|
REQUIRES ${REQUIRES_LIST}
|
||||||
cJSON
|
|
||||||
lvgl
|
|
||||||
)
|
)
|
||||||
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
tactility_add_module(Tactility
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS Include/
|
|
||||||
PRIV_INCLUDE_DIRS Private/
|
|
||||||
REQUIRES ${REQUIRES_LIST}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-unused-variable)
|
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-unused-variable)
|
||||||
endif ()
|
endif ()
|
||||||
@ -68,6 +50,31 @@ if (DEFINED ENV{ESP_IDF_VERSION})
|
|||||||
# Read-write
|
# Read-write
|
||||||
fatfs_create_spiflash_image(data "${CMAKE_CURRENT_SOURCE_DIR}/../Data/data" FLASH_IN_PROJECT PRESERVE_TIME)
|
fatfs_create_spiflash_image(data "${CMAKE_CURRENT_SOURCE_DIR}/../Data/data" FLASH_IN_PROJECT PRESERVE_TIME)
|
||||||
endif ()
|
endif ()
|
||||||
|
else()
|
||||||
|
file(GLOB_RECURSE SOURCES "Source/*.c*")
|
||||||
|
|
||||||
endif ()
|
add_library(Tactility OBJECT)
|
||||||
|
|
||||||
|
target_sources(Tactility PRIVATE ${SOURCES})
|
||||||
|
|
||||||
|
target_include_directories(Tactility
|
||||||
|
PRIVATE Private/
|
||||||
|
PUBLIC Include/
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(Tactility PUBLIC
|
||||||
|
cJSON
|
||||||
|
TactilityFreeRtos
|
||||||
|
TactilityCore
|
||||||
|
TactilityKernel
|
||||||
|
PlatformPosix
|
||||||
|
hal-device-module
|
||||||
|
lvgl-module
|
||||||
|
freertos_kernel
|
||||||
|
lvgl
|
||||||
|
lv_screenshot
|
||||||
|
minmea
|
||||||
|
minitar
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,11 @@ static auto LOGGER = Logger("Tactility");
|
|||||||
static const Configuration* config_instance = nullptr;
|
static const Configuration* config_instance = nullptr;
|
||||||
static Dispatcher mainDispatcher;
|
static Dispatcher mainDispatcher;
|
||||||
|
|
||||||
|
struct ModuleParent tactility_module_parent {
|
||||||
|
"tactility",
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
|
||||||
// region Default services
|
// region Default services
|
||||||
namespace service {
|
namespace service {
|
||||||
// Primary
|
// Primary
|
||||||
@ -333,9 +338,10 @@ void run(const Configuration& config, Module* platformModule, Module* deviceModu
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Module parent
|
||||||
|
check(module_parent_construct(&tactility_module_parent) == ERROR_NONE);
|
||||||
// hal-device-module
|
// hal-device-module
|
||||||
check(module_construct(&hal_device_module) == ERROR_NONE);
|
check(module_set_parent(&hal_device_module, &tactility_module_parent) == ERROR_NONE);
|
||||||
check(module_add(&hal_device_module) == ERROR_NONE);
|
|
||||||
check(module_start(&hal_device_module) == ERROR_NONE);
|
check(module_start(&hal_device_module) == ERROR_NONE);
|
||||||
|
|
||||||
const hal::Configuration& hardware = *config.hardware;
|
const hal::Configuration& hardware = *config.hardware;
|
||||||
@ -365,8 +371,7 @@ void run(const Configuration& config, Module* platformModule, Module* deviceModu
|
|||||||
.task_affinity = getCpuAffinityConfiguration().graphics
|
.task_affinity = getCpuAffinityConfiguration().graphics
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
check(module_construct(&lvgl_module) == ERROR_NONE);
|
check(module_set_parent(&lvgl_module, &tactility_module_parent) == ERROR_NONE);
|
||||||
check(module_add(&lvgl_module) == ERROR_NONE);
|
|
||||||
lvgl::start();
|
lvgl::start();
|
||||||
|
|
||||||
registerAndStartSecondaryServices();
|
registerAndStartSecondaryServices();
|
||||||
|
|||||||
@ -1,27 +1,32 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/../Buildscripts/module.cmake")
|
|
||||||
|
|
||||||
list(APPEND REQUIRES_LIST
|
|
||||||
lvgl
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND PRIV_REQUIRES_LIST
|
|
||||||
Tactility
|
|
||||||
TactilityCore
|
|
||||||
TactilityKernel
|
|
||||||
)
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
list(APPEND PRIV_REQUIRES_LIST elf_loader)
|
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||||
endif ()
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
idf_component_register(
|
||||||
|
|
||||||
tactility_add_module(TactilityC
|
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
INCLUDE_DIRS Include/
|
INCLUDE_DIRS "Include/"
|
||||||
PRIV_INCLUDE_DIRS Private/
|
PRIV_INCLUDE_DIRS "Private/"
|
||||||
REQUIRES ${REQUIRES_LIST}
|
REQUIRES lvgl
|
||||||
PRIV_REQUIRES ${PRIV_REQUIRES_LIST}
|
PRIV_REQUIRES Tactility TactilityCore elf_loader TactilityKernel
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-unused-variable)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
file(GLOB_RECURSE SOURCES "Source/*.c**")
|
||||||
|
|
||||||
|
add_library(TactilityC OBJECT)
|
||||||
|
|
||||||
|
target_sources(TactilityC PRIVATE ${SOURCES})
|
||||||
|
include_directories(TactilityC PRIVATE Private/)
|
||||||
|
target_include_directories(TactilityC PUBLIC Include/)
|
||||||
|
target_link_libraries(TactilityC
|
||||||
|
PRIVATE Tactility
|
||||||
|
PRIVATE TactilityCore
|
||||||
|
PRIVATE TactilityKernel
|
||||||
|
PUBLIC lvgl
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -7,22 +7,12 @@ extern "C" {
|
|||||||
extern void* _Znwj(uint32_t size); // operator new(unsigned int)
|
extern void* _Znwj(uint32_t size); // operator new(unsigned int)
|
||||||
extern void _ZdlPvj(void* p, uint64_t size); // operator delete(void*, unsigned int)
|
extern void _ZdlPvj(void* p, uint64_t size); // operator delete(void*, unsigned int)
|
||||||
extern void __cxa_pure_virtual();
|
extern void __cxa_pure_virtual();
|
||||||
// cxx_guards.cpp
|
|
||||||
extern int __cxa_guard_acquire(void* pg);
|
|
||||||
extern void __cxa_guard_release(void* pg) throw();
|
|
||||||
extern void __cxa_guard_abort(void* pg) throw();
|
|
||||||
extern void __cxa_guard_dummy(void);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const esp_elfsym cplusplus_symbols[] = {
|
const esp_elfsym cplusplus_symbols[] = {
|
||||||
ESP_ELFSYM_EXPORT(_Znwj), // operator new(unsigned int)
|
ESP_ELFSYM_EXPORT(_Znwj), // operator new(unsigned int)
|
||||||
ESP_ELFSYM_EXPORT(_ZdlPvj), // operator delete(void*, unsigned int)
|
ESP_ELFSYM_EXPORT(_ZdlPvj), // operator delete(void*, unsigned int)
|
||||||
// cxx_guards
|
|
||||||
ESP_ELFSYM_EXPORT(__cxa_pure_virtual), // class-related, see https://arobenko.github.io/bare_metal_cpp/
|
ESP_ELFSYM_EXPORT(__cxa_pure_virtual), // class-related, see https://arobenko.github.io/bare_metal_cpp/
|
||||||
ESP_ELFSYM_EXPORT(__cxa_guard_acquire),
|
|
||||||
ESP_ELFSYM_EXPORT(__cxa_guard_release),
|
|
||||||
ESP_ELFSYM_EXPORT(__cxa_guard_abort),
|
|
||||||
ESP_ELFSYM_EXPORT(__cxa_guard_dummy),
|
|
||||||
// delimiter
|
// delimiter
|
||||||
ESP_ELFSYM_END
|
ESP_ELFSYM_END
|
||||||
};
|
};
|
||||||
|
|||||||
@ -20,36 +20,37 @@
|
|||||||
#include "tt_time.h"
|
#include "tt_time.h"
|
||||||
#include "tt_wifi.h"
|
#include "tt_wifi.h"
|
||||||
|
|
||||||
#include "symbols/cplusplus.h"
|
|
||||||
#include "symbols/esp_event.h"
|
#include "symbols/esp_event.h"
|
||||||
#include "symbols/esp_http_client.h"
|
#include "symbols/esp_http_client.h"
|
||||||
#include "symbols/freertos.h"
|
|
||||||
#include "symbols/gcc_soft_float.h"
|
|
||||||
#include "symbols/pthread.h"
|
#include "symbols/pthread.h"
|
||||||
#include "symbols/stl.h"
|
#include "symbols/stl.h"
|
||||||
#include "symbols/string.h"
|
#include "symbols/string.h"
|
||||||
|
#include "symbols/cplusplus.h"
|
||||||
|
#include "symbols/freertos.h"
|
||||||
|
#include "symbols/gcc_soft_float.h"
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <cassert>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <dirent.h>
|
#include <cmath>
|
||||||
|
#include <ctime>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <sys/errno.h>
|
||||||
|
#include <sys/unistd.h>
|
||||||
|
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
#include <esp_random.h>
|
#include <esp_random.h>
|
||||||
#include <esp_sntp.h>
|
#include <esp_sntp.h>
|
||||||
#include <esp_netif.h>
|
#include <esp_netif.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <time.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <lwip/sockets.h>
|
#include <lwip/sockets.h>
|
||||||
#include <locale.h>
|
|
||||||
#include <setjmp.h>
|
|
||||||
#include <sys/errno.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/unistd.h>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <Tactility/Tactility.h>
|
#include <lvgl.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@ -87,30 +88,8 @@ const esp_elfsym main_symbols[] {
|
|||||||
// esp_sntp.h
|
// esp_sntp.h
|
||||||
ESP_ELFSYM_EXPORT(sntp_get_sync_status),
|
ESP_ELFSYM_EXPORT(sntp_get_sync_status),
|
||||||
// math.h
|
// math.h
|
||||||
ESP_ELFSYM_EXPORT(atan),
|
|
||||||
ESP_ELFSYM_EXPORT(cos),
|
ESP_ELFSYM_EXPORT(cos),
|
||||||
ESP_ELFSYM_EXPORT(sin),
|
ESP_ELFSYM_EXPORT(sin),
|
||||||
ESP_ELFSYM_EXPORT(tan),
|
|
||||||
ESP_ELFSYM_EXPORT(tanh),
|
|
||||||
ESP_ELFSYM_EXPORT(frexp),
|
|
||||||
ESP_ELFSYM_EXPORT(modf),
|
|
||||||
ESP_ELFSYM_EXPORT(ceil),
|
|
||||||
ESP_ELFSYM_EXPORT(fabs),
|
|
||||||
ESP_ELFSYM_EXPORT(floor),
|
|
||||||
#ifndef _REENT_ONLY
|
|
||||||
ESP_ELFSYM_EXPORT(acos),
|
|
||||||
ESP_ELFSYM_EXPORT(asin),
|
|
||||||
ESP_ELFSYM_EXPORT(atan2),
|
|
||||||
ESP_ELFSYM_EXPORT(cos),
|
|
||||||
ESP_ELFSYM_EXPORT(sinh),
|
|
||||||
ESP_ELFSYM_EXPORT(exp),
|
|
||||||
ESP_ELFSYM_EXPORT(ldexp),
|
|
||||||
ESP_ELFSYM_EXPORT(log),
|
|
||||||
ESP_ELFSYM_EXPORT(log10),
|
|
||||||
ESP_ELFSYM_EXPORT(pow),
|
|
||||||
ESP_ELFSYM_EXPORT(sqrt),
|
|
||||||
ESP_ELFSYM_EXPORT(fmod),
|
|
||||||
#endif
|
|
||||||
// sys/errno.h
|
// sys/errno.h
|
||||||
ESP_ELFSYM_EXPORT(__errno),
|
ESP_ELFSYM_EXPORT(__errno),
|
||||||
// freertos_tasks_c_additions.h
|
// freertos_tasks_c_additions.h
|
||||||
@ -133,7 +112,6 @@ const esp_elfsym main_symbols[] {
|
|||||||
// cassert
|
// cassert
|
||||||
ESP_ELFSYM_EXPORT(__assert_func),
|
ESP_ELFSYM_EXPORT(__assert_func),
|
||||||
// cstdio
|
// cstdio
|
||||||
ESP_ELFSYM_EXPORT(abort),
|
|
||||||
ESP_ELFSYM_EXPORT(fclose),
|
ESP_ELFSYM_EXPORT(fclose),
|
||||||
ESP_ELFSYM_EXPORT(feof),
|
ESP_ELFSYM_EXPORT(feof),
|
||||||
ESP_ELFSYM_EXPORT(ferror),
|
ESP_ELFSYM_EXPORT(ferror),
|
||||||
@ -142,7 +120,6 @@ const esp_elfsym main_symbols[] {
|
|||||||
ESP_ELFSYM_EXPORT(fgetpos),
|
ESP_ELFSYM_EXPORT(fgetpos),
|
||||||
ESP_ELFSYM_EXPORT(fgets),
|
ESP_ELFSYM_EXPORT(fgets),
|
||||||
ESP_ELFSYM_EXPORT(fopen),
|
ESP_ELFSYM_EXPORT(fopen),
|
||||||
ESP_ELFSYM_EXPORT(freopen),
|
|
||||||
ESP_ELFSYM_EXPORT(fputc),
|
ESP_ELFSYM_EXPORT(fputc),
|
||||||
ESP_ELFSYM_EXPORT(fputs),
|
ESP_ELFSYM_EXPORT(fputs),
|
||||||
ESP_ELFSYM_EXPORT(fprintf),
|
ESP_ELFSYM_EXPORT(fprintf),
|
||||||
@ -176,15 +153,11 @@ const esp_elfsym main_symbols[] {
|
|||||||
ESP_ELFSYM_EXPORT(strtol),
|
ESP_ELFSYM_EXPORT(strtol),
|
||||||
ESP_ELFSYM_EXPORT(strcspn),
|
ESP_ELFSYM_EXPORT(strcspn),
|
||||||
ESP_ELFSYM_EXPORT(strncat),
|
ESP_ELFSYM_EXPORT(strncat),
|
||||||
ESP_ELFSYM_EXPORT(strpbrk),
|
|
||||||
ESP_ELFSYM_EXPORT(strspn),
|
|
||||||
ESP_ELFSYM_EXPORT(strcoll),
|
|
||||||
ESP_ELFSYM_EXPORT(memset),
|
ESP_ELFSYM_EXPORT(memset),
|
||||||
ESP_ELFSYM_EXPORT(memcpy),
|
ESP_ELFSYM_EXPORT(memcpy),
|
||||||
ESP_ELFSYM_EXPORT(memcmp),
|
ESP_ELFSYM_EXPORT(memcmp),
|
||||||
ESP_ELFSYM_EXPORT(memchr),
|
ESP_ELFSYM_EXPORT(memchr),
|
||||||
ESP_ELFSYM_EXPORT(memmove),
|
ESP_ELFSYM_EXPORT(memmove),
|
||||||
|
|
||||||
// ctype
|
// ctype
|
||||||
ESP_ELFSYM_EXPORT(isalnum),
|
ESP_ELFSYM_EXPORT(isalnum),
|
||||||
ESP_ELFSYM_EXPORT(isalpha),
|
ESP_ELFSYM_EXPORT(isalpha),
|
||||||
@ -311,7 +284,300 @@ const esp_elfsym main_symbols[] {
|
|||||||
ESP_ELFSYM_EXPORT(tt_wifi_get_rssi),
|
ESP_ELFSYM_EXPORT(tt_wifi_get_rssi),
|
||||||
// tt::lvgl
|
// tt::lvgl
|
||||||
ESP_ELFSYM_EXPORT(tt_lvgl_spinner_create),
|
ESP_ELFSYM_EXPORT(tt_lvgl_spinner_create),
|
||||||
|
// lv_event
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_code),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_indev),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_key),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_param),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_scroll_anim),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_user_data),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_target_obj),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_target),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_current_target_obj),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_event_get_draw_task),
|
||||||
|
// lv_obj
|
||||||
|
ESP_ELFSYM_EXPORT(lv_color_hex),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_color_make),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_center),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_clean),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_clear_flag),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_delete),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_add_event_cb),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_add_flag),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_add_state),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_align),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_align_to),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_parent),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_height),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_coords),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_x),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_display),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_y),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_content_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_content_height),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_group),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_user_data),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_state),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_has_flag),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_has_flag_any),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_has_state),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_invalidate),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_is_valid),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_remove_event_cb),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_remove_flag),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_remove_state),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_pos),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_flex_align),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_flex_flow),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_flex_grow),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_layout),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_is_layout_positioned),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_mark_layout_as_dirty),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_style_layout),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_update_layout),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_scroll_dir),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_scroll_to_view),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_radius),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_border_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_border_color),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_border_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_line_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_line_color),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_line_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_line_rounded),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_bg_color),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_bg_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_bg_image_src),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_bg_image_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_bg_image_recolor),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_bg_image_recolor_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_margin_hor),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_margin_ver),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_margin_top),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_margin_bottom),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_margin_left),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_margin_right),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_margin_all),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_all),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_hor),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_ver),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_top),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_bottom),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_left),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_right),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_column),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_pad_row),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_border_post),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_border_side),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_align),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_color),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_font),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_decor),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_letter_space),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_line_space),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_outline_stroke_color),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_outline_stroke_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_text_outline_stroke_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_user_data),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_align),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_x),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_y),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_size),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_height),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_send_event),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_outline_color),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_outline_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_outline_pad),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_style_outline_opa),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_scroll_to_y),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_set_scrollbar_mode),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_child_count),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_obj_get_child),
|
||||||
|
// lv_font
|
||||||
|
ESP_ELFSYM_EXPORT(lv_font_get_default),
|
||||||
|
// lv_theme
|
||||||
|
ESP_ELFSYM_EXPORT(lv_theme_get_color_primary),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_theme_get_color_secondary),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_theme_get_font_small),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_theme_get_font_normal),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_theme_get_font_large),
|
||||||
|
// lv_button
|
||||||
|
ESP_ELFSYM_EXPORT(lv_button_create),
|
||||||
|
// lv_buttonmatrix
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_get_button_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_get_map),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_get_one_checked),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_get_selected_button),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_set_button_ctrl),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_set_button_ctrl_all),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_set_ctrl_map),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_set_map),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_set_one_checked),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_set_button_width),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_buttonmatrix_set_selected_button),
|
||||||
|
// lv_label
|
||||||
|
ESP_ELFSYM_EXPORT(lv_label_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_label_cut_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_label_get_long_mode),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_label_set_long_mode),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_label_get_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_label_set_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_label_set_text_fmt),
|
||||||
|
// lv_switch
|
||||||
|
ESP_ELFSYM_EXPORT(lv_switch_create),
|
||||||
|
// lv_checkbox
|
||||||
|
ESP_ELFSYM_EXPORT(lv_checkbox_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_checkbox_set_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_checkbox_get_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_checkbox_set_text_static),
|
||||||
|
// lv_bar
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_get_max_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_get_min_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_get_mode),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_get_start_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_get_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_set_mode),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_set_range),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_set_start_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_set_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_bar_is_symmetrical),
|
||||||
|
// lv_dropdown
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_add_option),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_clear_options),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_close),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_dir),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_list),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_option_count),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_option_index),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_options),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_selected),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_selected_str),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_get_selected_highlight),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_set_dir),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_set_options),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_set_options_static),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_set_selected),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_set_selected_highlight),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_set_symbol),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_set_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_dropdown_open),
|
||||||
|
// lv_list
|
||||||
|
ESP_ELFSYM_EXPORT(lv_list_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_list_add_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_list_add_button),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_list_get_button_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_list_set_button_text),
|
||||||
|
// lv_textarea
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_get_accepted_chars),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_get_label),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_get_max_length),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_get_one_line),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_get_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_get_text_selection),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_one_line),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_accepted_chars),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_align),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_password_bullet),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_password_mode),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_password_show_time),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_placeholder_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_text),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_text_selection),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_max_length),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_set_cursor_click_pos),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_textarea_add_text),
|
||||||
|
// lv_palette
|
||||||
|
ESP_ELFSYM_EXPORT(lv_palette_main),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_palette_darken),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_palette_lighten),
|
||||||
|
// lv_display
|
||||||
|
ESP_ELFSYM_EXPORT(lv_display_get_default),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_display_get_horizontal_resolution),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_display_get_vertical_resolution),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_display_get_physical_horizontal_resolution),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_display_get_physical_vertical_resolution),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_display_dpx),
|
||||||
|
// lv_pct
|
||||||
|
ESP_ELFSYM_EXPORT(lv_pct),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_pct_to_px),
|
||||||
|
// lv_spinbox
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_decrement),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_get_rollover),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_get_step),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_get_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_increment),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_set_rollover),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_set_step),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_set_range),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_set_digit_format),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_set_digit_step_direction),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_set_value),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_set_cursor_pos),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_step_next),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_spinbox_step_prev),
|
||||||
|
// lv_indev
|
||||||
|
ESP_ELFSYM_EXPORT(lv_indev_get_type),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_indev_get_point),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_indev_get_display),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_indev_get_key),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_indev_get_gesture_dir),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_indev_get_state),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_indev_active),
|
||||||
|
// lv_timer
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_handler),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_handler_run_in_period),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_periodic_handler),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_handler_set_resume_cb),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_create_basic),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_delete),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_pause),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_resume),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_set_cb),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_set_period),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_ready),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_set_repeat_count),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_set_auto_delete),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_set_user_data),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_reset),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_enable),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_get_idle),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_get_time_until_next),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_get_next),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_get_user_data),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_timer_get_paused),
|
||||||
|
// lvgl other
|
||||||
|
ESP_ELFSYM_EXPORT(lv_refr_now),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_line_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_line_set_points),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_line_set_points_mutable),
|
||||||
|
// lv_group
|
||||||
|
ESP_ELFSYM_EXPORT(lv_group_remove_obj),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_group_focus_obj),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_group_get_default),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_group_add_obj),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_group_set_default),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_group_set_editing),
|
||||||
|
// lv_mem
|
||||||
|
ESP_ELFSYM_EXPORT(lv_free),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_malloc),
|
||||||
|
// lv_draw
|
||||||
|
ESP_ELFSYM_EXPORT(lv_draw_task_get_draw_dsc),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_draw_task_get_label_dsc),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_draw_task_get_fill_dsc),
|
||||||
|
// lv_image
|
||||||
|
ESP_ELFSYM_EXPORT(lv_image_create),
|
||||||
|
ESP_ELFSYM_EXPORT(lv_image_set_src),
|
||||||
// stdio.h
|
// stdio.h
|
||||||
ESP_ELFSYM_EXPORT(rename),
|
ESP_ELFSYM_EXPORT(rename),
|
||||||
// dirent.h
|
// dirent.h
|
||||||
@ -337,8 +603,6 @@ const esp_elfsym main_symbols[] {
|
|||||||
// esp_netif.h
|
// esp_netif.h
|
||||||
ESP_ELFSYM_EXPORT(esp_netif_get_ip_info),
|
ESP_ELFSYM_EXPORT(esp_netif_get_ip_info),
|
||||||
ESP_ELFSYM_EXPORT(esp_netif_get_handle_from_ifkey),
|
ESP_ELFSYM_EXPORT(esp_netif_get_handle_from_ifkey),
|
||||||
// Locale
|
|
||||||
ESP_ELFSYM_EXPORT(localeconv),
|
|
||||||
// delimiter
|
// delimiter
|
||||||
ESP_ELFSYM_END
|
ESP_ELFSYM_END
|
||||||
};
|
};
|
||||||
@ -374,11 +638,6 @@ uintptr_t tt_symbol_resolver(const char* symbolName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t symbol_address;
|
|
||||||
if (module_resolve_symbol_global(symbolName, &symbol_address)) {
|
|
||||||
return symbol_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,9 +645,7 @@ void tt_init_tactility_c() {
|
|||||||
elf_set_symbol_resolver(tt_symbol_resolver);
|
elf_set_symbol_resolver(tt_symbol_resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // extern "C"
|
||||||
|
|
||||||
// extern "C"
|
|
||||||
|
|
||||||
#else // Simulator
|
#else // Simulator
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +1,31 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/../Buildscripts/module.cmake")
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
|
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
idf_component_register(
|
||||||
|
SRCS ${SOURCE_FILES}
|
||||||
|
INCLUDE_DIRS "Include/"
|
||||||
|
REQUIRES TactilityFreeRtos TactilityKernel mbedtls nvs_flash esp_rom
|
||||||
|
)
|
||||||
|
|
||||||
list(APPEND REQUIRES_LIST
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-unused-variable)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
file(GLOB_RECURSE SOURCES "Source/*.c*")
|
||||||
|
|
||||||
|
add_library(TactilityCore OBJECT)
|
||||||
|
|
||||||
|
target_sources(TactilityCore
|
||||||
|
PRIVATE ${SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(TactilityCore PUBLIC Include/)
|
||||||
|
|
||||||
|
target_link_libraries(TactilityCore PUBLIC
|
||||||
TactilityFreeRtos
|
TactilityFreeRtos
|
||||||
TactilityKernel
|
TactilityKernel
|
||||||
mbedtls
|
mbedtls
|
||||||
)
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
||||||
list(APPEND REQUIRES_LIST
|
|
||||||
nvs_flash esp_rom
|
|
||||||
)
|
)
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
tactility_add_module(TactilityCore
|
|
||||||
SRCS ${SOURCE_FILES}
|
|
||||||
INCLUDE_DIRS "Include/"
|
|
||||||
REQUIRES ${REQUIRES_LIST}
|
|
||||||
)
|
|
||||||
@ -1,70 +1,72 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include "LoggerAdapter.h"
|
||||||
|
#include "LoggerSettings.h"
|
||||||
|
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
|
#include "LoggerAdapterEsp.h"
|
||||||
|
#else
|
||||||
|
#include "LoggerAdapterGeneric.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
namespace tt {
|
namespace tt {
|
||||||
|
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
|
static LoggerAdapter defaultLoggerAdapter = espLoggerAdapter;
|
||||||
|
#else
|
||||||
|
static LoggerAdapter defaultLoggerAdapter = genericLoggerAdapter;
|
||||||
|
#endif
|
||||||
|
|
||||||
class Logger {
|
class Logger {
|
||||||
|
|
||||||
const char* tag;
|
const char* tag;
|
||||||
|
|
||||||
LogLevel level = LOG_LEVEL_INFO;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit Logger(const char* tag) : tag(tag) {}
|
explicit Logger(const char* tag) : tag(tag) {}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void verbose(std::format_string<Args...> format, Args&&... args) const {
|
void log(LogLevel level, std::format_string<Args...> format, Args&&... args) const {
|
||||||
std::string message = std::format(format, std::forward<Args>(args)...);
|
std::string message = std::format(format, std::forward<Args>(args)...);
|
||||||
LOG_V(tag, "%s", message.c_str());
|
defaultLoggerAdapter(level, tag, message.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
void verbose(std::format_string<Args...> format, Args&&... args) const {
|
||||||
|
log(LogLevel::Verbose, format, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void debug(std::format_string<Args...> format, Args&&... args) const {
|
void debug(std::format_string<Args...> format, Args&&... args) const {
|
||||||
std::string message = std::format(format, std::forward<Args>(args)...);
|
log(LogLevel::Debug, format, std::forward<Args>(args)...);
|
||||||
LOG_D(tag, "%s", message.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void info(std::format_string<Args...> format, Args&&... args) const {
|
void info(std::format_string<Args...> format, Args&&... args) const {
|
||||||
std::string message = std::format(format, std::forward<Args>(args)...);
|
log(LogLevel::Info, format, std::forward<Args>(args)...);
|
||||||
LOG_I(tag, "%s", message.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void warn(std::format_string<Args...> format, Args&&... args) const {
|
void warn(std::format_string<Args...> format, Args&&... args) const {
|
||||||
std::string message = std::format(format, std::forward<Args>(args)...);
|
log(LogLevel::Warning, format, std::forward<Args>(args)...);
|
||||||
LOG_W(tag, "%s", message.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void error(std::format_string<Args...> format, Args&&... args) const {
|
void error(std::format_string<Args...> format, Args&&... args) const {
|
||||||
std::string message = std::format(format, std::forward<Args>(args)...);
|
log(LogLevel::Error, format, std::forward<Args>(args)...);
|
||||||
LOG_E(tag, "%s", message.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isLoggingVerbose() const {
|
bool isLoggingVerbose() const { return LogLevel::Verbose <= LOG_LEVEL; }
|
||||||
return LOG_LEVEL_VERBOSE <= level;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLoggingDebug() const {
|
bool isLoggingDebug() const { return LogLevel::Debug <= LOG_LEVEL; }
|
||||||
return LOG_LEVEL_DEBUG <= level;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLoggingInfo() const {
|
bool isLoggingInfo() const { return LogLevel::Info <= LOG_LEVEL; }
|
||||||
return LOG_LEVEL_INFO <= level;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLoggingWarning() const {
|
bool isLoggingWarning() const { return LogLevel::Warning <= LOG_LEVEL; }
|
||||||
return LOG_LEVEL_WARNING <= level;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLoggingError() const {
|
bool isLoggingError() const { return LogLevel::Error <= LOG_LEVEL; }
|
||||||
return LOG_LEVEL_ERROR <= level;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
TactilityCore/Include/Tactility/LoggerAdapter.h
Normal file
10
TactilityCore/Include/Tactility/LoggerAdapter.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "LoggerCommon.h"
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace tt {
|
||||||
|
|
||||||
|
typedef std::function<void(LogLevel level, const char* tag, const char* message)> LoggerAdapter;
|
||||||
|
|
||||||
|
}
|
||||||
35
TactilityCore/Include/Tactility/LoggerAdapterEsp.h
Normal file
35
TactilityCore/Include/Tactility/LoggerAdapterEsp.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "LoggerAdapter.h"
|
||||||
|
#include "LoggerAdapterShared.h"
|
||||||
|
|
||||||
|
#include <esp_log.h>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace tt {
|
||||||
|
|
||||||
|
inline esp_log_level_t toEspLogLevel(LogLevel level) {
|
||||||
|
switch (level) {
|
||||||
|
case LogLevel::Error:
|
||||||
|
return ESP_LOG_ERROR;
|
||||||
|
case LogLevel::Warning:
|
||||||
|
return ESP_LOG_WARN;
|
||||||
|
case LogLevel::Info:
|
||||||
|
return ESP_LOG_INFO;
|
||||||
|
case LogLevel::Debug:
|
||||||
|
return ESP_LOG_DEBUG;
|
||||||
|
case LogLevel::Verbose:
|
||||||
|
default:
|
||||||
|
return ESP_LOG_VERBOSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const LoggerAdapter espLoggerAdapter = [](LogLevel level, const char* tag, const char* message) {
|
||||||
|
constexpr auto COLOR_RESET = "\033[0m";
|
||||||
|
constexpr auto COLOR_GREY = "\033[37m";
|
||||||
|
std::stringstream buffer;
|
||||||
|
buffer << COLOR_GREY << esp_log_timestamp() << ' ' << toTagColour(level) << toPrefix(level) << COLOR_GREY << " [" << COLOR_RESET << tag << COLOR_GREY << "] " << toMessageColour(level) << message << COLOR_RESET << std::endl;
|
||||||
|
esp_log_write(toEspLogLevel(level), tag, "%s", buffer.str().c_str());
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
35
TactilityCore/Include/Tactility/LoggerAdapterGeneric.h
Normal file
35
TactilityCore/Include/Tactility/LoggerAdapterGeneric.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "LoggerAdapter.h"
|
||||||
|
#include "LoggerAdapterShared.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <mutex>
|
||||||
|
#include <sstream>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
namespace tt {
|
||||||
|
|
||||||
|
static uint64_t getLogTimestamp() {
|
||||||
|
static uint64_t base = 0U;
|
||||||
|
static std::once_flag init_flag;
|
||||||
|
std::call_once(init_flag, []() {
|
||||||
|
timeval time {};
|
||||||
|
gettimeofday(&time, nullptr);
|
||||||
|
base = ((uint64_t)time.tv_sec * 1000U) + (time.tv_usec / 1000U);
|
||||||
|
});
|
||||||
|
timeval time {};
|
||||||
|
gettimeofday(&time, nullptr);
|
||||||
|
uint64_t now = ((uint64_t)time.tv_sec * 1000U) + (time.tv_usec / 1000U);
|
||||||
|
return now - base;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const LoggerAdapter genericLoggerAdapter = [](LogLevel level, const char* tag, const char* message) {
|
||||||
|
constexpr auto COLOR_RESET = "\033[0m";
|
||||||
|
constexpr auto COLOR_GREY = "\033[37m";
|
||||||
|
std::stringstream buffer;
|
||||||
|
buffer << COLOR_GREY << getLogTimestamp() << ' ' << toTagColour(level) << toPrefix(level) << COLOR_GREY << " [" << COLOR_RESET << tag << COLOR_GREY << "] " << toMessageColour(level) << message << COLOR_RESET << std::endl;
|
||||||
|
printf("%s", buffer.str().c_str());
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
58
TactilityCore/Include/Tactility/LoggerAdapterShared.h
Normal file
58
TactilityCore/Include/Tactility/LoggerAdapterShared.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "LoggerCommon.h"
|
||||||
|
|
||||||
|
namespace tt {
|
||||||
|
|
||||||
|
inline const char* toTagColour(LogLevel level) {
|
||||||
|
using enum LogLevel;
|
||||||
|
switch (level) {
|
||||||
|
case Error:
|
||||||
|
return "\033[1;31m";
|
||||||
|
case Warning:
|
||||||
|
return "\033[1;33m";
|
||||||
|
case Info:
|
||||||
|
return "\033[32m";
|
||||||
|
case Debug:
|
||||||
|
return "\033[36m";
|
||||||
|
case Verbose:
|
||||||
|
return "\033[37m";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char* toMessageColour(LogLevel level) {
|
||||||
|
using enum LogLevel;
|
||||||
|
switch (level) {
|
||||||
|
case Error:
|
||||||
|
return "\033[1;31m";
|
||||||
|
case Warning:
|
||||||
|
return "\033[1;33m";
|
||||||
|
case Info:
|
||||||
|
case Debug:
|
||||||
|
case Verbose:
|
||||||
|
return "\033[0m";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline char toPrefix(LogLevel level) {
|
||||||
|
using enum LogLevel;
|
||||||
|
switch (level) {
|
||||||
|
case Error:
|
||||||
|
return 'E';
|
||||||
|
case Warning:
|
||||||
|
return 'W';
|
||||||
|
case Info:
|
||||||
|
return 'I';
|
||||||
|
case Debug:
|
||||||
|
return 'D';
|
||||||
|
case Verbose:
|
||||||
|
default:
|
||||||
|
return 'V';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
TactilityCore/Include/Tactility/LoggerCommon.h
Normal file
14
TactilityCore/Include/Tactility/LoggerCommon.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace tt {
|
||||||
|
|
||||||
|
/** Used for log output filtering */
|
||||||
|
enum class LogLevel : int {
|
||||||
|
Error, /*!< Critical errors, software module can not recover on its own */
|
||||||
|
Warning, /*!< Error conditions from which recovery measures have been taken */
|
||||||
|
Info, /*!< Information messages which describe normal flow of events */
|
||||||
|
Debug, /*!< Extra information which is not necessary for normal use (values, pointers, sizes, etc). */
|
||||||
|
Verbose /*!< Bigger chunks of debugging information, or frequent messages which can potentially flood the output. */
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
9
TactilityCore/Include/Tactility/LoggerSettings.h
Normal file
9
TactilityCore/Include/Tactility/LoggerSettings.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "LoggerCommon.h"
|
||||||
|
|
||||||
|
namespace tt {
|
||||||
|
|
||||||
|
constexpr auto LOG_LEVEL = LogLevel::Info;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,20 +1,20 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/../Buildscripts/module.cmake")
|
file(GLOB_RECURSE SOURCES "Source/*.c**")
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCE_FILES "Source/*.c**")
|
|
||||||
|
|
||||||
list(APPEND REQUIRES_LIST)
|
|
||||||
|
|
||||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||||
# TODO move the related logic for esp_time in Tactility/time.h into the Platform/ subproject
|
|
||||||
list(APPEND REQUIRES_LIST esp_timer)
|
|
||||||
else ()
|
|
||||||
list(APPEND REQUIRES_LIST freertos_kernel)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
tactility_add_module(TactilityKernel
|
idf_component_register(
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCES}
|
||||||
INCLUDE_DIRS Include/
|
INCLUDE_DIRS "Include/"
|
||||||
REQUIRES ${REQUIRES_LIST}
|
# TODO move the related logic for esp_time in Tactility/time.h into the Platform/ subproject
|
||||||
)
|
REQUIRES esp_timer
|
||||||
|
)
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
add_library(TactilityKernel OBJECT ${SOURCES})
|
||||||
|
target_include_directories(TactilityKernel PUBLIC Include/)
|
||||||
|
target_link_libraries(TactilityKernel PUBLIC freertos_kernel)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|||||||
@ -10,32 +10,25 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Used for log output filtering */
|
#define LOG_TAG(x) "\033[37m"#x"\033[0m"
|
||||||
enum LogLevel {
|
|
||||||
LOG_LEVEL_ERROR, /*!< Critical errors, software module can not recover on its own */
|
|
||||||
LOG_LEVEL_WARNING, /*!< Error conditions from which recovery measures have been taken */
|
|
||||||
LOG_LEVEL_INFO, /*!< Information messages which describe normal flow of events */
|
|
||||||
LOG_LEVEL_DEBUG, /*!< Extra information which is not necessary for normal use (values, pointers, sizes, etc). */
|
|
||||||
LOG_LEVEL_VERBOSE /*!< Bigger chunks of debugging information, or frequent messages which can potentially flood the output. */
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef ESP_PLATFORM
|
#ifndef ESP_PLATFORM
|
||||||
|
|
||||||
void log_generic(enum LogLevel level, const char* tag, const char* format, ...);
|
void log_generic(const char* tag, const char* format, ...);
|
||||||
|
|
||||||
#define LOG_E(tag, ...) log_generic(LOG_LEVEL_ERROR, tag, ##__VA_ARGS__)
|
#define LOG_E(x, ...) log_generic(x, ##__VA_ARGS__)
|
||||||
#define LOG_W(tag, ...) log_generic(LOG_LEVEL_WARNING, tag, ##__VA_ARGS__)
|
#define LOG_W(x, ...) log_generic(x, ##__VA_ARGS__)
|
||||||
#define LOG_I(tag, ...) log_generic(LOG_LEVEL_INFO, tag, ##__VA_ARGS__)
|
#define LOG_I(x, ...) log_generic(x, ##__VA_ARGS__)
|
||||||
#define LOG_D(tag, ...) log_generic(LOG_LEVEL_DEBUG, tag, ##__VA_ARGS__)
|
#define LOG_D(x, ...) log_generic(x, ##__VA_ARGS__)
|
||||||
#define LOG_V(tag, ...) log_generic(LOG_LEVEL_VERBOSE, tag, ##__VA_ARGS__)
|
#define LOG_V(x, ...) log_generic(x, ##__VA_ARGS__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define LOG_E(tag, ...) ESP_LOGE(tag, ##__VA_ARGS__)
|
#define LOG_E(x, ...) ESP_LOGE(x, ##__VA_ARGS__)
|
||||||
#define LOG_W(tag, ...) ESP_LOGW(tag, ##__VA_ARGS__)
|
#define LOG_W(x, ...) ESP_LOGW(x, ##__VA_ARGS__)
|
||||||
#define LOG_I(tag, ...) ESP_LOGI(tag, ##__VA_ARGS__)
|
#define LOG_I(x, ...) ESP_LOGI(x, ##__VA_ARGS__)
|
||||||
#define LOG_D(tag, ...) ESP_LOGD(tag, ##__VA_ARGS__)
|
#define LOG_D(x, ...) ESP_LOGD(x, ##__VA_ARGS__)
|
||||||
#define LOG_V(tag, ...) ESP_LOGV(tag, ##__VA_ARGS__)
|
#define LOG_V(x, ...) ESP_LOGV(x, ##__VA_ARGS__)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +1,15 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "error.h"
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define MODULE_SYMBOL_TERMINATOR { nullptr, nullptr }
|
|
||||||
#else
|
|
||||||
#define MODULE_SYMBOL_TERMINATOR { NULL, NULL }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFINE_MODULE_SYMBOL(symbol) { #symbol, (void*)&symbol }
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** A binary symbol like a function or a variable. */
|
#include "error.h"
|
||||||
struct ModuleSymbol {
|
#include <stdbool.h>
|
||||||
/** The name of the symbol. */
|
|
||||||
const char* name;
|
struct ModuleParent;
|
||||||
/** The address of the symbol. */
|
struct ModuleParentPrivate;
|
||||||
const void* symbol;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A module is a collection of drivers or other functionality that can be loaded and unloaded at runtime.
|
* A module is a collection of drivers or other functionality that can be loaded and unloaded at runtime.
|
||||||
@ -52,52 +38,50 @@ struct Module {
|
|||||||
*/
|
*/
|
||||||
error_t (*stop)(void);
|
error_t (*stop)(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of symbols exported by the module.
|
|
||||||
* Should be terminated by MODULE_SYMBOL_TERMINATOR.
|
|
||||||
* Can be a NULL value.
|
|
||||||
*/
|
|
||||||
const struct ModuleSymbol* symbols;
|
|
||||||
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool started;
|
bool started;
|
||||||
|
struct ModuleParent* parent;
|
||||||
} internal;
|
} internal;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a module instance.
|
* A module parent is a collection of modules that can be loaded and unloaded at runtime.
|
||||||
* @param module module instance to construct
|
|
||||||
* @return ERROR_NONE if successful
|
|
||||||
*/
|
*/
|
||||||
error_t module_construct(struct Module* module);
|
struct ModuleParent {
|
||||||
|
/** The name of the parent module, for logging/debugging purposes */
|
||||||
|
const char* name;
|
||||||
|
struct ModuleParentPrivate* module_parent_private;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destruct a module instance.
|
* @brief Initialize the module parent.
|
||||||
* @param module module instance to destruct
|
* @warn This function does no validation on input or state.
|
||||||
* @return ERROR_NONE if successful
|
* @param parent parent module
|
||||||
|
* @return ERROR_NONE if successful, ERROR_OUT_OF_MEMORY if allocation fails
|
||||||
*/
|
*/
|
||||||
error_t module_destruct(struct Module* module);
|
error_t module_parent_construct(struct ModuleParent* parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add a module to the system.
|
* @brief Deinitialize the module parent. Must have no children when calling this.
|
||||||
* @warning Only call this once. This function does not check if it was added before.
|
* @warn This function does no validation on input.
|
||||||
* @param module module to add
|
* @param parent parent module
|
||||||
* @return ERROR_NONE if successful
|
* @return ERROR_NONE if successful or ERROR_INVALID_STATE if the parent has children
|
||||||
*/
|
*/
|
||||||
error_t module_add(struct Module* module);
|
error_t module_parent_destruct(struct ModuleParent* parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove a module from the system.
|
* @brief Set the parent of the module.
|
||||||
* @param module module to remove
|
* @warning must call before module_start()
|
||||||
* @return ERROR_NONE if successful
|
* @param module module
|
||||||
|
* @param parent nullable parent module
|
||||||
|
* @return ERROR_NONE if successful, ERROR_INVALID_STATE if the module is already started
|
||||||
*/
|
*/
|
||||||
error_t module_remove(struct Module* module);
|
error_t module_set_parent(struct Module* module, struct ModuleParent* parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Start the module.
|
* @brief Start the module.
|
||||||
* @param module module
|
* @param module module
|
||||||
* @return ERROR_NONE if already started, or otherwise it returns the result of the module's start function
|
* @return ERROR_NONE if already started, ERROR_INVALID_STATE if the module doesn't have a parent, or otherwise it returns the result of the module's start function
|
||||||
*/
|
*/
|
||||||
error_t module_start(struct Module* module);
|
error_t module_start(struct Module* module);
|
||||||
|
|
||||||
@ -115,25 +99,6 @@ bool module_is_started(struct Module* module);
|
|||||||
*/
|
*/
|
||||||
error_t module_stop(struct Module* module);
|
error_t module_stop(struct Module* module);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Resolve a symbol from the module.
|
|
||||||
* @details The module must be started for symbol resolution to succeed.
|
|
||||||
* @param module module
|
|
||||||
* @param symbol_name name of the symbol to resolve
|
|
||||||
* @param symbol_address pointer to store the address of the resolved symbol
|
|
||||||
* @return true if the symbol was found and the module is started, false otherwise
|
|
||||||
*/
|
|
||||||
bool module_resolve_symbol(struct Module* module, const char* symbol_name, uintptr_t* symbol_address);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Resolve a symbol from any module
|
|
||||||
* @details This function iterates through all started modules in the parent and attempts to resolve the symbol.
|
|
||||||
* @param symbol_name name of the symbol to resolve
|
|
||||||
* @param symbol_address pointer to store the address of the resolved symbol
|
|
||||||
* @return true if the symbol was found, false otherwise
|
|
||||||
*/
|
|
||||||
bool module_resolve_symbol_global(const char* symbol_name, uintptr_t* symbol_address);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#define TAG "Dispatcher"
|
#define TAG LOG_TAG(Dispatcher)
|
||||||
|
|
||||||
static constexpr EventBits_t BACKPRESSURE_WARNING_COUNT = 100U;
|
static constexpr EventBits_t BACKPRESSURE_WARNING_COUNT = 100U;
|
||||||
static constexpr EventBits_t WAIT_FLAG = 1U;
|
static constexpr EventBits_t WAIT_FLAG = 1U;
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
static const size_t LOCAL_STORAGE_SELF_POINTER_INDEX = 0;
|
static const size_t LOCAL_STORAGE_SELF_POINTER_INDEX = 0;
|
||||||
static const char* TAG = "Thread";
|
static const char* TAG = LOG_TAG(Thread);
|
||||||
|
|
||||||
struct Thread {
|
struct Thread {
|
||||||
TaskHandle_t taskHandle = nullptr;
|
TaskHandle_t taskHandle = nullptr;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include <tactility/freertos/task.h>
|
#include <tactility/freertos/task.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
static const auto* TAG = "Kernel";
|
static const auto* TAG = LOG_TAG(Kernel);
|
||||||
|
|
||||||
static void log_memory_info() {
|
static void log_memory_info() {
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define TAG "device"
|
#define TAG LOG_TAG(device)
|
||||||
|
|
||||||
struct DevicePrivate {
|
struct DevicePrivate {
|
||||||
std::vector<Device*> children;
|
std::vector<Device*> children;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
#include <tactility/error.h>
|
#include <tactility/error.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#define TAG "driver"
|
#define TAG LOG_TAG(driver)
|
||||||
|
|
||||||
struct DriverPrivate {
|
struct DriverPrivate {
|
||||||
Mutex mutex { 0 };
|
Mutex mutex { 0 };
|
||||||
@ -30,11 +30,21 @@ struct DriverLedger {
|
|||||||
std::vector<Driver*> drivers;
|
std::vector<Driver*> drivers;
|
||||||
Mutex mutex { 0 };
|
Mutex mutex { 0 };
|
||||||
|
|
||||||
DriverLedger() { mutex_construct(&mutex); }
|
DriverLedger() {
|
||||||
~DriverLedger() { mutex_destruct(&mutex); }
|
mutex_construct(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
void lock() { mutex_lock(&mutex); }
|
~DriverLedger() {
|
||||||
void unlock() { mutex_unlock(&mutex); }
|
mutex_destruct(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lock() {
|
||||||
|
mutex_lock(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unlock() {
|
||||||
|
mutex_unlock(&mutex);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static DriverLedger& get_ledger() {
|
static DriverLedger& get_ledger() {
|
||||||
@ -89,8 +99,6 @@ error_t driver_add(Driver* driver) {
|
|||||||
error_t driver_remove(Driver* driver) {
|
error_t driver_remove(Driver* driver) {
|
||||||
LOG_I(TAG, "remove %s", driver->name);
|
LOG_I(TAG, "remove %s", driver->name);
|
||||||
|
|
||||||
if (driver->owner == nullptr) return ERROR_NOT_ALLOWED;
|
|
||||||
|
|
||||||
ledger.lock();
|
ledger.lock();
|
||||||
const auto iterator = std::ranges::find(ledger.drivers, driver);
|
const auto iterator = std::ranges::find(ledger.drivers, driver);
|
||||||
if (iterator == ledger.drivers.end()) {
|
if (iterator == ledger.drivers.end()) {
|
||||||
|
|||||||
@ -12,7 +12,8 @@ Driver root_driver = {
|
|||||||
.stop_device = nullptr,
|
.stop_device = nullptr,
|
||||||
.api = nullptr,
|
.api = nullptr,
|
||||||
.device_type = nullptr,
|
.device_type = nullptr,
|
||||||
.owner = nullptr
|
.owner = nullptr,
|
||||||
|
.driver_private = nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TAG "kernel"
|
#define TAG LOG_TAG(kernel)
|
||||||
|
|
||||||
|
struct ModuleParent kernel_module_parent = {
|
||||||
|
"kernel",
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
|
||||||
static error_t init_kernel_drivers() {
|
static error_t init_kernel_drivers() {
|
||||||
extern Driver root_driver;
|
extern Driver root_driver;
|
||||||
@ -16,37 +21,24 @@ static error_t init_kernel_drivers() {
|
|||||||
error_t kernel_init(struct Module* platform_module, struct Module* device_module, struct CompatibleDevice devicetree_devices[]) {
|
error_t kernel_init(struct Module* platform_module, struct Module* device_module, struct CompatibleDevice devicetree_devices[]) {
|
||||||
LOG_I(TAG, "init");
|
LOG_I(TAG, "init");
|
||||||
|
|
||||||
|
if (module_parent_construct(&kernel_module_parent) != ERROR_NONE) {
|
||||||
|
LOG_E(TAG, "init failed to create kernel module parent");
|
||||||
|
return ERROR_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
if (init_kernel_drivers() != ERROR_NONE) {
|
if (init_kernel_drivers() != ERROR_NONE) {
|
||||||
LOG_E(TAG, "init failed to init kernel drivers");
|
LOG_E(TAG, "init failed to init kernel drivers");
|
||||||
return ERROR_RESOURCE;
|
return ERROR_RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (module_construct(platform_module) != ERROR_NONE) {
|
module_set_parent(platform_module, &kernel_module_parent);
|
||||||
LOG_E(TAG, "init failed to construct platform module");
|
|
||||||
return ERROR_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (module_add(platform_module) != ERROR_NONE) {
|
|
||||||
LOG_E(TAG, "init failed to add platform module");
|
|
||||||
return ERROR_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (module_start(platform_module) != ERROR_NONE) {
|
if (module_start(platform_module) != ERROR_NONE) {
|
||||||
LOG_E(TAG, "init failed to start platform module");
|
LOG_E(TAG, "init failed to start platform module");
|
||||||
return ERROR_RESOURCE;
|
return ERROR_RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_module != nullptr) {
|
if (device_module != nullptr) {
|
||||||
if (module_construct(device_module) != ERROR_NONE) {
|
module_set_parent(device_module, &kernel_module_parent);
|
||||||
LOG_E(TAG, "init failed to construct device module");
|
|
||||||
return ERROR_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (module_add(device_module) != ERROR_NONE) {
|
|
||||||
LOG_E(TAG, "init failed to add device module");
|
|
||||||
return ERROR_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (module_start(device_module) != ERROR_NONE) {
|
if (module_start(device_module) != ERROR_NONE) {
|
||||||
LOG_E(TAG, "init failed to start device module");
|
LOG_E(TAG, "init failed to start device module");
|
||||||
return ERROR_RESOURCE;
|
return ERROR_RESOURCE;
|
||||||
@ -66,7 +58,7 @@ error_t kernel_init(struct Module* platform_module, struct Module* device_module
|
|||||||
|
|
||||||
LOG_I(TAG, "init done");
|
LOG_I(TAG, "init done");
|
||||||
return ERROR_NONE;
|
return ERROR_NONE;
|
||||||
}
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,71 +4,17 @@
|
|||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
static const char* get_log_color(LogLevel level) {
|
|
||||||
using enum LogLevel;
|
|
||||||
switch (level) {
|
|
||||||
case LOG_LEVEL_ERROR:
|
|
||||||
return "\033[1;31m";
|
|
||||||
case LOG_LEVEL_WARNING:
|
|
||||||
return "\033[1;33m";
|
|
||||||
case LOG_LEVEL_INFO:
|
|
||||||
return "\033[32m";
|
|
||||||
case LOG_LEVEL_DEBUG:
|
|
||||||
return "\033[36m";
|
|
||||||
case LOG_LEVEL_VERBOSE:
|
|
||||||
return "\033[37m";
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline char get_log_prefix(LogLevel level) {
|
|
||||||
using enum LogLevel;
|
|
||||||
switch (level) {
|
|
||||||
case LOG_LEVEL_ERROR:
|
|
||||||
return 'E';
|
|
||||||
case LOG_LEVEL_WARNING:
|
|
||||||
return 'W';
|
|
||||||
case LOG_LEVEL_INFO:
|
|
||||||
return 'I';
|
|
||||||
case LOG_LEVEL_DEBUG:
|
|
||||||
return 'D';
|
|
||||||
case LOG_LEVEL_VERBOSE:
|
|
||||||
return 'V';
|
|
||||||
default:
|
|
||||||
return '?';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint64_t get_log_timestamp() {
|
|
||||||
static uint64_t base = 0U;
|
|
||||||
static std::once_flag init_flag;
|
|
||||||
std::call_once(init_flag, []() {
|
|
||||||
timeval time {};
|
|
||||||
gettimeofday(&time, nullptr);
|
|
||||||
base = ((uint64_t)time.tv_sec * 1000U) + (time.tv_usec / 1000U);
|
|
||||||
});
|
|
||||||
timeval time {};
|
|
||||||
gettimeofday(&time, nullptr);
|
|
||||||
uint64_t now = ((uint64_t)time.tv_sec * 1000U) + (time.tv_usec / 1000U);
|
|
||||||
return now - base;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
void log_generic(enum LogLevel level, const char* tag, const char* format, ...) {
|
void log_generic(const char* tag, const char* format, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
printf("%s %c (%" PRIu64 ") %s ", get_log_color(level), get_log_prefix(level), get_log_timestamp(), tag);
|
printf("%s ", tag);
|
||||||
vprintf(format, args);
|
vprintf(format, args);
|
||||||
printf("\033[0m\n");
|
printf("\n");
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,43 +1,75 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string.h>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <tactility/concurrent/mutex.h>
|
#include <tactility/concurrent/mutex.h>
|
||||||
#include <tactility/module.h>
|
#include <tactility/module.h>
|
||||||
|
|
||||||
#define TAG "module"
|
#define TAG LOG_TAG(module)
|
||||||
|
|
||||||
struct ModuleLedger {
|
struct ModuleParentPrivate {
|
||||||
std::vector<struct Module*> modules;
|
std::vector<struct Module*> modules;
|
||||||
struct Mutex mutex = { 0 };
|
struct Mutex mutex = { 0 };
|
||||||
|
|
||||||
ModuleLedger() { mutex_construct(&mutex); }
|
|
||||||
~ModuleLedger() { mutex_destruct(&mutex); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static ModuleLedger ledger;
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
error_t module_construct(struct Module* module) {
|
#pragma region module_parent
|
||||||
module->internal.started = false;
|
|
||||||
|
error_t module_parent_construct(struct ModuleParent* parent) {
|
||||||
|
parent->module_parent_private = new (std::nothrow) ModuleParentPrivate();
|
||||||
|
if (!parent->module_parent_private) return ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
auto* data = static_cast<ModuleParentPrivate*>(parent->module_parent_private);
|
||||||
|
mutex_construct(&data->mutex);
|
||||||
|
|
||||||
return ERROR_NONE;
|
return ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_t module_destruct(struct Module* module) {
|
error_t module_parent_destruct(struct ModuleParent* parent) {
|
||||||
|
auto* data = static_cast<ModuleParentPrivate*>(parent->module_parent_private);
|
||||||
|
if (data == nullptr) return ERROR_NONE;
|
||||||
|
|
||||||
|
mutex_lock(&data->mutex);
|
||||||
|
if (!data->modules.empty()) {
|
||||||
|
mutex_unlock(&data->mutex);
|
||||||
|
return ERROR_INVALID_STATE;
|
||||||
|
}
|
||||||
|
mutex_unlock(&data->mutex);
|
||||||
|
|
||||||
|
mutex_destruct(&data->mutex);
|
||||||
|
delete data;
|
||||||
|
parent->module_parent_private = nullptr;
|
||||||
return ERROR_NONE;
|
return ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_t module_add(struct Module* module) {
|
#pragma endregion
|
||||||
mutex_lock(&ledger.mutex);
|
|
||||||
ledger.modules.push_back(module);
|
#pragma region module
|
||||||
mutex_unlock(&ledger.mutex);
|
|
||||||
return ERROR_NONE;
|
error_t module_set_parent(struct Module* module, struct ModuleParent* parent) {
|
||||||
}
|
if (module->internal.started) return ERROR_INVALID_STATE;
|
||||||
|
if (module->internal.parent == parent) return ERROR_NONE;
|
||||||
|
|
||||||
|
// Remove from old parent
|
||||||
|
if (module->internal.parent && module->internal.parent->module_parent_private) {
|
||||||
|
auto* old_data = static_cast<ModuleParentPrivate*>(module->internal.parent->module_parent_private);
|
||||||
|
mutex_lock(&old_data->mutex);
|
||||||
|
auto it = std::find(old_data->modules.begin(), old_data->modules.end(), module);
|
||||||
|
if (it != old_data->modules.end()) {
|
||||||
|
old_data->modules.erase(it);
|
||||||
|
}
|
||||||
|
mutex_unlock(&old_data->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
module->internal.parent = parent;
|
||||||
|
|
||||||
|
// Add to new parent
|
||||||
|
if (parent && parent->module_parent_private) {
|
||||||
|
auto* new_data = static_cast<ModuleParentPrivate*>(parent->module_parent_private);
|
||||||
|
mutex_lock(&new_data->mutex);
|
||||||
|
new_data->modules.push_back(module);
|
||||||
|
mutex_unlock(&new_data->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
error_t module_remove(struct Module* module) {
|
|
||||||
mutex_lock(&ledger.mutex);
|
|
||||||
ledger.modules.erase(std::remove(ledger.modules.begin(), ledger.modules.end(), module), ledger.modules.end());
|
|
||||||
mutex_unlock(&ledger.mutex);
|
|
||||||
return ERROR_NONE;
|
return ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +77,7 @@ error_t module_start(struct Module* module) {
|
|||||||
LOG_I(TAG, "start %s", module->name);
|
LOG_I(TAG, "start %s", module->name);
|
||||||
|
|
||||||
if (module->internal.started) return ERROR_NONE;
|
if (module->internal.started) return ERROR_NONE;
|
||||||
|
if (!module->internal.parent) return ERROR_INVALID_STATE;
|
||||||
|
|
||||||
error_t error = module->start();
|
error_t error = module->start();
|
||||||
module->internal.started = (error == ERROR_NONE);
|
module->internal.started = (error == ERROR_NONE);
|
||||||
@ -69,33 +102,7 @@ error_t module_stop(struct Module* module) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool module_resolve_symbol(Module* module, const char* symbol_name, uintptr_t* symbol_address) {
|
#pragma endregion
|
||||||
if (!module_is_started(module)) return false;
|
|
||||||
auto* symbol_ptr = module->symbols;
|
|
||||||
if (symbol_ptr == nullptr) return false;
|
|
||||||
while (symbol_ptr->name != nullptr) {
|
|
||||||
if (strcmp(symbol_ptr->name, symbol_name) == 0) {
|
|
||||||
*symbol_address = reinterpret_cast<uintptr_t>(symbol_ptr->symbol);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
symbol_ptr++;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool module_resolve_symbol_global(const char* symbol_name, uintptr_t* symbol_address) {
|
|
||||||
mutex_lock(&ledger.mutex);
|
|
||||||
for (auto* module : ledger.modules) {
|
|
||||||
if (!module_is_started(module))
|
|
||||||
continue;
|
|
||||||
if (module_resolve_symbol(module, symbol_name, symbol_address)) {
|
|
||||||
mutex_unlock(&ledger.mutex);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mutex_unlock(&ledger.mutex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,15 +7,21 @@
|
|||||||
|
|
||||||
#include <tactility/kernel_init.h>
|
#include <tactility/kernel_init.h>
|
||||||
#include <tactility/hal_device_module.h>
|
#include <tactility/hal_device_module.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int argc;
|
int argc;
|
||||||
char** argv;
|
char** argv;
|
||||||
int result;
|
int result;
|
||||||
} TestTaskData;
|
} TestTaskData;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
// From the relevant platform
|
// From the relevant platform
|
||||||
extern "C" struct Module platform_module;
|
extern struct Module platform_module;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ModuleParent tactility_tests_module_parent {
|
||||||
|
"tactility-tests",
|
||||||
|
nullptr
|
||||||
|
};
|
||||||
|
|
||||||
void test_task(void* parameter) {
|
void test_task(void* parameter) {
|
||||||
auto* data = (TestTaskData*)parameter;
|
auto* data = (TestTaskData*)parameter;
|
||||||
@ -27,7 +33,11 @@ void test_task(void* parameter) {
|
|||||||
// overrides
|
// overrides
|
||||||
context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
|
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);
|
check(kernel_init(&platform_module, nullptr, nullptr) == ERROR_NONE);
|
||||||
|
// HAL compatibility module: it creates kernel driver wrappers for tt::hal::Device
|
||||||
|
check(module_parent_construct(&tactility_tests_module_parent) == ERROR_NONE);
|
||||||
|
check(module_set_parent(&hal_device_module, &tactility_tests_module_parent) == ERROR_NONE);
|
||||||
|
check(module_start(&hal_device_module) == ERROR_NONE);
|
||||||
|
|
||||||
data->result = context.run();
|
data->result = context.run();
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#include "doctest.h"
|
#include "doctest.h"
|
||||||
#include <tactility/module.h>
|
#include <tactility/module.h>
|
||||||
|
|
||||||
static void symbol_test_function() { /* NO-OP */ }
|
|
||||||
|
|
||||||
static error_t test_start_result = ERROR_NONE;
|
static error_t test_start_result = ERROR_NONE;
|
||||||
static bool start_called = false;
|
static bool start_called = false;
|
||||||
static error_t test_start() {
|
static error_t test_start() {
|
||||||
@ -17,40 +15,82 @@ static error_t test_stop() {
|
|||||||
return test_stop_result;
|
return test_stop_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Module construction and destruction") {
|
TEST_CASE("ModuleParent construction and destruction") {
|
||||||
struct Module module = {
|
struct ModuleParent parent = { "test_parent", nullptr };
|
||||||
.name = "test",
|
|
||||||
.start = test_start,
|
|
||||||
.stop = test_stop,
|
|
||||||
.symbols = nullptr,
|
|
||||||
.internal = {.started = false}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Test successful construction
|
// Test successful construction
|
||||||
CHECK_EQ(module_construct(&module), ERROR_NONE);
|
CHECK_EQ(module_parent_construct(&parent), ERROR_NONE);
|
||||||
CHECK_EQ(module.internal.started, false);
|
CHECK_NE(parent.module_parent_private, nullptr);
|
||||||
|
|
||||||
// Test successful destruction
|
// Test successful destruction
|
||||||
CHECK_EQ(module_destruct(&module), ERROR_NONE);
|
CHECK_EQ(module_parent_destruct(&parent), ERROR_NONE);
|
||||||
|
CHECK_EQ(parent.module_parent_private, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Module registration") {
|
TEST_CASE("ModuleParent destruction with children") {
|
||||||
|
struct ModuleParent parent = { "parent", nullptr };
|
||||||
|
REQUIRE_EQ(module_parent_construct(&parent), ERROR_NONE);
|
||||||
|
|
||||||
struct Module module = {
|
struct Module module = {
|
||||||
.name = "test",
|
.name = "test",
|
||||||
.start = test_start,
|
.start = test_start,
|
||||||
.stop = test_stop,
|
.stop = test_stop,
|
||||||
.symbols = nullptr,
|
.internal = {.started = false, .parent = nullptr}
|
||||||
.internal = {.started = false}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// module_add should succeed
|
REQUIRE_EQ(module_set_parent(&module, &parent), ERROR_NONE);
|
||||||
CHECK_EQ(module_add(&module), ERROR_NONE);
|
|
||||||
|
|
||||||
// module_remove should succeed
|
// Should fail to destruct because it has a child
|
||||||
CHECK_EQ(module_remove(&module), ERROR_NONE);
|
CHECK_EQ(module_parent_destruct(&parent), ERROR_INVALID_STATE);
|
||||||
|
CHECK_NE(parent.module_parent_private, nullptr);
|
||||||
|
|
||||||
|
// Remove child
|
||||||
|
REQUIRE_EQ(module_set_parent(&module, nullptr), ERROR_NONE);
|
||||||
|
|
||||||
|
// Now it should succeed
|
||||||
|
CHECK_EQ(module_parent_destruct(&parent), ERROR_NONE);
|
||||||
|
CHECK_EQ(parent.module_parent_private, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Module parent management") {
|
||||||
|
struct ModuleParent parent1 = { "parent1", nullptr };
|
||||||
|
struct ModuleParent parent2 = { "parent2", nullptr };
|
||||||
|
REQUIRE_EQ(module_parent_construct(&parent1), ERROR_NONE);
|
||||||
|
REQUIRE_EQ(module_parent_construct(&parent2), ERROR_NONE);
|
||||||
|
|
||||||
|
struct Module module = {
|
||||||
|
.name = "test",
|
||||||
|
.start = test_start,
|
||||||
|
.stop = test_stop,
|
||||||
|
.internal = {.started = false, .parent = nullptr}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set parent
|
||||||
|
CHECK_EQ(module_set_parent(&module, &parent1), ERROR_NONE);
|
||||||
|
CHECK_EQ(module.internal.parent, &parent1);
|
||||||
|
|
||||||
|
// Change parent
|
||||||
|
CHECK_EQ(module_set_parent(&module, &parent2), ERROR_NONE);
|
||||||
|
CHECK_EQ(module.internal.parent, &parent2);
|
||||||
|
|
||||||
|
// Clear parent
|
||||||
|
CHECK_EQ(module_set_parent(&module, nullptr), ERROR_NONE);
|
||||||
|
CHECK_EQ(module.internal.parent, nullptr);
|
||||||
|
|
||||||
|
// Set same parent (should be NOOP and return ERROR_NONE)
|
||||||
|
CHECK_EQ(module_set_parent(&module, &parent1), ERROR_NONE);
|
||||||
|
CHECK_EQ(module_set_parent(&module, &parent1), ERROR_NONE);
|
||||||
|
CHECK_EQ(module.internal.parent, &parent1);
|
||||||
|
|
||||||
|
CHECK_EQ(module_set_parent(&module, nullptr), ERROR_NONE);
|
||||||
|
CHECK_EQ(module_parent_destruct(&parent1), ERROR_NONE);
|
||||||
|
CHECK_EQ(module_parent_destruct(&parent2), ERROR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Module lifecycle") {
|
TEST_CASE("Module lifecycle") {
|
||||||
|
struct ModuleParent parent = { "parent", nullptr };
|
||||||
|
REQUIRE_EQ(module_parent_construct(&parent), ERROR_NONE);
|
||||||
|
|
||||||
start_called = false;
|
start_called = false;
|
||||||
stop_called = false;
|
stop_called = false;
|
||||||
test_start_result = ERROR_NONE;
|
test_start_result = ERROR_NONE;
|
||||||
@ -60,38 +100,48 @@ TEST_CASE("Module lifecycle") {
|
|||||||
.name = "test",
|
.name = "test",
|
||||||
.start = test_start,
|
.start = test_start,
|
||||||
.stop = test_stop,
|
.stop = test_stop,
|
||||||
.symbols = nullptr,
|
.internal = {.started = false, .parent = nullptr}
|
||||||
.internal = {.started = false}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 1. Successful start (no parent required anymore)
|
// 1. Cannot start without parent
|
||||||
|
CHECK_EQ(module_start(&module), ERROR_INVALID_STATE);
|
||||||
|
CHECK_EQ(module_is_started(&module), false);
|
||||||
|
CHECK_EQ(start_called, false);
|
||||||
|
|
||||||
|
CHECK_EQ(module_set_parent(&module, &parent), ERROR_NONE);
|
||||||
|
|
||||||
|
// 2. Successful start
|
||||||
CHECK_EQ(module_start(&module), ERROR_NONE);
|
CHECK_EQ(module_start(&module), ERROR_NONE);
|
||||||
CHECK_EQ(module_is_started(&module), true);
|
CHECK_EQ(module_is_started(&module), true);
|
||||||
CHECK_EQ(start_called, true);
|
CHECK_EQ(start_called, true);
|
||||||
|
|
||||||
// Start when already started (should return ERROR_NONE)
|
// 3. Start when already started (should return ERROR_NONE)
|
||||||
start_called = false;
|
start_called = false;
|
||||||
CHECK_EQ(module_start(&module), ERROR_NONE);
|
CHECK_EQ(module_start(&module), ERROR_NONE);
|
||||||
CHECK_EQ(start_called, false); // start() function should NOT be called again
|
CHECK_EQ(start_called, false); // start() function should NOT be called again
|
||||||
|
|
||||||
// Stop successful
|
// 4. Cannot change parent while started
|
||||||
|
CHECK_EQ(module_set_parent(&module, nullptr), ERROR_INVALID_STATE);
|
||||||
|
|
||||||
|
// 5. Successful stop
|
||||||
CHECK_EQ(module_stop(&module), ERROR_NONE);
|
CHECK_EQ(module_stop(&module), ERROR_NONE);
|
||||||
CHECK_EQ(module_is_started(&module), false);
|
CHECK_EQ(module_is_started(&module), false);
|
||||||
CHECK_EQ(stop_called, true);
|
CHECK_EQ(stop_called, true);
|
||||||
|
|
||||||
// Stop when already stopped (should return ERROR_NONE)
|
// 6. Stop when already stopped (should return ERROR_NONE)
|
||||||
stop_called = false;
|
stop_called = false;
|
||||||
CHECK_EQ(module_stop(&module), ERROR_NONE);
|
CHECK_EQ(module_stop(&module), ERROR_NONE);
|
||||||
CHECK_EQ(stop_called, false); // stop() function should NOT be called again
|
CHECK_EQ(stop_called, false); // stop() function should NOT be called again
|
||||||
|
|
||||||
// Test failed start
|
// 7. Test failed start
|
||||||
test_start_result = ERROR_NOT_FOUND;
|
test_start_result = ERROR_NOT_FOUND;
|
||||||
start_called = false;
|
start_called = false;
|
||||||
CHECK_EQ(module_start(&module), ERROR_NOT_FOUND);
|
CHECK_EQ(module_start(&module), ERROR_NOT_FOUND);
|
||||||
CHECK_EQ(module_is_started(&module), false);
|
CHECK_EQ(module_is_started(&module), false);
|
||||||
CHECK_EQ(start_called, true);
|
CHECK_EQ(start_called, true);
|
||||||
|
|
||||||
// Test failed stop
|
// 8. Test failed stop
|
||||||
|
CHECK_EQ(module_set_parent(&module, &parent), ERROR_NONE);
|
||||||
test_start_result = ERROR_NONE;
|
test_start_result = ERROR_NONE;
|
||||||
CHECK_EQ(module_start(&module), ERROR_NONE);
|
CHECK_EQ(module_start(&module), ERROR_NONE);
|
||||||
|
|
||||||
@ -104,32 +154,7 @@ TEST_CASE("Module lifecycle") {
|
|||||||
// Clean up: fix stop result so we can stop it
|
// Clean up: fix stop result so we can stop it
|
||||||
test_stop_result = ERROR_NONE;
|
test_stop_result = ERROR_NONE;
|
||||||
CHECK_EQ(module_stop(&module), ERROR_NONE);
|
CHECK_EQ(module_stop(&module), ERROR_NONE);
|
||||||
}
|
|
||||||
|
CHECK_EQ(module_set_parent(&module, nullptr), ERROR_NONE);
|
||||||
TEST_CASE("Global symbol resolution") {
|
CHECK_EQ(module_parent_destruct(&parent), ERROR_NONE);
|
||||||
static const struct ModuleSymbol test_symbols[] = {
|
|
||||||
DEFINE_MODULE_SYMBOL(symbol_test_function),
|
|
||||||
MODULE_SYMBOL_TERMINATOR
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Module module = {
|
|
||||||
.name = "test_sym",
|
|
||||||
.start = test_start,
|
|
||||||
.stop = test_stop,
|
|
||||||
.symbols = test_symbols,
|
|
||||||
.internal = {.started = false}
|
|
||||||
};
|
|
||||||
|
|
||||||
uintptr_t addr;
|
|
||||||
// Should fail as it is not added or started
|
|
||||||
CHECK_EQ(module_resolve_symbol_global("symbol_test_function", &addr), false);
|
|
||||||
REQUIRE_EQ(module_add(&module), ERROR_NONE);
|
|
||||||
CHECK_EQ(module_resolve_symbol_global("symbol_test_function", &addr), false);
|
|
||||||
REQUIRE_EQ(module_start(&module), ERROR_NONE);
|
|
||||||
// Still fails as symbols are null
|
|
||||||
CHECK_EQ(module_resolve_symbol_global("symbol_test_function", &addr), true);
|
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
CHECK_EQ(module_remove(&module), ERROR_NONE);
|
|
||||||
CHECK_EQ(module_destruct(&module), ERROR_NONE);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user