Automatic munu adding

This commit is contained in:
Christian Colglazier 2020-07-27 14:07:07 -04:00
parent 3f0adb3a52
commit f060bed10f

View File

@ -11,14 +11,20 @@ using namespace daisysp;
DaisyPatch patch; DaisyPatch patch;
const int MENU_SIZE = 8; const std::string MENU_ITEMS[] = {"VCO",
"VCA",
"Envelope",
"LFO",
"Logic",
"Noise",
"Delay",
"Reverb"};
const int MENU_SIZE = sizeof(MENU_ITEMS)/sizeof(*MENU_ITEMS);
const int MAX_CHAR_LENGTH = 15; const int MAX_CHAR_LENGTH = 15;
std::string menuItems[MENU_SIZE];
const int MENU_X[] = {0, 5, 10, 5, 0}; const int MENU_X[] = {0, 5, 10, 5, 0};
const int MENU_Y[] = {0, 11, 22, 41, 52}; const int MENU_Y[] = {0, 11, 22, 41, 52};
int selectedMenuItem = 0; int selectedMenuItem = 0;
void DrawSolidRect(uint8_t x1, void DrawSolidRect(uint8_t x1,
uint8_t y1, uint8_t y1,
uint8_t x2, uint8_t x2,
@ -29,21 +35,9 @@ void DrawSolidRect(uint8_t x1,
} }
} }
void SetupMenu() {
menuItems[0] = "VCO";
menuItems[1] = "VCA";
menuItems[2] = "Envelope";
menuItems[3] = "LFO";
menuItems[4] = "Logic";
menuItems[5] = "Noise";
menuItems[6] = "Delay";
menuItems[7] = "Reverb";
}
int main(void) { int main(void) {
patch.Init(); patch.Init();
patch.StartAdc(); patch.StartAdc();
SetupMenu();
while(true) { while(true) {
ProcessControls(); ProcessControls();
ProcessOled(); ProcessOled();
@ -63,7 +57,7 @@ std::string FilterMenuText(int position) {
if (position >= MENU_SIZE || position < 0) { if (position >= MENU_SIZE || position < 0) {
return ""; return "";
} else { } else {
return menuItems[position]; return MENU_ITEMS[position];
} }
} }
void ProcessControls() { void ProcessControls() {
@ -84,7 +78,6 @@ void CreateMenuItem(std::string text, int position, bool highlighted) {
} else { } else {
patch.display.WriteString(cstr, Font_7x10, !highlighted); patch.display.WriteString(cstr, Font_7x10, !highlighted);
} }
//DrawSolidRect(text.size()*7, (position-1)*10, text.size()*7+21, position*10, false);
} }
void ProcessOled() { void ProcessOled() {