application.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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-06-29 lgnq the first version
  10. *
  11. * For : NEC V850E
  12. * Toolchain : IAR Embedded Workbench for V850 v3.71
  13. */
  14. #include <rtthread.h>
  15. #include "board.h"
  16. #include "CG_macrodriver.h"
  17. #include "CG_system.h"
  18. #include "CG_port.h"
  19. #include "CG_timer.h"
  20. /* Start user code for include. Do not edit comment generated here */
  21. /* End user code. Do not edit comment generated here */
  22. #include "CG_userdefine.h"
  23. static struct rt_thread led;
  24. rt_align(RT_ALIGN_SIZE)
  25. static rt_uint8_t led_stack[256];
  26. static void rt_thread_entry_led(void *parameter)
  27. {
  28. while (1)
  29. {
  30. led_off();
  31. rt_thread_delay(20);
  32. led_on();
  33. rt_thread_delay(40);
  34. }
  35. }
  36. int rt_application_init(void)
  37. {
  38. rt_err_t result;
  39. result = rt_thread_init(&led,
  40. "led",
  41. rt_thread_entry_led,
  42. RT_NULL,
  43. &led_stack[0],
  44. sizeof(led_stack),
  45. RT_THREAD_PRIORITY_MAX / 2,
  46. 32);
  47. if (result == RT_EOK)
  48. rt_thread_startup(&led);
  49. return 0;
  50. }