forked from patriciobos/PdM_workspace
-
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.
ADD: printf support for other project TODO: add printf command to other example project
- Loading branch information
1 parent
ce3ef7a
commit bb5ba39
Showing
4 changed files
with
464 additions
and
0 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
Ej0_blinky/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp.c
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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/** | ||
****************************************************************************** | ||
* @file UART/UART_Printf/Src/stm32f4xx_hal_msp.c | ||
* @author MCD Application Team | ||
* @brief HAL MSP module. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© Copyright (c) 2017 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 | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
#include "main.h" | ||
|
||
/** @addtogroup STM32F4xx_HAL_Examples | ||
* @{ | ||
*/ | ||
|
||
/** @defgroup HAL_MSP | ||
* @brief HAL MSP module. | ||
* @{ | ||
*/ | ||
|
||
/* Private typedef -----------------------------------------------------------*/ | ||
/* Private define ------------------------------------------------------------*/ | ||
/* Private macro -------------------------------------------------------------*/ | ||
/* Private variables ---------------------------------------------------------*/ | ||
/* Private function prototypes -----------------------------------------------*/ | ||
/* Private functions ---------------------------------------------------------*/ | ||
|
||
/** @defgroup HAL_MSP_Private_Functions | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* @brief UART MSP Initialization | ||
* This function configures the hardware resources used in this example: | ||
* - Peripheral's clock enable | ||
* - Peripheral's GPIO Configuration | ||
* @param huart: UART handle pointer | ||
* @retval None | ||
*/ | ||
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | ||
{ | ||
GPIO_InitTypeDef GPIO_InitStruct; | ||
|
||
|
||
/*##-1- Enable peripherals and GPIO Clocks #################################*/ | ||
/* Enable GPIO TX/RX clock */ | ||
USARTx_TX_GPIO_CLK_ENABLE(); | ||
USARTx_RX_GPIO_CLK_ENABLE(); | ||
|
||
|
||
/* Enable USARTx clock */ | ||
USARTx_CLK_ENABLE(); | ||
|
||
/*##-2- Configure peripheral GPIO ##########################################*/ | ||
/* 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); | ||
} | ||
|
||
/** | ||
* @brief UART MSP De-Initialization | ||
* This function frees the hardware resources used in this example: | ||
* - Disable the Peripheral's clock | ||
* - Revert GPIO and NVIC configuration to their default state | ||
* @param huart: UART handle pointer | ||
* @retval None | ||
*/ | ||
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | ||
{ | ||
/*##-1- Reset peripherals ##################################################*/ | ||
USARTx_FORCE_RESET(); | ||
USARTx_RELEASE_RESET(); | ||
|
||
/*##-2- Disable peripherals and GPIO Clocks #################################*/ | ||
/* 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); | ||
|
||
} | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
116 changes: 116 additions & 0 deletions
116
Ej1_pushButton/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp.c
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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/** | ||
****************************************************************************** | ||
* @file UART/UART_Printf/Src/stm32f4xx_hal_msp.c | ||
* @author MCD Application Team | ||
* @brief HAL MSP module. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© Copyright (c) 2017 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 | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
#include "main.h" | ||
|
||
/** @addtogroup STM32F4xx_HAL_Examples | ||
* @{ | ||
*/ | ||
|
||
/** @defgroup HAL_MSP | ||
* @brief HAL MSP module. | ||
* @{ | ||
*/ | ||
|
||
/* Private typedef -----------------------------------------------------------*/ | ||
/* Private define ------------------------------------------------------------*/ | ||
/* Private macro -------------------------------------------------------------*/ | ||
/* Private variables ---------------------------------------------------------*/ | ||
/* Private function prototypes -----------------------------------------------*/ | ||
/* Private functions ---------------------------------------------------------*/ | ||
|
||
/** @defgroup HAL_MSP_Private_Functions | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* @brief UART MSP Initialization | ||
* This function configures the hardware resources used in this example: | ||
* - Peripheral's clock enable | ||
* - Peripheral's GPIO Configuration | ||
* @param huart: UART handle pointer | ||
* @retval None | ||
*/ | ||
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | ||
{ | ||
GPIO_InitTypeDef GPIO_InitStruct; | ||
|
||
|
||
/*##-1- Enable peripherals and GPIO Clocks #################################*/ | ||
/* Enable GPIO TX/RX clock */ | ||
USARTx_TX_GPIO_CLK_ENABLE(); | ||
USARTx_RX_GPIO_CLK_ENABLE(); | ||
|
||
|
||
/* Enable USARTx clock */ | ||
USARTx_CLK_ENABLE(); | ||
|
||
/*##-2- Configure peripheral GPIO ##########################################*/ | ||
/* 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); | ||
} | ||
|
||
/** | ||
* @brief UART MSP De-Initialization | ||
* This function frees the hardware resources used in this example: | ||
* - Disable the Peripheral's clock | ||
* - Revert GPIO and NVIC configuration to their default state | ||
* @param huart: UART handle pointer | ||
* @retval None | ||
*/ | ||
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | ||
{ | ||
/*##-1- Reset peripherals ##################################################*/ | ||
USARTx_FORCE_RESET(); | ||
USARTx_RELEASE_RESET(); | ||
|
||
/*##-2- Disable peripherals and GPIO Clocks #################################*/ | ||
/* 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); | ||
|
||
} | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
116 changes: 116 additions & 0 deletions
116
Ej2_uart/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp.c
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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/** | ||
****************************************************************************** | ||
* @file UART/UART_Printf/Src/stm32f4xx_hal_msp.c | ||
* @author MCD Application Team | ||
* @brief HAL MSP module. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© Copyright (c) 2017 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 | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
#include "main.h" | ||
|
||
/** @addtogroup STM32F4xx_HAL_Examples | ||
* @{ | ||
*/ | ||
|
||
/** @defgroup HAL_MSP | ||
* @brief HAL MSP module. | ||
* @{ | ||
*/ | ||
|
||
/* Private typedef -----------------------------------------------------------*/ | ||
/* Private define ------------------------------------------------------------*/ | ||
/* Private macro -------------------------------------------------------------*/ | ||
/* Private variables ---------------------------------------------------------*/ | ||
/* Private function prototypes -----------------------------------------------*/ | ||
/* Private functions ---------------------------------------------------------*/ | ||
|
||
/** @defgroup HAL_MSP_Private_Functions | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* @brief UART MSP Initialization | ||
* This function configures the hardware resources used in this example: | ||
* - Peripheral's clock enable | ||
* - Peripheral's GPIO Configuration | ||
* @param huart: UART handle pointer | ||
* @retval None | ||
*/ | ||
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | ||
{ | ||
GPIO_InitTypeDef GPIO_InitStruct; | ||
|
||
|
||
/*##-1- Enable peripherals and GPIO Clocks #################################*/ | ||
/* Enable GPIO TX/RX clock */ | ||
USARTx_TX_GPIO_CLK_ENABLE(); | ||
USARTx_RX_GPIO_CLK_ENABLE(); | ||
|
||
|
||
/* Enable USARTx clock */ | ||
USARTx_CLK_ENABLE(); | ||
|
||
/*##-2- Configure peripheral GPIO ##########################################*/ | ||
/* 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); | ||
} | ||
|
||
/** | ||
* @brief UART MSP De-Initialization | ||
* This function frees the hardware resources used in this example: | ||
* - Disable the Peripheral's clock | ||
* - Revert GPIO and NVIC configuration to their default state | ||
* @param huart: UART handle pointer | ||
* @retval None | ||
*/ | ||
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | ||
{ | ||
/*##-1- Reset peripherals ##################################################*/ | ||
USARTx_FORCE_RESET(); | ||
USARTx_RELEASE_RESET(); | ||
|
||
/*##-2- Disable peripherals and GPIO Clocks #################################*/ | ||
/* 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); | ||
|
||
} | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Oops, something went wrong.