waveblender/ui.h

46 lines
981 B
C
Raw Normal View History

2020-04-06 21:08:01 +02:00
#ifndef UI_H
#define UI_H
#include <stdint.h>
void ui_init(void);
2020-04-13 11:11:17 +02:00
#define ENTRY_TYPE_TEXT 0
#define ENTRY_TYPE_BOOL 1
#define ENTRY_TYPE_DEC 2
#define ENTRY_TYPE_HEX 3
#define MAX_ENTRY 8
2020-04-06 21:08:01 +02:00
struct display_menu {
struct display_menu *next;
int entry_n;
struct display_menu_entry {
2020-04-13 11:11:17 +02:00
int type;
char label[16];
void (*action)(struct display_menu_entry *item, uint8_t button);
int min, max, step;
int *var;
2020-04-06 21:08:01 +02:00
const void *arg;
2020-04-13 11:11:17 +02:00
} entry[MAX_ENTRY];
2020-04-06 21:08:01 +02:00
};
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);
2020-04-23 22:19:22 +02:00
int ui_get_menu_selection(void);
2020-04-06 21:08:01 +02:00
#endif