/**************************************************************************** Module TapeService.c Revision 1.0.1 Description This is the first service for the Test Harness under the Gen2 Events and Services Framework. Notes Private Definitions ONE_SEC HALF_SEC TWO_SEC FIVE_SEC DebounceTime TAPESENSOR_HI MyPriority LastTapeState CurrentState bool InitTapeService(uint8_t Priority) -------------------------------------- // set CurrentState to be Debouncing // sample the lines to initialize history state // start debounce timer ES_Event_t RunTapeDebounce(ES_Event_t ThisEvent) ---------------------------- // based on the current state: // if we are in Debouncing: // If EventType is ES_TIMEOUT & parameter is tape timer number // Set CurrentState to Ready2Sample // if we are in Ready2Sample: // if we saw a tape edge // Start debounce timer // Set CurrentState to Debouncing // Post that the tape was detected to Gameplay bool Check4Tape(void) ------------------------------------------------------- // set CurrentTapeState to state read from port pin // if the CurrentTapeState is different from the LastTapeState // if the current tape sensor pin is high, then we see the tape // post that we saw an edge to the tape debounce service (this one) // reset LastTapeState /***************************************************************************/