58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
#ifndef __TEMPLATE_FSM_H_
|
||
#define __TEMPLATE_FSM_H_
|
||
|
||
/* -------------------------------------------------------------------------- */
|
||
/* 提前做类型声明 */
|
||
/* -------------------------------------------------------------------------- */
|
||
|
||
|
||
/* -------------------------------------------------------------------------- */
|
||
/* 自定义数据和信号 */
|
||
/* -------------------------------------------------------------------------- */
|
||
/**
|
||
* @brief 自定义外部信号,目前最多15个
|
||
*
|
||
*/
|
||
enum TemplateFSMSignals{
|
||
Signal_A = 1, /**< 必须从1开始,0预留给Idle信号了*/
|
||
Signal_B,
|
||
};
|
||
|
||
/**
|
||
* @brief 自定义外部数据
|
||
*
|
||
*/
|
||
typedef struct _templateFSMExternalData
|
||
{
|
||
int arrindex;
|
||
int x;
|
||
}TemplateFSMExternalData;
|
||
|
||
|
||
/**
|
||
* @brief 自定义内部数据
|
||
*
|
||
*/
|
||
typedef struct _templateFSMInnerData
|
||
{
|
||
int y1;
|
||
int inner1;
|
||
}TemplateFSMInnerData;
|
||
|
||
/* -------------------------------------------------------------------------- */
|
||
/* 下面的改个名字就行了 */
|
||
/* -------------------------------------------------------------------------- */
|
||
#define TemplateFSM_Input(pFSM) ((TemplateFSMExternalData *)_preloadIn((FSM *)pFSM))
|
||
|
||
typedef struct _templateFSMData
|
||
{
|
||
TemplateFSMExternalData external;
|
||
TemplateFSMInnerData internal;
|
||
}TemplateFSMData;
|
||
|
||
typedef struct _TemplateFSM TemplateFSM;
|
||
TemplateFSM *createTemplateFSM();
|
||
|
||
|
||
#endif
|