soft_led.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _SOFT_LED_H
  2. #define _SOFT_LED_H
  3. #include "stdbool.h"
  4. #include "common.h"
  5. #define Red 0
  6. #define Blue 2
  7. #define Green 1
  8. #define Purple 3
  9. #define Yellow 4
  10. #define Cyan 5
  11. #define White 6
  12. #define ON 0xff
  13. #define OFF 0x00
  14. #define LEDRed_ON() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_SET)
  15. #define LEDRed_OFF() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_RESET)
  16. #define LEDGreen_ON() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_SET)
  17. #define LEDGreen_OFF() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_RESET)
  18. #define LEDBlue_ON() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_SET)
  19. #define LEDBlue_OFF() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_RESET)
  20. #define LEDPurple_ON() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_SET)
  21. #define LEDPurple_OFF() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_RESET)
  22. #define LEDYellow_ON() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_SET)
  23. #define LEDYellow_OFF() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_RESET)
  24. #define LEDCyan_ON() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_SET)
  25. #define LEDCyan_OFF() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_RESET)
  26. #define LEDWhite_ON() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_SET)
  27. #define LEDWhite_OFF() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1 | GPIO_PIN_1 | GPIO_PIN_1,GPIO_PIN_RESET)
  28. void led_set_blink( uint8_t, uint8_t, uint8_t, uint8_t );
  29. void led_blink_repeat( void );
  30. void Update_LED_Time( void );
  31. typedef struct
  32. {
  33. uint8_t status;
  34. uint32_t on_time_ms;
  35. uint32_t off_time_ms;
  36. uint32_t repeat;
  37. uint32_t time;
  38. } LED_Red, LED_Blue, LED_Green, LED_Purple, LED_Cyan, LED_Yellow, LED_White;
  39. extern LED_Red L_red;
  40. extern LED_Blue L_blue;
  41. extern LED_Green L_green;
  42. extern LED_Purple L_purple;
  43. extern LED_Cyan L_cyan;
  44. extern LED_Yellow L_yellow;
  45. extern LED_White L_white;
  46. void pmu_inside_led(void);
  47. #endif