// @(#) $Header: /usr/local/scalawags_cvs/Scalawags/Frc2006/user_routines.h,v 1.22 2006/03/05 20:51:00 abrown Exp $
/*****************************************************************************
* FILE NAME: user_routines.h
*
* DESCRIPTION: 
*  This is the include file which corresponds to user_routines.c and
*  user_routines_fast.c
*  It contains some aliases and function prototypes used in those files.
*
* USAGE:
*  If you add your own routines to those files, this is a good place to add
*  your custom macros (aliases), type definitions, and function prototypes.
*****************************************************************************/

#ifndef __user_program_h_
#define __user_program_h_

#include "varsizes.h"
/*****************************************************************************
                            MACRO DECLARATIONS
*****************************************************************************/
/* Add your macros (aliases and constants) here.                            */
/* Do not edit the ones in ifi_aliases.h                                    */
/* Macros are substituted in at compile time and make your code more readable */
/* as well as making it easy to change a constant value in one place, rather  */
/* than at every place it is used in your code.                             */

/* Used in limit switch routines in user_routines.c */
#define OPEN	1	/* Limit switch is open (input is floating high). */
#define CLOSED	0	/* Limit switch is closed (input connected to ground). */
#define LED0	0
#define LED1	1
#define LED2	2
#define LED3	3
#define LED4	4
#define LED5	5
#define LED6	6
#define LED7	7
#define INCH	100	// Fractional inch units.
#define FOOT 12*INCH

/*****************************************************************************
		TYPEDEF DECLARATIONS
*****************************************************************************/
#ifdef MAIN
  int32 distance_left=0, distance_right=0;
  int16 rightspeed = 0, leftspeed = 0;
  void *quad_left=0, *quad_right=0;
  void *navigate=0, *go2coord=0;
#else
  extern int32 distance_left, distance_right;
  extern int16 rightspeed, leftspeed;
  extern void *quad_left, *quad_right;
  extern void *navigate, *go2coord;
#endif

/*****************************************************************************
		FUNCTION PROTOTYPES
*****************************************************************************/

/* These routines reside in user_routines.c */
void User_Initialization(void);
void User_Slow_Pre(void);
void User_Slow_Manual(void);
void User_Slow_Auto(void);
void User_Slow_Post(void);
void User_Fast_Pre(void);
void User_Fast_Manual(void);
void User_Fast_Auto(void);
void User_Fast_Post(void);
void JoystickRegular(int16 joyx, int16 joyy, int16 *left, int16 *right);
void JoystickTank(int16 joyleft, int16 joyright, int16 *left, int16 *right);

/* These routines reside in user_routines_fast.c */
void InterruptHandlerLow (void);  /* DO NOT CHANGE! */
#if defined(ABSIMULATION_NOCOPROCESSOR) || defined(ABSIMULATION_COPROCESSOR) || defined(ABSIMULATION_COPRSIM)
  void InterruptVectorLow (void);
#endif
void autonomous_init(void);
// void Copy_Data_To_Transmit_Buffer(rx_data_record*);
// int  Serial_Read_One_Char(void);
// int  Serial_Write_One_Char(unsigned char ch);
#endif
/****************************************************************************/
/*
 * $Log: user_routines.h,v $
 * Revision 1.22  2006/03/05 20:51:00  abrown
 * Use varsizes.h.  Reduce INCH resolution to see if we get fewer
 * overflows.  Add FOOT defn and use it in our new autonomous tasks
 * that use go2coord and navigate.  Use varsizes.h.
 *
 * Revision 1.21  2006/02/12 16:52:43  abrown
 * Define inches and use that in quadrature_distance() comparisons.
 *
 * Revision 1.20  2006/02/04 19:26:45  abrown
 * Rewrite joystick code.
 *
 * Revision 1.19  2006/02/01 00:42:22  abrown
 * Replace the IFI routines in user_routines with sensible ones.
 * Remove coprocessor code.
 *
 * Revision 1.18  2006/01/30 00:44:09  abrown
 * Use quadrature.
 *
 * Revision 1.17  2005/12/24 01:36:50  abrown
 * Split the old target ABSIMULATION_COPROCESSOR into two.  Now
 * ABSIMULATION_COPROCESSOR includes a physical coprocessor.  The new
 * target, ABSIMULATION_COPRSIM, includes a simulated coprocessor.
 *
 * Revision 1.16  2005/08/13 02:56:34  jeff
 * Changed format of led flashing functions
 *
 * Revision 1.15  2005/04/30 17:54:45  abrown
 * Convert from obsolete defines to the new ones.
 *
 * Revision 1.14  2005/02/21 20:54:44  abrown
 * autonomous_init();
 *
 * Revision 1.13  2005/02/20 02:34:49  abrown
 * Remove scruff.
 *
 * Revision 1.12  2005/02/19 05:09:59  abrown
 * Add constants for arm motor control.  Remove some scruff.
 *
 * Revision 1.11  2005/02/15 16:59:42  abrown
 * Move ControlFromCamera into the new file more_camera.h.
 *
 * Revision 1.10  2005/02/14 01:00:11  abrown
 * Fix manual mode using JoystickRegular.
 *
 * Revision 1.9  2005/02/12 01:20:23  jeff
 * Fixed some minor errors such as capitalization
 *
 * Revision 1.8  2005/02/12 00:20:33  abrown
 * Prototype Copy_Data_To_Transmit_Buffer().
 *
 * Revision 1.7  2005/02/09 16:36:03  abrown
 * Remove reference to rxdata to eliminate a spurrious warning from gcc.
 * Make define of TRUE conditional to eliminate another warning.
 *
 * Revision 1.6  2005/02/09 05:18:29  go
 * msgxfer modifications for Frc message compatibility.
 * Serial Read interrupt function for TTL port
 * Ring buffer handling for input port
 *
 * Revision 1.5  2005/02/08 04:11:10  jeff
 * Not really working(something to do with int2byte, perhaps signed vs unsigned char), but changed references to pwms 13-16 to 09-12.
 *
 * Revision 1.4  2005/02/06 23:15:44  abrown
 * Get distance_left/distance_right working globally.  Also formating tweaks.
 *
 * Revision 1.3  2005/01/09 05:15:00  abrown
 * Update to 2005 default code base. -- Allen Brown
 *
 * Revision 1.2  2004/12/29 05:41:28  abrown
 * Conditionally declare InterruptVectorLow().
 *
 */
/****************************************************************************/


syntax highlighted by Code2HTML, v. 0.9.1