int main(void) { Key_Def key; LED_Init(); Key_Init(); //Set_Keyint();//设置按键中断方式 while (1) { /* 按键查询方式 */ key = KEY_Scan(); switch (key) { case KEY1: LEDTog(LED1); break; case KEY2: LEDTog(LED2); break; case KEYNULL: break; default : break; } } }
static void rt_thread_entry_led(void* parameter) { LED_Init(); Key_Init(); Set_Keyint(); while(1) { LEDTog(LED1); LEDTog(LED2); LEDTog(LED3); LEDTog(LED4); rt_thread_delay(RT_TICK_PER_SECOND/2); } }
static void rt_thread_entry_led2(void* parameter) { LED_Init(); while (1) { LEDTog(LED2); rt_thread_delay(RT_TICK_PER_SECOND/3); } }