main
This commit is contained in:
31
USER/led.c
Normal file
31
USER/led.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include "led.h"
|
||||
int lednumbernow=0;
|
||||
//LED IO初始化
|
||||
void LED_Init(void)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //使能PB,PE端口时钟
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
GPIO_SetBits(GPIOB,GPIO_Pin_12);
|
||||
}
|
||||
|
||||
void ledloop(void)
|
||||
{
|
||||
lednumbernow++;
|
||||
if (lednumbernow>200)
|
||||
{
|
||||
LED0=!LED0;
|
||||
lednumbernow=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user