led.c 829 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * File : led.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2014, 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. * 2014-11-23 Bright first implementation
  13. */
  14. #include "led.h"
  15. /*
  16. LED: P3.6
  17. */
  18. #define LED_PORT P3
  19. #define LED_DATA(dat) (P36 = dat)
  20. #define LED_BIT BIT6
  21. /* Initial led gpio pin */
  22. int rt_hw_led_init(void)
  23. {
  24. /* Configure the GPIO_LED pin */
  25. GPIO_SetMode(LED_PORT, LED_BIT, GPIO_PMD_OUTPUT);
  26. return 0;
  27. }
  28. void rt_hw_led_on(void)
  29. {
  30. LED_DATA(0);
  31. }
  32. void rt_hw_led_off(void)
  33. {
  34. LED_DATA(1);
  35. }
  36. /* Initial components for device */
  37. INIT_DEVICE_EXPORT(rt_hw_led_init);