#ifndef _main_h
  #define _main_h

  #define AD_V_GEN      0
  #define AD_I_GEN      1
  #define AD_V_BAT      2

  #define LOADSW		PB0
  #define GENSW		    PB1
  #define PORT_SW		PORTB
  #define DDR_SW		DDRB
  #define PIN_SW        PINB

  #define LOAD_ON		PORT_SW |= _BV(LOADSW)
  #define LOAD_OFF	    PORT_SW &= ~_BV(LOADSW)
  #define GEN_ON		PORT_SW |= _BV(GENSW)
  #define GEN_OFF	    PORT_SW &= ~_BV(GENSW)

  #define IS_LOAD_ON    (PIN_SW & _BV(LOADSW))
  #define IS_GEN_ON     (PIN_SW & _BV(GENSW))

  #define GENERATOR					13000
  #define GENERATOR_TIMEOUT			2
  #define GENERATOR_OFF_TIMEOUT		5
  
  #define UNDERVOLTAGE          	11200
  #define OVERVOLTAGE           	15000
  #define OVERVOLTAGE_TIMEOUT   	8
  #define OVERVOLTAGEOFF_TIMEOUT  	4
  #define UNDERVOLTAGE_TIMEOUT  	8
  #define UNDERVOLTAGEOFF_TIMEOUT  	4

  #define CURRENT_OFFSET        	511
  #define CURRENT_PER_TICK      	72
  #define VOLTAGE_PER_TICK      	15

#endif

