/* 
 * File:   config.h
 * Author: hamilton
 *
 * Created on January 15, 2014, 4:29 PM
 */

#ifndef CONFIG_H
#define	CONFIG_H

#define M_PI 3.14159265359

#define DEBUG  //Define this to enable RS-232 outputs and Operating modes other than Battery Charging Mode.

#define LED_BLINK_PERIOD 200 //Blinking LED period in CentiSeconds
#define CAMERA_OFF_DELAY 200 //Camera Off Delay in CentiSeconds


#define CAMERA_TEMP_WARNING_THRESHOLD 440  //tenths of a degree C.  -- Blinking
#define CAMERA_TEMP_ALARM_THRESHOLD 470  //tenths of a degree C.
#define CAMERA_TEMP_BUZZER_THRESHOLD 470  //tenths of a degree C.

#define CAN_HUMIDITY_WARNING_THRESHOLD 20.0  //% Relative Humidity  -- Blinking
#define CAN_HUMIDITY_ALARM_THRESHOLD 30.0  //% Relative Humidity
#define CAN_HUMIDITY_BUZZER_THRESHOLD 30.0  //% Relative Humidity

/******** Digitial Inputs  *************/
#define LASER_PWR_SW _RE5
#define CAMERA_PWR_SW _RE6
#define SPARE_SW _RE7
#define SW_CHANGE_ACTIVELOW _RE8
#define JOYSTCK_REV_SW _RE1
#define JOYSTCK_SEN_SW _RG14
#define PORT_LIGHT_SW _RG12
#define PORT_CAM_SW _RG13
#define STBD_CAM_SW _RE2
#define STBD_LIGHT_SW _RE3
#define EXTENDER_SW _RE4
#define SS2 _RG9

/******** Digitial Outputs  *************/
#define  LASER_PWR_LED _LATB14
#define  CAM_PWR_LED _LATB13
#define  SPARE_LED _LATB12
#define  SW_ENABLE_ACTIVELOW _LATB0
#define  EXTENDER_LED _LATB1
#define  HUM_ALARM_LED _LATB3
#define  WATER_ALARM_LED _LATB4
#define  TEMP_ALARM_LED _LATB5
#define  PIEZO_ALARM _LATB12
#define  PORT_CAM_LED _LATC4
#define  PORT_LIGHT_LED _LATC3
#define  JOYSTCK_SEN_LED _LATC2
#define  JOYSTCK_REV_LED _LATC1
#define  STBD_CAM_LED _LATB8
#define  STBD_LIGHT_LED _LATB9
#define  EEPROM_WP _LATD10
#define  SS1 _LATB2

#define  AUXIO_PIN1 _LATD2
#define  AUXIO_PIN2 _LATD8
#define  AUXIO_PIN3 _LATD1
#define  AUXIO_PIN5 _LATD9



/******** Configure Analog IO here  *********/
//These defines relate the analog channel numbers to the analog signals, they can be rearranged here without trouble later.
// AN10 = CAMERA_TEMP
// AN11 = 
#define NUMAIO 2
#define AIOMASK_H 0xffff  //None of AN16-31 are selected
#define AIOMASK_L 0xf3ff  //Select AN10 and AN11 to be sampled and scanned, total must match NUMAIO
#define INNERFILTERSAMPLES 32 //Must be 1,2,4,8,16,32,64,128   This is the number of ADC samples that are filtered to create every PWM period

#define DEFAULT_DIMMER_CTR 2 //0 -> 255 is off to full brightness.

//#define ZOOM_ROCKER_MIN_CNTS -30042
//#define ZOOM_ROCKER_MAX_CNTS 32767
//#define ZOOM_ROCKER_ZERO_CNTS 2290
//#define ZOOM_ROCKER_DEADBAND_CNTS 300
//#define ZOOM_ROCKER_LOWRATE_WIDTH 18000
//#define ZOOM_ROCKER_LOWRATE_HEIGHT 4000 

#define ZOOM_ROCKER_MIN_CNTS -30042
#define ZOOM_ROCKER_MAX_CNTS 32767
#define ZOOM_ROCKER_ZERO_CNTS -960
#define ZOOM_ROCKER_DEADBAND_CNTS 300
#define ZOOM_ROCKER_LOWRATE_WIDTH 18000
#define ZOOM_ROCKER_LOWRATE_HEIGHT 4000 

#define FOCUS_SLIDER_MIN_CNTS -30030
#define FOCUS_SLIDER_MAX_CNTS 32767


#endif	/* CONFIG_H */

