/****************************************************************************


  Header file for template Flat Sate Machine

  based on the Gen2 Events and Services Framework


 ****************************************************************************/


#ifndef CrewService_H

#define CrewService_H


// Event Definitions

#include "ES_Configure.h" /* gets us event definitions */

#include "ES_Types.h"     /* gets bool type for returns */

#include "ES_Events.h"


// typedefs for the states

// State definitions for use with the query function

typedef enum

{

  InitCrew,

  Idle,

  Left_Down,

  Right_Down,

  Both_Down

}CrewServiceState_t;


typedef enum

{

  Stop,

  Left,

  Right  

}CrewDirection_t;


typedef struct Crew_Movement_t

{

  CrewDirection_t Direction;  // Crew moving direction

  int16_t Speed;   // Crew moving speed

  int16_t Position;  // Crew current position

}Crew_Movement_t;


// Public Function Prototypes


bool InitCrewService(uint8_t Priority);

bool PostCrewService(ES_Event_t ThisEvent);

ES_Event_t RunCrewService(ES_Event_t ThisEvent);

void UpdateCrewSpeed(void);

void UpdateCrewPosition(void);

// TemplateState_t QueryCrewService(void);


#endif /* CrewService_H */