coffee.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * coffee.h
  3. *
  4. * Created on: Sep 25, 2017
  5. * Author: Sebastian
  6. */
  7. #ifndef COFFEE_H_
  8. #define COFFEE_H_
  9. #include <csignal>
  10. #include "events.h"
  11. //define status
  12. typedef enum {
  13. STATE_OFF,
  14. STATE_HEATING,
  15. STATE_INITALHEATING,
  16. STATE_IDLE,
  17. STATE_BREW,
  18. STATE_BREWMANUAL,
  19. STATE_CLEANING,
  20. STATE_ERROR
  21. } coffee_status_t;
  22. extern const char* StateName[];
  23. #define AMOUNT_PREINFUSION 25 //Preinfusion amount in ml
  24. #define TIME_SOAK 5000 //Time between preinfusion and infusion in ms
  25. #define TIME_INFUSION 25000 //Infusion time in ms
  26. #define AMOUNT_DBLESPRESSO 59.0 //Size of a double espresso in ml
  27. void *coffeeThread(void *threadid);
  28. void coffeeHandler(int signum, siginfo_t *siginfo, void *context);
  29. int getSigValue(void);
  30. bool SigValueEmpty(void);
  31. void changeState(coffee_status_t newState);
  32. coffee_status_t getState(void);
  33. void brewTimeHandler(void);
  34. void writeBackCache(void);
  35. void coffeeTerminate(event_t *event);
  36. void coffeeBrew(void);
  37. void coffeeIncreaseBrewCounter(void);
  38. void coffeeIncreaseHeatingTime(uint64_t heatingTime);
  39. #endif /* COFFEE_H_ */