HAL GPIO Overview ¶
Introducing GPIO ¶
- group GPIO_Introduction
-
The GPIO hardware abstraction layer (HAL) provides a set of APIs to interface with the general-purpose Input/Output (GPIO) peripheral on STM32 microcontrollers.
This layer simplifies the configuration, initialization, and management of GPIO pins, allowing multiple pins to be managed simultaneously when they belong to the same port. The GPIO includes the following features:
Initialize one or more GPIO pins.
Read the value of a pin.
Write values to one or more pins.
Toggle the state of pins.
Lock pins configuration.
Lock a set of pins.
This abstraction layer ensures portability and ease of use across different STM32 series microcontrollers.
Module and files ¶
The following diagram illustrates the GPIO module and its associated files.
Component diagram ¶
The following diagram illustrates the software components involved in the GPIO module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.
Configuration table ¶
The following table lists the configuration defines for the HAL GPIO module, specifying their locations, default values, and descriptions:
- group GPIO_Configuration_Table
-
Configuration inside the GPIO driver ¶
Config defines
Description
Default value
Note
USE_HAL_GPIO_MODULE
hal_conf.h
1
When set, HAL GPIO module is enabled
USE_HAL_CHECK_PARAM
hal_conf.h
0
When set, parameters are checked at runtime
USE_ASSERT_DBG_PARAM
PreProcessor env
NA
When defined, enable the params assert
USE_HAL_GPIO_CLK_ENABLE_MODEL
hal_conf.h
HAL_CLK_ENABLE_NO
Enable GPIO port clock in HAL_GPIO_Init