GPS Device
Loading...
Searching...
No Matches
menu.c File Reference

Menu implementation file. More...

#include "menu.h"
#include "common.h"
#include "init.h"
#include "ssd1309.h"
#include "err.h"
#include "configuration.h"
#include "log.h"
#include "cmd.h"
Include dependency graph for menu.c:

Go to the source code of this file.

Classes

struct  menu_handle_s
 Internal structure representing a single menu instance. More...
struct  internal_state_s
 Internal state of the SysTick driver. More...

Functions

static ERR_te menu_selectable_run (MENU_HANDLE_ts *menu_handle)
 Renders a MENU_TYPE_SELECTABLE menu to the display.
static ERR_te menu_dataview_run (MENU_HANDLE_ts *menu_handle)
 Renders a MENU_TYPE_DATA_VIEW menu to the display.
static ERR_te menu_cmd_info_handler (uint32_t argc, char **argv)
 CLI handler for the "info" command. Logs the names of all active menu handles.
static ERR_te menu_cmd_scroll_handler (uint32_t argc, char **argv)
 CLI handler for the "scroll" command. Scrolls a named menu and re-renders it.
ERR_te menu_init_subsys (void)
 Initializes the menu subsystem.
ERR_te menu_deinit_subsys (void)
 Deinitializes the menu subsystem.
ERR_te menu_start_subsys (void)
 Starts the menu subsystem.
ERR_te menu_stop_subsys (void)
 Stops the menu subsystem.
ERR_te menu_init_handle (MENU_CFG_ts *menu_cfg, MENU_HANDLE_ts **menu_handle_o)
 Initializes and registers a menu handle.
ERR_te menu_run_handle (MENU_HANDLE_ts *menu_handle)
 Renders a single menu to the display.
ERR_te menu_run_handle_all (void)
 Renders all registered menus to the display.
ERR_te menu_get_selected_option (MENU_HANDLE_ts const *menu_handle, char *selected_option_o)
 Retrieves the string of the currently highlighted option.
ERR_te menu_scroll (MENU_HANDLE_ts *menu_handle, VERTICAL_DIR_te vertical_dir)
 Moves the menu selection cursor by one step in the given direction.
ERR_te menu_get_prev_menu (MENU_HANDLE_ts *menu_handle, MENU_HANDLE_ts **prev_menu_handle_o)
 Pops and returns the previous menu from the navigation history stack.
ERR_te menu_set_prev_menu (MENU_HANDLE_ts *menu_handle, MENU_HANDLE_ts *prev_menu_handle)
 Pushes a menu onto the navigation history stack of another menu.

Variables

static struct internal_state_s internal_state = { 0 }
 Singleton instance of the menu subsystem internal state.
static CMD_INFO_ts menu_cmds []
 Table of CLI commands registered by the menu subsystem.
static CMD_CLIENT_INFO_ts menu_cmd_client_info
 Registration descriptor passed to the command subsystem.

Detailed Description

Menu implementation file.

Author
github.com/Baksi675
Version
0.1
Date
2025-12-21

Definition in file menu.c.

Variable Documentation

◆ internal_state

struct internal_state_s internal_state = { 0 }
static

Singleton instance of the menu subsystem internal state.

Definition at line 109 of file menu.c.

109{ 0 };

◆ menu_cmds

CMD_INFO_ts menu_cmds[]
static
Initial value:
= {
{
.name = "scroll",
.help = "Scroll up or down, usage: menu scroll <menu> <up|down>",
},
{
.name = "info",
.help = "Shows menu information, usage: menu info",
}
}
static ERR_te menu_cmd_info_handler(uint32_t argc, char **argv)
CLI handler for the "info" command. Logs the names of all active menu handles.
Definition menu.c:665
static ERR_te menu_cmd_scroll_handler(uint32_t argc, char **argv)
CLI handler for the "scroll" command. Scrolls a named menu and re-renders it.
Definition menu.c:711

Table of CLI commands registered by the menu subsystem.

Registered with the command subsystem via menu_cmd_client_info during menu_init_subsys.

Definition at line 126 of file menu.c.

126 {
127 {
128 .name = "scroll",
129 .help = "Scroll up or down, usage: menu scroll <menu> <up|down>",
130 .handler = menu_cmd_scroll_handler
131 },
132 {
133 .name = "info",
134 .help = "Shows menu information, usage: menu info",
135 .handler = menu_cmd_info_handler
136 }
137};

◆ menu_cmd_client_info

CMD_CLIENT_INFO_ts menu_cmd_client_info
static
Initial value:
= {
.cmds_ptr = menu_cmds,
.num_cmds = sizeof(menu_cmds) / sizeof(menu_cmds[0]),
.name = "menu",
.log_level_ptr = &internal_state.log_level
}
static struct internal_state_s internal_state
Singleton instance of the SysTick driver internal state.
static CMD_INFO_ts menu_cmds[]
Table of CLI commands registered by the menu subsystem.
Definition menu.c:126

Registration descriptor passed to the command subsystem.

Bundles the command table, its size, the subsystem name prefix used on the CLI, and a pointer to the runtime log-level variable.

Definition at line 146 of file menu.c.

146 {
147 .cmds_ptr = menu_cmds,
148 .num_cmds = sizeof(menu_cmds) / sizeof(menu_cmds[0]),
149 .name = "menu",
150 .log_level_ptr = &internal_state.log_level
151};