Properly link libi2c to i2cnode
This commit is contained in:
@ -46,6 +46,8 @@ target_include_directories(
|
|||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(mg_i2cnode i2c)
|
||||||
|
|
||||||
ament_target_dependencies(mg_bt_executor ${PACKAGE_DEPS})
|
ament_target_dependencies(mg_bt_executor ${PACKAGE_DEPS})
|
||||||
ament_target_dependencies(mg_i2cnode rclcpp mg_msgs)
|
ament_target_dependencies(mg_i2cnode rclcpp mg_msgs)
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
#include "rclcpp/rclcpp.hpp"
|
#include "rclcpp/rclcpp.hpp"
|
||||||
#include "mg_msgs/srv/i2c.hpp"
|
#include "mg_msgs/srv/i2c.hpp"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/i2c-dev.h>
|
#include <linux/i2c-dev.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <i2c/smbus.h>
|
#include <i2c/smbus.h>
|
||||||
|
}
|
||||||
|
|
||||||
class MgI2c : public rclcpp::Node {
|
class MgI2c : public rclcpp::Node {
|
||||||
using I2cSrv = mg_msgs::srv::I2c;
|
using I2cSrv = mg_msgs::srv::I2c;
|
||||||
@ -30,6 +33,8 @@ class MgI2c : public rclcpp::Node {
|
|||||||
|
|
||||||
int main(int argc, const char* const* argv) {
|
int main(int argc, const char* const* argv) {
|
||||||
rclcpp::init(argc, argv);
|
rclcpp::init(argc, argv);
|
||||||
|
rclcpp::spin(std::make_shared<MgI2c>("i2cu"));
|
||||||
|
rclcpp::shutdown();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user