STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
stm32h7xx_hal_gpio.c
Go to the documentation of this file.
1/**
2 ******************************************************************************
3 * @file stm32h7xx_hal_gpio.c
4 * @author MCD Application Team
5 * @brief GPIO HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of the General Purpose Input/Output (GPIO) peripheral:
8 * + Initialization and de-initialization functions
9 * + IO operation functions
10 *
11 ******************************************************************************
12 * @attention
13 *
14 * Copyright (c) 2017 STMicroelectronics.
15 * All rights reserved.
16 *
17 * This software is licensed under terms that can be found in the LICENSE file
18 * in the root directory of this software component.
19 * If no LICENSE file comes with this software, it is provided AS-IS.
20 *
21 ******************************************************************************
22 @verbatim
23 ==============================================================================
24 ##### GPIO Peripheral features #####
25 ==============================================================================
26 [..]
27 (+) Each port bit of the general-purpose I/O (GPIO) ports can be individually
28 configured by software in several modes:
29 (++) Input mode
30 (++) Analog mode
31 (++) Output mode
32 (++) Alternate function mode
33 (++) External interrupt/event lines
34
35 (+) During and just after reset, the alternate functions and external interrupt
36 lines are not active and the I/O ports are configured in input floating mode.
37
38 (+) All GPIO pins have weak internal pull-up and pull-down resistors, which can be
39 activated or not.
40
41 (+) In Output or Alternate mode, each IO can be configured on open-drain or push-pull
42 type and the IO speed can be selected depending on the VDD value.
43
44 (+) The microcontroller IO pins are connected to onboard peripherals/modules through a
45 multiplexer that allows only one peripheral alternate function (AF) connected
46 to an IO pin at a time. In this way, there can be no conflict between peripherals
47 sharing the same IO pin.
48
49 (+) All ports have external interrupt/event capability. To use external interrupt
50 lines, the port must be configured in input mode. All available GPIO pins are
51 connected to the 16 external interrupt/event lines from EXTI0 to EXTI15.
52
53 The external interrupt/event controller consists of up to 23 edge detectors
54 (16 lines are connected to GPIO) for generating event/interrupt requests (each
55 input line can be independently configured to select the type (interrupt or event)
56 and the corresponding trigger event (rising or falling or both). Each line can
57 also be masked independently.
58
59 ##### How to use this driver #####
60 ==============================================================================
61 [..]
62 (#) Enable the GPIO AHB clock using the following function: __HAL_RCC_GPIOx_CLK_ENABLE().
63
64 (#) Configure the GPIO pin(s) using HAL_GPIO_Init().
65 (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure
66 (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef
67 structure.
68 (++) In case of Output or alternate function mode selection: the speed is
69 configured through "Speed" member from GPIO_InitTypeDef structure.
70 (++) In alternate mode is selection, the alternate function connected to the IO
71 is configured through "Alternate" member from GPIO_InitTypeDef structure.
72 (++) Analog mode is required when a pin is to be used as ADC channel
73 or DAC output.
74 (++) In case of external interrupt/event selection the "Mode" member from
75 GPIO_InitTypeDef structure select the type (interrupt or event) and
76 the corresponding trigger event (rising or falling or both).
77
78 (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority
79 mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using
80 HAL_NVIC_EnableIRQ().
81
82 (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin().
83
84 (#) To set/reset the level of a pin configured in output mode use
85 HAL_GPIO_WritePin()/HAL_GPIO_TogglePin().
86
87 (#) To lock pin configuration until next reset use HAL_GPIO_LockPin().
88
89
90 (#) During and just after reset, the alternate functions are not
91 active and the GPIO pins are configured in input floating mode (except JTAG
92 pins).
93
94 (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose
95 (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has
96 priority over the GPIO function.
97
98 (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as
99 general purpose PH0 and PH1, respectively, when the HSE oscillator is off.
100 The HSE has priority over the GPIO function.
101
102 @endverbatim
103 ******************************************************************************
104 */
105
106/* Includes ------------------------------------------------------------------*/
107#include "stm32h7xx_hal.h"
108
109/** @addtogroup STM32H7xx_HAL_Driver
110 * @{
111 */
112
113/** @defgroup GPIO GPIO
114 * @brief GPIO HAL module driver
115 * @{
116 */
117
118#ifdef HAL_GPIO_MODULE_ENABLED
119
120/* Private typedef -----------------------------------------------------------*/
121/* Private defines ------------------------------------------------------------*/
122/** @addtogroup GPIO_Private_Constants GPIO Private Constants
123 * @{
124 */
125
126#if defined(DUAL_CORE)
127#define EXTI_CPU1 (0x01000000U)
128#define EXTI_CPU2 (0x02000000U)
129#endif /*DUAL_CORE*/
130#define GPIO_NUMBER (16U)
131/**
132 * @}
133 */
134/* Private macro -------------------------------------------------------------*/
135/* Private variables ---------------------------------------------------------*/
136/* Private function prototypes -----------------------------------------------*/
137/* Private functions ---------------------------------------------------------*/
138/* Exported functions --------------------------------------------------------*/
139/** @defgroup GPIO_Exported_Functions GPIO Exported Functions
140 * @{
141 */
142
143/** @defgroup GPIO_Exported_Functions_Group1 Initialization and de-initialization functions
144 * @brief Initialization and Configuration functions
145 *
146@verbatim
147 ===============================================================================
148 ##### Initialization and de-initialization functions #####
149 ===============================================================================
150 [..]
151 This section provides functions allowing to initialize and de-initialize the GPIOs
152 to be ready for use.
153
154@endverbatim
155 * @{
156 */
157
158/**
159 * @brief Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init.
160 * @param GPIOx: where x can be (A..K) to select the GPIO peripheral.
161 * @param GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains
162 * the configuration information for the specified GPIO peripheral.
163 * @retval None
164 */
165void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, const GPIO_InitTypeDef *GPIO_Init)
166{
167 uint32_t position = 0x00U;
168 uint32_t iocurrent;
169 uint32_t temp;
170 EXTI_Core_TypeDef *EXTI_CurrentCPU;
171
172#if defined(DUAL_CORE) && defined(CORE_CM4)
173 EXTI_CurrentCPU = EXTI_D2; /* EXTI for CM4 CPU */
174#else
175 EXTI_CurrentCPU = EXTI_D1; /* EXTI for CM7 CPU */
176#endif
177
178 /* Check the parameters */
180 assert_param(IS_GPIO_PIN(GPIO_Init->Pin));
181 assert_param(IS_GPIO_MODE(GPIO_Init->Mode));
182
183 /* Configure the port pins */
184 while (((GPIO_Init->Pin) >> position) != 0x00U)
185 {
186 /* Get current io position */
187 iocurrent = (GPIO_Init->Pin) & (1UL << position);
188
189 if (iocurrent != 0x00U)
190 {
191 /*--------------------- GPIO Mode Configuration ------------------------*/
192 /* In case of Output or Alternate function mode selection */
193 if (((GPIO_Init->Mode & GPIO_MODE) == MODE_OUTPUT) || ((GPIO_Init->Mode & GPIO_MODE) == MODE_AF))
194 {
195 /* Check the Speed parameter */
196 assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
197
198 /* Configure the IO Speed */
199 temp = GPIOx->OSPEEDR;
200 temp &= ~(GPIO_OSPEEDR_OSPEED0 << (position * 2U));
201 temp |= (GPIO_Init->Speed << (position * 2U));
202 GPIOx->OSPEEDR = temp;
203
204 /* Configure the IO Output Type */
205 temp = GPIOx->OTYPER;
206 temp &= ~(GPIO_OTYPER_OT0 << position) ;
207 temp |= (((GPIO_Init->Mode & OUTPUT_TYPE) >> OUTPUT_TYPE_Pos) << position);
208 GPIOx->OTYPER = temp;
209 }
210
211 if (((GPIO_Init->Mode & GPIO_MODE) != MODE_ANALOG) ||
212 (((GPIO_Init->Mode & GPIO_MODE) == MODE_ANALOG) && (GPIO_Init->Pull != GPIO_PULLUP)))
213 {
214 /* Check the Pull parameter */
215 assert_param(IS_GPIO_PULL(GPIO_Init->Pull));
216
217 /* Activate the Pull-up or Pull down resistor for the current IO */
218 temp = GPIOx->PUPDR;
219 temp &= ~(GPIO_PUPDR_PUPD0 << (position * 2U));
220 temp |= ((GPIO_Init->Pull) << (position * 2U));
221 GPIOx->PUPDR = temp;
222 }
223
224 /* In case of Alternate function mode selection */
225 if ((GPIO_Init->Mode & GPIO_MODE) == MODE_AF)
226 {
227 /* Check the Alternate function parameters */
229 assert_param(IS_GPIO_AF(GPIO_Init->Alternate));
230
231 /* Configure Alternate function mapped with the current IO */
232 temp = GPIOx->AFR[position >> 3U];
233 temp &= ~(0xFUL << ((position & 0x07U) * 4U));
234 temp |= ((GPIO_Init->Alternate) << ((position & 0x07U) * 4U));
235 GPIOx->AFR[position >> 3U] = temp;
236 }
237
238 /* Configure IO Direction mode (Input, Output, Alternate or Analog) */
239 temp = GPIOx->MODER;
240 temp &= ~(GPIO_MODER_MODE0 << (position * 2U));
241 temp |= ((GPIO_Init->Mode & GPIO_MODE) << (position * 2U));
242 GPIOx->MODER = temp;
243
244 /*--------------------- EXTI Mode Configuration ------------------------*/
245 /* Configure the External Interrupt or event for the current IO */
246 if ((GPIO_Init->Mode & EXTI_MODE) != 0x00U)
247 {
248 /* Enable SYSCFG Clock */
250
251 temp = SYSCFG->EXTICR[position >> 2U];
252 temp &= ~(0x0FUL << (4U * (position & 0x03U)));
253 temp |= (GPIO_GET_INDEX(GPIOx) << (4U * (position & 0x03U)));
254 SYSCFG->EXTICR[position >> 2U] = temp;
255
256 /* Clear Rising Falling edge configuration */
257 temp = EXTI->RTSR1;
258 temp &= ~(iocurrent);
259 if ((GPIO_Init->Mode & TRIGGER_RISING) != 0x00U)
260 {
261 temp |= iocurrent;
262 }
263 EXTI->RTSR1 = temp;
264
265 temp = EXTI->FTSR1;
266 temp &= ~(iocurrent);
267 if ((GPIO_Init->Mode & TRIGGER_FALLING) != 0x00U)
268 {
269 temp |= iocurrent;
270 }
271 EXTI->FTSR1 = temp;
272
273 temp = EXTI_CurrentCPU->EMR1;
274 temp &= ~(iocurrent);
275 if ((GPIO_Init->Mode & EXTI_EVT) != 0x00U)
276 {
277 temp |= iocurrent;
278 }
279 EXTI_CurrentCPU->EMR1 = temp;
280
281 /* Clear EXTI line configuration */
282 temp = EXTI_CurrentCPU->IMR1;
283 temp &= ~(iocurrent);
284 if ((GPIO_Init->Mode & EXTI_IT) != 0x00U)
285 {
286 temp |= iocurrent;
287 }
288 EXTI_CurrentCPU->IMR1 = temp;
289 }
290 }
291
292 position++;
293 }
294}
295
296/**
297 * @brief De-initializes the GPIOx peripheral registers to their default reset values.
298 * @param GPIOx: where x can be (A..K) to select the GPIO peripheral.
299 * @param GPIO_Pin: specifies the port bit to be written.
300 * This parameter can be one of GPIO_PIN_x where x can be (0..15).
301 * @retval None
302 */
303void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
304{
305 uint32_t position = 0x00U;
306 uint32_t iocurrent;
307 uint32_t tmp;
308 EXTI_Core_TypeDef *EXTI_CurrentCPU;
309
310#if defined(DUAL_CORE) && defined(CORE_CM4)
311 EXTI_CurrentCPU = EXTI_D2; /* EXTI for CM4 CPU */
312#else
313 EXTI_CurrentCPU = EXTI_D1; /* EXTI for CM7 CPU */
314#endif
315
316 /* Check the parameters */
318 assert_param(IS_GPIO_PIN(GPIO_Pin));
319
320 /* Configure the port pins */
321 while ((GPIO_Pin >> position) != 0x00U)
322 {
323 /* Get current io position */
324 iocurrent = GPIO_Pin & (1UL << position) ;
325
326 if (iocurrent != 0x00U)
327 {
328 /*------------------------- EXTI Mode Configuration --------------------*/
329 /* Clear the External Interrupt or Event for the current IO */
330 tmp = SYSCFG->EXTICR[position >> 2U];
331 tmp &= (0x0FUL << (4U * (position & 0x03U)));
332 if (tmp == (GPIO_GET_INDEX(GPIOx) << (4U * (position & 0x03U))))
333 {
334 /* Clear EXTI line configuration for Current CPU */
335 EXTI_CurrentCPU->IMR1 &= ~(iocurrent);
336 EXTI_CurrentCPU->EMR1 &= ~(iocurrent);
337
338 /* Clear Rising Falling edge configuration */
339 EXTI->FTSR1 &= ~(iocurrent);
340 EXTI->RTSR1 &= ~(iocurrent);
341
342 tmp = 0x0FUL << (4U * (position & 0x03U));
343 SYSCFG->EXTICR[position >> 2U] &= ~tmp;
344 }
345
346 /*------------------------- GPIO Mode Configuration --------------------*/
347 /* Configure IO in Analog Mode */
348 GPIOx->MODER |= (GPIO_MODER_MODE0 << (position * 2U));
349
350 /* Configure the default Alternate Function in current IO */
351 GPIOx->AFR[position >> 3U] &= ~(0xFUL << ((position & 0x07U) * 4U)) ;
352
353 /* Deactivate the Pull-up and Pull-down resistor for the current IO */
354 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPD0 << (position * 2U));
355
356 /* Configure the default value IO Output Type */
357 GPIOx->OTYPER &= ~(GPIO_OTYPER_OT0 << position) ;
358
359 /* Configure the default value for IO Speed */
360 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDR_OSPEED0 << (position * 2U));
361 }
362
363 position++;
364 }
365}
366
367/**
368 * @}
369 */
370
371/** @defgroup GPIO_Exported_Functions_Group2 IO operation functions
372 * @brief GPIO Read, Write, Toggle, Lock and EXTI management functions.
373 *
374@verbatim
375 ===============================================================================
376 ##### IO operation functions #####
377 ===============================================================================
378
379@endverbatim
380 * @{
381 */
382
383/**
384 * @brief Reads the specified input port pin.
385 * @param GPIOx: where x can be (A..K) to select the GPIO peripheral.
386 * @param GPIO_Pin: specifies the port bit to read.
387 * This parameter can be GPIO_PIN_x where x can be (0..15).
388 * @retval The input port pin value.
389 */
390GPIO_PinState HAL_GPIO_ReadPin(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
391{
392 GPIO_PinState bitstatus;
393
394 /* Check the parameters */
395 assert_param(IS_GPIO_PIN(GPIO_Pin));
396
397 if ((GPIOx->IDR & GPIO_Pin) != 0x00U)
398 {
399 bitstatus = GPIO_PIN_SET;
400 }
401 else
402 {
403 bitstatus = GPIO_PIN_RESET;
404 }
405 return bitstatus;
406}
407
408/**
409 * @brief Sets or clears the selected data port bit.
410 *
411 * @note This function uses GPIOx_BSRR register to allow atomic read/modify
412 * accesses. In this way, there is no risk of an IRQ occurring between
413 * the read and the modify access.
414 *
415 * @param GPIOx: where x can be (A..K) to select the GPIO peripheral.
416 * @param GPIO_Pin: specifies the port bit to be written.
417 * This parameter can be one of GPIO_PIN_x where x can be (0..15).
418 * @param PinState: specifies the value to be written to the selected bit.
419 * This parameter can be one of the GPIO_PinState enum values:
420 * @arg GPIO_PIN_RESET: to clear the port pin
421 * @arg GPIO_PIN_SET: to set the port pin
422 * @retval None
423 */
424void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
425{
426 /* Check the parameters */
427 assert_param(IS_GPIO_PIN(GPIO_Pin));
429
430 if (PinState != GPIO_PIN_RESET)
431 {
432 GPIOx->BSRR = GPIO_Pin;
433 }
434 else
435 {
436 GPIOx->BSRR = (uint32_t)GPIO_Pin << GPIO_NUMBER;
437 }
438}
439
440/**
441 * @brief Toggles the specified GPIO pins.
442 * @param GPIOx: Where x can be (A..K) to select the GPIO peripheral.
443 * @param GPIO_Pin: Specifies the pins to be toggled.
444 * @retval None
445 */
446void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
447{
448 uint32_t odr;
449
450 /* Check the parameters */
451 assert_param(IS_GPIO_PIN(GPIO_Pin));
452
453 /* get current Output Data Register value */
454 odr = GPIOx->ODR;
455
456 /* Set selected pins that were at low level, and reset ones that were high */
457 GPIOx->BSRR = ((odr & GPIO_Pin) << GPIO_NUMBER) | (~odr & GPIO_Pin);
458}
459
460/**
461 * @brief Locks GPIO Pins configuration registers.
462 * @note The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR,
463 * GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.
464 * @note The configuration of the locked GPIO pins can no longer be modified
465 * until the next reset.
466 * @param GPIOx: where x can be (A..K) to select the GPIO peripheral for STM32H7 family
467 * @param GPIO_Pin: specifies the port bit to be locked.
468 * This parameter can be any combination of GPIO_PIN_x where x can be (0..15).
469 * @retval None
470 */
471HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
472{
473 __IO uint32_t tmp = GPIO_LCKR_LCKK;
474
475 /* Check the parameters */
477 assert_param(IS_GPIO_PIN(GPIO_Pin));
478
479 /* Apply lock key write sequence */
480 tmp |= GPIO_Pin;
481 /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
482 GPIOx->LCKR = tmp;
483 /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */
484 GPIOx->LCKR = GPIO_Pin;
485 /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
486 GPIOx->LCKR = tmp;
487 /* Read LCKK register. This read is mandatory to complete key lock sequence*/
488 tmp = GPIOx->LCKR;
489
490 /* read again in order to confirm lock is active */
491 if ((GPIOx->LCKR & GPIO_LCKR_LCKK) != 0x00U)
492 {
493 return HAL_OK;
494 }
495 else
496 {
497 return HAL_ERROR;
498 }
499}
500
501/**
502 * @brief Handle EXTI interrupt request.
503 * @param GPIO_Pin: Specifies the port pin connected to corresponding EXTI line.
504 * @retval None
505 */
506void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
507{
508#if defined(DUAL_CORE) && defined(CORE_CM4)
509 if (__HAL_GPIO_EXTID2_GET_IT(GPIO_Pin) != 0x00U)
510 {
511 __HAL_GPIO_EXTID2_CLEAR_IT(GPIO_Pin);
512 HAL_GPIO_EXTI_Callback(GPIO_Pin);
513 }
514#else
515 /* EXTI line interrupt detected */
516 if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00U)
517 {
518 __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
519 HAL_GPIO_EXTI_Callback(GPIO_Pin);
520 }
521#endif
522}
523
524/**
525 * @brief EXTI line detection callback.
526 * @param GPIO_Pin: Specifies the port pin connected to corresponding EXTI line.
527 * @retval None
528 */
529__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
530{
531 /* Prevent unused argument(s) compilation warning */
532 UNUSED(GPIO_Pin);
533
534 /* NOTE: This function Should not be modified, when the callback is needed,
535 the HAL_GPIO_EXTI_Callback could be implemented in the user file
536 */
537}
538
539/**
540 * @}
541 */
542
543
544/**
545 * @}
546 */
547
548#endif /* HAL_GPIO_MODULE_ENABLED */
549/**
550 * @}
551 */
552
553/**
554 * @}
555 */
556
#define __IO
Defines 'read / write' permissions.
int32_t temp
Definition flight_e2e.c:78
#define IS_GPIO_ALL_INSTANCE(INSTANCE)
#define IS_GPIO_AF_INSTANCE(INSTANCE)
#define IS_GPIO_LOCK_INSTANCE(INSTANCE)
#define GPIO_GET_INDEX(__GPIOx__)
#define IS_GPIO_AF(AF)
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, const GPIO_InitTypeDef *GPIO_Init)
void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
Definition board_exti.c:45
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
GPIO_PinState HAL_GPIO_ReadPin(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
#define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__)
Checks whether the specified EXTI line is asserted or not.
#define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__)
Clears the EXTI's line pending bits.
GPIO_PinState
GPIO Bit SET and Bit RESET enumeration.
@ GPIO_PIN_SET
@ GPIO_PIN_RESET
#define MODE_OUTPUT
#define EXTI_MODE
#define EXTI_EVT
#define MODE_AF
#define MODE_ANALOG
#define TRIGGER_FALLING
#define EXTI_IT
#define GPIO_MODE
#define TRIGGER_RISING
#define OUTPUT_TYPE
#define OUTPUT_TYPE_Pos
#define IS_GPIO_PULL(PULL)
#define IS_GPIO_PIN(__PIN__)
#define IS_GPIO_PIN_ACTION(ACTION)
#define IS_GPIO_SPEED(SPEED)
#define IS_GPIO_MODE(MODE)
#define GPIO_PULLUP
Pull-up activation.
#define GPIO_OSPEEDR_OSPEED0
#define GPIO_OTYPER_OT0
#define GPIO_PUPDR_PUPD0
#define GPIO_MODER_MODE0
#define GPIO_LCKR_LCKK
#define SYSCFG
#define EXTI_D1
#define EXTI
#define EXTI_D2
#define __HAL_RCC_SYSCFG_CLK_ENABLE()
Enable or disable the APB4 peripheral clock.
This file contains all the functions prototypes for the HAL module driver.
#define assert_param(expr)
Uncomment the line below to expanse the "assert_param" macro in the HAL drivers code.
HAL_StatusTypeDef
HAL Status structures definition.
@ HAL_ERROR
@ HAL_OK
#define UNUSED(x)
This structure registers corresponds to EXTI_Typdef CPU1/CPU2 registers subset (IMRx,...
__IO uint32_t EMR1
EXTI Event mask register, Address offset: 0x04.
__IO uint32_t IMR1
EXTI Interrupt mask register, Address offset: 0x00.
GPIO Init structure definition.
uint32_t Mode
Specifies the operating mode for the selected pins.
uint32_t Alternate
Peripheral to be connected to the selected pins.
uint32_t Pull
Specifies the Pull-up or Pull-Down activation for the selected pins.
uint32_t Pin
Specifies the GPIO pins to be configured.
uint32_t Speed
Specifies the speed for the selected pins.
General Purpose I/O.
__IO uint32_t OSPEEDR
GPIO port output speed register, Address offset: 0x08.
__IO uint32_t AFR[2]
GPIO alternate function registers, Address offset: 0x20-0x24.
__IO uint32_t PUPDR
GPIO port pull-up/pull-down register, Address offset: 0x0C.
__IO uint32_t ODR
GPIO port output data register, Address offset: 0x14.
__IO uint32_t OTYPER
GPIO port output type register, Address offset: 0x04.
__IO uint32_t LCKR
GPIO port configuration lock register, Address offset: 0x1C.
__IO uint32_t MODER
GPIO port mode register, Address offset: 0x00.
__IO uint32_t BSRR
GPIO port bit set/reset, Address offset: 0x18.
__IO uint32_t IDR
GPIO port input data register, Address offset: 0x10.