* WireTouchDB * This file contains the service to debounce the wire game WireTouch event. define: DB_TIME 1000 // WireTouch debounce time [ms] Module data: static uint8_t MyPriority //module-level variable for the WireTouchDB module's priority static bool timerOn //variable to store whether or not the debounce timer has been activated * Initializes the WireTouchDB service. InitializeWireTouchDB Param: MyPriority Return: timerOn, true unless the initialization failed 1) post the initial transition event of type ES_INIT with the priority value 2) if the initialization event posted correctly return true else return false end InitializeWireTouchDB * Runs the WireTouchDB service. * CurrentEvent: the current event that has occurred RunWireTouchDB Param: ES_Event called CurrentEvent Return: ES_Event called ReturnEvent 1) assume no problems will occur so set Return Event equal to ES_NO_EVENT; 2) if the wire is touched and the db timer is off start the wire debounce timer, i.e. set timerOn equal to true else if the debouncing timer has expired turn off the wire debounce timer, i.e. timerOn equal to false if the wire is still being touched after the denouncing timer has expired post an ES_Event of type WireTouch to the MummySM end if end if 3) return ReturnEvent end RunWireTouchDB * Posts events to the WireTouchDB service. PostWireTouchDB Param: ThisEvent: event to post to WireTouchDB service Return: bool, true if successfully posted; false otherwise return ES_PostToService(MyPriority, ThisEvent); end PostWireTouchDB * Samples the state of the wire. wireState takes no parameters, returns nothing return the state of the tiva pin connected to the wire end wireState