Skip to content

Commit 5e42cb0

Browse files
authored
Moved UDP, CAN and Register files to separate shared cmake static library targets (#27)
For issue #28
1 parent 1257662 commit 5e42cb0

File tree

24 files changed

+65
-756
lines changed

24 files changed

+65
-756
lines changed

differential_pressure_sensor/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ include_directories(SYSTEM ${submodules}/libcanard/libcanard)
7171
add_library(o1heap STATIC ${submodules}/o1heap/o1heap/o1heap.c)
7272
include_directories(SYSTEM ${submodules}/o1heap/o1heap/)
7373

74+
include(${CMAKE_SOURCE_DIR}/../shared/register/register.cmake)
75+
include(${CMAKE_SOURCE_DIR}/../shared/socketcan/socketcan.cmake)
76+
7477
# Build the application.
7578
add_executable(differential_pressure_sensor
7679
src/main.c
77-
src/register.c
78-
src/socketcan.c
7980
)
8081
add_dependencies(differential_pressure_sensor dsdl_uavcan dsdl_reg)
81-
target_link_libraries(differential_pressure_sensor canard o1heap)
82+
target_link_libraries(differential_pressure_sensor canard o1heap shared_register shared_socketcan)

differential_pressure_sensor/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void handleFastLoop(State* const state, const CanardMicrosecond monotonic
186186
if (!anonymous && (state->port_id.pub.differential_pressure <= CANARD_SUBJECT_ID_MAX))
187187
{
188188
uavcan_si_unit_pressure_Scalar_1_0 msg = {0};
189-
msg.pascal = (float) rand() * 0.1F; // TODO: sample data from the real sensor.
189+
msg._pascal = (float) rand() * 0.1F; // TODO: sample data from the real sensor.
190190
// Serialize and publish the message:
191191
uint8_t serialized[uavcan_si_unit_pressure_Scalar_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_] = {0};
192192
size_t serialized_size = sizeof(serialized);

libcyphal_demo/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,7 @@ target_include_directories(canard INTERFACE SYSTEM ${submodules}/libcanard/libca
9696
add_library(o1heap STATIC ${submodules}/o1heap/o1heap/o1heap.c)
9797
target_include_directories(o1heap INTERFACE SYSTEM ${submodules}/o1heap/o1heap)
9898

99+
include(${CMAKE_SOURCE_DIR}/../shared/socketcan/socketcan.cmake)
100+
include(${CMAKE_SOURCE_DIR}/../shared/udp/udp.cmake)
101+
99102
add_subdirectory(src)

libcyphal_demo/src/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@
66

77
cmake_minimum_required(VERSION 3.20)
88

9-
add_subdirectory(platform)
10-
119
# Define the demo application build target and link it with the library.
1210
add_executable(
1311
demo
1412
${CMAKE_SOURCE_DIR}/src/application.cpp
1513
${CMAKE_SOURCE_DIR}/src/main.cpp
1614
${CMAKE_SOURCE_DIR}/src/no_cpp_heap.cpp
1715
)
18-
target_link_libraries(demo PRIVATE canard)
19-
target_link_libraries(demo PRIVATE o1heap)
20-
target_link_libraries(demo PRIVATE udpard)
21-
target_link_libraries(demo PRIVATE platform)
16+
target_link_libraries(demo PRIVATE canard o1heap udpard shared_socketcan shared_udp)
2217
target_include_directories(demo PRIVATE ${CMAKE_SOURCE_DIR}/src)
2318
target_include_directories(demo PRIVATE ${submodules}/cetl/include)
2419
target_include_directories(demo PRIVATE ${submodules}/libcyphal/include)

libcyphal_demo/src/platform/linux/can/socketcan.c

Lines changed: 0 additions & 299 deletions
This file was deleted.

0 commit comments

Comments
 (0)