From af79f4eb8185caded4de2fe87ac5619f4c2cabd1 Mon Sep 17 00:00:00 2001 From: Pimpest <82343504+Pimpest@users.noreply.github.com> Date: Mon, 5 May 2025 18:11:17 +0200 Subject: [PATCH] Properly link libi2c to i2cnode --- mg_bt/CMakeLists.txt | 2 ++ mg_bt/i2cmodule/i2cnode.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/mg_bt/CMakeLists.txt b/mg_bt/CMakeLists.txt index a684a21..9a9932d 100644 --- a/mg_bt/CMakeLists.txt +++ b/mg_bt/CMakeLists.txt @@ -46,6 +46,8 @@ target_include_directories( include ) +target_link_libraries(mg_i2cnode i2c) + ament_target_dependencies(mg_bt_executor ${PACKAGE_DEPS}) ament_target_dependencies(mg_i2cnode rclcpp mg_msgs) diff --git a/mg_bt/i2cmodule/i2cnode.cpp b/mg_bt/i2cmodule/i2cnode.cpp index 398cf2a..1c9f65c 100644 --- a/mg_bt/i2cmodule/i2cnode.cpp +++ b/mg_bt/i2cmodule/i2cnode.cpp @@ -1,10 +1,13 @@ #include "rclcpp/rclcpp.hpp" #include "mg_msgs/srv/i2c.hpp" +extern "C" { + #include #include #include #include +} class MgI2c : public rclcpp::Node { using I2cSrv = mg_msgs::srv::I2c; @@ -30,6 +33,8 @@ class MgI2c : public rclcpp::Node { int main(int argc, const char* const* argv) { rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared("i2cu")); + rclcpp::shutdown(); return 0; } \ No newline at end of file