From 31912e28d5311a0e8585dc36e2c01cdd0e3315ca Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 30 Nov 2015 16:01:54 -0500 Subject: libZEPHYR began --- include/API.h | 2 ++ include/main.h | 34 +-------------------- include/zephyr.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 33 deletions(-) create mode 100644 include/zephyr.h (limited to 'include') diff --git a/include/API.h b/include/API.h index 7de7889..32d8686 100644 --- a/include/API.h +++ b/include/API.h @@ -504,6 +504,7 @@ unsigned int imeInitializeAll(); * * \c 240.448 for the 269 IME * * \c 627.2 for the 393 IME in high torque mode (factory default) * * \c 392 for the 393 IME in high speed mode + * * \c 261.333 for the 393 IME in turbo speed mode * * If the IME address is invalid, or the IME has not been reset or initialized, the value * stored in *value is undefined. @@ -527,6 +528,7 @@ bool imeGet(unsigned char address, int *value); * * \c 30.056 for the 269 IME * * \c 39.2 for the 393 IME in high torque mode (factory default) * * \c 24.5 for the 393 IME in high speed mode + * * \c 16.3333125 for the 393 IME in turbo speed mode * * If the IME address is invalid, or the IME has not been reset or initialized, the value * stored in *value is undefined. diff --git a/include/main.h b/include/main.h index d1fcdb4..7022f11 100644 --- a/include/main.h +++ b/include/main.h @@ -2,44 +2,12 @@ #define MAIN_H_ #include - -#define LCD_PORT uart1 - -#define ANALOG_PORT(x) (x+13) +#include #ifdef __cplusplus extern "C" { #endif -/* - * Aliases for all the motors, stored in an enum for convenience. -*/ - -enum MOTOR_PORT_MAP { - UNUSED = 0, - CANNON1, - CANNON2, - CANNON3, - CANNON4, - INTAKE, - DRIVER, - DRIVEL, - LIFT1, - LIFT2, - ROTATER, -}; - -enum IME_PORT_MAP { - IDRIVER = 0, - IDRIVEL, - IROTATER, - ILIFT1, - ILIFT2, - ICANNONL, - ICANNONR -}; - - void autonomous(); void initializeIO(); void initialize(); diff --git a/include/zephyr.h b/include/zephyr.h new file mode 100644 index 0000000..844416a --- /dev/null +++ b/include/zephyr.h @@ -0,0 +1,90 @@ +#ifndef ZEPHYR_H_ +#define ZEPHYR_H_ + +#include + +#define APPLY_THRESH(n,t) if(n < t && n > -t){ n = 0;} + +/* + * Comment to disable LCD support. +*/ + +#define LCD_PORT uart1 + +#define LCD_RATE 500 + +#ifdef LCD_PORT + +void zLCDInit(void); +void zLCDStart(void); + +void zLCDWrite(unsigned char, // 1-based Line Number + const char *, // Text + ...); + +void zLCDSetUpdateFunc(void (*)(void *)); // Function Pointer +void zLCDClearUpdateFunc(void); + +#endif // LCD_PORT + +/* + * Comment to disable gyro support. +*/ + +#define GYRO_PORT 2 + +#ifdef GYRO_PORT + +void zGyroInit(void); + +#endif // GYRO_PORT + +/* + * Comment to disable IME support. +*/ + +#define IME_ENABLE + +#ifdef IME_ENABLE + +void zIMEInit(void); + +#endif // IME_ENABLE + +/* + * DRIVE_NORMAL will override tank drive options. +*/ + +#define DRIVE_JOY 1 +#define DRIVE_THRESHOLD 10 + +//#define DRIVE_NORMAL 3 + +#define DRIVE_TANK_LEFT 3 +#define DRIVE_TANK_RIGHT 2 + +#define zJoyDigital(j,g,b) joystickGetDigital(j,g,b) +#define zJoyAnalog(j,a) joystickGetAnalog(j,a) + +void zMotorSet(const char *, // Motor Name + char // Desired Speed + ); +char zMotorGet(const char *); // Motor Name + +#ifdef IME_ENABLE + +int zMotorIMEGet(const char *); // Motor Name +int zMotorIMEGetVelocity(const char *); // Motor Name + +#endif // IME_ENABLE + +void zDriveUpdate(void); + +char zGetDigitalMotorSpeed(unsigned char, // Joystick No. + unsigned char, // Button Group + unsigned char, // Positive Button + unsigned char, // Negative Button + char // Desired Speed + ); + +#endif // ZEPHYR_H_ -- cgit v1.2.3