Академический Документы
Профессиональный Документы
Культура Документы
LEAF_STATE_MACHINE
This state machine detecs the insertion of the leaf card, during which the game
should run
States:
LeafInserted
LeafNotInserted
*/
InitLeafSM
Parameters
uint8_t : the priorty of this service
Returns
bool, false if error in initialization, true otherwise
Description
Saves away the priority, and does any
other required initialization for this service
Function
Post ES_INIT to this state machine. Return true if successful, false in case of
any error.
PostLeafSM
Parameters
ES_Event_t ThisEvent ,the event to post to the queue
Returns
bool false if the Enqueue operation failed, true otherwise
Description
Posts an event to this state machine's queue
Function:
Call ES_PostToService passing the priority through MyPriority and the assigned
event
RunLeafSM
Parameters
ES_Event_t : the event from its service queue to process in this State
Machine
Types of ES_Event_t: LEAF_ACTIVATED, LEAF_NOT_ACTIVATED
Returns
ES_Event_t, ES_NO_EVENT if no error ES_ERROR otherwise
Function
Switch CurrentState
If PseudoState_Leaf:
If event is ES_INIT:
Switch on the Leaf LED
Put current state to LeafNotInserted
If LeafNotInserted:
If event is LEAF_VALID:
Post LEAF_ACTIVATED event to the ControlSM
Put current state to LeafInserted
Switch off leaf led
If LeafInserted:
If event LEAF_REMOVED:
Post LEAF_RESET
Put current state to LeafNotInserted
Switch on the Leaf LED
return ReturnEvent