2024-01-30 15:50:34 +08:00
|
|
|
|
#ifndef __PARENT_FSM_H_
|
|
|
|
|
#define __PARENT_FSM_H_
|
2024-06-28 21:40:28 +08:00
|
|
|
|
|
|
|
|
|
|
2024-06-26 20:21:14 +08:00
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* 提前做类型声明 */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2024-06-28 21:40:28 +08:00
|
|
|
|
typedef struct FSM FSM;
|
|
|
|
|
typedef struct ParentFSM ParentFSM;
|
2024-01-30 15:50:34 +08:00
|
|
|
|
|
2024-01-30 23:00:38 +08:00
|
|
|
|
|
2024-06-28 21:40:28 +08:00
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* 子状态机绑定,需要自己实现逻辑 */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
void bind_ParentFSM_ChildFSMs(ParentFSM *pFSM, FSM *B_FSM);
|
|
|
|
|
|
2024-06-26 20:21:14 +08:00
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* 自定义数据和信号 */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/**
|
|
|
|
|
* @brief 自定义外部信号,目前最多15个
|
|
|
|
|
* @details 因为是Unint16存储的信号位
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
enum ParentFSMSignals{
|
|
|
|
|
Signal_toA = 1, /**< 必须从1开始,0预留给Idle信号了*/
|
|
|
|
|
Signal_toB,
|
|
|
|
|
Signal_toC,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 自定义外部数据
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
typedef struct ParentFSMExternalData
|
2024-01-30 15:50:34 +08:00
|
|
|
|
{
|
|
|
|
|
int arrindex;
|
2024-06-26 20:21:14 +08:00
|
|
|
|
int x;
|
|
|
|
|
}ParentFSMExternalData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 自定义内部数据
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
typedef struct ParentFSMInnerData
|
|
|
|
|
{
|
|
|
|
|
int y1;
|
|
|
|
|
int inner1;
|
|
|
|
|
}ParentFSMInnerData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2024-06-28 21:40:28 +08:00
|
|
|
|
/* 这一块改个名字就行了 */
|
2024-06-26 20:21:14 +08:00
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
typedef struct ParentFSMData
|
|
|
|
|
{
|
|
|
|
|
ParentFSMExternalData external;
|
|
|
|
|
ParentFSMInnerData internal;
|
2024-01-30 15:50:34 +08:00
|
|
|
|
}ParentFSMData;
|
|
|
|
|
|
|
|
|
|
ParentFSM *createParentFSM();
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 20:21:14 +08:00
|
|
|
|
|
2024-01-30 15:50:34 +08:00
|
|
|
|
#endif
|