#ifndef __KEY_FSM_H_ #define __KEY_FSM_H_ #define KeyFSM_Input(pFSM) (KeyIn *)_preloadIn((FSM *)pFSM) typedef enum _keyIn{ pUp, pDown, }KeyIn; typedef enum _keyOut{ Idle, Down, Hold, Down_2times, Down_3times, }KeyOut; const static char *keyStr[] = { "Idle", "Down", "Hold", "Down_2times", "Down_3times", }; typedef struct _keyFSMExternalData { KeyIn in; }KeyFSMExternalData; typedef struct _keyFSMInternalData { int countDelay; int countMultiDown; KeyOut out; }KeyFSMInternalData; typedef struct _keyFSMData { KeyFSMExternalData external; KeyFSMInternalData internal; }KeyFSMData; typedef struct _KeyFSM KeyFSM; KeyFSM *createKeyFSM(); KeyOut readKeyFSMOut(KeyFSM *FSM); #endif