/* constants.h * * This file contains the definition of all the constants relevant to the execution of the program. * Descriptions may be found inline. */ #ifndef CONSTANTS_H #define CONSTANTS_H // Useful includes #include #include #include #include // A/D routines #include "me118.h" // Basic 118 libraries #include "timer.h" // Timer libraries #include "ses.h" // Event handling libraries #include "pwm3.h" // Pulse width modulation library #include "pls.h" // Pulse library // Global debug flag //#define ROBOT_DEBUG #ifdef ROBOT_DEBUG #define dprintf printf #else #define dprintf #endif // Global types typedef enum { kFalse = 0, kTrue } Boolean; // Type used to control direction of rotation typedef enum { kDirectionRight = 0, kDirectionLeft, kDirectionNone } Direction; // MicroCore related definitions // port assignments #define kMaxControlLevel 255 // Maximum A/D input level #define kSwitchInput 3 // Port E3 #define kRightLeftSpeedChan PWM_CHAN3 // Port A4 #define kLeftBaseMotorDirection 1 // Port G1 #define kRightBaseMotorDirection 3 // Port G3 #define kLeftSolenoid 4 // Port G4 #define kRightSolenoid 5 // Port G5 #define kBaseTurretDirection 6 // Port G6 #define kBaseTurretEnable 7 // Port G7 #define kColumnSpeedChan PWM_CHAN1 // Port A5 #define kPitchingSpeedChan PWM_CHAN2 // Port A6 #define kOneSecond 244 // Interrupts/4.1 ms #define kReverseTime (10*kOneSecond) #define kPitchingPowerUpTime (10*kOneSecond) #define kColumnPowerUpTime (kOneSecond) #define kBaseRotateTime (kOneSecond/2) #define kTurretCorrectionTime (kOneSecond/6) #define kTurretBootstrap (kOneSecond) #define kPWMPeriod 32 // Period to run PWM #define kGeneralTimer 0 // Timer used to run turret #define kDisableMotor 0 // PWM duty cycle to disable #define kColumnRunMotor 34 // Column duty cycle #define kColumnMaxSpeed 100 // Max column duty cycle #define kBaseReverseSpeed 100 // Base drive reverse duty #define kBaseRotateSpeed 65 // Rotate drive duty cycle #define kPitchingRunCenter 90 // Pitching speed (center) #define kPitchingAngled 88 // Pitching speed (angled) #endif // CONSTANTS_H