aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Thulin <fredrik@thulin.net>2016-05-13 12:59:46 +0200
committerFredrik Thulin <fredrik@thulin.net>2016-05-13 12:59:46 +0200
commit4c5cee7be2804953f48c6d1d7132e48bc21373b6 (patch)
treebd2db3691eaf6650beb001a9f358a9fc5a823ec8
parentc670d7b194eea62d6fd6f9de0ae4025abe076ad4 (diff)
rename huart1 and huart2 to huart_mgmt and huart_user
reduces risk of using the wrong one
-rw-r--r--stm-init.c40
-rw-r--r--stm-uart.c8
-rw-r--r--stm-uart.h4
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);