FSM/vscode/FSM_OOP/keytest/keyFSM.h

50 lines
845 B
C

#ifndef __KEY_FSM_H_
#define __KEY_FSM_H_
#define KeyFSM_Input(pFSM) (KeyIn *)_preloadIn((FSM *)pFSM)
typedef enum _keyIn{
Up,
pDown,
}KeyIn;
typedef enum _keyOutSignal{
Idle,
Down,
Hold,
Down_2times,
Down_3times,
}KeyOutSignal;
const static char *keyStr[] =
{
"Idle",
"Down",
"Hold",
"Down_2times",
"Down_3times",
};
typedef struct _keyFSMData
{
/* ----------------------------------- 输入 ----------------------------------- */
KeyIn in;
/* ----------------------------------- 输出 ----------------------------------- */
KeyOutSignal out;
/* ---------------------------------- 内部变量 ---------------------------------- */
int countDelay;
int countMultiDown;
}KeyFSMData;
typedef struct _KeyFSM KeyFSM;
KeyFSM *createKeyFSM();
#endif