led.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * @Description:
  3. * @Version: 2.0
  4. * @Author: Seven
  5. * @Date: 2022-06-14 14:01:08
  6. * @LastEditors: Seven
  7. * @LastEditTime: 2022-09-30 14:08:58
  8. */
  9. #ifndef __LED_H
  10. #define __LED_H
  11. #include "gd32f10x.h"
  12. extern uint16_t LED_STATUS;
  13. #ifdef TY_0904
  14. #define LED_RUN_RCU RCU_GPIOD
  15. #define LED_STATE_RCU RCU_GPIOD
  16. #define LED_RUN_PORT GPIOD
  17. #define LED_RUN_PIN GPIO_PIN_14
  18. #define LED_STATE_PORT GPIOD
  19. #define LED_STATE_PIN GPIO_PIN_15
  20. #else
  21. #define LED_RUN_RCU RCU_GPIOC
  22. #define LED_STATE_RCU RCU_GPIOA
  23. #define LED_RUN_PORT GPIOC
  24. #define LED_RUN_PIN GPIO_PIN_13
  25. #define LED_STATE_PORT GPIOA
  26. #define LED_STATE_PIN GPIO_PIN_0
  27. #endif
  28. #define LED_ON 1
  29. #define LED_OFF 0
  30. #define LED_NUM 16
  31. enum{
  32. LED0 = 0,
  33. LED1 = 1,
  34. LED2 = 2,
  35. LED3 = 3,
  36. LED4 = 4,
  37. LED5 = 5,
  38. LED6 = 6,
  39. LED7 = 7,
  40. LED8 = 8,
  41. LED9 = 9,
  42. LED10 = 10,
  43. LED11 = 11,
  44. LED12 = 12,
  45. LED13 = 13,
  46. LED14 = 14,
  47. LED15 = 15,
  48. LED16 = 16,
  49. LED_ALL = 0xff,
  50. };
  51. //#define LED_RUN PEout(14)
  52. //#define LED_RUN_ON() gpio_bit_set(GPIOE, GPIO_PIN_14)
  53. //#define LED_RUN_OFF() gpio_bit_reset(GPIOE, GPIO_PIN_14)
  54. #define LED_RUN_OFF() gpio_bit_set(LED_RUN_PORT, LED_RUN_PIN)
  55. #define LED_RUN_ON() gpio_bit_reset(LED_RUN_PORT, LED_RUN_PIN)
  56. #define LED_STATE_OFF() gpio_bit_set(LED_STATE_PORT, LED_STATE_PIN)
  57. #define LED_STATE_ON() gpio_bit_reset(LED_STATE_PORT, LED_STATE_PIN)
  58. void LED_Init(void);
  59. void Led_Single_State_Set(uint8_t led, uint8_t state);
  60. void led_info_init(void);
  61. void led_start(uint8_t state);
  62. void led_run(void);
  63. void close_all_led(void);
  64. void Encryption_type_led_run_state(uint8_t state);
  65. void ota_start_led_init(void);
  66. void Data_last4bit_led(uint32_t data, uint8_t signal);
  67. void Data_lastNbit_led(uint32_t data, uint8_t bit, uint8_t signal);
  68. void APP_edittion_led_run(void);
  69. #endif