2 ******************************************************************************
3 * @file stm32f1xx_hal_gpio_ex.c
4 * @author MCD Application Team
6 * @date 15-December-2014
7 * @brief GPIO Extension HAL module driver.
8 * This file provides firmware functions to manage the following
9 * functionalities of the General Purpose Input/Output (GPIO) extension peripheral.
10 * + Extended features functions
13 ==============================================================================
14 ##### GPIO Peripheral extension features #####
15 ==============================================================================
16 [..] GPIO module on STM32F1 family, manage also the AFIO register:
17 (+) Possibility to use the EVENTOUT Cortex feature
19 ##### How to use this driver #####
20 ==============================================================================
21 [..] This driver provides functions to use EVENTOUT Cortex feature
22 (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
23 (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
24 (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
27 ******************************************************************************
30 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
32 * Redistribution and use in source and binary forms, with or without modification,
33 * are permitted provided that the following conditions are met:
34 * 1. Redistributions of source code must retain the above copyright notice,
35 * this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright notice,
37 * this list of conditions and the following disclaimer in the documentation
38 * and/or other materials provided with the distribution.
39 * 3. Neither the name of STMicroelectronics nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
44 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
46 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
49 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
51 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 ******************************************************************************
57 /* Includes ------------------------------------------------------------------*/
58 #include "stm32f1xx_hal.h"
60 /** @addtogroup STM32F1xx_HAL_Driver
64 /** @defgroup GPIOEx GPIOEx
65 * @brief GPIO HAL module driver
69 #ifdef HAL_GPIO_MODULE_ENABLED
71 /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions
75 /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions
76 * @brief Extended features functions
79 ==============================================================================
80 ##### Extended features functions #####
81 ==============================================================================
82 [..] This section provides functions allowing to:
83 (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
84 (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
85 (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
92 * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected.
93 * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal.
94 * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT.
95 * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal.
96 * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN.
99 void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource)
101 /* Verify the parameters */
102 assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource));
103 assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource));
105 /* Apply the new configuration */
106 MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT)|(AFIO_EVCR_PIN), (GPIO_PortSource)|(GPIO_PinSource));
110 * @brief Enables the Event Output.
113 void HAL_GPIOEx_EnableEventout(void)
115 SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
119 * @brief Disables the Event Output.
122 void HAL_GPIOEx_DisableEventout(void)
124 CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
135 #endif /* HAL_GPIO_MODULE_ENABLED */
145 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/