Professional Documents
Culture Documents
ResetSM
States:
*/
#include "BITDEFS.H"
#include "ResetSM.h"
#include "SR_HillAndMotor.h"
#include "SoundSM.h"
#include "GameSM.h"
#include "VisualBlastSM.h"
#include "ControlSM.h"
// readability defines
//*********************************MODULE
DEFINES***********************************************
// an image of the last 8 bits written to the shift register
static uint8_t MyPriority;
//**********************Module
Functions***********************************************
/****************************************************************************
Function
InitResetSM
Parameters
uint8_t : the priorty of this service
Returns
true if an INIT event has been posted. Else False which is equivalent to an
error in posting the event
Description
A function to initialize the shift register
The data and sclk lines start from low and the RCLK starts from high
Notes
Author
****************************************************************************/
/****************************************************************************
Function
PostResetSM
Parameters
ES_Event_t ThisEvent ,the event to post to the queue
Returns
bool false if the Enqueue operation failed, true otherwise
Description
Posts an event to this state machine's queue
Notes
Author
****************************************************************************/
bool PostResetSM(ES_Event_t ThisEvent)
{
return ES_PostToService(MyPriority, ThisEvent);
}
/****************************************************************************
Function
RunResetSM
Parameters
ES_Event_t : the event from its service queue to process in this State
Machine.
The EventParam will carry the index of the sound to be played.
Returns
ES_Event_t, ES_NO_EVENT if no error ES_ERROR otherwise
Description
Notes
Author
****************************************************************************/
ES_Event_t RunResetSM(ES_Event_t ThisEvent)
{
ES_Event_t ReturnEvent;
ReturnEvent.EventType = ES_NO_EVENT; // assume no errors
puts("\r \n Event received in ResetSM");
//switching off the timers off here for checking inactive timer
//puts("\r \n Switching off the timers");
//ES_Timer_StopTimer(0); //inactive timer
//ES_Timer_StopTimer(1); //pipe timer