/**************************************************************************** Module BeaconSense.c Description This is an IR sensing input capture interrupt module for ME218B Project for Team 3. Notes Private Definitions ConsecutivePulses TicksPerMs MeasurementError LastCaptureRear PeriodRear CanCalculatePeriodRear PulseCount void InitializeBeaconSense(void) -------------------------------------------- // disable beacon interrupts in the local interrupt mask // ensure that the interrupts are enabled in the NVIC void BeaconRearISR(void) ---------------------------------------------------- // start by clearing the source of the interrupt // grab the captured value // check to see if we can capture the pulse yet // we can't calculate the period now, but we can next time // we can calculate the period, then: // calculate the period // get the beacon signal we are trying to see // see if this period is within that of the known beacon signal // found beacon once, save success to safety value // otherwise, we didn't see the correct period: // value doesn't correspond to measurement, reset our count // if we saw a consecutive number of pulses of the correct length: //Signal has been located! // --> disable interrupts // --> reset CanCalculatePeriodRear // --> Set GuardCondition to 0 // --> send BEACON_DETECTED event with param REAR to GameplayHSM // update LastCaptureRear to prepare for the next edge void EnableRearBeaconInterrupts(void) --------------------------------------- // enable interrupts using the local interrupt mask static void DisableRearBeaconInterrupts(void) ------------------------------- // disable interrupts using the local interrupt mask /***************************************************************************/