Files
player/Project/Src/Drive/Source/led.c

40 lines
1.2 KiB
C
Raw Normal View History

2025-06-27 00:32:57 +08:00
/***
***************************************************************************
* @file led.c
* @brief LED接口相关函数
***************************************************************************
* @description
*
* LED的IO口2M
*
***************************************************************************
***/
#include "led.h"
// 函数LED IO口初始化
//
void LED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure; //定义结构体
RCC_AHB1PeriphClockCmd ( LED1_CLK, ENABLE); //初始化GPIOG时钟
RCC_AHB1PeriphClockCmd ( LED2_CLK, ENABLE); //初始化GPIOD时钟
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //输出模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽输出
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; //速度选择
//初始化 LED1 引脚
GPIO_InitStructure.GPIO_Pin = LED1_PIN;
GPIO_Init(LED1_PORT, &GPIO_InitStructure);
//初始化 LED2 引脚
GPIO_InitStructure.GPIO_Pin = LED2_PIN;
GPIO_Init(LED2_PORT, &GPIO_InitStructure);
LED1_OFF;
LED2_OFF;
}