Просмотр исходного кода

Merge branch 'bugfix/allow_including_ports_from_cpp' into 'master'

Allow including port headers from C++

Closes ESF-2

See merge request espressif/esp-serial-flasher!48
Roland Dobai 3 лет назад
Родитель
Сommit
85598931b8
3 измененных файлов с 27 добавлено и 3 удалено
  1. 9 1
      port/esp32_port.h
  2. 9 1
      port/raspberry_port.h
  3. 9 1
      port/stm32_port.h

+ 9 - 1
port/esp32_port.h

@@ -19,6 +19,10 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/queue.h"
 #include "freertos/queue.h"
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct
 typedef struct
 {
 {
   uint32_t baud_rate;     /*!< Initial baud rate, can be changed later */
   uint32_t baud_rate;     /*!< Initial baud rate, can be changed later */
@@ -48,4 +52,8 @@ esp_loader_error_t loader_port_esp32_init(const loader_esp32_config_t *config);
 /**
 /**
   * @brief Deinitialize serial interface.
   * @brief Deinitialize serial interface.
   */
   */
-void loader_port_esp32_deinit(void);
+void loader_port_esp32_deinit(void);
+
+#ifdef __cplusplus
+}
+#endif

+ 9 - 1
port/raspberry_port.h

@@ -18,6 +18,10 @@
 #include <stdint.h>
 #include <stdint.h>
 #include "serial_io.h"
 #include "serial_io.h"
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
 typedef struct {
     const char *device;
     const char *device;
     uint32_t baudrate;
     uint32_t baudrate;
@@ -25,4 +29,8 @@ typedef struct {
     uint32_t gpio0_trigger_pin;
     uint32_t gpio0_trigger_pin;
 } loader_raspberry_config_t;
 } loader_raspberry_config_t;
 
 
-esp_loader_error_t loader_port_raspberry_init(const loader_raspberry_config_t *config);
+esp_loader_error_t loader_port_raspberry_init(const loader_raspberry_config_t *config);
+
+#ifdef __cplusplus
+}
+#endif

+ 9 - 1
port/stm32_port.h

@@ -19,6 +19,10 @@
 #include "serial_io.h"
 #include "serial_io.h"
 #include "stm32f4xx_hal.h"
 #include "stm32f4xx_hal.h"
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
 typedef struct {
     UART_HandleTypeDef *huart;
     UART_HandleTypeDef *huart;
     GPIO_TypeDef *port_io0;
     GPIO_TypeDef *port_io0;
@@ -27,4 +31,8 @@ typedef struct {
     uint16_t pin_num_rst;
     uint16_t pin_num_rst;
 } loader_stm32_config_t;
 } loader_stm32_config_t;
 
 
-void loader_port_stm32_init(loader_stm32_config_t *config);
+void loader_port_stm32_init(loader_stm32_config_t *config);
+
+#ifdef __cplusplus
+}
+#endif