led.c 901 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2013-11-15 bright the first version
  9. */
  10. #include <rtthread.h>
  11. #include "led.h"
  12. /*
  13. LED_GREEN: PC8
  14. LED_RED : PC9
  15. */
  16. /* Initial led gpio pin */
  17. int rt_hw_led_init(void)
  18. {
  19. GPIO_InitTypeDef GPIO_InitStructure;
  20. /* Enable the GPIO_LED Clock */
  21. RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
  22. /* Configure the GPIO_LED pin */
  23. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  24. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  25. GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  26. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  27. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  28. GPIO_Init(GPIOC, &GPIO_InitStructure);
  29. return 0;
  30. }
  31. /* Initial components for device */
  32. INIT_DEVICE_EXPORT(rt_hw_led_init);