dev_led.c 838 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "dev_led.h"
  2. #include "hal_conf.h"
  3. dev_led_t dev_led; // 自定义led结构体;
  4. // 驱动led开关
  5. void dev_led_on_off(uint8_t leds, uint8_t on_off)
  6. {
  7. switch (leds)
  8. {
  9. case 0:
  10. {
  11. if (0x00 == on_off)
  12. {
  13. // HAL_GPIO_LED0(0x00);
  14. dev_led.dev_led_state.bits.led0_state_flag = 0;
  15. }
  16. else
  17. {
  18. // HAL_GPIO_LED0(0x01);
  19. dev_led.dev_led_state.bits.led0_state_flag = 1;
  20. }
  21. break;
  22. }
  23. case 1:
  24. {
  25. if (0x00 == on_off)
  26. {
  27. HAL_GPIO_LED1(0x00);
  28. dev_led.dev_led_state.bits.led1_state_flag = 0;
  29. }
  30. else
  31. {
  32. HAL_GPIO_LED1(0x01);
  33. dev_led.dev_led_state.bits.led1_state_flag = 1;
  34. }
  35. break;
  36. }
  37. default:
  38. break;
  39. }
  40. }