/** * @file ctrlmdfsm1.h * @author Zhang, Kai(zhangkai71@midea.com) * @brief Control mode FSM * @version 0.1 * @date 2021-09-27 * * @copyright Copyright (c) 2021 * */ #ifndef FSM2ND_H #define FSM2ND_H #include "typedefine.h" /**************************************** * * Definitions & Macros * ****************************************/ #define CTRLMD_FSM_FLG_DEFAULT \ { \ FALSE, TRUE \ } // Default value of CTRLMD_FSM_FLG /*************************************** * * Type Definations * ***************************************/ /** * @brief Type of control mode FSM * */ typedef enum { Assistance = 0, Boost = 1, Cruise = 2, Exit = 3, Charge1 = 4, } RUN_FSM_STATUS; /** * @brief Type of control mode function hook * */ typedef struct { RUN_FSM_STATUS state; void (*Event_hook)(void); void (*Tbcup_hook)(void); void (*Tbcdown_hook)(void); ///< void (*Tbs_hook)(void); } FSM_RUN_HOOK; /** * @brief Type of control mode flag * */ typedef struct { BOOL blCmdRunFlg; BOOL blMotorStopFlg; } CTRLMD_FSM_FLG1; /**************************************** * * Exported variable * ****************************************/ extern FSM_RUN_HOOK FSM2nd_Run_state; extern FSM_RUN_HOOK Exit_state; extern CTRLMD_FSM_FLG1 cmfsm_stFlg; /*************************************** * * Function Definations * ***************************************/ /** * * @brief Process of control mode FSM during Assistance state * */ void Assistance_hook(void); /** * @brief Process of tbc_up during Assistance state * */ void Assistance_tbcuphook(void); /** * @brief @brief Process of tbc_down during Assistance state * */ void Assistance_tbcdownhook(void); /** * @brief @brief Process of tbs during Assistance state * */ void Assistance_tbshook(void); /** * * @brief Process of control mode FSM during Boost state * */ void Boost_hook(void); /** * * @brief Process of tbc_up during Boost state * */ void Boost_tbcuphook(void); /** * * @brief Process of tbc_down during Boost state * */ void Boost_tbcdownhook(void); /** * * @brief Process of tbs during Boost state * */ void Boost_tbshook(void); /** * * @brief Process of control mode FSM during Exit state * */ void Exit_hook(void); /** * * @brief Process of tbc_up during Exit state * */ void Exit_tbcuphook(void); /** * * @brief Process of tbc_down during Exit state * */ void Exit_tbcdownhook(void); /** * * @brief Process of tbs during Exit state * */ void Exit_tbshook(void); /** * @brief Switch current state to *in state * * @param in pointer to target state */ void Switch_Second_FSM(FSM_RUN_HOOK *in); /** * * @brief Control mode FSM running function * */ void FSM_2nd_Main(void); /** * * * @brief Control mode FSM initialization * */ void RUN_FSM_voInit(void); #endif