Bumperservice

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

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

You might also like