fome-fw/firmware/controllers/algo/lcd_menu_tree.h

75 lines
1.3 KiB
C
Raw Normal View History

2015-01-06 19:07:46 -08:00
/**
* @file lcd_menu_tree.h
*
* @date Jan 6, 2015
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2015-01-06 19:07:46 -08:00
*/
#ifndef CONTROLLERS_ALGO_LCD_MENU_TREE_H_
#define CONTROLLERS_ALGO_LCD_MENU_TREE_H_
typedef enum {
LL_STRING,
LL_VERSION,
LL_CONFIG,
2015-01-08 08:05:05 -08:00
LL_ALGORITHM,
2015-01-30 20:09:23 -08:00
LL_INJECTION,
LL_IGNITION,
2015-01-08 08:05:05 -08:00
2015-01-06 19:07:46 -08:00
LL_RPM,
2015-01-08 08:05:05 -08:00
LL_TRIGGER_ERRORS,
LL_TRIGGER_DUTY,
2015-01-06 19:07:46 -08:00
LL_CLT_TEMPERATURE,
LL_IAT_TEMPERATURE,
2015-01-08 08:05:05 -08:00
LL_TPS,
LL_VBATT,
LL_MAF,
LL_MAP,
LL_EGO,
LL_BARO,
LL_BASE_FUEL,
LL_TOTAL_FUEL,
LL_CLT_FUEL_CORR,
LL_IAT_FUEL_CORR,
2015-01-06 19:07:46 -08:00
} lcd_line_e;
2015-01-08 20:04:09 -08:00
typedef void (*VoidCallback)(void);
2015-01-06 19:07:46 -08:00
class MenuItem {
public:
2015-01-08 20:04:09 -08:00
MenuItem(MenuItem * parent, const char *text, VoidCallback callback);
2015-01-06 19:07:46 -08:00
MenuItem(MenuItem * parent, const char *text);
2015-01-07 05:04:24 -08:00
MenuItem(MenuItem * parent, lcd_line_e lcdLine);
2015-01-06 19:07:46 -08:00
const char *text;
lcd_line_e lcdLine;
int index;
// that's upper level menu item
MenuItem *parent;
2015-01-06 20:03:36 -08:00
MenuItem *topOfTheList;
2015-01-06 19:07:46 -08:00
MenuItem *firstChild;
MenuItem *lastChild;
MenuItem *next;
2015-01-08 20:04:09 -08:00
VoidCallback callback;
2015-01-07 05:04:24 -08:00
private:
2015-01-08 20:04:09 -08:00
void init(MenuItem * parent, VoidCallback callback);
2015-01-06 19:07:46 -08:00
};
class MenuTree {
public:
MenuTree(MenuItem *root);
void nextItem(void);
2015-01-06 20:03:36 -08:00
void back(void);
void enterSubMenu(void);
2015-01-06 19:07:46 -08:00
void init(MenuItem *first, int linesCount);
MenuItem *root;
int linesCount;
MenuItem *current;
MenuItem *topVisible;
};
#endif /* CONTROLLERS_ALGO_LCD_MENU_TREE_H_ */