68 lines
2.0 KiB
C
68 lines
2.0 KiB
C
/* Reflow Oven Controller
|
|
*
|
|
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
|
*
|
|
* This file is part of the Reflow Oven Controller Project.
|
|
*
|
|
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with the reflow oven controller project.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#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__ */
|