1
0
mirror of https://github.com/AquaMorph/Droplets.git synced 2025-05-19 08:56:59 +00:00

Basic menu

This commit is contained in:
Christian Colglazier 2020-07-26 18:49:49 -04:00
parent 8a6b088ea7
commit 60945dcfd4

@ -10,9 +10,24 @@ using namespace daisysp;
DaisyPatch patch;
const int MENU_SIZE = 7;
std::string menuItems[MENU_SIZE];
int selectedMenuItem = 0;
void SetupMenu() {
menuItems[0] = "VCO";
menuItems[1] = "VCA";
menuItems[2] = "Envelope";
menuItems[3] = "LFO";
menuItems[4] = "Logic";
menuItems[5] = "Delay";
menuItems[6] = "Reverb";
}
int main(void) {
patch.Init();
patch.StartAdc();
SetupMenu();
while(true) {
ProcessControls();
ProcessOled();
@ -20,7 +35,20 @@ int main(void) {
}
}
void ProcessControls() {}
void FilterMenu() {
if (selectedMenuItem >= MENU_SIZE) {
selectedMenuItem = 0;
} else if (selectedMenuItem < 0) {
selectedMenuItem = MENU_SIZE - 1;
}
}
void ProcessControls() {
patch.UpdateAnalogControls();
patch.DebounceControls();
selectedMenuItem += patch.encoder.Increment();
FilterMenu();
}
void ProcessOutputs() {}
@ -30,7 +58,7 @@ void ProcessOled() {
std::string str;
char* cstr = &str[0];
patch.display.SetCursor(0,0);
str = "Cascade";
str = std::to_string(selectedMenuItem) + " " + menuItems[selectedMenuItem];
patch.display.WriteString(cstr, Font_7x10, true);
patch.display.Update();