CODE
Signaling Module: [Header File] [Pseudocode] [C Code] Timing Module: [Header File] [Pseudocode] [C Code] Pinout: [Pinout Diagram] |
Game Play Module: [Header File] [Pseudocode] [C Code] Main Module: [Header File] [Pseudocode] [C Code] |
Game Play Header
/* G Play header for Railroad Handcar arcade game */ /**************************************************/ /* Defines */ /**************************************************/ /* Raw speed for handpump to overcome board noise */ #define NOISE 25 /* Send signal port UP or DN for puppet hand pump */ #define UP 0 #define DN 1 /* Send signal port UP or DN for puppet hand pump */ #define FW 1 #define BK 0 /* How fast is villain compared to hand car speed */ #define VILLAIN_SPEED 25 #define ACCUMULATOR_MAX 50 /* Position extremes for villain front-back moves */ /* The maximum sweep angle of the servo is 60 deg */ #define SERVO_MAX 44 #define SERVO_MIN 18 #define SERVO_HYS 6 /**************************************************/ /* Prototypes */ /**************************************************/ /* Get raw handcar velocity to sync w/puppet pump */ unsigned char HandleDiff(void); /* Calculate the handcar's velocity (range 0-100) */ unsigned char CalculateVelocity(void); /* Account for the servo's dead-band (hysteresis) */ void CalculateChase(unsigned int Speed); /* Move villain left or right relative to handcar */ void AdvanceVillain(char Dir); /* Move villain left or right relative to handcar */ char Caught(void); /* Check that hand car is currently over obstacle */ char Colliding(void);