coffee.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. typedef enum {
  25. MODE_STATE,
  26. MODE_MENU
  27. } coffee_mode_t;
  28. typedef enum {
  29. PAGE_SOFTOFF,
  30. PAGE_KILL,
  31. PAGE_STATS,
  32. PAGE_TEMP,
  33. PAGE_CLEAN,
  34. PAGE_DEMO,
  35. PAGE_EXIT
  36. } coffee_menuPage_t;
  37. extern const char* StateName[];
  38. extern const char* PageName[];
  39. #define AMOUNT_PREINFUSION 25 //Preinfusion amount in ml
  40. #define TIME_SOAK 5000 //Time between preinfusion and infusion in ms
  41. #define TIME_INFUSION 25000 //Infusion time in ms
  42. #define AMOUNT_DBLESPRESSO 59.0 //Size of a double espresso in ml
  43. #define DIRTY_ESPRESSO 35 //Number of espressos till the next cleaning
  44. void *coffeeThread(void *threadid);
  45. void coffeeHandler(int signum, siginfo_t *siginfo, void *context);
  46. bool SigValueEmpty(void);
  47. void changeState(coffee_status_t newState);
  48. void changeMode(coffee_mode_t mode);
  49. void changePage(coffee_menuPage_t newPage);
  50. void leaveMenu(void);
  51. coffee_status_t getState(void);
  52. int getSigValue(coffee_mode_t mode);
  53. void brewTimeHandler(void);
  54. void writeBackCache(void);
  55. void coffeeTerminate(event_t *event);
  56. void coffeeBrew(void);
  57. void coffeeClean(void);
  58. void stopBrewing(void);
  59. void coffeeIncreaseBrewCounter(void);
  60. void coffeeIncreaseHeatingTime(uint64_t heatingTime);
  61. #endif /* COFFEE_H_ */