45 lines
981 B
C
45 lines
981 B
C
#ifndef UI_H
|
|
#define UI_H
|
|
#include <stdint.h>
|
|
|
|
void ui_init(void);
|
|
|
|
#define ENTRY_TYPE_TEXT 0
|
|
#define ENTRY_TYPE_BOOL 1
|
|
#define ENTRY_TYPE_DEC 2
|
|
#define ENTRY_TYPE_HEX 3
|
|
|
|
#define MAX_ENTRY 8
|
|
|
|
|
|
|
|
struct display_menu {
|
|
struct display_menu *next;
|
|
int entry_n;
|
|
struct display_menu_entry {
|
|
int type;
|
|
char label[16];
|
|
void (*action)(struct display_menu_entry *item, uint8_t button);
|
|
int min, max, step;
|
|
int *var;
|
|
const void *arg;
|
|
} entry[MAX_ENTRY];
|
|
|
|
};
|
|
|
|
const struct display_menu MainMenu, MeasureMenu, SignalGenMenu,
|
|
ExtraMenu;
|
|
|
|
void ui_display_menu(const struct display_menu *menu);
|
|
void ui_button_press(uint8_t b, int hold);
|
|
|
|
struct display_menu *CurrentMenu;
|
|
|
|
/* Defined in main to intercept input controls */
|
|
void set_input_callback(void (*cb)(uint8_t press, int hold));
|
|
void clear_input_callback(void);
|
|
void set_keepalive(void (*cb)(void));
|
|
void clear_keepalive(void);
|
|
int ui_get_menu_selection(void);
|
|
|
|
#endif
|