/**************************************************************************** Module T_Mining.c Description This is a sub state machine (2nd level) called Mining within the Master module for ME 218B project for Team 5. Implements a hierarchical state machine under the Gen2 Events and Services Framework. Notes Private Definitions ENTRY_STATE FORWARD REVERSE CurrentState Private Functions DuringNormalOp DuringCollision ES_Event_t RunMining(ES_Event_t CurrentEvent) -------------------------------------------- // initialize NextState to CurrentState // set MakeTransition false // based on our CurrentState: // if our CurrentState is NormalOp // call the During function of NormalOp - DuringNormalOp // process any events // if a PERMITS_EXPIRED event occurs // turn off green LED // set NextState to Standby // stop driving // consume this event // if a COLLISION_DETECTED event occurs // set NextState to Collision // consume this event // if our CurrentState is Collision // call the During function of Collision - DuringCollision // process any events // if an ES_TIMEOUT occurs for COLLISION_TIMER // set NextState to NormalOp // consume this event // if a PERMITS_EXPIRED event occurs // set NextState to Standby // stop drying // consume this event // if our CurrentState is Standby // process any events // if a PERMITS_ISSUED event occurs // turn on green LED // set NextState to NormalOp // consume this event void StartMining (ES_Event_t CurrentEvent) -------------------------------------------- // calls RunMining MiningState_t QueryMining (void) ------------------------------------------------------ // returns CurrentState static ES_Event_t DuringNormalOp(ES_Event_t Event) ------------------------------------ // set ReturnEvent to Event // based on Event: // process ES_ENTRY or ES_ENTRY_HISTORY events // Start NormalOp SM with entry event // process ES_EXIT event // Run NormalOp SM with exit event // in all other cases // Run NormalOp SM with Event // return ReturnEvent to allow lower level SMs to remap Event static ES_Event_t DuringCollision(ES_Event_t Event) ------------------------------------ // set ReturnEvent to Event // based on Event: // process ES_ENTRY or ES_ENTRY_HISTORY events // Start Collision SM with entry event // process ES_EXIT event // Run Collision SM with exit event // in all other cases // Run Collision SM with Event // return ReturnEvent to allow lower level SMs to remap Event /***************************************************************************************/