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

 Gameplay header file

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

#ifndef GameplayHSM_H
#define GameplayHSM_H

#include "ES_Framework.h"

// make definitions for timers
#define MotorTimer               0
#define GameplayTimer            1
#define CompassQueryTimer        2
#define CompassDelayTimer        3
#define GameControlTimer         4
#define MotorAStoppedTimer       5
#define MotorBStoppedTimer       6
#define ColorServoTimer          7
#define I2C_TIMER                8
#define TapeTimer                9
#define FrontLeftDebounceTimer  10
#define FrontRightDebounceTimer 11
#define RearLeftDebounceTimer   12
#define RearRightDebounceTimer  13

// PWM identification
#define MotorA          0
#define MotorB          1
#define BothAandB       2
#define RecycleServo    3
#define TrashServo      4
#define SortServo       5
#define FlagServo       6
#define RecycleEmitter  7
#define RobotDetEmitter 8

// PWM groupings (for frequency setting)
#define DriveMotors 0
#define AllServos   1

// event parameters
#define FRONT  0
#define REAR   1
#define RIGHT  2
#define LEFT   3
#define CENTER 4

// motor command event parameters
#define FORWARD              0
#define BACKWARDS            1
#define LEFT_STOP_RIGHT_BACK 2
#define RIGHT_STOP_LEFT_BACK 3
#define CW                   4
#define CCW                  5
#define CW90                 6
#define CCW90                7
#define STOP                 8

// team assignments
#define NORTH 0
#define SOUTH 1

// frequencies
#define NorthLandfillFreq 1250
#define SouthLandfillFreq 1429
#define EastRecyclingFreq 2000
#define WestRecyclingFreq 1667

// target RPM frequencies
#define WestAcceptedFreq 1000
#define EastAcceptedFreq 5000


// State definitions for use with the query function
typedef enum { IdleGame, GameTasks } GameplayState_t;

// Public Function Prototypes
ES_Event_t RunGameplayMasterSM(ES_Event_t CurrentEvent);
void StartGameplayMasterSM(ES_Event_t CurrentEvent);
bool PostGameplayMasterSM(ES_Event_t ThisEvent);
bool InitGameplayMasterSM(uint8_t Priority);
GameplayState_t QueryGameplayHSM(void);

#endif /* GameplayHSM_H */