/****************************************************************************
 Module
 TOMmain.c

 Description
 Main file for ME218b project, team TOM.
 ****************************************************************************/
/*----------------------------- Include Files -----------------------------*/
#include "GlobalHeader.h"
#include "SMMaster.h"
#include "ChkEvents.h"
#include "TOMDebug.h"

/*------------------------------ Module Code ------------------------------*/
void main (void)
{
    Event_t StartupEvent = EV_ENTRY;
    printf("Starting Machine\n\r");

	//Initializations
    BumpTapeInit();
    StartMasterSM(StartupEvent);
    TMRS12_Init(TMRS12_RATE_1MS);
    EnableInterrupts;

    // check for and handle events
    while (1)
    {
        Event_t Event = CheckEvents(); //run event checker
        (void)RunMasterSM(Event);	   //run master state machine on event
        DebugPrint(Event);			   //debugging output
    }
}