main.c 713 B

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