更新 'USER/Led/Led.c'
添加系统控制指示灯时钟初始化
This commit is contained in:
parent
4b6f0a164d
commit
a971ce7e43
@ -1,37 +1,37 @@
|
||||
#include "Led.h"
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* @函数名 LED_GPIO_INIT
|
||||
* @功能 LED GPIO初始化
|
||||
* @返回值 无
|
||||
* @函数名 LED_GPIO_INIT
|
||||
* @功能 LED GPIO初始化
|
||||
* @返回值 无
|
||||
***------------------------------------------------------*/
|
||||
void LED_GPIO_INIT(void){
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
/* 使能LED对应GPIO的时钟 */
|
||||
RCC_APB2PeriphClockCmd(LED_CLOCK, ENABLE); //使能对应端口时钟
|
||||
/* 使能LED对应GPIO的时钟 */
|
||||
RCC_APB2PeriphClockCmd(LED_CLOCK|LED_SYS_CLOCK, ENABLE); //使能对应端口时钟
|
||||
|
||||
/* 初始化LED的GPIO管脚,配置为推挽输出 */ //设置端口
|
||||
GPIO_InitStructure.GPIO_Pin = LED_Pin_ALL; //LED所有引脚
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //设置为推挽(Push-Pull)输出
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //最大输出速度为50MHz
|
||||
GPIO_Init(LED_PORT, &GPIO_InitStructure); //调用GPIO初始化函数
|
||||
GPIO_SetBits(LED_PORT,LED_Pin_ALL); //led全灭
|
||||
/* 初始化LED的GPIO管脚,配置为推挽输出 */ //设置端口
|
||||
GPIO_InitStructure.GPIO_Pin = LED_Pin_ALL; //LED所有引脚
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //设置为推挽(Push-Pull)输出
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //最大输出速度为50MHz
|
||||
GPIO_Init(LED_PORT, &GPIO_InitStructure); //调用GPIO初始化函数
|
||||
GPIO_SetBits(LED_PORT,LED_Pin_ALL); //led全灭
|
||||
|
||||
/* 初始化LED的GPIO管脚,配置为推挽输出 */ //设置端口
|
||||
GPIO_InitStructure.GPIO_Pin = LED_SYS_Pin; //LED所有引脚
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //设置为推挽(Push-Pull)输出
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //最大输出速度为50MHz
|
||||
GPIO_Init(LED_SYS_PORT, &GPIO_InitStructure); //调用GPIO初始化函数
|
||||
GPIO_ResetBits(LED_SYS_PORT,LED_SYS_Pin); //点亮系统指示灯
|
||||
/* 初始化LED的GPIO管脚,配置为推挽输出 */ //设置端口
|
||||
GPIO_InitStructure.GPIO_Pin = LED_SYS_Pin; //LED所有引脚
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //设置为推挽(Push-Pull)输出
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //最大输出速度为50MHz
|
||||
GPIO_Init(LED_SYS_PORT, &GPIO_InitStructure); //调用GPIO初始化函数
|
||||
GPIO_ResetBits(LED_SYS_PORT,LED_SYS_Pin); //点亮系统指示灯
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* @函数名 LED_ON
|
||||
* @功能 点亮指定LED LED0,1,2,3
|
||||
* @返回值 无
|
||||
* @函数名 LED_ON
|
||||
* @功能 点亮指定LED LED0,1,2,3
|
||||
* @返回值 无
|
||||
***------------------------------------------------------*/
|
||||
void LED_ON(u8 n){
|
||||
uint16_t GPIO_PIN_LIST[]={LED2_Pin,LED3_Pin,LED4_Pin,LED5_Pin};
|
||||
@ -45,9 +45,9 @@ void LED_ON(u8 n){
|
||||
}
|
||||
|
||||
/**-------------------------------------------------------
|
||||
* @函数名 LED_OFF
|
||||
* @功能 关闭所有LED
|
||||
* @返回值 无
|
||||
* @函数名 LED_OFF
|
||||
* @功能 关闭所有LED
|
||||
* @返回值 无
|
||||
***------------------------------------------------------*/
|
||||
void LED_OFF(void){
|
||||
uint16_t GPIO_PIN_LIST[]={LED2_Pin,LED3_Pin,LED4_Pin,LED5_Pin};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user