|
@@ -1,47 +1,31 @@ |
|
|
#if F0 |
|
|
|
|
|
#include "stm32f0xx_hal.h" |
|
|
|
|
|
#elif F1 |
|
|
|
|
|
#include "stm32f1xx_hal.h" |
|
|
|
|
|
#elif F2 |
|
|
|
|
|
#include "stm32f2xx_hal.h" |
|
|
|
|
|
#elif F3 |
|
|
|
|
|
#include "stm32f3xx_hal.h" |
|
|
|
|
|
#elif F4 |
|
|
|
|
|
#include "stm32f4xx_hal.h" |
|
|
|
|
|
#elif F7 |
|
|
|
|
|
#include "stm32f7xx_hal.h" |
|
|
|
|
|
#elif L0 |
|
|
|
|
|
#include "stm32l0xx_hal.h" |
|
|
|
|
|
#elif L1 |
|
|
|
|
|
#include "stm32l1xx_hal.h" |
|
|
|
|
|
#elif L4 |
|
|
|
|
|
#include "stm32l4xx_hal.h" |
|
|
|
|
|
#else |
|
|
|
|
|
#error "Unsupported STM32 Family" |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#include "main.h" |
|
|
|
|
|
|
|
|
#define LED_PIN GPIO_PIN_5 |
|
|
|
|
|
#define LED_GPIO_PORT GPIOA |
|
|
|
|
|
#define LED_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() |
|
|
|
|
|
|
|
|
|
|
|
int main(void) |
|
|
|
|
|
|
|
|
void LED_Init() |
|
|
{ |
|
|
{ |
|
|
HAL_Init(); |
|
|
|
|
|
|
|
|
|
|
|
LED_GPIO_CLK_ENABLE(); |
|
|
LED_GPIO_CLK_ENABLE(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GPIO_InitTypeDef GPIO_InitStruct; |
|
|
GPIO_InitTypeDef GPIO_InitStruct; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GPIO_InitStruct.Pin = LED_PIN; |
|
|
GPIO_InitStruct.Pin = LED_PIN; |
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP; |
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP; |
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; |
|
|
|
|
|
HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct); |
|
|
|
|
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; |
|
|
|
|
|
HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifndef UNIT_TEST |
|
|
|
|
|
int main(void) |
|
|
|
|
|
#else |
|
|
|
|
|
int app_main(void) |
|
|
|
|
|
#endif |
|
|
|
|
|
{ |
|
|
|
|
|
HAL_Init(); |
|
|
|
|
|
LED_Init(); |
|
|
|
|
|
|
|
|
while (1) |
|
|
while (1) |
|
|
{ |
|
|
{ |
|
|
HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_PIN); |
|
|
HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_PIN); |
|
|
|
|
|
|
|
|
HAL_Delay(1000); |
|
|
HAL_Delay(1000); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|