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 ******************************************************************************
11 * @attention
12 *
13 * Copyright (c) 2016 STMicroelectronics.
14 * All rights reserved.
15 *
16 * This software is licensed under terms that can be found in the LICENSE file
17 * in the root directory of this software component.
18 * If no LICENSE file comes with this software, it is provided AS-IS.
19 *
20 ******************************************************************************
21 @verbatim
22 ==============================================================================
23 ##### GPIO Peripheral extension features #####
24 ==============================================================================
25 [..] GPIO module on STM32F1 family, manage also the AFIO register:
26 (+) Possibility to use the EVENTOUT Cortex feature
27
28 ##### How to use this driver #####
29 ==============================================================================
30 [..] This driver provides functions to use EVENTOUT Cortex feature
31 (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
32 (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
33 (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
34
35 @endverbatim
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