1
0

application.c 1010 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2011-01-13 weety first version
  9. * 2015-04-27 ArdaFu Port bsp from at91sam9260 to asm9260t
  10. */
  11. #include <rtthread.h>
  12. #include <rtdevice.h>
  13. #ifdef RT_USING_LED
  14. #include "led.h"
  15. void rt_led_thread_entry(void* parameter)
  16. {
  17. rt_uint8_t cnt = 0;
  18. led_init();
  19. while(1)
  20. {
  21. /* light on leds for one second */
  22. rt_thread_delay(40);
  23. cnt++;
  24. if(cnt & 0x01)
  25. led_on(1);
  26. else
  27. led_off(1);
  28. }
  29. }
  30. static void start_led_thread(void)
  31. {
  32. rt_thread_t led_thread;
  33. led_thread = rt_thread_create("led", rt_led_thread_entry, RT_NULL, 512,
  34. (RT_THREAD_PRIORITY_MAX / 8 * 5), 20);
  35. if(led_thread != RT_NULL)
  36. rt_thread_startup(led_thread);
  37. }
  38. #endif
  39. int main()
  40. {
  41. #ifdef RT_USING_LED
  42. start_led_thread();
  43. #endif
  44. return 0;
  45. }