Bumperservice
Bumperservice
Bumperservice
PublicFunctions:InitBumperService,PostBumperService,CheckBumperEvents,
RunBumperService
InitBumperService
Setpriority
InitializeLastButtonStatevariablebyreadingbuttons1,2,and3
SetCurrentStatetoDebouncing
Startdebouncetimer
Postinitialtransitionevent
EndInitBumperService
PostBumperService
Postpriorityandeventtoservice
EndPostBumperService
CheckBumperEvents
InitializeReturnVal
SetCurrentButtonStatetoreadfrom3bumperbuttonports
IfCurrentButtonStatedoesnotequalLastButtonState
ReturnValequalstrue
IfCurrentButtonStateequalsbutton1hiorbutton2hiorbutton3hi
PostBUTTON_DOWNeventtoButtonServicequeue
Else
PostBUTTON_UPeventtoButtonServicequeue
EndIf
SetLastButtonStateequaltoCurrentButtonState
ReturnReturnVal
EndCheckBumperEvents
RunBumperService
InitializeReturnEvent
SwitchCurrentBumperState
CaseDebouncing
Ifdebouncetimertimeout
CurrentBumperStateisReady2Sample
EndIf
EndBlock
CaseReady2Sample
IfBUTTON_UPevent
Startbuttondebouncetimer
CurrentBumperStateisDebouncing
ElseIfBUTTON_DOWNevent
Startdebouncetimer
CurrentBumperStateisDebouncing
PostBUMPeventtoMasterSM
EndIf
EndBlock
ReturnReturnEvent
EndRunBumperService
EndBumperService