application.c 961 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, 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. */
  14. /**
  15. * @addtogroup STM32
  16. */
  17. /*@{*/
  18. #include <rtthread.h>
  19. #include "led.h"
  20. void led(void* parameter)
  21. {
  22. /* init led configuration */
  23. rt_hw_led_init();
  24. while (1)
  25. {
  26. /* led on */
  27. rt_hw_led_on(0);
  28. rt_thread_delay(50); /* sleep 0.5 second and switch to other thread */
  29. /* led off */
  30. rt_hw_led_off(0);
  31. rt_thread_delay(50);
  32. }
  33. }
  34. int rt_application_init()
  35. {
  36. rt_thread_t thread;
  37. /* create led thread */
  38. thread = rt_thread_create("led",
  39. led, RT_NULL,
  40. 512,
  41. 20, 5);
  42. if (thread != RT_NULL)
  43. rt_thread_startup(thread);
  44. return 0;
  45. }
  46. /*@}*/