led.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "led.h"
  15. /* RT_USING_COMPONENTS_INIT */
  16. #ifdef RT_USING_COMPONENTS_INIT
  17. #include <components.h>
  18. #endif
  19. /*
  20. LED_GREEN: PC8
  21. LED_RED : PC9
  22. */
  23. /* Initial led gpio pin */
  24. void rt_hw_led_init(void)
  25. {
  26. GPIO_InitTypeDef GPIO_InitStructure;
  27. /* Enable the GPIO_LED Clock */
  28. RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
  29. /* Configure the GPIO_LED pin */
  30. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  31. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  32. GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  33. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  34. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  35. GPIO_Init(GPIOC, &GPIO_InitStructure);
  36. }
  37. /* Initial components for device */
  38. INIT_DEVICE_EXPORT(rt_hw_led_init);