main.c 954 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2021 hpmicro
  3. *
  4. * Change Logs:
  5. * Date Author Notes
  6. * 2021-08-13 Fan YANG first version
  7. *
  8. */
  9. #include <rtthread.h>
  10. #include <rtdevice.h>
  11. #include "rtt_board.h"
  12. void thread_entry(void *arg);
  13. int main(void)
  14. {
  15. app_init_led_pins();
  16. static uint32_t led_thread_arg = 0;
  17. rt_thread_t led_thread = rt_thread_create("led_th", thread_entry, &led_thread_arg, 1024, 1, 10);
  18. rt_thread_startup(led_thread);
  19. return 0;
  20. }
  21. void thread_entry(void *arg)
  22. {
  23. while(1){
  24. app_led_write(0, APP_LED_ON);
  25. rt_thread_mdelay(500);
  26. app_led_write(0, APP_LED_OFF);
  27. rt_thread_mdelay(500);
  28. app_led_write(1, APP_LED_ON);
  29. rt_thread_mdelay(500);
  30. app_led_write(1, APP_LED_OFF);
  31. rt_thread_mdelay(500);
  32. app_led_write(2, APP_LED_ON);
  33. rt_thread_mdelay(500);
  34. app_led_write(2, APP_LED_OFF);
  35. rt_thread_mdelay(500);
  36. }
  37. }