39 lines
938 B
C
39 lines
938 B
C
#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 3
|
|
#define GENERATOR_OFF_TIMEOUT 1
|
|
|
|
#define UNDERVOLTAGE 11200
|
|
#define OVERVOLTAGE 15000
|
|
#define OVERVOLTAGE_TIMEOUT 5
|
|
#define OVERVOLTAGEOFF_TIMEOUT 3
|
|
#define UNDERVOLTAGE_TIMEOUT 5
|
|
#define UNDERVOLTAGEOFF_TIMEOUT 3
|
|
|
|
#define CURRENT_OFFSET 511
|
|
#define CURRENT_PER_TICK 72
|
|
#define VOLTAGE_PER_TICK 15
|
|
|
|
#endif
|
|
|