TA的每日心情 | 开心 2015-9-9 14:42 |
---|
签到天数: 9 天 连续签到: 1 天 [LV.3]偶尔看看II
|
int main(void)
{
LED_config();//
while (1)
{
LED1( ON ); // ÁÁ
Delay(0x0FFFEF);
LED1( OFF ); // Ãð
LED2( ON );
Delay(0x0FFFEF);
LED2( OFF );
LED3( ON );
Delay(0x0FFFEF);
LED3( OFF );
}
}
void Delay(__IO u32 nCount) //¼òµ¥µÄÑÓʱº¯Êý
{
for(; nCount != 0; nCount--);
}
#ifndef __LED_H
#define __LED_H
#include "gd32f20X.h"
/* the macro definition to trigger the led on or off
* 1 - off
- 0 - on
*/
#define ON 0
#define OFF 1
//´ø²Îºê£¬¿ÉÒÔÏñÄÚÁªº¯ÊýÒ»ÑùʹÓÃ
#define LED1(a) if (a) \
GPIO_SetBits(GPIOD,GPIO_PIN_11);\
else \
GPIO_ResetBits(GPIOD,GPIO_PIN_11)
#define LED2(a) if (a) \
GPIO_SetBits(GPIOD,GPIO_PIN_12);\
else \
GPIO_ResetBits(GPIOD,GPIO_PIN_12)
#define LED3(a) if (a) \
GPIO_SetBits(GPIOD,GPIO_PIN_13);\
else \
GPIO_ResetBits(GPIOD,GPIO_PIN_13)
void LED_GPIO_Config(void);
#endif /* __LED_H */
|
|