From b1fe4c4cc603ec6b74c46b241d505e3b35614237 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 --- 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 ++- tools/ci/check_public_headers_exceptions.txt | 4 ---- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/components/freemodbus/common/include/esp_modbus_common.h b/components/freemodbus/common/include/esp_modbus_common.h index a6f83029a..b44296b34 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 6fae9540b..7b87ffaa5 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 dcaf6d94e..1f911450a 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 73a50ca60..3b73d6763 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 diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index a6599c3ef..970bbb617 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -73,10 +73,6 @@ components/expat/ components/fatfs/vfs/vfs_fat_internal.h components/fatfs/src/ffconf.h -components/freemodbus/common/include/esp_modbus_common.h -components/freemodbus/common/include/esp_modbus_master.h -components/freemodbus/common/include/esp_modbus_slave.h - components/idf_test/include/idf_performance.h components/json/cJSON/