main.c 658 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <rtthread.h>
  2. #include "led.h"
  3. #ifdef PKG_USING_GUIENGINE
  4. #include <rtgui/driver.h>
  5. #endif
  6. int main(void)
  7. {
  8. rt_device_t device;
  9. rt_kprintf("hello rt-thread\n");
  10. #ifdef PKG_USING_GUIENGINE
  11. device = rt_device_find("lcd");
  12. if (device)
  13. {
  14. rtgui_graphic_set_device(device);
  15. }
  16. #endif
  17. while (1)
  18. {
  19. /* light on leds for one second */
  20. rt_hw_led_on(LED2|LED3);
  21. rt_hw_led_off(LED1|LED4);
  22. rt_thread_delay(100);
  23. /* light off leds for one second */
  24. rt_hw_led_off(LED2|LED3);
  25. rt_hw_led_on(LED1|LED4);
  26. rt_thread_delay(100);
  27. }
  28. return 0;
  29. }