led.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * File : led.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006-2013, 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. * 2013-11-15 bright the first version
  13. */
  14. #include <rtthread.h>
  15. #include "led.h"
  16. /*
  17. LED_GREEN: PC8
  18. LED_RED : PC9
  19. */
  20. /* Initial led gpio pin */
  21. int rt_hw_led_init(void)
  22. {
  23. GPIO_InitTypeDef GPIO_InitStructure;
  24. /* Enable the GPIO_LED Clock */
  25. RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
  26. /* Configure the GPIO_LED pin */
  27. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  28. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  29. GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  30. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  31. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  32. GPIO_Init(GPIOC, &GPIO_InitStructure);
  33. return 0;
  34. }
  35. /* Initial components for device */
  36. INIT_DEVICE_EXPORT(rt_hw_led_init);