main.c 751 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include <drv_gpio.h>
  13. void thread_entry(void *arg);
  14. int main(void)
  15. {
  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. rt_pin_mode(APP_LED0_PIN_NUM, PIN_MODE_OUTPUT);
  24. while(1){
  25. rt_pin_write(APP_LED0_PIN_NUM, APP_LED_ON);
  26. rt_thread_mdelay(500);
  27. rt_pin_write(APP_LED0_PIN_NUM, APP_LED_OFF);
  28. rt_thread_mdelay(500);
  29. }
  30. }