/* * hal.h * * Created on: Aug 3, 2016 * Author: sebastian */ #ifndef HAL_H_ #define HAL_H_ #define RELAIS_HEAT 29 #define RELAIS_PUMP 25 #define RELAIS_POWER 28 #define PIN_PRESSURE_CTRL 7 #define PIN_PROXIMITY_SENSOR 6 #define PIN_INT0 0 // bottom button #define PIN_INT1 2 // top button #define PIN_FLOW 3 // flow sensor #define FLOW_ML_PULSE (1000.0/990) // Flow sensor: volume (ml) per pulse /* * Explanation for the signal levels * SigInt_Psh Button is pushed * SigInt_Rls Button is released * SigPressCls Pressure control is closed, System is heating * SigPressOpn Pressure control is open, heating is off * SigProxOpn Proximity Sensor is uncovered * SigProxCvrd Proximity Sensor is covered */ enum HalSig { SigInt0Psh = 1, SigInt0Rls = 2, SigInt1Psh = 3, SigInt1Rls = 4, SigPressCls = 5, SigPressOpn = 6, SigProxOpn = 7, SigProxCvrd = 8, SigBrewOn = 9, SigBrewOff = 10 }; void halInit(void); void halRelaisOn(int relais); void halRelaisOff(int relais); void halRelaisSet(int relais, int state); int halGetRelaisState(int relais); void halInt0(void); void halInt1(void); void halIntFlow(void); void halIntPressure(void); void halIntProximity(void); float halGetFlow(void); void halResetFlow(void); bool halIsHeating(void); bool halProxSensorCovered(void); int halGetInt0(void); int halGetInt1(void); void halSendSignal(int value); #endif /* HAL_H_ */