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

42 lines
1.1 KiB
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 15000
#define OVERVOLTAGE2 16500
#define OVERVOLTAGE_TIMEOUT1 8
#define OVERVOLTAGEOFF_TIMEOUT1 1
#define OVERVOLTAGE_TIMEOUT2 6
#define OVERVOLTAGEOFF_TIMEOUT2 3
#define UNDERVOLTAGE_TIMEOUT 5
#define UNDERVOLTAGEOFF_TIMEOUT 2
#define CURRENT_OFFSET 511
#define CURRENT_PER_TICK 72
#define VOLTAGE_PER_TICK 15.5
#endif