parent
15f63351c0
commit
3bf7ceee79
|
@ -45,7 +45,7 @@ void measure(void) {
|
||||||
current_out *= CURRENT_PER_TICK;
|
current_out *= CURRENT_PER_TICK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t get_power(uint16_t voltage, int16_t currents) {
|
uint16_t get_power(uint16_t voltage, int16_t currents) {
|
||||||
return (voltage/100 * (currents/100)) / 100 ;
|
return (voltage/100 * (currents/100)) / 100 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#define DUMPSW PB2
|
#define DUMPSW PB2
|
||||||
#define PORT_SW PORTB
|
#define PORT_SW PORTB
|
||||||
#define DDR_SW DDRB
|
#define DDR_SW DDRB
|
||||||
|
#define PIN_SW PINB
|
||||||
|
|
||||||
#define LOAD_ON PORT_SW |= _BV(LOADSW)
|
#define LOAD_ON PORT_SW |= _BV(LOADSW)
|
||||||
#define LOAD_OFF PORT_SW &= ~_BV(LOADSW)
|
#define LOAD_OFF PORT_SW &= ~_BV(LOADSW)
|
||||||
|
@ -18,7 +19,9 @@
|
||||||
#define DUMP_ON PORT_SW |= _BV(DUMPSW)
|
#define DUMP_ON PORT_SW |= _BV(DUMPSW)
|
||||||
#define DUMP_OFF PORT_SW &= ~_BV(DUMPSW)
|
#define DUMP_OFF PORT_SW &= ~_BV(DUMPSW)
|
||||||
|
|
||||||
#define IS_LOAD_ON PIND &= _BV(LOADSW);
|
#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 UNDERVOLTAGE 11200
|
||||||
#define OVERVOLTAGE1 14100
|
#define OVERVOLTAGE1 14100
|
||||||
|
|
Loading…
Reference in New Issue