Relay.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*********************************************************************************************************
  2. * 模块名称:Relay.h
  3. * 摘 要:Relay模块
  4. * 当前版本:1.0.0
  5. * 作 者:liyi(COPYRIGHT 2024 - ~. All rights reserved.)
  6. * 完成日期:2024年07月30日
  7. * 内 容:
  8. * 注 意:
  9. **********************************************************************************************************
  10. * 取代版本:
  11. * 作 者:
  12. * 完成日期:
  13. * 修改内容:
  14. * 修改文件:
  15. *********************************************************************************************************/
  16. #ifndef _RELAY_H_
  17. #define _RELAY_H_
  18. /*********************************************************************************************************
  19. * 包含头文件
  20. *********************************************************************************************************/
  21. #include "gd32e230x_conf.h"
  22. /*********************************************************************************************************
  23. * 宏定义
  24. *********************************************************************************************************/
  25. #define LK_Relay_D 1
  26. //#define RELAY9 8
  27. //#define RELAY8 7
  28. //#define RELAY7 6
  29. //#define RELAY6 5
  30. //#define RELAY5 4
  31. #define RELAY4 3
  32. #define RELAY3 2
  33. #define RELAY2 1
  34. #define RELAY1 0
  35. #define RELAY_ON 1
  36. #define RELAY_OFF 0
  37. #define Data_Output_RCU_A RCU_GPIOA
  38. #define Data_Output_RCU_B RCU_GPIOB
  39. #define DB_Out4 GPIO_PIN_5 // N
  40. #define DB_Out3 GPIO_PIN_4 // L3
  41. #define DB_Out2 GPIO_PIN_3 // L2
  42. #define DB_Out1 GPIO_PIN_15 // L1
  43. #define Data_Output_IO_A GPIOA
  44. #define Data_Output_IO_B GPIOB
  45. #define DB_Out1_L gpio_bit_reset(Data_Output_IO_A, DB_Out1) // 输出低电平
  46. #define DB_Out1_H gpio_bit_set(Data_Output_IO_A,DB_Out1) // 输出高电平
  47. #define DB_Out2_L gpio_bit_reset(Data_Output_IO_B, DB_Out2) // 输出低电平
  48. #define DB_Out2_H gpio_bit_set(Data_Output_IO_B,DB_Out2) // 输出高电平
  49. #define DB_Out3_L gpio_bit_reset(Data_Output_IO_B, DB_Out3) // 输出低电平
  50. #define DB_Out3_H gpio_bit_set(Data_Output_IO_B,DB_Out3) // 输出高电平
  51. #define DB_Out4_L gpio_bit_reset(Data_Output_IO_B, DB_Out4) // 输出低电平
  52. #define DB_Out4_H gpio_bit_set(Data_Output_IO_B,DB_Out4) // 输出高电平
  53. //#define Data_Output_RCU RCU_GPIOB
  54. //#define Data_Output_IO GPIOB
  55. //#define DB_Out8 GPIO_PIN_15
  56. //#define DB_Out7 GPIO_PIN_14
  57. //#define DB_Out6 GPIO_PIN_13
  58. //#define DB_Out5 GPIO_PIN_12
  59. //#define DB_Out4 GPIO_PIN_11
  60. //#define DB_Out3 GPIO_PIN_10
  61. //#define DB_Out2 GPIO_PIN_9
  62. //#define DB_Out1 GPIO_PIN_8
  63. //#define DB_Out1_L gpio_bit_reset(Data_Output_IO, DB_Out1) // 输出低电平
  64. //#define DB_Out1_H gpio_bit_set(Data_Output_IO,DB_Out1) // 输出高电平
  65. //#define DB_Out2_L gpio_bit_reset(Data_Output_IO, DB_Out2) // 输出低电平
  66. //#define DB_Out2_H gpio_bit_set(Data_Output_IO,DB_Out2) // 输出高电平
  67. //#define DB_Out3_L gpio_bit_reset(Data_Output_IO, DB_Out3) // 输出低电平
  68. //#define DB_Out3_H gpio_bit_set(Data_Output_IO,DB_Out3) // 输出高电平
  69. //#define DB_Out4_L gpio_bit_reset(Data_Output_IO, DB_Out4) // 输出低电平
  70. //#define DB_Out4_H gpio_bit_set(Data_Output_IO,DB_Out4) // 输出高电平
  71. //#define DB_Out5_L gpio_bit_reset(Data_Output_IO, DB_Out5) // 输出低电平
  72. //#define DB_Out5_H gpio_bit_set(Data_Output_IO,DB_Out5) // 输出高电平
  73. //#define DB_Out6_L gpio_bit_reset(Data_Output_IO, DB_Out6) // 输出低电平
  74. //#define DB_Out6_H gpio_bit_set(Data_Output_IO,DB_Out6) // 输出高电平
  75. //#define DB_Out7_L gpio_bit_reset(Data_Output_IO, DB_Out7) // 输出低电平
  76. //#define DB_Out7_H gpio_bit_set(Data_Output_IO,DB_Out7) // 输出高电平
  77. //#define DB_Out8_L gpio_bit_reset(Data_Output_IO, DB_Out8) // 输出低电平
  78. //#define DB_Out8_H gpio_bit_set(Data_Output_IO,DB_Out8) // 输出高电平
  79. /*********************************************************************************************************
  80. * 枚举结构体
  81. *********************************************************************************************************/
  82. /*********************************************************************************************************
  83. * API函数声明
  84. *********************************************************************************************************/
  85. void InitRelay(void); //初始化Relay模块
  86. void Relayx_Onoff_state(uint8_t RLx,uint8_t st);
  87. #endif