FSM_2nd.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /**
  2. * @file ctrlmdfsm1.h
  3. * @author Zhang, Kai(zhangkai71@midea.com)
  4. * @brief Control mode FSM
  5. * @version 0.1
  6. * @date 2021-09-27
  7. *
  8. * @copyright Copyright (c) 2021
  9. *
  10. */
  11. #ifndef FSM2ND_H
  12. #define FSM2ND_H
  13. #include "typedefine.h"
  14. /****************************************
  15. *
  16. * Definitions & Macros
  17. *
  18. ****************************************/
  19. #define CTRLMD_FSM_FLG_DEFAULT \
  20. { \
  21. FALSE, TRUE \
  22. } // Default value of CTRLMD_FSM_FLG
  23. /***************************************
  24. *
  25. * Type Definations
  26. *
  27. ***************************************/
  28. /**
  29. * @brief Type of control mode FSM
  30. *
  31. */
  32. typedef enum
  33. {
  34. Assistance = 0,
  35. Boost = 1,
  36. Cruise = 2,
  37. Exit = 3,
  38. Charge1 = 4,
  39. } RUN_FSM_STATUS;
  40. /**
  41. * @brief Type of control mode function hook
  42. *
  43. */
  44. typedef struct
  45. {
  46. RUN_FSM_STATUS state;
  47. void (*Event_hook)(void);
  48. void (*Tbcup_hook)(void);
  49. void (*Tbcdown_hook)(void); ///<
  50. void (*Tbs_hook)(void);
  51. } FSM_RUN_HOOK;
  52. /**
  53. * @brief Type of control mode flag
  54. *
  55. */
  56. typedef struct
  57. {
  58. BOOL blCmdRunFlg;
  59. BOOL blMotorStopFlg;
  60. } CTRLMD_FSM_FLG1;
  61. /****************************************
  62. *
  63. * Exported variable
  64. *
  65. ****************************************/
  66. extern FSM_RUN_HOOK FSM2nd_Run_state;
  67. extern FSM_RUN_HOOK Exit_state;
  68. extern CTRLMD_FSM_FLG1 cmfsm_stFlg;
  69. /***************************************
  70. *
  71. * Function Definations
  72. *
  73. ***************************************/
  74. /**
  75. *
  76. * @brief Process of control mode FSM during Assistance state
  77. *
  78. */
  79. void Assistance_hook(void);
  80. /**
  81. * @brief Process of tbc_up during Assistance state
  82. *
  83. */
  84. void Assistance_tbcuphook(void);
  85. /**
  86. * @brief @brief Process of tbc_down during Assistance state
  87. *
  88. */
  89. void Assistance_tbcdownhook(void);
  90. /**
  91. * @brief @brief Process of tbs during Assistance state
  92. *
  93. */
  94. void Assistance_tbshook(void);
  95. /**
  96. *
  97. * @brief Process of control mode FSM during Boost state
  98. *
  99. */
  100. void Boost_hook(void);
  101. /**
  102. *
  103. * @brief Process of tbc_up during Boost state
  104. *
  105. */
  106. void Boost_tbcuphook(void);
  107. /**
  108. *
  109. * @brief Process of tbc_down during Boost state
  110. *
  111. */
  112. void Boost_tbcdownhook(void);
  113. /**
  114. *
  115. * @brief Process of tbs during Boost state
  116. *
  117. */
  118. void Boost_tbshook(void);
  119. /**
  120. *
  121. * @brief Process of control mode FSM during Exit state
  122. *
  123. */
  124. void Exit_hook(void);
  125. /**
  126. *
  127. * @brief Process of tbc_up during Exit state
  128. *
  129. */
  130. void Exit_tbcuphook(void);
  131. /**
  132. *
  133. * @brief Process of tbc_down during Exit state
  134. *
  135. */
  136. void Exit_tbcdownhook(void);
  137. /**
  138. *
  139. * @brief Process of tbs during Exit state
  140. *
  141. */
  142. void Exit_tbshook(void);
  143. /**
  144. * @brief Switch current state to *in state
  145. *
  146. * @param in pointer to target state
  147. */
  148. void Switch_Second_FSM(FSM_RUN_HOOK *in);
  149. /**
  150. *
  151. * @brief Control mode FSM running function
  152. *
  153. */
  154. void FSM_2nd_Main(void);
  155. /**
  156. *
  157. *
  158. * @brief Control mode FSM initialization
  159. *
  160. */
  161. void RUN_FSM_voInit(void);
  162. #endif