annotate f103c8/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c @ 2:0c59e7a7782a

Working on GPIO and RCC
author cin
date Mon, 16 Jan 2017 11:04:47 +0300
parents
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.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 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) peripheral:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 * + Initialization and de-initialization functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 * + IO operation functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 @verbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 ##### GPIO Peripheral features #####
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 in several modes:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 (+) Input mode
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 (+) Analog mode
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 (+) Output mode
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 (+) Alternate function mode
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 (+) External interrupt/event lines
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 During and just after reset, the alternate functions and external interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 lines are not active and the I/O ports are configured in input floating mode.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 All GPIO pins have weak internal pull-up and pull-down resistors, which can be
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33 activated or not.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 In Output or Alternate mode, each IO can be configured on open-drain or push-pull
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37 type and the IO speed can be selected depending on the VDD value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 All ports have external interrupt/event capability. To use external interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 lines, the port must be configured in input mode. All available GPIO pins are
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42 connected to the 16 external interrupt/event lines from EXTI0 to EXTI15.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 The external interrupt/event controller consists of up to 20 edge detectors in connectivity
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46 line devices, or 19 edge detectors in other devices for generating event/interrupt requests.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 Each input line can be independently configured to select the type (event or interrupt) and
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48 the corresponding trigger event (rising or falling or both). Each line can also masked
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 independently. A pending register maintains the status line of the interrupt requests
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51 ##### How to use this driver #####
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 ==============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 (#) Enable the GPIO APB2 clock using the following function : __HAL_RCC_GPIOx_CLK_ENABLE().
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56 (#) Configure the GPIO pin(s) using HAL_GPIO_Init().
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 structure.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 (++) In case of Output or alternate function mode selection: the speed is
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 configured through "Speed" member from GPIO_InitTypeDef structure
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 (++) Analog mode is required when a pin is to be used as ADC channel
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 or DAC output.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 (++) In case of external interrupt/event selection the "Mode" member from
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 GPIO_InitTypeDef structure select the type (interrupt or event) and
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 the corresponding trigger event (rising or falling or both).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 HAL_NVIC_EnableIRQ().
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin().
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74 (#) To set/reset the level of a pin configured in output mode use
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75 HAL_GPIO_WritePin()/HAL_GPIO_TogglePin().
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 (#) To lock pin configuration until next reset use HAL_GPIO_LockPin().
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 (#) During and just after reset, the alternate functions are not
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80 active and the GPIO pins are configured in input floating mode (except JTAG
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 pins).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 priority over the GPIO function.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 general purpose PD0 and PD1, respectively, when the HSE oscillator is off.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 The HSE has priority over the GPIO function.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 @endverbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 * @attention
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 * Redistribution and use in source and binary forms, with or without modification,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 * are permitted provided that the following conditions are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 * 1. Redistributions of source code must retain the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 * this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 * 2. Redistributions in binary form must reproduce the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 * this list of conditions and the following disclaimer in the documentation
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 * and/or other materials provided with the distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 * 3. Neither the name of STMicroelectronics nor the names of its contributors
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 * may be used to endorse or promote products derived from this software
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 * without specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122 /* Includes ------------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 #include "stm32f1xx_hal.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 /** @addtogroup STM32F1xx_HAL_Driver
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 /** @defgroup GPIO GPIO
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130 * @brief GPIO HAL module driver
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 #ifdef HAL_GPIO_MODULE_ENABLED
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 /* Private typedef -----------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 /* Private define ------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138 /** @defgroup GPIO_Private_Constants GPIO Private Constants
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 #define GPIO_MODE ((uint32_t)0x00000003)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 #define EXTI_MODE ((uint32_t)0x10000000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144 #define GPIO_MODE_IT ((uint32_t)0x00010000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 #define GPIO_MODE_EVT ((uint32_t)0x00020000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146 #define RISING_EDGE ((uint32_t)0x00100000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 #define FALLING_EDGE ((uint32_t)0x00200000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 #define GPIO_OUTPUT_TYPE ((uint32_t)0x00000010)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149 #define GPIO_NUMBER ((uint32_t)16)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151 /* Definitions for bit manipulation of CRL and CRH register */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152 #define GPIO_CR_MODE_INPUT ((uint32_t)0x00000000) /*!< 00: Input mode (reset state) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 #define GPIO_CR_CNF_ANALOG ((uint32_t)0x00000000) /*!< 00: Analog mode */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154 #define GPIO_CR_CNF_INPUT_FLOATING ((uint32_t)0x00000004) /*!< 01: Floating input (reset state) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155 #define GPIO_CR_CNF_INPUT_PU_PD ((uint32_t)0x00000008) /*!< 10: Input with pull-up / pull-down */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156 #define GPIO_CR_CNF_GP_OUTPUT_PP ((uint32_t)0x00000000) /*!< 00: General purpose output push-pull */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 #define GPIO_CR_CNF_GP_OUTPUT_OD ((uint32_t)0x00000004) /*!< 01: General purpose output Open-drain */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158 #define GPIO_CR_CNF_AF_OUTPUT_PP ((uint32_t)0x00000008) /*!< 10: Alternate function output Push-pull */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159 #define GPIO_CR_CNF_AF_OUTPUT_OD ((uint32_t)0x0000000C) /*!< 11: Alternate function output Open-drain */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
163 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165 /* Private macro -------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166 /* Private variables ---------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167 /* Private function prototypes -----------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168 /* Private functions ---------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
169
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
170 /** @defgroup GPIO_Exported_Functions GPIO Exported Functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
171 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
172 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
173
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
174 /** @defgroup GPIO_Exported_Functions_Group1 Initialization and deinitialization functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
175 * @brief Initialization and Configuration functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
176 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
177 @verbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
178 ===============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
179 ##### Initialization and deinitialization functions #####
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
180 ===============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
181 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
182 This section provides functions allowing to initialize and de-initialize the GPIOs
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
183 to be ready for use.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
184
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
185 @endverbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
186 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
187 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
188
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
189 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
190 * @brief Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
191 * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
192 * @param GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
193 * the configuration information for the specified GPIO peripheral.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
194 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
195 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
196 void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
197 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
198 uint32_t position;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
199 uint32_t ioposition = 0x00;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
200 uint32_t iocurrent = 0x00;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
201 uint32_t temp = 0x00;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
202 uint32_t config = 0x00;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
203 __IO uint32_t *configregister; /* Store the address of CRL or CRH register based on pin number */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
204 uint32_t registeroffset = 0; /* offset used during computation of CNF and MODE bits placement inside CRL or CRH register */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
205
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
206 /* Check the parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
207 assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
208 assert_param(IS_GPIO_PIN(GPIO_Init->Pin));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
209 assert_param(IS_GPIO_MODE(GPIO_Init->Mode));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
210
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
211 /* Configure the port pins */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
212 for (position = 0; position < GPIO_NUMBER; position++)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
213 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
214 /* Get the IO position */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
215 ioposition = ((uint32_t)0x01) << position;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
216
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
217 /* Get the current IO position */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
218 iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
219
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
220 if (iocurrent == ioposition)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
221 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
222 /* Check the Alternate function parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
223 assert_param(IS_GPIO_AF_INSTANCE(GPIOx));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
224
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
225 /* Based on the required mode, filling config variable with MODEy[1:0] and CNFy[3:2] corresponding bits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
226 switch (GPIO_Init->Mode)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
227 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
228 /* If we are configuring the pin in OUTPUT push-pull mode */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
229 case GPIO_MODE_OUTPUT_PP:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
230 /* Check the GPIO speed parameter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
231 assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
232 config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_PP;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
233 break;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
234
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
235 /* If we are configuring the pin in OUTPUT open-drain mode */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
236 case GPIO_MODE_OUTPUT_OD:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
237 /* Check the GPIO speed parameter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
238 assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
239 config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_OD;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
240 break;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
241
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
242 /* If we are configuring the pin in ALTERNATE FUNCTION push-pull mode */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
243 case GPIO_MODE_AF_PP:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
244 /* Check the GPIO speed parameter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
245 assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
246 config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_PP;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
247 break;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
248
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
249 /* If we are configuring the pin in ALTERNATE FUNCTION open-drain mode */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
250 case GPIO_MODE_AF_OD:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
251 /* Check the GPIO speed parameter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
252 assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
253 config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_OD;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
254 break;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
255
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
256 /* If we are configuring the pin in INPUT (also applicable to EVENT and IT mode) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
257 case GPIO_MODE_INPUT:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
258 case GPIO_MODE_IT_RISING:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
259 case GPIO_MODE_IT_FALLING:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
260 case GPIO_MODE_IT_RISING_FALLING:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
261 case GPIO_MODE_EVT_RISING:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
262 case GPIO_MODE_EVT_FALLING:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
263 case GPIO_MODE_EVT_RISING_FALLING:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
264 /* Check the GPIO pull parameter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
265 assert_param(IS_GPIO_PULL(GPIO_Init->Pull));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
266 if(GPIO_Init->Pull == GPIO_NOPULL)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
267 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
268 config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_FLOATING;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
269 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
270 else if(GPIO_Init->Pull == GPIO_PULLUP)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
271 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
272 config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
273
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
274 /* Set the corresponding ODR bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
275 GPIOx->BSRR = ioposition;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
276 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
277 else /* GPIO_PULLDOWN */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
278 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
279 config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
280
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
281 /* Reset the corresponding ODR bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
282 GPIOx->BRR = ioposition;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
283 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
284 break;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
285
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
286 /* If we are configuring the pin in INPUT analog mode */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
287 case GPIO_MODE_ANALOG:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
288 config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_ANALOG;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
289 break;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
290
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
291 /* Parameters are checked with assert_param */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
292 default:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
293 break;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
294 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
295
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
296 /* Check if the current bit belongs to first half or last half of the pin count number
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
297 in order to address CRH or CRL register*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
298 configregister = (iocurrent < GPIO_PIN_8) ? &GPIOx->CRL : &GPIOx->CRH;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
299 registeroffset = (iocurrent < GPIO_PIN_8) ? (position << 2) : ((position - 8) << 2);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
300
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
301 /* Apply the new configuration of the pin to the register */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
302 MODIFY_REG((*configregister), ((GPIO_CRL_MODE0 | GPIO_CRL_CNF0) << registeroffset ), (config << registeroffset));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
303
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
304 /*--------------------- EXTI Mode Configuration ------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
305 /* Configure the External Interrupt or event for the current IO */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
306 if((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
307 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
308 /* Enable AFIO Clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
309 __HAL_RCC_AFIO_CLK_ENABLE();
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
310 temp = AFIO->EXTICR[position >> 2];
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
311 CLEAR_BIT(temp, ((uint32_t)0x0F) << (4 * (position & 0x03)));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
312 SET_BIT(temp, (GPIO_GET_INDEX(GPIOx)) << (4 * (position & 0x03)));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
313 AFIO->EXTICR[position >> 2] = temp;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
314
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
315
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
316 /* Configure the interrupt mask */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
317 if((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
318 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
319 SET_BIT(EXTI->IMR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
320 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
321 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
322 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
323 CLEAR_BIT(EXTI->IMR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
324 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
325
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
326 /* Configure the event mask */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
327 if((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
328 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
329 SET_BIT(EXTI->EMR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
330 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
331 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
332 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
333 CLEAR_BIT(EXTI->EMR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
334 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
335
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
336 /* Enable or disable the rising trigger */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
337 if((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
338 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
339 SET_BIT(EXTI->RTSR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
340 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
341 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
342 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
343 CLEAR_BIT(EXTI->RTSR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
344 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
345
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
346 /* Enable or disable the falling trigger */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
347 if((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
348 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
349 SET_BIT(EXTI->FTSR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
350 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
351 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
352 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
353 CLEAR_BIT(EXTI->FTSR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
354 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
355 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
356 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
357 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
358 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
359
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
360 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
361 * @brief De-initializes the GPIOx peripheral registers to their default reset values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
362 * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
363 * @param GPIO_Pin: specifies the port bit to be written.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
364 * This parameter can be one of GPIO_PIN_x where x can be (0..15).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
365 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
366 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
367 void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
368 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
369 uint32_t position = 0x00;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
370 uint32_t iocurrent = 0x00;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
371 uint32_t tmp = 0x00;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
372 __IO uint32_t *configregister; /* Store the address of CRL or CRH register based on pin number */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
373 uint32_t registeroffset = 0;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
374
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
375 /* Check the parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
376 assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
377 assert_param(IS_GPIO_PIN(GPIO_Pin));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
378
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
379 /* Configure the port pins */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
380 while ((GPIO_Pin >> position) != 0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
381 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
382 /* Get current io position */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
383 iocurrent = (GPIO_Pin) & ((uint32_t)1 << position);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
384
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
385 if (iocurrent)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
386 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
387 /*------------------------- GPIO Mode Configuration --------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
388 /* Check if the current bit belongs to first half or last half of the pin count number
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
389 in order to address CRH or CRL register */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
390 configregister = (iocurrent < GPIO_PIN_8) ? &GPIOx->CRL : &GPIOx->CRH;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
391 registeroffset = (iocurrent < GPIO_PIN_8) ? (position << 2) : ((position - 8) << 2);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
392
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
393 /* CRL/CRH default value is floating input(0x04) shifted to correct position */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
394 MODIFY_REG(*configregister, ((GPIO_CRL_MODE0 | GPIO_CRL_CNF0) << registeroffset ), GPIO_CRL_CNF0_0 << registeroffset);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
395
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
396 /* ODR default value is 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
397 CLEAR_BIT(GPIOx->ODR, iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
398
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
399 /*------------------------- EXTI Mode Configuration --------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
400 /* Clear the External Interrupt or Event for the current IO */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
401
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
402 tmp = AFIO->EXTICR[position >> 2];
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
403 tmp &= (((uint32_t)0x0F) << (4 * (position & 0x03)));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
404 if(tmp == (GPIO_GET_INDEX(GPIOx) << (4 * (position & 0x03))))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
405 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
406 tmp = ((uint32_t)0x0F) << (4 * (position & 0x03));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
407 CLEAR_BIT(AFIO->EXTICR[position >> 2], tmp);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
408
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
409 /* Clear EXTI line configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
410 CLEAR_BIT(EXTI->IMR, (uint32_t)iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
411 CLEAR_BIT(EXTI->EMR, (uint32_t)iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
412
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
413 /* Clear Rising Falling edge configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
414 CLEAR_BIT(EXTI->RTSR, (uint32_t)iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
415 CLEAR_BIT(EXTI->FTSR, (uint32_t)iocurrent);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
416 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
417 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
418
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
419 position++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
420 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
421 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
422
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
423 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
424 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
425 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
426
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
427 /** @defgroup GPIO_Exported_Functions_Group2 IO operation functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
428 * @brief GPIO Read and Write
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
429 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
430 @verbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
431 ===============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
432 ##### IO operation functions #####
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
433 ===============================================================================
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
434 [..]
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
435 This subsection provides a set of functions allowing to manage the GPIOs.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
436
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
437 @endverbatim
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
438 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
439 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
440 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
441 * @brief Reads the specified input port pin.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
442 * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
443 * @param GPIO_Pin: specifies the port bit to read.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
444 * This parameter can be GPIO_PIN_x where x can be (0..15).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
445 * @retval The input port pin value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
446 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
447 GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
448 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
449 GPIO_PinState bitstatus;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
450
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
451 /* Check the parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
452 assert_param(IS_GPIO_PIN(GPIO_Pin));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
453
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
454 if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
455 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
456 bitstatus = GPIO_PIN_SET;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
457 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
458 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
459 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
460 bitstatus = GPIO_PIN_RESET;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
461 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
462 return bitstatus;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
463 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
464
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
465 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
466 * @brief Sets or clears the selected data port bit.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
467 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
468 * @note This function uses GPIOx_BSRR register to allow atomic read/modify
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
469 * accesses. In this way, there is no risk of an IRQ occurring between
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
470 * the read and the modify access.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
471 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
472 * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
473 * @param GPIO_Pin: specifies the port bit to be written.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
474 * This parameter can be one of GPIO_PIN_x where x can be (0..15).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
475 * @param PinState: specifies the value to be written to the selected bit.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
476 * This parameter can be one of the GPIO_PinState enum values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
477 * @arg GPIO_BIT_RESET: to clear the port pin
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
478 * @arg GPIO_BIT_SET: to set the port pin
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
479 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
480 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
481 void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
482 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
483 /* Check the parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
484 assert_param(IS_GPIO_PIN(GPIO_Pin));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
485 assert_param(IS_GPIO_PIN_ACTION(PinState));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
486
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
487 if(PinState != GPIO_PIN_RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
488 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
489 GPIOx->BSRR = GPIO_Pin;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
490 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
491 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
492 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
493 GPIOx->BSRR = (uint32_t)GPIO_Pin << 16;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
494 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
495 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
496
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
497 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
498 * @brief Toggles the specified GPIO pin
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
499 * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
500 * @param GPIO_Pin: Specifies the pins to be toggled.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
501 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
502 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
503 void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
504 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
505 /* Check the parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
506 assert_param(IS_GPIO_PIN(GPIO_Pin));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
507
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
508 GPIOx->ODR ^= GPIO_Pin;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
509 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
510
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
511 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
512 * @brief Locks GPIO Pins configuration registers.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
513 * @note The locking mechanism allows the IO configuration to be frozen. When the LOCK sequence
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
514 * has been applied on a port bit, it is no longer possible to modify the value of the port bit until
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
515 * the next reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
516 * @param GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
517 * @param GPIO_Pin: specifies the port bit to be locked.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
518 * This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
519 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
520 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
521 HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
522 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
523 __IO uint32_t tmp = GPIO_LCKR_LCKK;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
524
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
525 /* Check the parameters */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
526 assert_param(IS_GPIO_LOCK_INSTANCE(GPIOx));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
527 assert_param(IS_GPIO_PIN(GPIO_Pin));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
528
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
529 /* Apply lock key write sequence */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
530 SET_BIT(tmp, GPIO_Pin);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
531 /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
532 GPIOx->LCKR = tmp;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
533 /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
534 GPIOx->LCKR = GPIO_Pin;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
535 /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
536 GPIOx->LCKR = tmp;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
537 /* Read LCKK bit*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
538 tmp = GPIOx->LCKR;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
539
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
540 if((uint32_t)(GPIOx->LCKR & GPIO_LCKR_LCKK))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
541 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
542 return HAL_OK;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
543 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
544 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
545 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
546 return HAL_ERROR;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
547 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
548 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
549
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
550 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
551 * @brief This function handles EXTI interrupt request.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
552 * @param GPIO_Pin: Specifies the pins connected EXTI line
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
553 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
554 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
555 void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
556 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
557 /* EXTI line interrupt detected */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
558 if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
559 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
560 __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
561 HAL_GPIO_EXTI_Callback(GPIO_Pin);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
562 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
563 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
564
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
565 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
566 * @brief EXTI line detection callback
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
567 * @param GPIO_Pin: Specifies the pins connected EXTI line
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
568 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
569 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
570 __weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
571 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
572 /* Prevent unused argument(s) compilation warning */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
573 UNUSED(GPIO_Pin);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
574 /* NOTE : This function Should not be modified, when the callback is needed,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
575 the HAL_GPIO_EXTI_Callback could be implemented in the user file
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
576 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
577 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
578
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
579 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
580 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
581 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
582
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
583
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
584 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
585 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
586 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
587
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
588 #endif /* HAL_GPIO_MODULE_ENABLED */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
589 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
590 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
591 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
592
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
593 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
594 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
595 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
596
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
597 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/