FSM/vscode/FSM_OOP/childtest/parentFSM.h

68 lines
1.8 KiB
C
Raw Normal View History

2024-01-30 15:50:34 +08:00
#ifndef __PARENT_FSM_H_
#define __PARENT_FSM_H_
2024-06-26 20:21:14 +08:00
/* -------------------------------------------------------------------------- */
/* 提前做类型声明 */
/* -------------------------------------------------------------------------- */
typedef struct FSM FSM;
typedef struct ParentFSM ParentFSM;
2024-01-30 15:50:34 +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-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