Przeglądaj źródła

Allow including port headers from C++ for stm32 and raspberry ports

Djordje Nedic 3 lat temu
rodzic
commit
0fcbdca9f9
2 zmienionych plików z 18 dodań i 2 usunięć
  1. 9 1
      port/raspberry_port.h
  2. 9 1
      port/stm32_port.h

+ 9 - 1
port/raspberry_port.h

@@ -18,6 +18,10 @@
 #include <stdint.h>
 #include "serial_io.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
     const char *device;
     uint32_t baudrate;
@@ -25,4 +29,8 @@ typedef struct {
     uint32_t gpio0_trigger_pin;
 } 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 "stm32f4xx_hal.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
     UART_HandleTypeDef *huart;
     GPIO_TypeDef *port_io0;
@@ -27,4 +31,8 @@ typedef struct {
     uint16_t pin_num_rst;
 } 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