/****************************************************************************/
/* Copyright 1997 MBARI                                                     */
/****************************************************************************/
/* Summary  : Lap Box Microcontroller Board Application definitions         */
/* Filename : lapbox.h                                                     */
/* Author   : Douglas Au                                                    */
/* Project  : Tiburon ROV                                                   */
/* Version  : Version 1.0                                                   */
/* Created  : 02/11/97                                                      */
/* Modified : 02/11/97                                                      */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/* $Header: /usr/tiburon/.cvsroot/micro/h/lapbox.h,v 1.1.1.1 1997/05/02 17:15:38 pean Exp $
 * $Log: lapbox.h,v $
 * Revision 1.1.1.1  1997/05/02 17:15:38  pean
 * Initial release of the microcontroller software after Tiburon
 * Moolpool Dive to test IView, Lapboxes, modified Power can
 * GF/5V using bus capacitance mode.
 *
*/
/****************************************************************************/

/* bit assignments of switch register 1 */
#define kSwSpare1     0x0001
#define kSwPano       0x0002
#define kSwStbdLight  0x0004
#define kSwStbdCamJS  0x0008
#define kSwPortCamJS  0x0010
#define kSwPortLight  0x0020
/* switch register 2 */
#define kSwStbdCamZFI 0x0100
#define kSwPortCamZFI 0x0200
#define kSwAutoIris   0x0400
#define kSwJSPushBtn  0x0800
#define kSwBoxEna     0x1000
#define kSwSpare2     0x2000

/* bit assignments of light register 1 */
#define kGrnStbdLight   0x00000001
#define kRedStbdLight   0x00000002
#define kGrnStbdCamJS   0x00000004
#define kRedStbdCamJS   0x00000008
#define kGrnPortCamJS   0x00000010
#define kRedPortCamJS   0x00000020
#define kGrnPortLight   0x00000040
#define kRedPortLight   0x00000080
/* light register 2 */
#define kGrnBoxEna      0x00000100
#define kRedBoxEna      0x00000200
#define kGrnSpare2      0x00000400
#define kRedSpare2      0x00000800
#define kGrnSpare1      0x00001000
#define kRedSpare1      0x00002000
#define kGrnPano        0x00004000
#define kRedPano        0x00008000
/* light register 3 */
#define kGrnStbdCamZFI  0x00010000
#define kRedStbdCamZFI  0x00020000
#define kGrnPortCamZFI  0x00040000
#define kRedPortCamZFI  0x00080000
#define kGrnAutoIris    0x00100000
#define kRedAutoIris    0x00200000
#define kGrnFocusCap    0x00400000
/* all off or on */
#define kGrnAll         0x00555555
#define kRedAll         0x002aaaaa

/*
thresholds for analog input testing */
#define kThreshHi       512
#define kThreshLo       -512

                                        /* *** Micro AD Channels ***   */
#define X_JOYSTICK_CHAN             0   /* X Axis Joystick Channel     */
#define Y_JOYSTICK_CHAN             1   /* Y Axis Joystick Channel     */
#define ZOOM_CHAN                   2   /* Zoom  Channel               */
#define FOCUS_CHAN                  3   /* Focus Channel               */
#define IRIS_CHAN                   4   /* Iris Channel                */


#define ENABLED_BIT               0x00


#define XAXIS                       0
#define YAXIS                       1
#define ZOOM                        2
#define FOCUS                       3
#define IRIS                        4

#define MAX_XAXIS_VALUE           148
#define MAX_YAXIS_VALUE           120
#define MAX_ZAXIS_VALUE           510
#define MAX_FAXIS_VALUE           511
#define MAX_IAXIS_VALUE           240

#define NUMBER_OF_AXIS              5

#define GET_AXIS                  0x01  /* Get AXIS Values                  */
#define STBD_LIGHT_LAMP_CONTROL   0x02  /* Set Stbd Light Lamp              */
#define STBD_CAMERA_LAMP_CONTROL  0x03  /* Set Stbd Camera Lamp             */
#define PORT_LIGHT_LAMP_CONTROL   0x04  /* Set Port Light Lamp              */
#define PORT_CAMERA_LAMP_CONTROL  0x05  /* Set Port Camera Lamp             */
#define PANORAMIC_LAMP_CONTROL    0x06  /* Set Panoramic Lamp State         */
#define SPARE1_LAMP_CONTROL       0x07  /* Set Spare1 Lamp State            */
#define SPARE2_LAMP_CONTROL       0x08  /* Set Spare2 Lamp State            */
#define ENABLED_LAMP_CONTROL      0x09  /* Set Enabled Lamp State           */
#define STBD_CAM_SEL_LAMP_CONTROL 0x0A  /* Set Stbd Camera Select Lamp State*/
#define PORT_CAM_SEL_LAMP_CONTROL 0x0B  /* Set Port Camera Select Lamp State*/
#define AUTO_IRIS_LAMP_CONTROL    0x0C  /* Set Auto Iris Lamp State         */
#define FOCUS_CAP_LAMP_CONTROL    0x0D  /* Set Focus Capture Lamp State     */

                                    /* Belly Pack Applic Service Requests   */
#define ENABLE_ALARM_SRQ               APPLIC_SRQ_BASE | 0x01

#define SPARE1_SRQ                     APPLIC_SRQ_BASE | 0x02
#define PANO_SRQ                       APPLIC_SRQ_BASE | 0x03
#define STBD_LIGHT_SRQ                 APPLIC_SRQ_BASE | 0x04
#define STBD_CAMERA_SRQ                APPLIC_SRQ_BASE | 0x05
#define PORT_LIGHT_SRQ                 APPLIC_SRQ_BASE | 0x06
#define PORT_CAMERA_SRQ                APPLIC_SRQ_BASE | 0x07
#define STBD_CAMERA_SELECT_SRQ         APPLIC_SRQ_BASE | 0x08
#define PORT_CAMERA_SELECT_SRQ         APPLIC_SRQ_BASE | 0x09
#define AUTO_IRIS_SRQ                  APPLIC_SRQ_BASE | 0x0A
#define JOYSTICK_BUTTON_SRQ            APPLIC_SRQ_BASE | 0x0B
#define LAP_BOX_ENABLE_SRQ             APPLIC_SRQ_BASE | 0x0C
#define SPARE2_SRQ                     APPLIC_SRQ_BASE | 0x0D
#define LAP_BOX_DISABLED_SRQ           APPLIC_SRQ_BASE | 0x0E

typedef enum{
        lampOff,
        lampGreen,
        lampRed
        }LampMode;

#define BUTTON_DEBOUNCE       15000   /* HSI Port debounce 50ms */



