diff options
-rw-r--r-- | stm-uart.c | 36 |
1 files changed, 33 insertions, 3 deletions
@@ -4,6 +4,8 @@ * Functions for sending strings and numbers over the uart. * * Copyright (c) 2015, NORDUnet A/S All rights reserved. + * Copyright: 2020, The Commons Conservancy Cryptech Project + * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -15,9 +17,9 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * - Neither the name of the NORDUnet nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. + * - Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -69,6 +71,20 @@ static void MX_DMA_Init(void) /* USART1 init function */ static void MX_USART1_UART_Init(void) { + GPIO_InitTypeDef g; + g.Mode = GPIO_MODE_AF_PP; + g.Pull = GPIO_NOPULL; + g.Speed = GPIO_SPEED_LOW; + g.Alternate = GPIO_AF7_USART1; + + /* USART1_CTS */ + g.Pin = GPIO_PIN_11; + HAL_GPIO_Init(GPIOA, &g); + + /* USART1_RTS */ + g.Pin = GPIO_PIN_12; + HAL_GPIO_Init(GPIOA, &g); + huart_mgmt.Instance = USART1; huart_mgmt.Init.BaudRate = USART_MGMT_BAUD_RATE; huart_mgmt.Init.WordLength = UART_WORDLENGTH_8B; @@ -90,6 +106,20 @@ static void MX_USART1_UART_Init(void) /* USART2 init function */ static void MX_USART2_UART_Init(void) { + GPIO_InitTypeDef g; + g.Mode = GPIO_MODE_AF_PP; + g.Pull = GPIO_NOPULL; + g.Speed = GPIO_SPEED_LOW; + g.Alternate = GPIO_AF7_USART2; + + /* USART2_CTS */ + g.Pin = GPIO_PIN_0; + HAL_GPIO_Init(GPIOA, &g); + + /* USART2_RTS */ + g.Pin = GPIO_PIN_1; + HAL_GPIO_Init(GPIOA, &g); + huart_user.Instance = USART2; huart_user.Init.BaudRate = USART_USER_BAUD_RATE; huart_user.Init.WordLength = UART_WORDLENGTH_8B; |