application.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-01-05 Bernard the first version
  13. * 2010-04-09 fify modified for M16C
  14. *
  15. * For : Renesas M16C
  16. * Toolchain : IAR's EW for M16C v3.401
  17. */
  18. #include <rtthread.h>
  19. #include "bsp.h"
  20. static struct rt_thread led;
  21. static rt_uint8_t led_stack[256];
  22. static void rt_thread_entry_led(void* parameter)
  23. {
  24. while (1)
  25. {
  26. /* led off */
  27. led_off();
  28. rt_thread_delay(100); /* sleep 1 second and switch to other thread */
  29. /* led on */
  30. led_on();
  31. rt_thread_delay(100);
  32. }
  33. }
  34. int rt_application_init(void)
  35. {
  36. /* create led thread */
  37. rt_thread_init(&led,
  38. "led",
  39. rt_thread_entry_led, RT_NULL,
  40. &led_stack[0], sizeof(led_stack),
  41. 5, 32);
  42. if (&led != RT_NULL)
  43. rt_thread_startup(&led);
  44. return 0;
  45. }