1 /**
2 ******************************************************************************
3 * @file stm32f1xx_hal_gpio_ex.c
4 * @author MCD Application Team
5 * @brief GPIO Extension HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of the General Purpose Input/Output (GPIO) extension peripheral.
8 * + Extended features functions
9 *
10 @verbatim
11 ==============================================================================
12 ##### GPIO Peripheral extension features #####
13 ==============================================================================
14 [..] GPIO module on STM32F1 family, manage also the AFIO register:
15 (+) Possibility to use the EVENTOUT Cortex feature
16
17 ##### How to use this driver #####
18 ==============================================================================
19 [..] This driver provides functions to use EVENTOUT Cortex feature
20 (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
21 (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
22 (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
23
24 @endverbatim
25 ******************************************************************************
26 * @attention
27 *
28 * <h2><center>© Copyright (c) 2016 STMicroelectronics.
29 * All rights reserved.</center></h2>
30 *
31 * This software component is licensed by ST under BSD 3-Clause license,
32 * the "License"; You may not use this file except in compliance with the
33 * License. You may obtain a copy of the License at:
34 * opensource.org/licenses/BSD-3-Clause
35 *
36 ******************************************************************************
37 */
38
39 /* Includes ------------------------------------------------------------------*/
40 #include "stm32f1xx_hal.h"
41
42 /** @addtogroup STM32F1xx_HAL_Driver
43 * @{
44 */
45
46 /** @defgroup GPIOEx GPIOEx
47 * @brief GPIO HAL module driver
48 * @{
49 */
50
51 #ifdef HAL_GPIO_MODULE_ENABLED
52
53 /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions
54 * @{
55 */
56
57 /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions
58 * @brief Extended features functions
59 *
60 @verbatim
61 ==============================================================================
62 ##### Extended features functions #####
63 ==============================================================================
64 [..] This section provides functions allowing to:
65 (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
66 (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
67 (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
68
69 @endverbatim
70 * @{
71 */
72
73 /**
74 * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected.
75 * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal.
76 * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT.
77 * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal.
78 * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN.
79 * @retval None
80 */
HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource,uint32_t GPIO_PinSource)81 void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource)
82 {
83 /* Verify the parameters */
84 assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource));
85 assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource));
86
87 /* Apply the new configuration */
88 MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT) | (AFIO_EVCR_PIN), (GPIO_PortSource) | (GPIO_PinSource));
89 }
90
91 /**
92 * @brief Enables the Event Output.
93 * @retval None
94 */
HAL_GPIOEx_EnableEventout(void)95 void HAL_GPIOEx_EnableEventout(void)
96 {
97 SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
98 }
99
100 /**
101 * @brief Disables the Event Output.
102 * @retval None
103 */
HAL_GPIOEx_DisableEventout(void)104 void HAL_GPIOEx_DisableEventout(void)
105 {
106 CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
107 }
108
109 /**
110 * @}
111 */
112
113 /**
114 * @}
115 */
116
117 #endif /* HAL_GPIO_MODULE_ENABLED */
118
119 /**
120 * @}
121 */
122
123 /**
124 * @}
125 */
126
127 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
128