Skip to main content

Menu Driver - Overview

Purpose

The menu driver is a page-based UI framework for an embedded display (ILI9341).

It defines:

  • how UI is structured into pages
  • how state is stored per page
  • how navigation works
  • how rendering is organized

Architecture Position

[ Application Logic ]        
↓[ Menu Driver ]        
↓[ ILI9341 Driver ]        
↓[ SPI / Hardware ]

It does not:

  • own the main loop
  • schedule tasks
  • interpret input fully

It does:

  • define UI structure
  • manage page lifecycle
  • coordinate rendering

1.3 Design Model

Everything revolves around:

“A UI is a collection of pages with lifecycle and state.”

Each page has:

  • state
  • init/update/render/destruct
  • parent relationship
         Input / System Events
                  │
                  ▼
        ┌─────────────────────┐
        │   menu_manager_t    │
        │─────────────────────│
        │ active_page_id      │
        │ pages[]             │
        │ get_input()         │
        └─────────┬───────────┘
                  │ selects active page
                  ▼
      ┌──────────────────────────────────┐
      │          Active Page             │
      │──────────────────────────────────│
      │ state pointer                    │
      │ init()       ─┐                  │
      │ update()      ├─ custom page     │
      │ render()      ┤  behavior        │
      │ destruct()    ┘                  │
      └────────────────┬─────────────────┘
                       │ reads/writes
                       ▼
              ┌──────────────────┐
              │   Page State     │
              │──────────────────│
              │ selection        │
              │ cached values    │
              │ render flags     │
              │ page-local data  │
              └──────────────────┘