CoffeePi
Coffee machine control for Raspberry Pi
hal.h
Go to the documentation of this file.
1 /*
2  * hal.h
3  *
4  * Created on: Aug 3, 2016
5  * Author: sebastian
6  */
7 
8 #ifndef HAL_H_
9 #define HAL_H_
10 
11 #define RELAIS_HEAT 29
12 #define RELAIS_PUMP 25
13 #define RELAIS_POWER 28
14 #define PRESSURE_CTRL 7
15 #define PROXIMITY_SENSOR 6
16 
17 #define INT0 0 // bottom button
18 #define INT1 2 // top button
19 #define FLOW 3 // flow sensor
20 #define PROX_COVERED 1 //proximity sensor
21 #define FLOW_ML_PULSE (1000.0/990) // Flow sensor: volume (ml) per pulse
22 /*
23  * Explanation for the signal levels
24  * SigInt_Psh Button is pushed
25  * SigInt_Rls Button is released
26  * SigPressCls Pressure control is closed, System is heating
27  * SigPressOpn Pressure control is open, heating is off
28  * SigProxOpn Proximity Sensor is uncovered
29  * SigProxCvrd Proximity Sensor is covered
30  */
31 enum HalSig {
40  SigBrewOn = 9,
42 };
43 
44 void halInit(void);
45 void halRelaisOn(int relais);
46 void halRelaisOff(int relais);
47 void halRelaisSet(int relais, int state);
48 int halGetRelaisState(int relais);
49 void halInt0(void);
50 void halInt1(void);
51 void halIntFlow(void);
52 void halIntPressure(void);
53 void halIntProximity(void);
54 float halGetFlow(void);
55 void halResetFlow(void);
56 bool halIsHeating(void);
57 bool halProxSensorCovered(void);
58 int halGetInt0(void);
59 int halGetInt1(void);
60 void halSendSignal(int value);
61 
62 #endif /* HAL_H_ */
void halRelaisOn(int relais)
Switches relais on.
Definition: hal.cpp:66
void halResetFlow(void)
Resets the Flow counter.
Definition: hal.cpp:174
void halRelaisSet(int relais, int state)
Switches relais to state.
Definition: hal.cpp:83
Definition: hal.h:34
Definition: hal.h:35
bool halProxSensorCovered(void)
Returns status of the proximity switch.
Definition: hal.cpp:194
void halRelaisOff(int relais)
Switches relais off.
Definition: hal.cpp:74
HalSig
Definition: hal.h:31
Definition: hal.h:41
Definition: hal.h:32
float halGetFlow(void)
Returns total flow trough sensor in ml.
Definition: hal.cpp:167
void halInt0(void)
Definition: hal.cpp:111
int halGetRelaisState(int relais)
Returns the state of the relais relais Returns HIGH when Relais is ON.
Definition: hal.cpp:100
int halGetInt0(void)
Returns the value of the top button Int0 (low active)
Definition: hal.cpp:207
bool halIsHeating(void)
Reads the status of the Pressure Control.
Definition: hal.cpp:182
Definition: hal.h:36
void halInt1(void)
Definition: hal.cpp:120
void halIntFlow(void)
Definition: hal.cpp:129
int halGetInt1(void)
Returns the value of the bottom button Int1 (low active)
Definition: hal.cpp:215
Definition: hal.h:33
Definition: hal.h:37
Definition: hal.h:38
void halInit(void)
Initializes HAL.
Definition: hal.cpp:22
Definition: hal.h:39
void halIntProximity(void)
Method to handle toggle of the proximity sensor.
Definition: hal.cpp:155
void halSendSignal(int value)
send Signal to coffee thread
Definition: hal.cpp:223
void halIntPressure(void)
Method to handle toggle of the pressure control.
Definition: hal.cpp:143
Definition: hal.h:40