/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1987, 1991 by John E. Lloyd and Vincent Hayward.	    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#ifndef _JOINTINTERFACE_H_
#define _JOINTINTERFACE_H_

/* WRITE BITS */
/* The hand control bits are switched between PUMA 260 and 760 */

#define ARMPWR	     0400	/* ARM power on/enable bit */
#define  HNDOH	     02000	/* open hand / release  (high/low)	*/
#define  HNDCH	     01000	/* close hand / release  (high/low)	*/

/* Host commands to the joints */

#define  POSET	       000	/* 16 bit unsigned position set point	*/
#define  DACSET	       010	/* 12 bit signed dac setpoint		*/
				/*   000000 minimum positive value	*/
				/*   001777 halfway positive value	*/
				/*   003777 maximum positive value	*/
				/*   777777 minimum negative value	*/
				/*   775777 halfway negative value	*/
				/*   774000 maximum negative value	*/
#define  TOLBND	       020	/* position tolerance			*/
#define  STOPM	       030	/* enter stop mode and set position	*/
#define  CALIB	       040	/* calibrate				*/
#define  GRAVITY       050	/* Not implemented on the 260 micros	*/
#define  INTBND        060	/* set integration band			*/
#define  SETPAR	       070	/* setup joint servo parameters		*/
#define  STOPP        0100	/* stop without changing position count */
#define  UNSD1        0110	/* undefined				*/
#define  UNSD2        0120	/* undefined				*/
#define  UNSD3        0130	/* undefined				*/
#define  READ         0140	/* read 16 bit unsigned position	*/
#define  JSTAT        0150	/* read joint status definitions	*/
#define  JRSERVO   0100000	/*		servoing enabled	*/
#define  JRINTBD   0040000	/*		integration enabled	*/
#define  JRTRQSV   0020000	/*		torgue servo enabled	*/
#define  JRHLFCT   0010000	/*		1/2 count enabled	*/
#define  JRPOSSV   0004000	/*		position servo enabled	*/
				/*	002000  undefined		*/
#define  JFNDIXS   0001000	/*		index found and halted	*/
#define  JLOOKZI   0000400	/*		looking for index	*/
#define  JLOSTSY   0000200	/*		lost synch with encoder */
#define  JFIXFND   0000100	/*		first index found	*/
				/*	000040  undefined		*/
				/*	000020  undefined		*/
				/*	000010  undefined		*/
				/*	000004  undefined		*/
				/*	000002  undefined		*/
				/*	000001  undefined		*/
#define  READP        0160	/* read joint pot			*/
#define  READM	      0170      /* read micro memory set in location 2	*/
#define  SEQUENT      0200	/* sequential (to address all joints)	*/

#define  STATUS      00000	/* index status register		*/
				/*   0200  lost synch with encoder	*/
				/*   0100  set after first index found	*/

#define  MODE        00400	/* joint control and status register	*/
#define  MESERVO      0200	/*	| enable servoing		*/
#define  MEINTBD      0100	/*	| enable integration band	*/
#define  MELSBSV       040	/*	| enable lsb servo		*/
#define  MEHLFCT       020	/*	| enable half count mode	*/
#define  MEPOSSV       010	/*	| enable position servo		*/
#define  MFNDIXS        02	/*	| set when found zero index	*/
#define  MLOOKZI        01	/*	| look for zero index		*/

#define  ADDR	    001000	/* memory address to read with readm	*/

#endif
