Add basic definitions for menu entries

This commit is contained in:
Mario Hüttel 2020-06-01 21:42:31 +02:00
parent 6477950eea
commit d508402aa8
3 changed files with 48 additions and 2 deletions

View File

@ -31,6 +31,11 @@
#define LCD_RS_MASK (1U << LCD_RS)
#define LCD_E_MASK (1U << LCD_E)
#define LCD_CHAR_WIDTH 16
#define LCD_ROW_COUNT 4
enum lcd_fsm_ret {LCD_FSM_NOP, LCD_FSM_CALL_AGAIN, LCD_FSM_WAIT_CALL};
void lcd_init(void);

View File

@ -21,4 +21,47 @@
#ifndef __MENU_H__
#define __MENU_H__
#include <stdint.h>
#include <reflow-controller/button.h>
#include <stdbool.h>
#include <reflow-controller/ui/lcd.h>
struct lcd_menu;
enum menu_entry_func_entry {MENU_ENTRY_FIRST_ENTER, MENU_ENTRY_CONTINUE, MENU_ENTRY_DROPBACK};
typedef enum menu_func_ret_t (*menu_func_t)(struct lcd_menu *menu, enum menu_entry_func_entry entry_type,
void *parent);
struct menu_inputs {
uint16_t rotary_encoder_val;
enum button_state push_button;
};
struct lcd_menu {
menu_func_t active_entry;
menu_func_t root_entry;
enum menu_entry_func_entry active_entry_type;
struct menu_inputs inputs;
char lcd_buffer[LCD_ROW_COUNT][21];
};
struct menu_list {
const char **entry_names;
uint32_t currently_selected;
const menu_func_t *submenu_list;
};
void menu_handle(struct lcd_menu *menu, uint16_t rotary_encoder_value, enum button_state push_button);
void menu_init(struct lcd_menu *menu, menu_func_t root_node);
void menu_entry_dropback(struct lcd_menu *menu, menu_func_t parent_func);
void menu_entry_enter(struct lcd_menu *menu, menu_func_t parent_func, bool handle_immediately);
void menu_override_lcd_output(uint8_t row_num, char *text);
void menu_list_display(struct menu_list *list, uint8_t top_row, uint8_t bottom_row);
#endif /* __MENU_H__ */

View File

@ -19,5 +19,3 @@
*/
#include <reflow-controller/ui/menu.h>
#include <reflow-controller/ui/lcd.h>