lib/gpio/gpio-stm-impl.h¶
STM32 specific GPIO implementation details for CFBD. More...
Detailed Description¶
STM32 specific GPIO implementation details for CFBD.
This header provides STM32-specific types used by the public GPIO abstraction ([lib/gpio/gpio.h](Files/gpio_8h.md#file-gpio.h)). It is included only when the CFBD_IS_ST macro selects the ST platform implementation. The declarations here reference HAL types from stm32f1xx_hal_gpio.h.
The STM32 GPIO backend encapsulates STM HAL initialization parameters and provides the low-level interface for pin configuration, setting, clearing and toggling operations on STM32 microcontrollers.
STM32 GPIO Usage¶
To use STM32 GPIO functionality:
- Include
[gpio.h](Files/gpio_8h.md#file-gpio.h)(which conditionally includes this file when CFBD_IS_ST is set) - Populate a
CFBD_ST_GPIOInitParamsstructure with HAL types - Cast to
CFBD_GPIOInitParamsand pass toCFBD_GPIOInit
STM32 GPIO Example¶
#include "lib/gpio/gpio.h"
#include <stm32f1xx_hal.h>
// Example: Initialize GPIOA pin 5 as output
CFBD_ST_GPIOInitParams stm_params;
stm_params.handle = GPIOA;
stm_params.pin = GPIO_PIN_5;
stm_params.initer.Mode = GPIO_MODE_OUTPUT_PP;
stm_params.initer.Pull = GPIO_NOPULL;
stm_params.initer.Speed = GPIO_SPEED_FREQ_HIGH;
CFBD_GPIOHandle gpio_handle;
CFBD_GPIOInit(&gpio_handle, (CFBD_GPIOInitParams)&stm_params);
// Set pin high
CFBD_GPIOSet(&gpio_handle);
Source code¶
#pragma once
#include "../config/lib_settings.h"
#if defined(CFBD_IS_ST)
#include <stdint.h>
typedef struct
{
GPIO_TypeDef* handle;
uint32_t pin;
GPIO_InitTypeDef initer;
} CFBD_ST_GPIOInitParams;
#endif
Updated on 2026-02-03 at 13:21:55 +0000