1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /*
- * 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 2 // Top button
- #define PIN_INT1 0 // Bottom button
- #define PIN_FLOW 3 // Flow sensor
- #define PIN_DISP 4
- #define FLOW_ML_PULSE (1000.0/2219) // Flow sensor: volume (ml) per pulse
- #define TIME_BUTTONLONGPRESS 3 //Time in s until a Signal for a long pressed button is sent
- /*
- * Explanation for the signal levels
- * SigInt_Psh Button is pushed
- * SigInt_Rls Button is released
- * SigInt_RlsLong Button is pressed for more than TIME_BUTTONLONGPRESS seconds
- * 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
- */
- /*
- * Functions of the buttons, the letter in brackets defines if the event is triggered
- * on push(P), release(R) or long pressing(RLong) of the button
- * TOP Button: Turn machine on(R), start brewing(P),
- *
- * BOTTOM button: Stop brewing immediately(P), Turn machine off(RLong),
- */
- enum HalSig {
- SigInt0Psh = 1,
- SigInt0Rls = 2,
- SigInt0RlsLong = 3,
- SigInt1Psh = 4,
- SigInt1Rls = 5,
- SigInt1RlsLong = 6,
- SigPressCls = 7,
- SigPressOpn = 8,
- SigProxOpn = 9,
- SigProxCvrd = 10,
- SigBrewOn = 11,
- SigBrewOff = 12,
- SigPowerUp = 13,
- SigPowerDown = 14
- };
- void halInit(void);
- void halDisplayOff();
- void halDisplayOn();
- 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);
- double halgetHeatingTime(void);
- void halIntProximity(void);
- float halGetFlow(void);
- void halResetFlow(void);
- bool halIsHeating(void);
- bool halProxSensorCovered(void);
- int halGetInt0(void);
- int halGetInt1(void);
- void halSendSignal(HalSig value);
- void halMachineOn(void);
- void halMachineOff(void);
- void halInt0TimerHandler(void);
- void halInt1TimerHandler(void);
- void halIdleTimerHandler(void);
- void halEnterIdle (void);
- void halLeaveIdle (void);
- void halPumpOn(void);
- void halPumpOff(void);
- double halGetPumpTime(void);
- void timespec_diff(timespec *start, timespec *stop, timespec *result);
- #endif /* HAL_H_ */
|