基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.5 KiB

  1. //
  2. // Created by iflyt on 2025/2/27.
  3. //
  4. #include "led.h"
  5. #include "bsp.h"
  6. void LED_Init(void)
  7. {
  8. GPIO_InitTypeDef GPIO_InitStruct = {0};
  9. // 使能 GPIOF 和 GPIOE 端口时钟
  10. __HAL_RCC_GPIOE_CLK_ENABLE();
  11. __HAL_RCC_GPIOF_CLK_ENABLE();
  12. __HAL_RCC_GPIOI_CLK_ENABLE();
  13. // 配置 LED_KEY 引脚
  14. GPIO_InitStruct.Pin = LED_KEY_Pin;
  15. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  16. GPIO_InitStruct.Pull = GPIO_NOPULL;
  17. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  18. HAL_GPIO_Init(LED_KEY_GPIO_Port, &GPIO_InitStruct);
  19. // 配置 LED_GREEN 引脚
  20. GPIO_InitStruct.Pin = LED_GREEN_Pin;
  21. HAL_GPIO_Init(LED_GREEN_GPIO_Port, &GPIO_InitStruct);
  22. // 配置 LED_RED 引脚
  23. GPIO_InitStruct.Pin = LED_RED_Pin;
  24. HAL_GPIO_Init(LED_RED_GPIO_Port, &GPIO_InitStruct);
  25. // 配置 LED_BLUE 引脚
  26. GPIO_InitStruct.Pin = LED_BLUE_Pin;
  27. HAL_GPIO_Init(LED_BLUE_GPIO_Port, &GPIO_InitStruct);
  28. // 配置 蜂鸣器
  29. GPIO_InitStruct.Pin = BEPPER_ALARM_Pin;
  30. HAL_GPIO_Init(BEPPER_ALARM_GPIO_Port, &GPIO_InitStruct);
  31. // 配置 LIGHT_FLOOD 引脚
  32. GPIO_InitStruct.Pin = LIGHT_FLOOD_Pin;
  33. HAL_GPIO_Init(LIGHT_FLOOD_GPIO_Port, &GPIO_InitStruct);
  34. GPIO_InitStruct.Pin = RK3588_POWER_Pin;
  35. HAL_GPIO_Init(RK3588_POWER_GPIO_Port, &GPIO_InitStruct);
  36. // LED_KEY_ON;
  37. LED_KEY_OFF;
  38. // 初始化时将所有 LED 熄灭
  39. LED_GREEN_ON;
  40. LED_RED_ON;
  41. LED_BLUE_ON;
  42. BEPPER_ALARM_OFF;
  43. // 初始化时将照明灯关闭
  44. LIGHT_FLOOD_OFF;
  45. }