TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
Loading...
Searching...
No Matches
menu.c File Reference
#include <avr/io.h>
#include "menu.h"
#include "utils.h"
#include "io.h"

Go to the source code of this file.

Macros

#define BIG_FONT   &OLED_FONT_8x8
#define MEDIUM_FONT   &OLED_FONT_5x7
#define SMALL_FONT   &OLED_FONT_4x6

Functions

int menu_init (struct menu_cfg *menu)
 Initializes the menu struct and OLED display.
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_dispatch (struct menu_cfg *menu)
 Dispatches to the appropriate page display function based on the current page field in the menu struct.
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 based on current page and button inputs from the IO board.

Macro Definition Documentation

◆ BIG_FONT

#define BIG_FONT   &OLED_FONT_8x8

Definition at line 7 of file menu.c.

◆ MEDIUM_FONT

#define MEDIUM_FONT   &OLED_FONT_5x7

◆ SMALL_FONT