This functionality allows to extend and use default menu system for programs where this functionality is sufficient enough.
More...
|
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.
|
|
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.
◆ handle_menu()
int handle_menu |
( |
const smenu_t * |
menu_id, |
|
|
int |
action, |
|
|
int |
cur_line |
|
) |
| |
Starts menu screen.
- Parameters
-
menu_id | Menu definition structure |
action | MENU_RESET for first menu screen, MENU_ADD for nested menu |
cur_line | Line 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_id | Menu item id |
ln | Buffer which can be used for line text |
ln_len | Length 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
-
- 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
-
It allows e.g. launching of USB disk mode from user program by running run_menu_item_sys(MI_MSC).