DMCP interface  03.15_020
Menu system

This functionality allows to extend and use default menu system for programs where this functionality is sufficient enough. More...

Modules

 System menus
 Menus defined in system.
 
 Menu item ids
 Menu item ids.
 
 Menu defines
 
 Aux menu item functions
 Functions for menu_line_str() formatting.
 

Data Structures

struct  smenu_t
 Single menu screen definition. More...
 

Typedefs

typedef int run_menu_item_fn_t(uint8_t line_id)
 Prototype for run_menu_item function.
 
typedef const char * menu_line_str_fn_t(uint8_t line_id, char *s, const int slen)
 Prototype for menu_line_str function.
 

Functions

int handle_menu (const smenu_t *menu_id, int action, int cur_line)
 Starts menu screen. More...
 
int run_menu_item_sys (uint8_t line_id)
 Invoke particular sys menu function. More...
 
int run_menu_item (uint8_t line_id)
 (Defined by user) Invoke functionality for selected menu item More...
 
const char * menu_line_str (uint8_t line_id, char *ln, const int ln_len)
 (Defined by user) Should return string representation of given menu item More...
 

Detailed Description

This functionality allows to extend and use default menu system for programs where this functionality is sufficient enough.

User has to define run_menu_item() and menu_line_str() functions and assign them to system variables

to extend default menu functionality.

Function Documentation

◆ handle_menu()

int handle_menu ( const smenu_t menu_id,
int  action,
int  cur_line 
)

Starts menu screen.

Parameters
menu_idMenu definition structure
actionMENU_RESET for first menu screen, MENU_ADD for nested menu
cur_lineLine selected at start
Returns
Exit code.

◆ menu_line_str()

const char* menu_line_str ( uint8_t  line_id,
char *  ln,
const int  ln_len 
)

(Defined by user) Should return string representation of given menu item

Parameters
line_idMenu item id
lnBuffer which can be used for line text
ln_lenLength of ln return Line item string

This function is called by system when particular line is drawn only if this function is assigned to menu_line_str_app system variable.

◆ run_menu_item()

int run_menu_item ( uint8_t  line_id)

(Defined by user) Invoke functionality for selected menu item

Parameters
line_idMenu item id
Returns
Exit code

This function is called by system when particular menu item is selected only if this function is assigned to run_menu_item_app system variable.

◆ run_menu_item_sys()

int run_menu_item_sys ( uint8_t  line_id)

Invoke particular sys menu function.

Parameters
line_idSys menu line id

It allows e.g. launching of USB disk mode from user program by running run_menu_item_sys(MI_MSC).