[Cryptech-Commits] [sw/stm32] 07/12: rename huart1 and huart2 to huart_mgmt and huart_user

git at cryptech.is git at cryptech.is
Mon May 16 09:43:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

fredrik at thulin.net pushed a commit to branch ft-alpha_board_bringup
in repository sw/stm32.

commit 4c5cee7be2804953f48c6d1d7132e48bc21373b6
Author: Fredrik Thulin <fredrik at thulin.net>
AuthorDate: Fri May 13 12:59:46 2016 +0200

    rename huart1 and huart2 to huart_mgmt and huart_user
    
    reduces risk of using the wrong one
---
 stm-init.c | 40 ++++++++++++++++++++--------------------
 stm-uart.c |  8 ++++----
 stm-uart.h |  4 ++--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/stm-init.c b/stm-init.c
index 216f127..efcc025 100644
--- a/stm-init.c
+++ b/stm-init.c
@@ -123,16 +123,16 @@ void SystemClock_Config(void)
 /* USART1 init function */
 static void MX_USART1_UART_Init(void)
 {
-  huart1.Instance = USART1;
-  huart1.Init.BaudRate = USART1_BAUD_RATE;
-  huart1.Init.WordLength = UART_WORDLENGTH_8B;
-  huart1.Init.StopBits = UART_STOPBITS_1;
-  huart1.Init.Parity = UART_PARITY_NONE;
-  huart1.Init.Mode = UART_MODE_TX_RX;
-  huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
-  huart1.Init.OverSampling = UART_OVERSAMPLING_16;
-
-  if (HAL_UART_Init(&huart1) != HAL_OK) {
+  huart_mgmt.Instance = USART1;
+  huart_mgmt.Init.BaudRate = USART1_BAUD_RATE;
+  huart_mgmt.Init.WordLength = UART_WORDLENGTH_8B;
+  huart_mgmt.Init.StopBits = UART_STOPBITS_1;
+  huart_mgmt.Init.Parity = UART_PARITY_NONE;
+  huart_mgmt.Init.Mode = UART_MODE_TX_RX;
+  huart_mgmt.Init.HwFlowCtl = UART_HWCONTROL_NONE;
+  huart_mgmt.Init.OverSampling = UART_OVERSAMPLING_16;
+
+  if (HAL_UART_Init(&huart_mgmt) != HAL_OK) {
     /* Initialization Error */
     Error_Handler();
   }
@@ -140,16 +140,16 @@ static void MX_USART1_UART_Init(void)
 /* USART2 init function */
 static void MX_USART2_UART_Init(void)
 {
-  huart2.Instance = USART2;
-  huart2.Init.BaudRate = USART2_BAUD_RATE;
-  huart2.Init.WordLength = UART_WORDLENGTH_8B;
-  huart2.Init.StopBits = UART_STOPBITS_1;
-  huart2.Init.Parity = UART_PARITY_NONE;
-  huart2.Init.Mode = UART_MODE_TX_RX;
-  huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
-  huart2.Init.OverSampling = UART_OVERSAMPLING_16;
-
-  if (HAL_UART_Init(&huart2) != HAL_OK) {
+  huart_user.Instance = USART2;
+  huart_user.Init.BaudRate = USART2_BAUD_RATE;
+  huart_user.Init.WordLength = UART_WORDLENGTH_8B;
+  huart_user.Init.StopBits = UART_STOPBITS_1;
+  huart_user.Init.Parity = UART_PARITY_NONE;
+  huart_user.Init.Mode = UART_MODE_TX_RX;
+  huart_user.Init.HwFlowCtl = UART_HWCONTROL_NONE;
+  huart_user.Init.OverSampling = UART_OVERSAMPLING_16;
+
+  if (HAL_UART_Init(&huart_user) != HAL_OK) {
     /* Initialization Error */
     Error_Handler();
   }
diff --git a/stm-uart.c b/stm-uart.c
index 538fe6c..ce52ca0 100644
--- a/stm-uart.c
+++ b/stm-uart.c
@@ -37,8 +37,8 @@
 
 #include <string.h>
 
-UART_HandleTypeDef huart1;
-UART_HandleTypeDef huart2;
+UART_HandleTypeDef huart_mgmt;
+UART_HandleTypeDef huart_user;
 
 #define DEFAULT_UART STM_UART_USER
 
@@ -46,9 +46,9 @@ UART_HandleTypeDef huart2;
 inline UART_HandleTypeDef *_which_uart(enum stm_uart_port port)
 {
     if (port == STM_UART_USER) {
-        return &huart2;
+        return &huart_user;
     } else if (port == STM_UART_MGMT) {
-        return &huart1;
+        return &huart_mgmt;
     }
 
     return NULL;
diff --git a/stm-uart.h b/stm-uart.h
index e934068..4334d27 100644
--- a/stm-uart.h
+++ b/stm-uart.h
@@ -45,8 +45,8 @@ enum stm_uart_port {
   STM_UART_MGMT
 };
 
-extern UART_HandleTypeDef huart1;
-extern UART_HandleTypeDef huart2;
+extern UART_HandleTypeDef huart_mgmt;
+extern UART_HandleTypeDef huart_user;
 
 extern HAL_StatusTypeDef uart_send_char(uint8_t ch);
 extern HAL_StatusTypeDef uart_recv_char(uint8_t *cp);



More information about the Commits mailing list