From 2ce5c0cb95cf2162a124688d873af2527c41d304 Mon Sep 17 00:00:00 2001 From: Alex Lisitsyn Date: Fri, 17 Apr 2020 17:56:50 +0800 Subject: [PATCH] freemodbus: add extern c block into common header for cpp * Original commit: espressif/esp-idf@b1fe4c4cc603ec6b74c46b241d505e3b35614237 --- components/freemodbus/common/include/esp_modbus_common.h | 8 ++++++++ components/freemodbus/common/include/esp_modbus_master.h | 8 ++++++++ components/freemodbus/common/include/esp_modbus_slave.h | 8 ++++++++ components/freemodbus/common/include/mbcontroller.h | 3 ++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/components/freemodbus/common/include/esp_modbus_common.h b/components/freemodbus/common/include/esp_modbus_common.h index dab3461..95f0b84 100644 --- a/components/freemodbus/common/include/esp_modbus_common.h +++ b/components/freemodbus/common/include/esp_modbus_common.h @@ -18,6 +18,10 @@ #include "driver/uart.h" // for UART types +#ifdef __cplusplus +extern "C" { +#endif + #define MB_CONTROLLER_STACK_SIZE (CONFIG_FMB_CONTROLLER_STACK_SIZE) // Stack size for Modbus controller #define MB_CONTROLLER_PRIORITY (CONFIG_FMB_SERIAL_TASK_PRIO - 1) // priority of MB controller task @@ -135,4 +139,8 @@ typedef esp_err_t (*iface_destroy)(void); /*!< Interface method typedef esp_err_t (*iface_setup)(void*); /*!< Interface method setup */ typedef esp_err_t (*iface_start)(void); /*!< Interface method start */ +#ifdef __cplusplus +} +#endif + #endif // _MB_IFACE_COMMON_H diff --git a/components/freemodbus/common/include/esp_modbus_master.h b/components/freemodbus/common/include/esp_modbus_master.h index 6fae954..7b87ffa 100644 --- a/components/freemodbus/common/include/esp_modbus_master.h +++ b/components/freemodbus/common/include/esp_modbus_master.h @@ -21,6 +21,10 @@ #include "soc/soc.h" // for BITN definitions #include "esp_modbus_common.h" // for common types +#ifdef __cplusplus +extern "C" { +#endif + /*! * \brief Modbus descriptor table parameter type defines. */ @@ -238,4 +242,8 @@ esp_err_t mbc_master_get_parameter(uint16_t cid, char* name, uint8_t* value, uin */ esp_err_t mbc_master_set_parameter(uint16_t cid, char* name, uint8_t* value, uint8_t *type); +#ifdef __cplusplus +} +#endif + #endif // _ESP_MB_MASTER_INTERFACE_H diff --git a/components/freemodbus/common/include/esp_modbus_slave.h b/components/freemodbus/common/include/esp_modbus_slave.h index dcaf6d9..1f91145 100644 --- a/components/freemodbus/common/include/esp_modbus_slave.h +++ b/components/freemodbus/common/include/esp_modbus_slave.h @@ -24,6 +24,10 @@ #include "freertos/event_groups.h" // for event groups #include "esp_modbus_common.h" // for common types +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Parameter access event information type */ @@ -120,4 +124,8 @@ esp_err_t mbc_slave_get_param_info(mb_param_info_t* reg_info, uint32_t timeout); */ esp_err_t mbc_slave_set_descriptor(mb_register_area_descriptor_t descr_data); +#ifdef __cplusplus +} +#endif + #endif diff --git a/components/freemodbus/common/include/mbcontroller.h b/components/freemodbus/common/include/mbcontroller.h index 73a50ca..3b73d67 100644 --- a/components/freemodbus/common/include/mbcontroller.h +++ b/components/freemodbus/common/include/mbcontroller.h @@ -13,7 +13,7 @@ * limitations under the License. */ // mbcontroller.h -// mbcontroller common header +// mbcontroller - common Modbus controller header file #ifndef _MODBUS_CONTROLLER_COMMON #define _MODBUS_CONTROLLER_COMMON @@ -28,5 +28,6 @@ #include "esp_modbus_master.h" #include "esp_modbus_slave.h" + #endif