/* Game Definitions file */
/* By: Benjie Nelson, Nora Levinson, David Sirkin */
/* Dr. Von Sirlevson's Automated Locomotive Computation Engine */

/**************************************************/
/* Defines                                        */
/**************************************************/

/* PWM pre-scale, scale & period for freq = 20KHz */

#define PRE_SCL        0x72     // Pre-scale B128 A4
#define PWM_SCA        0x01     // Scale SA by 1*2=2
#define PWM_SCB        0x01     // Scale SB by 1*1=2
#define PWM_PRA        150      // Pd SA for 100% DC
#define PWM_PRB        234      // Pd SB for 100% DC
#define BIT034HI       0x19     // Map port U0,U3,U4

/* Timers for use with Timer S12 library */

#define GAME           0
#define WAIT           1
#define SM_TMR         2
#define BEACON         3
#define HOLD		   4
#define FOLLOW         5

/* DC (speed) to use for finding or driving modes */

#define LO_SPD		   37
#define HI_SPD         42

/* Number of events to accept/reject beacon there */

#define ACCEPT_BEACON  5
#define REJECT_BEACON  1
#define ACCEPT_GOAL    8


/* DC values to be within indicating which beacon */

#define ABOUT_40       47
#define ABOUT_60	   53
#define ABOUT_80	   78
#define ABOUT_100	   100

/* Number of events to accept that tapeline there */

#define ACCEPT_TAPE    5

/* Values to be above indicating which color tape */

#define BLACK		   400
#define GREEN		   150
#define RED			   100

/* All sensory events that CheckEvents() looks at */

#define NO_EVENT       0
#define SEE_FLASH      1

#define SEE_DISPENSER  2
#define SEE_GOAL       3
#define LOST_BEACON	   4

#define TAPE_CHANGE    5

#define BUMP_FT 	   6
#define LOST_FT		   7

#define BUMP_FB 	   8
#define LOST_FB		   9

#define BUMP_BR 	   10
#define LOST_BR		   11

#define BUMP_BL		   12
#define LOST_BL		   13

#define AT_DISPENSER   14
#define AT_1ST_TAPE    15

/* Time to look to each side following the beacon */

#define FOLLOW_TIME    750

/* Turn time-out interval in AlignWithDispenser() */
/* ReAlignWithDispenser() and FollowBeacon() fcns */

#define SM_TMR_XPD     16

/* Args for CW, CCW turns in AlignWithDispenser() */
/* ReAlignWithDispenser() and FollowBeacon() fcns */

#define RUN            0
#define CLEAR          1
#define CLEARCW        1
#define CLEARCCW       2