annotate f103c8/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c @ 4:ca4f5b55b391

working on pwm
author cin
date Wed, 18 Jan 2017 03:27:00 +0300
parents 0c59e7a7782a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 * @file stm32f1xx_hal_gpio_ex.c
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4 * @author MCD Application Team
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 * @version V1.0.4
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 * @date 29-April-2016
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 * @brief GPIO Extension HAL module driver.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8 * This file provides firmware functions to manage the following
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 * functionalities of the General Purpose Input/Output (GPIO) extension peripheral.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 * + Extended features functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 @verbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 ##### GPIO Peripheral extension features #####
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 [..] GPIO module on STM32F1 family, manage also the AFIO register:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 (+) Possibility to use the EVENTOUT Cortex feature
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 ##### How to use this driver #####
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 [..] This driver provides functions to use EVENTOUT Cortex feature
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 @endverbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 * @attention
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 * Redistribution and use in source and binary forms, with or without modification,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33 * are permitted provided that the following conditions are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34 * 1. Redistributions of source code must retain the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 * this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 * 2. Redistributions in binary form must reproduce the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37 * this list of conditions and the following disclaimer in the documentation
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38 * and/or other materials provided with the distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39 * 3. Neither the name of STMicroelectronics nor the names of its contributors
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 * may be used to endorse or promote products derived from this software
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 * without specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 /* Includes ------------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 #include "stm32f1xx_hal.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 /** @addtogroup STM32F1xx_HAL_Driver
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 /** @defgroup GPIOEx GPIOEx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 * @brief GPIO HAL module driver
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 #ifdef HAL_GPIO_MODULE_ENABLED
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75 /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 * @brief Extended features functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78 @verbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80 ##### Extended features functions #####
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 [..] This section provides functions allowing to:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 @endverbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 /* Verify the parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 /* Apply the new configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT)|(AFIO_EVCR_PIN), (GPIO_PortSource)|(GPIO_PinSource));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 * @brief Enables the Event Output.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 void HAL_GPIOEx_EnableEventout(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 * @brief Disables the Event Output.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122 void HAL_GPIOEx_DisableEventout(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124 CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135 #endif /* HAL_GPIO_MODULE_ENABLED */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/