forked from bbrown1867/stm32-makefile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
6 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1 @@ | ||
/** | ||
****************************************************************************** | ||
* @file stm32f7xx_hal_msp.c | ||
* @author MCD Application Team | ||
* @brief HAL MSP module. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© Copyright (c) 2016 STMicroelectronics. | ||
* All rights reserved.</center></h2> | ||
* | ||
* This software component is licensed by ST under BSD 3-Clause license, | ||
* the "License"; You may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* opensource.org/licenses/BSD-3-Clause | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
#include "stm32f7xx_hal.h" | ||
|
||
/* UART configuration for USART3, which is connected to the ST-Link and sent to host PC */ | ||
#define USARTx USART3 | ||
#define USARTx_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE(); | ||
#define USARTx_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() | ||
#define USARTx_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() | ||
#define USARTx_FORCE_RESET() __HAL_RCC_USART3_FORCE_RESET() | ||
#define USARTx_RELEASE_RESET() __HAL_RCC_USART3_RELEASE_RESET() | ||
#define USARTx_TX_PIN GPIO_PIN_8 | ||
#define USARTx_TX_GPIO_PORT GPIOD | ||
#define USARTx_TX_AF GPIO_AF7_USART3 | ||
#define USARTx_RX_PIN GPIO_PIN_9 | ||
#define USARTx_RX_GPIO_PORT GPIOD | ||
#define USARTx_RX_AF GPIO_AF7_USART3 | ||
|
||
void HAL_MspInit(void) | ||
{ | ||
|
||
} | ||
|
||
void HAL_MspDeInit(void) | ||
{ | ||
|
||
} | ||
|
||
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | ||
{ | ||
RCC_PeriphCLKInitTypeDef RCC_PeriphClkInit; | ||
GPIO_InitTypeDef GPIO_InitStruct; | ||
|
||
/* Enable GPIO TX/RX clock */ | ||
USARTx_TX_GPIO_CLK_ENABLE(); | ||
USARTx_RX_GPIO_CLK_ENABLE(); | ||
|
||
/* Select SysClk as source of USARTx clocks */ | ||
RCC_PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1; | ||
RCC_PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_SYSCLK; | ||
HAL_RCCEx_PeriphCLKConfig(&RCC_PeriphClkInit); | ||
|
||
/* Enable USARTx clock */ | ||
USARTx_CLK_ENABLE(); | ||
|
||
/* UART TX GPIO pin configuration */ | ||
GPIO_InitStruct.Pin = USARTx_TX_PIN; | ||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; | ||
GPIO_InitStruct.Pull = GPIO_PULLUP; | ||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; | ||
GPIO_InitStruct.Alternate = USARTx_TX_AF; | ||
HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct); | ||
|
||
/* UART RX GPIO pin configuration */ | ||
GPIO_InitStruct.Pin = USARTx_RX_PIN; | ||
GPIO_InitStruct.Alternate = USARTx_RX_AF; | ||
HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct); | ||
} | ||
|
||
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | ||
{ | ||
USARTx_FORCE_RESET(); | ||
USARTx_RELEASE_RESET(); | ||
|
||
/* Configure UART TX as alternate function */ | ||
HAL_GPIO_DeInit(USARTx_TX_GPIO_PORT, USARTx_TX_PIN); | ||
|
||
/* Configure UART RX as alternate function */ | ||
HAL_GPIO_DeInit(USARTx_RX_GPIO_PORT, USARTx_RX_PIN); | ||
} | ||
#include "main.h" |