add globaly available notaus-state
This commit is contained in:
12
notaus.c
12
notaus.c
@@ -1,10 +1,16 @@
|
||||
#include "kraftsensor.h"
|
||||
#include "avrIOhelper/io-helper.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "notaus.h"
|
||||
|
||||
uint8_t notaus_state = POWER_OFF;
|
||||
|
||||
void do_notaus(){
|
||||
if(!read_Input(IN_NOTAUS_ANLAGE, LEVEL) || read_Input(IN_NOTAUS_SCHRANK, LEVEL) || read_Input(IN_NOTAUS_DISPLAY, LEVEL)){
|
||||
/* at least on pressed */
|
||||
/* at least one pressed */
|
||||
notaus_state = POWER_OFF;
|
||||
|
||||
ioHelperSetBit(outStates, AMPEL_ROT, 1);
|
||||
ioHelperSetBit(outStates, AMPEL_GELB, 0);
|
||||
ioHelperSetBit(outStates, AMPEL_GRUEN, 0);
|
||||
@@ -34,6 +40,8 @@ void do_notaus(){
|
||||
}
|
||||
else if(!read_Input(IN_ANLAGE_EIN, LEVEL)){
|
||||
/* nothing pressed, but power not on */
|
||||
notaus_state = ARMED;
|
||||
|
||||
ioHelperSetBit(outStates, AMPEL_ROT, 0);
|
||||
ioHelperSetBit(outStates, AMPEL_GELB, 1);
|
||||
ioHelperSetBit(outStates, AMPEL_GRUEN, 0);
|
||||
@@ -48,6 +56,8 @@ void do_notaus(){
|
||||
}
|
||||
else{
|
||||
/* powered on */
|
||||
notaus_state = POWER_ON;
|
||||
|
||||
ioHelperSetBit(outStates, AMPEL_ROT, 0);
|
||||
ioHelperSetBit(outStates, AMPEL_GELB, 0);
|
||||
ioHelperSetBit(outStates, AMPEL_GRUEN, 1);
|
||||
|
||||
Reference in New Issue
Block a user