-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfig.h
114 lines (93 loc) · 2.3 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
config.h - MiSTeryNano FPGA Companion
*/
#ifndef CONFIG_H
#define CONFIG_H
#include <stdarg.h>
#ifndef ESP_PLATFORM
#define CONFIG_MAX_PRIORITY (32)
#else
#define CONFIG_MAX_PRIORITY (25)
#endif
#define MAX_DRIVES (6)
#define MAX_HID_DEVICES (4)
#define MAX_XBOX_DEVICES (2)
/* ================== configuration as requested by the FPGA ================ */
#define CONFIG_ACTION_COMMAND_IDLE 0
#define CONFIG_ACTION_COMMAND_SET 1
#define CONFIG_ACTION_COMMAND_DELAY 2
#define CONFIG_ACTION_COMMAND_SAVE 3
#define CONFIG_ACTION_COMMAND_LOAD 4
#define CONFIG_ACTION_COMMAND_HIDE 5
#define CONFIG_ACTION_COMMAND_LINK 6
typedef struct {
unsigned char code;
union {
struct {
unsigned char id;
unsigned char value;
} set;
struct {
unsigned short ms;
} delay;
char *filename;
struct config_action_S *action;
};
} config_action_command_t;
typedef struct config_action_S {
char *name;
config_action_command_t *commands;
} config_action_t;
typedef struct {
unsigned char index;
char *label;
char *def;
char **ext;
config_action_t *action;
} config_fsel_t;
typedef struct {
char *label;
unsigned char value;
} config_listentry_t;
typedef struct {
unsigned char id;
char *label;
unsigned char def;
config_listentry_t **listentries;
config_action_t *action;
} config_list_t;
typedef struct {
char *label;
config_action_t *action;
} config_button_t;
#define CONFIG_MENU_ENTRY_UNKNOWN 0
#define CONFIG_MENU_ENTRY_MENU 1
#define CONFIG_MENU_ENTRY_FILESELECTOR 2
#define CONFIG_MENU_ENTRY_LIST 3
#define CONFIG_MENU_ENTRY_BUTTON 4
typedef struct {
unsigned char type;
union {
struct config_menu_S *menu;
config_fsel_t *fsel;
config_list_t *list;
config_button_t *button;
};
} config_menu_entry_t;
typedef struct config_menu_S {
char *label;
config_menu_entry_t *entries;
} config_menu_t;
typedef struct {
char *name;
int version;
config_action_t **actions;
config_menu_t *menu;
} config_t;
// the global config
extern config_t *cfg;
void config_init(void);
config_action_t *config_get_action(const char *);
void config_dump(void);
const char *config_menuentry_get_type_str(config_menu_entry_t *);
#endif // CONFIG_H