bikegenerator/display/software/powerboard/src/main.h

39 lines
998 B
C

#ifndef _main_h
#define _main_h
#define AD_I_LOAD 0
#define AD_I_GEN 1
#define AD_V 2
#define LOADSW PB0
#define GENSW PB1
#define DUMPSW PB2
#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 DUMP_ON PORT_SW |= _BV(DUMPSW)
#define DUMP_OFF PORT_SW &= ~_BV(DUMPSW)
#define IS_LOAD_ON (PIN_SW & _BV(LOADSW))
#define IS_DUMP_ON (PIN_SW & _BV(DUMPSW))
#define IS_GEN_ON (PIN_SW & _BV(GENSW))
#define UNDERVOLTAGE 11200
#define OVERVOLTAGE1 14100
#define OVERVOLTAGE2 15000
#define OVERVOLTAGE_TIMEOUT1 5
#define OVERVOLTAGE_TIMEOUT2 3
#define UNDERVOLTAGE_TIMEOUT 5
#define CURRENT_OFFSET 511
#define CURRENT_PER_TICK 72
#define VOLTAGE_PER_TICK 15.5
#endif