coffee.h 1.1 KB

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