From e6977afbac5bd1a3a5f6e5919e0c6761f7853daa Mon Sep 17 00:00:00 2001 From: Sergi Hernandez Juan <shernand@iri.upc.edu> Date: Wed, 15 Jan 2020 07:32:59 +0100 Subject: [PATCH] Made the dynamixel_base and dynamixel manager libraries compatible with C and C++ adding the extern "C" tag. --- dynamixel_base/include/dynamixel.h | 8 ++++++++ dynamixel_base/include/dynamixel2.h | 8 ++++++++ dynamixel_base/include/dynamixel_master.h | 8 ++++++++ dynamixel_base/include/dynamixel_slave.h | 8 ++++++++ dynamixel_base/include/dynamixel_slave_device.h | 8 ++++++++ dynamixel_manager/include/dyn_manager.h | 8 ++++++++ dynamixel_manager/include/dyn_module.h | 8 ++++++++ dynamixel_manager/include/modules/motion_manager.h | 8 ++++++++ dynamixel_manager/include/modules/motion_module.h | 8 ++++++++ 9 files changed, 72 insertions(+) diff --git a/dynamixel_base/include/dynamixel.h b/dynamixel_base/include/dynamixel.h index 802189f..9623b1d 100755 --- a/dynamixel_base/include/dynamixel.h +++ b/dynamixel_base/include/dynamixel.h @@ -1,6 +1,10 @@ #ifndef _DYNAMIXEL_H #define _DYNAMIXEL_H +#ifdef __cplusplus +extern "C" { +#endif + #include "dynamixel_common.h" #define DYN_HEADER_OFF 0 @@ -223,4 +227,8 @@ inline unsigned char dyn_get_read_status_id(unsigned char *packet) return packet[DYN_ID_OFF]; } +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_base/include/dynamixel2.h b/dynamixel_base/include/dynamixel2.h index 8104605..2b69fd2 100644 --- a/dynamixel_base/include/dynamixel2.h +++ b/dynamixel_base/include/dynamixel2.h @@ -1,6 +1,10 @@ #ifndef _DYNAMIXEL2_H #define _DYNAMIXEL2_H +#ifdef __cplusplus +extern "C" { +#endif + #include "dynamixel_common.h" #define DYN2_HEADER_OFF 0 @@ -246,4 +250,8 @@ inline unsigned char dyn2_get_read_status_id(unsigned char *packet) return packet[DYN2_ID_OFF]; } +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_base/include/dynamixel_master.h b/dynamixel_base/include/dynamixel_master.h index d88a46f..2a726aa 100644 --- a/dynamixel_base/include/dynamixel_master.h +++ b/dynamixel_base/include/dynamixel_master.h @@ -1,6 +1,10 @@ #ifndef _DYNAMIXEL_MASTER_H #define _DYNAMIXEL_MASTER_H +#ifdef __cplusplus +extern "C" { +#endif + #include "comm.h" #include "dynamixel.h" #include "dynamixel2.h" @@ -197,4 +201,8 @@ unsigned char dyn_master_bulk_write(TDynamixelMaster *master,unsigned char num,u */ unsigned char dyn_master_relay(TDynamixelMaster *master,unsigned char *inst_pkt,unsigned char *status_pkt); +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_base/include/dynamixel_slave.h b/dynamixel_base/include/dynamixel_slave.h index 6d92d9f..39a1a55 100644 --- a/dynamixel_base/include/dynamixel_slave.h +++ b/dynamixel_base/include/dynamixel_slave.h @@ -1,6 +1,10 @@ #ifndef _DYNAMIXEL_SLAVE_H #define _DYNAMIXEL_SLAVE_H +#ifdef __cplusplus +extern "C" { +#endif + #include "comm.h" #include "dynamixel.h" #include "dynamixel2.h" @@ -164,4 +168,8 @@ inline void dyn_slave_stop(TDynamixelSlave *slave) scheduler_disable_channel(slave->scheduler,slave->sch_channel); } +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_base/include/dynamixel_slave_device.h b/dynamixel_base/include/dynamixel_slave_device.h index 76e3540..f1f0deb 100644 --- a/dynamixel_base/include/dynamixel_slave_device.h +++ b/dynamixel_base/include/dynamixel_slave_device.h @@ -1,6 +1,10 @@ #ifndef _DYNAMIXEL_SLAVE_DEVICE_H #define _DYNAMIXEL_SLAVE_DEVICE_H +#ifdef __cplusplus +extern "C" { +#endif + #include "dynamixel_slave_registers.h" #include "dynamixel.h" #include "dynamixel2.h" @@ -203,4 +207,8 @@ inline TMemory *dyn_slave_device_get_memory(TDynamixelSlaveDevice *device) return &device->memory; } +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_manager/include/dyn_manager.h b/dynamixel_manager/include/dyn_manager.h index b5c8cff..948c040 100644 --- a/dynamixel_manager/include/dyn_manager.h +++ b/dynamixel_manager/include/dyn_manager.h @@ -1,6 +1,10 @@ #ifndef _DYN_MANAGER_H #define _DYN_MANAGER_H +#ifdef __cplusplus +extern "C" { +#endif + #include "dyn_manager_registers.h" #include "dynamixel_master.h" #include "memory.h" @@ -157,4 +161,8 @@ void dyn_manager_bulk_op_change_length(TDynManager *manager,OP_HANDLE *op,unsign void dyn_manager_bulk_op_change_data(TDynManager *manager,OP_HANDLE *op,unsigned char num,unsigned char *ids,unsigned char * const data[]); void dyn_manager_loop(TDynManager *manager); +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_manager/include/dyn_module.h b/dynamixel_manager/include/dyn_module.h index a79d6c6..77c5ce1 100644 --- a/dynamixel_manager/include/dyn_module.h +++ b/dynamixel_manager/include/dyn_module.h @@ -1,6 +1,10 @@ #ifndef _DYN_MODULE_H #define _DYN_MODULE_H +#ifdef __cplusplus +extern "C" { +#endif + #ifndef MODULE_MAX_NUM_MODELS #error "Please, specify the maximum number of dynamixel master modules with the MODULE_MAX_NUM_MODELS macro" #endif @@ -38,4 +42,8 @@ unsigned char dyn_module_device_is_assigned(TDynModule *module,unsigned char id) void dyn_module_set_period(TDynModule *module,unsigned char period); inline unsigned char dyn_module_get_period(TDynModule *module); +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_manager/include/modules/motion_manager.h b/dynamixel_manager/include/modules/motion_manager.h index 1a2e9aa..7ebf988 100644 --- a/dynamixel_manager/include/modules/motion_manager.h +++ b/dynamixel_manager/include/modules/motion_manager.h @@ -1,6 +1,10 @@ #ifndef _MOTION_MANAGER_H #define _MOTION_MANAGER_H +#ifdef __cplusplus +extern "C" { +#endif + #include "dyn_module.h" #ifndef MM_MAX_NUM_MOTION_MODULES @@ -64,4 +68,8 @@ unsigned char mmanager_is_servo_enabled(TMotionManager *mmanager,unsigned char s void mmanager_set_offset(TMotionManager *mmanager,unsigned char servo_id,char offset); void mmanager_add_module(TMotionManager *mmanager,struct TMotionModule *module); +#ifdef __cplusplus + } +#endif + #endif diff --git a/dynamixel_manager/include/modules/motion_module.h b/dynamixel_manager/include/modules/motion_module.h index bb4c613..9498d54 100644 --- a/dynamixel_manager/include/modules/motion_module.h +++ b/dynamixel_manager/include/modules/motion_module.h @@ -1,6 +1,10 @@ #ifndef _MOTION_MODULE_H #define _MOTION_MODULE_H +#ifdef __cplusplus +extern "C" { +#endif + #include "motion_manager.h" typedef struct TMotionModule{ @@ -15,4 +19,8 @@ typedef struct TMotionModule{ void mmodule_init(TMotionModule *module); +#ifdef __cplusplus + } +#endif + #endif -- GitLab