Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

49 righe
1.5 KiB

  1. /**
  2. ******************************************************************************
  3. * @file bsp_led.c
  4. * @author fire
  5. * @version V1.0
  6. * @date 2017-xx-xx
  7. * @brief led应用函数接口
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * 实验平台:野火 STM32 F407 开发板
  12. * 论坛 :http://www.firebbs.cn
  13. * 淘宝 :http://firestm32.taobao.com
  14. *
  15. ******************************************************************************
  16. */
  17. #include "./led/bsp_led.h"
  18. /**
  19. * @brief 初始化控制LED的IO
  20. * @param 无
  21. * @retval 无
  22. */
  23. void LED_GPIO_Config(void)
  24. {
  25. /*定义一个GPIO_InitTypeDef类型的结构体*/
  26. GPIO_InitTypeDef GPIO_InitStruct;
  27. /*开启LED相关的GPIO外设时钟*/
  28. LED1_GPIO_CLK_ENABLE();
  29. LED2_GPIO_CLK_ENABLE();
  30. /*选择要控制的GPIO引脚*/
  31. GPIO_InitStruct.Pin = LED1_PIN;
  32. /*设置引脚的输出类型为推挽输出*/
  33. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  34. /*设置引脚为上拉模式*/
  35. GPIO_InitStruct.Pull = GPIO_PULLUP;
  36. /*设置引脚速率为高速 */
  37. GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
  38. /*调用库函数,使用上面配置的GPIO_InitStructure初始化GPIO*/
  39. HAL_GPIO_Init(LED1_GPIO_PORT, &GPIO_InitStruct);
  40. /*选择要控制的GPIO引脚*/
  41. GPIO_InitStruct.Pin = LED2_PIN;
  42. HAL_GPIO_Init(LED2_GPIO_PORT, &GPIO_InitStruct);
  43. /*关闭RGB灯*/
  44. LED_RGBOFF;
  45. }
  46. /*********************************************END OF FILE**********************/