* VibrateMotor * This file contains the service to activate/deactivate the button vibration motors. define: _500_MS 500 // amount of time for which each button should vibrate [ms] Module data: Priority: uint8_t priority of the VibrateMotor service * Initializes the VibrateMotor service. InitializeVibrateMotor(Priority) Param: priority Return: bool, 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 InitializeVibrateMotor * Runs the VibrateMotor service. RunVibrateMotor Param: ES_Event called CurrentEvent Return: ES_Event called ES_NO_EVENT; // assume no problems will occur 1) Decide if a specific motor should be turned on or off based on an event’s parameter if a motor should be turned on if the event parameter corresponds to motor 1 vibrate motor 1 start the vibration motor timer if the event parameter corresponds to motor 2 vibrate motor 2 start the vibration motor timer if the event parameter corresponds to motor 3 vibrate motor 3 start the vibration motor timer if the event parameter corresponds to motor 4 vibrate motor 4 start the vibration motor timer if the event parameter corresponds to motor 5 vibrate motor 5 start the vibration motor timer if the event parameter corresponds to motor 6 vibrate motor 6 start the vibration motor timer if the vibration motor timer has expired (i.e. event param is equal to ES_TIMEOUT) /* Ensure that all vibration motors are off */ turn off all of the vibration motors end if 2) return ReturnEvent end RunVibrateMotor * Posts events to the VibrateMotor service. PostVibrateMotor Param: ThisEvent: event to post to VibrateMotor service Return: bool, true if successfully posted; false otherwise 1) return ES_PostToService(MyPriority, ThisEvent) end PostVibrateMotor