From 7c4cf729ff58587d46dba78a7677764604632a81 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Wed, 15 Jan 2020 23:40:42 +0100
Subject: [PATCH] Added the extern "C" tag to make the usart3 module compatible
 with C++.

---
 dynamixel_base/include/dynamixel.h              |  2 +-
 dynamixel_base/include/dynamixel2.h             |  2 +-
 dynamixel_base/include/dynamixel_master.h       |  2 +-
 dynamixel_base/include/dynamixel_slave.h        |  2 +-
 dynamixel_base/include/dynamixel_slave_device.h |  2 +-
 f1/usart/include/usart3.h                       | 12 ++++++++++++
 6 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/dynamixel_base/include/dynamixel.h b/dynamixel_base/include/dynamixel.h
index 9623b1d..29b35c0 100755
--- a/dynamixel_base/include/dynamixel.h
+++ b/dynamixel_base/include/dynamixel.h
@@ -228,7 +228,7 @@ inline unsigned char dyn_get_read_status_id(unsigned char *packet)
 }
 
 #ifdef __cplusplus
-  }
+}
 #endif
 
 #endif
diff --git a/dynamixel_base/include/dynamixel2.h b/dynamixel_base/include/dynamixel2.h
index 2b69fd2..f430306 100644
--- a/dynamixel_base/include/dynamixel2.h
+++ b/dynamixel_base/include/dynamixel2.h
@@ -251,7 +251,7 @@ inline unsigned char dyn2_get_read_status_id(unsigned char *packet)
 }
 
 #ifdef __cplusplus
-  }
+}
 #endif
 
 #endif
diff --git a/dynamixel_base/include/dynamixel_master.h b/dynamixel_base/include/dynamixel_master.h
index 2a726aa..f1fdf2e 100644
--- a/dynamixel_base/include/dynamixel_master.h
+++ b/dynamixel_base/include/dynamixel_master.h
@@ -202,7 +202,7 @@ 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 39a1a55..067ad7e 100644
--- a/dynamixel_base/include/dynamixel_slave.h
+++ b/dynamixel_base/include/dynamixel_slave.h
@@ -169,7 +169,7 @@ inline void dyn_slave_stop(TDynamixelSlave *slave)
 }
 
 #ifdef __cplusplus
-  }
+}
 #endif
 
 #endif
diff --git a/dynamixel_base/include/dynamixel_slave_device.h b/dynamixel_base/include/dynamixel_slave_device.h
index f1f0deb..34b28e1 100644
--- a/dynamixel_base/include/dynamixel_slave_device.h
+++ b/dynamixel_base/include/dynamixel_slave_device.h
@@ -208,7 +208,7 @@ inline TMemory *dyn_slave_device_get_memory(TDynamixelSlaveDevice *device)
 }
 
 #ifdef __cplusplus
-  }
+}
 #endif
 
 #endif
diff --git a/f1/usart/include/usart3.h b/f1/usart/include/usart3.h
index 6766e64..5d60161 100644
--- a/f1/usart/include/usart3.h
+++ b/f1/usart/include/usart3.h
@@ -1,10 +1,15 @@
 #ifndef USART3_F1_H
 #define USART3_F1_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "stm32f1xx_hal.h"
 #include "usart_common.h"
 #include "comm.h"
 
+
 /* public functions */
 void usart3_init(TComm *comm_dev,USART_InitTypeDef *conf,TUSART_IRQ_Priorities *priorities);
 void usart3_config(TComm *comm_dev,USART_InitTypeDef *conf);
@@ -15,9 +20,16 @@ unsigned char usart3_send_irq(unsigned char first_byte);
 unsigned char usart3_enable_tx_irq(void);
 unsigned char usart3_receive_irq(void);
 unsigned char usart3_cancel_receive_irq(void);
+void USART_IRQHandler(void);
 /* DMA functions */
 unsigned char usart3_send_dma(unsigned char *data,unsigned short int length);
 unsigned char usart3_receive_dma(unsigned char *data,unsigned short int length);
 unsigned char usart3_cancel_receive_dma(void);
+void USART_DMA_TX_IRQHandler(void);
+void USART_DMA_RX_IRQHandler(void);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif
-- 
GitLab