TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
Loading...
Searching...
No Matches
menu.h File Reference

Hierarchical OLED menu system with navigation and page handling. More...

#include "io.h"
#include <avr/io.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  menu_item
 Menu item struct. More...
struct  menu_cfg
 Menu configuration and state. More...

Enumerations

enum  page_id {
  PAGE_WELCOME , PAGE_PLAY_GAME , PAGE_HIGH_SCORES , PAGE_SETTINGS ,
  PAGE_ADJUST_BRIGHTNESS , PAGE_CALIBRATE_JOYSTICK , PAGE_GAME_OVER
}
 Menu page identifiers. More...

Functions

int menu_init (struct menu_cfg *menu)
 Initializes menu and OLED display.
int page_dispatch (struct menu_cfg *menu)
 Dispatches to the current page display function.
int welcome_display (struct menu_cfg *menu)
 Displays the welcome page.
int play_game_display (struct menu_cfg *menu)
 Displays the play game page.
int high_scores_display (struct menu_cfg *menu)
 Displays the high scores page.
int settings_display (struct menu_cfg *menu)
 Displays the settings page.
int brightness_display (struct menu_cfg *menu)
int calibrate_joystick_display (struct menu_cfg *menu)
int game_over_display (struct menu_cfg *menu)
int draw_cursor (struct menu_cfg *menu)
 Draws the cursor (">") at the current cursor position in the menu.
int cursor_update (struct menu_cfg *menu, struct io_avr_buttons *btn)
 Updates the cursor position based on nav button from the IO board. Wraps around if going out of bounds.
int page_select (struct menu_cfg *menu, struct io_avr_buttons *btn)
 Selects the current menu item based on nav button from the IO board.
int set_page (struct menu_cfg *menu, enum page_id page)
 Sets the current page field in the menu struct to a specified page and calls the page_dispatch function.
int page_back (struct menu_cfg *menu, struct io_avr_buttons *btn)
int menu_handler (struct menu_cfg *menu, struct io_avr_buttons *btn)
 Handles menu logic (navigation, selection, page timers).

Detailed Description

Hierarchical OLED menu system with navigation and page handling.

Definition in file menu.h.