application.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. * 2009-01-05 Bernard the first version
  9. * 2010-04-09 fify modified for M16C
  10. *
  11. * For : Renesas M16C
  12. * Toolchain : IAR's EW for M16C v3.401
  13. */
  14. #include <rtthread.h>
  15. #include "bsp.h"
  16. static struct rt_thread led;
  17. rt_align(RT_ALIGN_SIZE)
  18. static rt_uint8_t led_stack[256];
  19. static void rt_thread_entry_led(void *parameter)
  20. {
  21. while (1)
  22. {
  23. led_off();
  24. rt_thread_delay(100);
  25. led_on();
  26. rt_thread_delay(100);
  27. }
  28. }
  29. int rt_application_init(void)
  30. {
  31. rt_err_t result;
  32. /* create led thread */
  33. result = rt_thread_init(&led,
  34. "led",
  35. rt_thread_entry_led,
  36. RT_NULL,
  37. &led_stack[0],
  38. sizeof(led_stack),
  39. RT_THREAD_PRIORITY_MAX / 2,
  40. 32);
  41. if (result == RT_EOK)
  42. rt_thread_startup(&led);
  43. return 0;
  44. }