#include <stm32f1xx_hal.h>
#define LED_PIN GPIO_PIN_13
#define LED_PORT GPIOC
static void MX_GPIO_Init(void);
void Error_Handler(void);
int main(void)
{
HAL_Init();
MX_GPIO_Init();
while (1)
{
HAL_GPIO_TogglePin(LED_PORT, LED_PIN);
HAL_Delay(250);
}
}
void SysTick_Handler(void)
{
HAL_IncTick();
}
void MX_GPIO_Init(void)
{
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(LED_PORT, &GPIO_InitStruct);
}
void Error_Handler(void)
{
while (1)
{
}
}
Loading
stm32-bluepill
stm32-bluepill