[AppleScript] syntaxhighlighter_viewsource syntaxhighlighter_copycode
LED_Display(N)
{
LED1=~LED1;
Delay(N秒);
}
[AppleScript] syntaxhighlighter_viewsource syntaxhighlighter_copycode
LED_Display(ontime,offtime,alltime)
{
int n;
n=alltime/(ontime+offtime);
for(i=0;i<n;i++)
{
LED_ON;
Delay(ontime);
LED_OFF;
Delay(offtime);
}
}
[AppleScript] syntaxhighlighter_viewsource syntaxhighlighter_copycode
void LEDInit(u32 ontime ,u32 offtime,u32 alltime)
{
static u32 m_ontime,m_offtime,m_alltime;
//统统滴 读进来
}
[AppleScript] syntaxhighlighter_viewsource syntaxhighlighter_copycode
void __Timer0Int(void)
{
//10ms重载
LEDProcess();
}
void LEDProcess(void)
{
static u32 allcount,ncount;
m_count+=10;
if(allcount>alltime)
{
//任务结束
//看起来这里还要设个标志
}
else
{
//燥起来
ncount+=10;
if(ncount>m_ontime)
{
LED_ON;
ncount=0;
//看起来还要设个交替的标志
}
else
{
LED_OFF;
ncount=0;
}
}
}
void LEDInit(u32 ontime ,u32 offtime,u32 alltime)
{
static u32 m_ontime,m_offtime,m_alltime;
//统统滴 读进来
}