1、main.c
#include "sys.h"
#include "delay.h"
#include "key.h"
#define LEDPORT GPIOC //定义IO接口
#define LED1 GPIO_Pin_13 //定义IO接口
int Index1,Index2,Index3 = ;
int time1;
unsigned char gUart_Rece_Buf1[];
unsigned char gUart_Rece_Buf2[];
unsigned char gUart_Rece_Buf3[];
u8 menu=;
u16 i,t=;
int main(void)
{
delay_init(); //延时函数初始化
sys_Init(); //系统初始化(时钟初始化、中断初始化、GPIOx初始化、串口1初始化、串口2初始化、串口3初始化)
while()
{
if(menu==)//变亮
{
for(i=;i<;i++)
{
GPIO_WriteBit(LEDPORT,LED1,(BitAction)());
delay_us(t);
GPIO_WriteBit(LEDPORT,LED1,(BitAction)());
delay_us(-t);
}
t++;
if(t==)
{
menu=;
}
}
if(menu==)//变暗
{
for(i=;i<;i++)
{
GPIO_WriteBit(LEDPORT,LED1,(BitAction)());
delay_us(t);
GPIO_WriteBit(LEDPORT,LED1,(BitAction)());
delay_us(-t);
}
t--;
if(t==)
{
menu=;
}
}
}
}