/* * coffee.h * * Created on: Sep 25, 2017 * Author: Sebastian */ #ifndef COFFEE_H_ #define COFFEE_H_ #include #include "events.h" //define status typedef enum { STATE_OFF, STATE_HEATING, STATE_INITALHEATING, STATE_IDLE, STATE_BREW, STATE_BREWMANUAL, STATE_CLEANING, STATE_ERROR, STATE_WAIT_OFF, STATE_FULLTANK } coffee_status_t; typedef enum { MODE_STATE, MODE_MENU } coffee_mode_t; typedef enum { PAGE_SOFTOFF, PAGE_KILL, PAGE_STATS, PAGE_TEMP, PAGE_CLEAN, PAGE_DEMO, PAGE_EXIT } coffee_menuPage_t; extern const char* StateName[]; extern const char* PageName[]; #define AMOUNT_PREINFUSION 24 //Preinfusion amount in ml #define TIME_SOAK 5000 //Time between preinfusion and infusion in ms #define TIME_INFUSION 25000 //Infusion time in ms #define AMOUNT_DBLESPRESSO 59.0 //Size of a double espresso in ml #define DIRTY_ESPRESSO 35 //Number of espressos till the next cleaning void *coffeeThread(void *threadid); void coffeeHandler(int signum, siginfo_t *siginfo, void *context); bool SigValueEmpty(void); void changeState(coffee_status_t newState); void changeMode(coffee_mode_t newMode); void changePage(coffee_menuPage_t newPage); void leaveMenu(void); coffee_status_t getState(void); int getSigValue(coffee_mode_t mode); void brewTimeHandler(void); void writeBackCache(void); void coffeeTerminate(event_t *event); void coffeeBrew(void); void coffeeClean(void); void stopBrewing(void); void coffeeIncreaseBrewCounter(void); void coffeeIncreaseHeatingTime(uint64_t heatingTime); #endif /* COFFEE_H_ */