2022-12-11 20:42:18 +08:00

107 lines
3.0 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
******************************************************************************
* @file main.c
* @author MCU Application Team
* @brief Main program body
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) Puya Semiconductor Co.
* All rights reserved.</center></h2>
*
* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private define ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private user code ---------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
static void APP_LedConfig(void);
/**
* @brief 应用程序入口函数.
* @param 无
* @retval int
*/
int main(void)
{
/* 初始化所有外设Flash接口SysTick */
HAL_Init();
/* 初始化LED */
APP_LedConfig();
while (1)
{
/* 延时250ms */
HAL_Delay(250);
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5);
}
}
/**
* @brief 初始化LED
* @param 无
* @retval 无
*/
static void APP_LedConfig(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
__HAL_RCC_GPIOB_CLK_ENABLE(); /* GPIOB时钟使能 */
GPIO_InitStruct.Pin = GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; /* 推挽输出 */
GPIO_InitStruct.Pull = GPIO_PULLUP; /* 使能上拉 */
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; /* GPIO速度 */
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /* GPIO初始化 */
}
/**
* @brief 错误执行函数
* @param 无
* @retval 无
*/
void APP_ErrorHandler(void)
{
/* 无限循环 */
while (1)
{
}
}
#ifdef USE_FULL_ASSERT
/**
* @brief 输出产生断言错误的源文件名及行号
* @param file源文件名指针
* @param line发生断言错误的行号
* @retval 无
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* 用户可以根据需要添加自己的打印信息,
例如: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* 无限循环 */
while (1)
{
}
}
#endif /* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT Puya *****END OF FILE******************/