stm32g0cube-projects/myapps/OLD/first-hal/src/main.c

28 lines
509 B
C
Raw Normal View History

2025-08-23 11:49:01 +10:00
//#include "stm32g0xx_hal.h"
#include "stm32g0xx_hal_msp.h"
2025-08-23 02:26:08 +10:00
#define LED_PIN 4
int main(void)
{
HAL_Init();
2025-08-23 11:49:01 +10:00
SystemClock_Config();
2025-08-23 02:26:08 +10:00
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Pin = GPIO_PIN_4;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
while(1)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_4);
HAL_Delay(100);
}
}