How to set pin speed/alternate function in STM32 Arduino (PlatformIO)
You can use the STM32 HAL (STM32CubeMX) even when using Arduino as a framework for STM32 boards in PlatformIO:
GPIO_InitTypeDef pinInit = {
.Pin = GPIO_PIN_8,
.Mode = GPIO_MODE_AF_PP,
.Pull = GPIO_NOPULL,
.Speed = GPIO_SPEED_FREQ_VERY_HIGH,
.Alternate = GPIO_AF1_TIM1
};
HAL_GPIO_Init(GPIOA, &pinInit);
Use
#include <stm32f4xx_hal_gpio.h>
in order to include the HAL functions.