-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.c
More file actions
117 lines (100 loc) · 2.64 KB
/
Menu.c
File metadata and controls
117 lines (100 loc) · 2.64 KB
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
#include "Menu.h"
void default_menu() {
char *message[4] = {"1 Signal Toggle", "2 Sample Rate", "3 Sample Mode", "4 Change Filter"};
send_multiline_message(message);
bool pressed = false;
while(!pressed) {
// watch for button press
pressed = true; // innocent until proven guilty
if(switch_pressed(switch_1)) {
// toggle the signal
} else if (switch_pressed(switch_2)) {
// go to sample rate menu
sample_rate_menu();
} else if (switch_pressed(switch_3)) {
// go to sample mode menu
sample_mode_menu();
} else if (switch_pressed(switch_4)) {
// go to change filter menu
filter_select_menu();
} else if (switch_pressed(switch_5)) {
// scroll up
scroll_up();
} else if (switch_pressed(switch_6)) {
// scroll down
scroll_down();
} else {
pressed = false; // proven guilty
}
}
}
void sample_rate_menu() {
char *message[3] = {"1 Option1", "1 Option1", "1 Option1"};
send_multiline_message(message);
bool pressed = false;
while(!pressed) {
// watch for button press
pressed = true; // innocent until proven guilty
if(switch_pressed(switch_1)) {
// choose option1
} else if (switch_pressed(switch_2)) {
// choose option2
} else if (switch_pressed(switch_3)) {
// choose option3
} else if (switch_pressed(switch_5)) {
// scroll up
scroll_up();
} else if (switch_pressed(switch_6)) {
// scroll down
scroll_down();
} else {
pressed = false; // proven guilty
}
}
}
void sample_mode_menu() {
char *message[2] = {"1 FIR mode", "1 Sample/Output"};
send_multiline_message(message);
bool pressed = false;
while(!pressed) {
// watch for button press
pressed = true; // innocent until proven guilty
if(switch_pressed(switch_1)) {
// choose FIR mode
} else if (switch_pressed(switch_2)) {
// choose sample/output mode
} else if (switch_pressed(switch_5)) {
// scroll up
scroll_up();
} else if (switch_pressed(switch_6)) {
// scroll down
scroll_down();
} else {
pressed = false; // proven guilty
}
}
}
void filter_select_menu() {
char *message[3] = {"1 Filter1 (LP1)", "1 Filter2 (LP2)", "1 Filter3 (HP)"};
send_multiline_message(message);
bool pressed = false;
while(!pressed) {
// watch for button press
pressed = true; // innocent until proven guilty
if(switch_pressed(switch_1)) {
// choose filter1
} else if (switch_pressed(switch_2)) {
// choose filter2
} else if (switch_pressed(switch_3)) {
// choose filter3
} else if (switch_pressed(switch_5)) {
// scroll up
scroll_up();
} else if (switch_pressed(switch_6)) {
// scroll down
scroll_down();
} else {
pressed = false; // proven guilty
}
}
}