coffee.h File Reference
`#include <csignal>`

Go to the source code of this file.

## Macros

#define | STATE_OFF 0
#define | STATE_HEATING 1
#define | STATE_INITALHEATING 2
#define | STATE_IDLE 3
#define | STATE_BREW 4
#define | STATE_BREWMANUAL 5
#define | STATE_CLEANING 6
#define | STATE_ERROR 7
#define | AMOUNT_PREINFUSION 3
#define | TIME_SOAK 3000
#define | TIME_INFUSION 25000
#define | AMOUNT_DBLESPRESSO 25.0

## Functions

void * | coffeeThread (void *threadid)
| Thread for the finite state machine It represents the current state of the machine and handles signals coming from the pressure control, buttons, the brew switch and the proximity sensor. More...
void | coffeeHandler (int signum, siginfo_t *siginfo, void *context)
| Handler for the Signal send to this thread It saves the type of signal received and tracks the time between a push and release event of up to 4 signals The time is stored in the HalEvent variable when a release event is received. More...
int | getSigValue (void)
| returns the Signal value from the last received Signal and clears the variable More...
bool | SigValueEmpty (void)
void | changeState (int newState)
| Changes the state of the machine to newState prints the change to the logger. More...
int | getState (void)
| Returns the current state of the FSM. More...
void | brewTimeHandler (void)
| Counter for the brew time refresh every 200ms. More...
void | coffeeTerminate (void)
| handles program termination More...
void | coffeeBrew (void)
| Brewing process. More...
void | coffeeIncreaseBrewCounter (void)
void | coffeeIncreaseHeatingTime (uint64_t heatingTime)

## Macro Definition Documentation

#define AMOUNT_DBLESPRESSO 25.0

#define AMOUNT_PREINFUSION 3

#define STATE_BREW 4

#define STATE_BREWMANUAL 5

#define STATE_CLEANING 6

#define STATE_ERROR 7

#define STATE_HEATING 1

#define STATE_IDLE 3

#define STATE_INITALHEATING 2

#define STATE_OFF 0

#define TIME_INFUSION 25000

#define TIME_SOAK 3000

## Function Documentation

void brewTimeHandler | ( | void |  | ) |

Counter for the brew time refresh every 200ms.

void changeState | ( | int | newState | ) |

Changes the state of the machine to newState prints the change to the logger.

Parameters

  newState |

void coffeeBrew | ( | void |  | ) |

Brewing process.

void coffeeHandler | ( | int | signum,
|  | siginfo_t * | siginfo,
|  | void * | context
| ) |  |

Handler for the Signal send to this thread It saves the type of signal received and tracks the time between a push and release event of up to 4 signals The time is stored in the HalEvent variable when a release event is received.

Parameters

  signum |
  siginfo |
  context |

void coffeeIncreaseBrewCounter | ( | void |  | ) |

void coffeeIncreaseHeatingTime | ( | uint64_t | heatingTime | ) |

void coffeeTerminate | ( | void |  | ) |

handles program termination

void* coffeeThread | ( | void * | threadid | ) |

Thread for the finite state machine It represents the current state of the machine and handles signals coming from the pressure control, buttons, the brew switch and the proximity sensor.

Parameters

  threadid | the ID of the thread

int getSigValue | ( | void |  | ) |

returns the Signal value from the last received Signal and clears the variable

Returns
  value sent with the last signal

int getState | ( | void |  | ) |

Returns the current state of the FSM.

bool SigValueEmpty | ( | void |  | ) |