Professional Documents
Culture Documents
InitBeaconEdgeCapturePeriod
start by enabling the clock to the timer (Wide Timer 0)
we want to use the full 32 bit count, so initialize the Interval Load
register to 0xffffffff (its default value)
To set the event to rising edge, we need to modify the TAEVENT bits
in GPTMCTL. Rising edges = 00, so we set the TAEVENT bits
Now Set up the port to do the capture (clock was enabled earlier)
start by setting the alternate function for Port C bit 4 (WT0CCP0)
StartBeaconCapture
now kick the InputCaptureTimer off by enabling it and
enabling the timer to stall while stopped by the debugger
End of StartBeaconCapture
StopBeaconCapture
now disable the InputCaptureTimer writing 0 to it
End of StopBeaconCapture
BeaconEdgeCaptureResponse
start by clearing the source of the interrupt, the input capture event
End of BeaconEdgeCaptureResponse
InitBeaconOneShot
start by enabling the clock to the timer (Wide Timer 0)
set timeout
End of InitBeaconOneshot
StartBeaconOneShot
now kick the timer off by enabling it and enabling the timer to
stall while stopped by the debugger
End of StartBeaconOneShot
StopBeaconOneShot
now disable the timer writing 0 to it
End of StopBeaconOneShot
BeaconOneShotIntResponse
start by clearing the source of the interrupt
increment our counter so that we can tell this is running
clear accumulated noise on counts and average
OneShotTimer timing out means the no beacon pulses detected
post EV_BEACON_NOTFOUND to GameMasterSM
End of BeaconOneShotIntResponse