Further menu implementations

This commit is contained in:
Mario Hüttel 2020-06-04 21:53:00 +02:00
parent fc2372f754
commit 9615fdb39d
2 changed files with 13 additions and 4 deletions

View File

@ -52,7 +52,7 @@ struct menu_list {
const menu_func_t *submenu_list;
};
void menu_handle(struct lcd_menu *menu, uint16_t rotary_encoder_delta, enum button_state push_button);
void menu_handle(struct lcd_menu *menu, int16_t rotary_encoder_delta, enum button_state push_button);
void menu_init(struct lcd_menu *menu, menu_func_t root_node, void (*display_update)(uint8_t row, const char *data));

View File

@ -21,7 +21,7 @@
#include <reflow-controller/ui/menu.h>
#include <stddef.h>
void menu_handle(struct lcd_menu *menu, uint16_t rotary_encoder_delta, enum button_state push_button)
void menu_handle(struct lcd_menu *menu, int16_t rotary_encoder_delta, enum button_state push_button)
{
menu_func_t tmp;
@ -74,10 +74,17 @@ void menu_entry_dropback(struct lcd_menu *menu, menu_func_t parent_func)
menu->active_entry_type = MENU_ENTRY_DROPBACK;
}
void menu_entry_enter(struct lcd_menu *menu, menu_func_t parent_func, bool handle_immediately)
void menu_entry_enter(struct lcd_menu *menu, menu_func_t entry, bool handle_immediately)
{
if (!menu)
return;
menu->init_parent = menu->active_entry;
menu->active_entry_type = MENU_ENTRY_FIRST_ENTER;
menu->active_entry = entry;
if (handle_immediately)
menu_handle(menu, menu->inputs.rotary_encoder_delta, menu->inputs.push_button);
}
void menu_override_lcd_output(struct lcd_menu *menu, uint8_t row_num, const char *text)
@ -90,5 +97,7 @@ void menu_override_lcd_output(struct lcd_menu *menu, uint8_t row_num, const char
void menu_list_display(struct menu_list *list, uint8_t top_row, uint8_t bottom_row)
{
(void)list;
(void)top_row;
(void)bottom_row;
}