Professional Documents
Culture Documents
Check4Shift
InitializeGearService
Set switch pin to input
Set Gear LED pin to output
Read switch pin and set as LastGearState
Set CurrentState to InitGear
Post Event ES_Init to this service
End of InitializeGearService
RunGear
CurrentState is GearWaiting2Begin
Switch for Event Type
Event is ES_BEGIN
Set Gear Timer
Set CurrentState to Waiting2Shift
Event is ES_GEAR_SHIFT
Post ES_BEGIN to all
End switch
End GearWaiting2Begin block
CurrentState is Waiting2Shift
Switch for Event Type
Event is ES_GEAR_TIMEOUT
Turn on Gear LED
Set CurrentState to Ready2Shift
Event is ES_ACTIVITY_TIMEOUT
Disable Gear Timer
Set CurrentState to GearWaiting2Begin
End switch
End Waiting2Shift block
CurrentState is Ready2Shift
Switch for Event Type
Event is ES_GEAR_SHIFT
Turn off Gear LED
Reset Gear Timer
Reset Activity Timer
Add 5 points to score
Set CurrentState to Waiting2Shift
Event is ES_ACTIVITY_TIMEOUT
Turn off Gear LED
Disable Gear Timer
Set CurrentState to GearWaiting2Begin
End switch
End Ready2Shift block
End switch block