CoffeePi
Coffee machine control for Raspberry Pi
coffee.h
Go to the documentation of this file.
1 /*
2  * coffee.h
3  *
4  * Created on: Sep 25, 2017
5  * Author: sebastian
6  */
7 
8 #ifndef COFFEE_H_
9 #define COFFEE_H_
10 #include <csignal>
11 
12 
13 //define status
14 #define STATE_OFF 0
15 #define STATE_HEATING 1
16 #define STATE_INITALHEATING 2
17 #define STATE_IDLE 3
18 #define STATE_BREW 4
19 #define STATE_BREWMANUAL 5
20 #define STATE_CLEANING 6
21 #define STATE_ERROR 7
22 
23 #define AMOUNT_PREINFUSION 3 //Preinfusion amount in ml
24 #define TIME_SOAK 3000//Time between preinfusion and infusion in ms
25 #define TIME_INFUSION 25000 //Infusion time in ms
26 #define AMOUNT_DBLESPRESSO 25.0 //Size of a double espresso in ml
27 
28 void *coffeeThread(void *threadid);
29 
30 void coffeeHandler (int signum, siginfo_t *siginfo, void *context);
31 int getSigValue(void);
32 bool SigValueEmpty(void);
33 void changeState(int newState);
34 int getState(void);
35 void brewTimeHandler (void);
36 void coffeeTerminate(void);
37 void coffeeBrew(void);
38 void coffeeIncreaseBrewCounter(void);
40 
41 #endif /* COFFEE_H_ */
bool SigValueEmpty(void)
Definition: coffee.cpp:238
void coffeeTerminate(void)
handles program termination
Definition: coffee.cpp:275
void coffeeIncreaseHeatingTime(uint64_t heatingTime)
Definition: coffee.cpp:350
int getState(void)
Returns the current state of the FSM.
Definition: coffee.cpp:260
int getSigValue(void)
returns the Signal value from the last received Signal and clears the variable
Definition: coffee.cpp:232
void coffeeIncreaseBrewCounter(void)
Definition: coffee.cpp:340
void coffeeHandler(int signum, siginfo_t *siginfo, void *context)
Handler for the Signal send to this thread It saves the type of signal received and tracks the time b...
Definition: coffee.cpp:222
void coffeeBrew(void)
Brewing process.
Definition: coffee.cpp:285
double heatingTime
Definition: coffee.cpp:33
void brewTimeHandler(void)
Counter for the brew time refresh every 200ms.
Definition: coffee.cpp:268
void changeState(int newState)
Changes the state of the machine to newState prints the change to the logger.
Definition: coffee.cpp:250
void * coffeeThread(void *threadid)
Thread for the finite state machine It represents the current state of the machine and handles signal...
Definition: coffee.cpp:41