CoffeePi Coffee machine control for Raspberry Pi

- Main Page
- Data Structures
- Files

- File List
- Globals

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 PIN_PRESSURE_CTRL 7
15 #define PIN_PROXIMITY_SENSOR 6
16 #define PIN_INT0 2 // Top button
17 #define PIN_INT1 0 // Bottom button
18 #define PIN_FLOW 3 // Flow sensor
19 #define FLOW_ML_PULSE (1000.0/990) // Flow sensor: volume (ml) per pulse
20
21 #define TIME_BUTTONLONGPRESS 3 //Time in s until a Signal for a long pressed button is sent
22 /*
23 * Explanation for the signal levels
24 * SigInt_Psh Button is pushed
25 * SigInt_Rls Button is released
26 * SigInt_RlsLong Button is pressed for more than TIME_BUTTONLONGPRESS seconds
27 * SigPressCls Pressure control is closed, System is heating
28 * SigPressOpn Pressure control is open, heating is off
29 * SigProxOpn Proximity Sensor is uncovered
30 * SigProxCvrd Proximity Sensor is covered
31 */
32
33 /*
34 * Functions of the buttons, the letter in brackets defines if the event is triggered
35 * on push(P), release(R) or long pressing(RLong) of the button
36 * TOP Button: Turn machine on(R), start brewing(P),
37 *
38 * BOTTOM button: Stop brewing immediately(P), Turn machine off(RLong),
39 */
40 enum HalSig {
41 SigInt0Psh = 1,
42 SigInt0Rls = 2,
43 SigInt0RlsLong = 3,
44 SigInt1Psh = 4,
45 SigInt1Rls = 5,
46 SigInt1RlsLong = 6,
47 SigPressCls = 7,
48 SigPressOpn = 8,
49 SigProxOpn = 9,
50 SigProxCvrd = 10,
51 SigBrewOn = 11,
52 SigBrewOff = 12
53 };
54
55 void halInit(void);
56 void halRelaisOn(int relais);
57 void halRelaisOff(int relais);
58 void halRelaisSet(int relais, int state);
59 int halGetRelaisState(int relais);
60 void halInt0(void);
61 void halInt1(void);
62 void halIntFlow(void);
63 void halIntPressure(void);
64 void halIntProximity(void);
65 float halGetFlow(void);
66 void halResetFlow(void);
67 bool halIsHeating(void);
68 bool halProxSensorCovered(void);
69 int halGetInt0(void);
70 int halGetInt1(void);
71 void halSendSignal(int value);
72 void halMachineOn(void);
73 void halMachineOff(void);
74 void halInt0TimerHandler(void);
75 void halInt1TimerHandler(void);
76
77 #endif /* HAL_H_ */
halRelaisOn
void halRelaisOn(int relais)
Switches relais on.
Definition: hal.cpp:80
halResetFlow
void halResetFlow(void)
Resets the Flow counter.
Definition: hal.cpp:240
halRelaisSet
void halRelaisSet(int relais, int state)
Switches relais to state.
Definition: hal.cpp:97
SigInt0RlsLong
Definition: hal.h:43
SigInt1RlsLong
Definition: hal.h:46
SigInt1Psh
Definition: hal.h:44
SigInt1Rls
Definition: hal.h:45
halProxSensorCovered
bool halProxSensorCovered(void)
Returns status of the proximity switch.
Definition: hal.cpp:260
halMachineOff
void halMachineOff(void)
Turn machine off.
Definition: hal.cpp:314
halRelaisOff
void halRelaisOff(int relais)
Switches relais off.
Definition: hal.cpp:88
HalSig
HalSig
Definition: hal.h:40
halMachineOn
void halMachineOn(void)
Turn machine on.
Definition: hal.cpp:304
SigBrewOff
Definition: hal.h:52
SigInt0Psh
Definition: hal.h:41
halGetFlow
float halGetFlow(void)
Returns total flow trough sensor in ml.
Definition: hal.cpp:233
halInt0
void halInt0(void)
Interrupt routine for Int0 (Top button)
Definition: hal.cpp:133
halGetRelaisState
int halGetRelaisState(int relais)
Returns the state of the relais relais Returns HIGH when Relais is ON.
Definition: hal.cpp:119
halGetInt0
int halGetInt0(void)
Returns the value of the top button Int0 (low active)
Definition: hal.cpp:274
halIsHeating
bool halIsHeating(void)
Reads the status of the Pressure Control.
Definition: hal.cpp:248
SigPressCls
Definition: hal.h:47
halInt1
void halInt1(void)
Interrupt routine for Int1 (Bottom button)
Definition: hal.cpp:164
halIntFlow
void halIntFlow(void)
Interrupt routine for the flow sensor It counts the edgdes and stores the value in flowcnt...
Definition: hal.cpp:196
halGetInt1
int halGetInt1(void)
Returns the value of the bottom button Int1 (low active)
Definition: hal.cpp:282
SigInt0Rls
Definition: hal.h:42
SigPressOpn
Definition: hal.h:48
SigProxOpn
Definition: hal.h:49
halInt1TimerHandler
void halInt1TimerHandler(void)
Definition: hal.cpp:182
halInit
void halInit(void)
Initializes HAL.
Definition: hal.cpp:30
SigProxCvrd
Definition: hal.h:50
halIntProximity
void halIntProximity(void)
Method to handle toggle of the proximity sensor.
Definition: hal.cpp:221
state
int state
Definition: coffee.cpp:27
halSendSignal
void halSendSignal(int value)
send Signal to coffee thread
Definition: hal.cpp:290
halIntPressure
void halIntPressure(void)
Interrupt routine for the pressure control.
Definition: hal.cpp:209
SigBrewOn
Definition: hal.h:51
halInt0TimerHandler
void halInt0TimerHandler(void)
Definition: hal.cpp:151