...
The FreeRTOS demo application illustrates the corresponding APIs through controlling of the LEDs and Push-Buttons available on the carrier board.
1. Understanding FreeRTOS GPIO Interfaces
1.1. FreeRTOS GPIO Implementation
The FreeRTOS BSP makes use of the STM32CubeH7 software component to provide a device driver for the STM32H7 GPIO. The driver is configured (enabled / disabled) at the BSP build time, using the HAL_GPIO_MODULE_ENABLED
configuration option, defined in the stm32h7xx_hal_conf.h
file.
1.2. FreeRTOS GPIO C-Binding API
The GPIO driver implements the following C-binding API:
Function | Description | Comments |
| Initialise GPIO pins in a specified GPIO port |
|
| Reset a GPIO pin to default settings |
|
| Read state of a GPIO pin |
|
| Set or clear a GPIO pin |
|
| Toggle specified GPIO pins |
The GPIO_InitTypeDef
data structure used in the HAL_GPIO_Init
interface has the following definition:
Code Block |
---|
typedef struct { uint32_t Pin; /* GPIO pins to be configured */ uint32_t Mode; /* Operating mode for the selected pins */ uint32_t Pull; /* Pull-up or Pull-Down activation for the selected pins */ uint32_t Speed; /* Speed for the selected pins */ uint32_t Alternate;/* Peripheral to be connected to the selected pin */ } GPIO_InitTypeDef; |
1.3. FreeRTOS LED and Push-Button Tasks
The FreeRTOS demos application provides two threads illustrating use of the GPIO API from a FreeRTOS application. Specifically:
...