/* File: state_machine.h */ /** * @file state_machine.h * @brief State machine interface for the beverage dispenser core program. * * This module drives a keypad‐and‐LCD UI to select beverage types (A–D), * choose quantities, confirm orders, detect door events, and edit stock levels. * * @authors * Frederik Beimgraben * Minh Dan Cam * Luis Meyer * @date 2025-07-03 */ #ifndef STATE_MACHINE_H #define STATE_MACHINE_H #include #include /** * @enum State_t * @brief All possible states of the UI state machine. */ typedef enum { STATE_IDLE, /**< Waiting for user input */ STATE_SEL_COUNT, /**< Selecting order quantity */ STATE_CONFIRMED, /**< Order confirmed */ STATE_OPEN, /**< Door is open */ STATE_UNAUTHORIZED, /**< Unauthorized door opening */ STATE_NONE_SELECTED, /**< No beverage selected at confirm */ STATE_RESET, /**< Transient “reset” display */ STATE_EDIT_STOCK_SELECT, /**< Select which beverage’s stock to edit */ STATE_EDIT_STOCK_SET, /**< Enter new stock value */ STATE_EDIT_STOCK_CONFIRMED /**< Stock update confirmed */ } State_t; /** * @enum SelectedBev_t * @brief Identifiers for the four beverage types. */ typedef enum { BEV_A, /**< Beverage A */ BEV_B, /**< Beverage B */ BEV_C, /**< Beverage C */ BEV_D /**< Beverage D */ } SelectedBev_t; /** * @brief Initialize the state machine, keypad, door sensor, and LCD. */ void sm_init(void); /** * @brief Enter the state‐machine’s main loop (low‐power + interrupts). */ void sm_loop(void); #endif // STATE_MACHINE_H