/********************************  servobits.h  *******************************
 * $Source: /home/cvs/ESP/gen2/software/msp430/dwarves/servobits.h,v $
 *  Copyright (C) 2003 MBARI
 *
 *  MBARI Proprietary Information. All rights reserved.
 * $Id: servobits.h,v 1.8 2004/09/11 00:11:47 brent Exp $
 *
 * ESP "dwarf" node servo control and status bit masks
 *
 *  These bit masks are common to the interrupt handlers and the background
 *  message processing.  See espmsg.h
 *
 *****************************************************************************/

#ifndef servobits_h
#define servobits_h

enum servoOption {  //optionMask Bits:

  servoOptionEnable       = 0x1,  //Enable encoder power and servo loop
  servoOptionEncPolarity  = 0x2,  //increase count clockwise(0) or counterclkwse
  servoOptionThreshold    = 0x4,  //Alter goal with threshold reached
  servoOptionThresPolarity= 0x8,  //Threshold flag polarity (set for rising)
  servoOptionHomePwr      = 0x10, //home sensor power ON
  servoOptionHomePolarity = 0x20, //reset position on rising(0) or falling edge
  servoOptionHomeDir      = 0x40, //reserved
  servoOptionJog          = 0x80  //jog until position reset by home flag
};

enum servoStatusBits {  //servoStatus  bits:
  servoOn           = 0x1,  //servo is ON in servoStatus
  servoLostHome     = 0x2,  //lost track of axis home position (encoder invalid)
  servoHomeFlag     = 0x4,  //home flag active
  servoPastThreshold= 0x8,  //exceeded threshold (goal was altered)
  servoRLS          = 0x10, //at or past reverse limit
  servoFLS          = 0x20  //at or past forward limit
};

enum ServoReason { //causes of servo command aborts
  noServoError, ServoAborted, ServoOvercurrent, ServoOverpressure,
  ServoPositionErr
}

enum ShaftReason {
  noShaftError, ShaftAborted, ShaftOvercurrent
};

#endif
