-
Notifications
You must be signed in to change notification settings - Fork 10
/
menu_data.h
132 lines (118 loc) · 2.54 KB
/
menu_data.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef MENU_DATA_H_
#define MENU_DATA_H_
#include <avr/pgmspace.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __FLASH
#define FLASH __flash
#else
#define FLASH
#endif
typedef enum {
menu_noflags = 0x00,
menu_num = 0x01,
menu_offOn = 0x02,
menu_list = 0x04,
menu_time = 0x08,
menu_hasSub = 0x10,
menu_isSub = 0x20,
// menu_disabled = 0x80,
} menu_flags;
typedef struct {
const uint8_t value; // list of possible values in order
const char valName[4]; // list of value names for display
} menu_value;
typedef struct {
const uint8_t menuNum; // menu item number
menu_flags flags; // flags
const char shortName[4];
const char longName[5];
int8_t* setting;
const int8_t loLimit; // low limit for num
const int8_t hiLimit; // high limit for num, # of values for list
const menu_value* menuList[]; // list of menu choices
} menu_item;
typedef struct {
uint8_t menuNum; // menu item number
menu_flags flags; // flags
char shortName[4];
char longName[5];
int8_t* setting;
int8_t loLimit; // low limit for num
int8_t hiLimit; // high limit for num, # of values for list
menu_value* menuList[]; // list of menu choices
} menu_item_rw;
// menu states
typedef enum {
// basic states
STATE_CLOCK = 0, // show clock time
STATE_SET_CLOCK,
STATE_SET_ALARM,
// menu
STATE_MENU,
STATE_MENU_LAST,
} menu_state_t;
typedef enum { // no ifdefs, no harm in defining unused items
MENU_24H = 0,
MENU_ALARM,
MENU_ALARMHOUR,
MENU_ALARMMINUTE,
MENU_AUTODATE,
MENU_AUTODATE_ENABLE,
MENU_AUTODIM,
MENU_AUTODIM_ENABLE,
MENU_AUTODIM_HOUR1,
MENU_AUTODIM_LEVEL1,
MENU_AUTODIM_HOUR2,
MENU_AUTODIM_LEVEL2,
MENU_AUTODIM_HOUR3,
MENU_AUTODIM_LEVEL3,
MENU_BRIGHTNESS,
MENU_DATE,
MENU_DATEYEAR,
MENU_DATEMONTH,
MENU_DATEDAY,
MENU_DOTS,
MENU_FLW,
MENU_GPS,
MENU_GPS_ENABLE,
MENU_TZH,
MENU_TZM,
MENU_GPSC, // GPS error counter
MENU_GPSP, // GPS error counter
MENU_GPST, // GPS error counter
MENU_DST,
MENU_DST_ENABLE,
MENU_REGION,
MENU_RULES,
MENU_RULE0,
MENU_RULE1,
MENU_RULE2,
MENU_RULE3,
MENU_RULE4,
MENU_RULE5,
MENU_RULE6,
MENU_RULE7,
MENU_RULE8,
MENU_HUMID,
MENU_PRESS,
MENU_TEMP,
MENU_TIME,
MENU_TIMEHOUR,
MENU_TIMEMINUTE,
MENU_TIMESECOND,
MENU_VOL,
// MENU_SQW,
MENU_END // must be last
} menu_number;
extern uint8_t alarm_hour, alarm_minute, alarm_second;
extern uint8_t time_hour, time_minute, time_second;
extern menu_state_t menu_state;
extern uint8_t menu_disabled[MENU_END];
menu_item* getItem(uint8_t idx);
uint8_t nextItem(uint8_t idx, uint8_t skipSub);
#ifdef __cplusplus
}
#endif
#endif // MENU_DATA_H_