/** * @file menu.h * @brief Menu system for OLED display */ #pragma once #include #ifdef __cplusplus extern "C" { #endif /* Menu item callback */ typedef void (*menu_callback_t)(void); /* Menu item structure */ typedef struct { const char *name; /* Display name (max 16 chars visible) */ menu_callback_t callback; /* Callback when selected */ struct menu_t *submenu; /* Sub-menu (NULL if leaf) */ } menu_item_t; /* Menu structure */ typedef struct menu_t { const char *title; /* Menu title */ const menu_item_t *items; /* Array of menu items */ uint8_t item_count; /* Number of items */ uint8_t current; /* Current selection index */ } menu_t; /* Initialize menu system */ void menu_init(void); /* Navigate up */ void menu_up(void); /* Navigate down */ void menu_down(void); /* Select current item */ void menu_select(void); /* Go back to parent menu */ void menu_back(void); /* Get current menu for display */ const menu_t* menu_get_current(void); /* Draw current menu on OLED */ void menu_draw(void); /* Get current menu item name */ const char* menu_get_current_item_name(void); #ifdef __cplusplus } #endif