coffee.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. STATE_WAIT_OFF,
  22. STATE_FULLTANK
  23. } coffee_status_t;
  24. extern const char* StateName[];
  25. #define AMOUNT_PREINFUSION 25 //Preinfusion amount in ml
  26. #define TIME_SOAK 5000 //Time between preinfusion and infusion in ms
  27. #define TIME_INFUSION 25000 //Infusion time in ms
  28. #define AMOUNT_DBLESPRESSO 59.0 //Size of a double espresso in ml
  29. void *coffeeThread(void *threadid);
  30. void coffeeHandler(int signum, siginfo_t *siginfo, void *context);
  31. int getSigValue(void);
  32. bool SigValueEmpty(void);
  33. void changeState(coffee_status_t newState);
  34. coffee_status_t getState(void);
  35. void brewTimeHandler(void);
  36. void writeBackCache(void);
  37. void coffeeTerminate(event_t *event);
  38. void coffeeBrew(void);
  39. void coffeeIncreaseBrewCounter(void);
  40. void coffeeIncreaseHeatingTime(uint64_t heatingTime);
  41. #endif /* COFFEE_H_ */