ELEC2645 (2019/20) / Mbed 2 deprecated el18loc_final

Dependencies:   mbed

Revision:
8:f305ea78b2b1
Parent:
7:33cb5f2db1ee
Child:
13:27300c533dd1
--- a/Front/Front.cpp	Tue May 05 14:32:04 2020 +0000
+++ b/Front/Front.cpp	Tue May 05 16:46:01 2020 +0000
@@ -1,5 +1,6 @@
 #include "mbed.h"
 #include "Front.h"
+//objects
 
 const int fader[35][5] =   {
     { 1,1,1,1,1 },
@@ -71,8 +72,30 @@
 {
 }
 //PUBLIC------------------------------------------------------------------------
+
+void Front::frontrun(N5110 &lcd, Gamepad &pad, int submenu)
+{
+    frontsetup(lcd, pad, submenu);
+    menuflag=1;
+    while (menuflag==1) {
+        if (pad.start_pressed())  { //go back menu
+            // printf("start pressed\n");
+            printf("Waveforms Sub selected\n"); //debug
+            wait_ms(200); //debounce
+            menuflag=0; //sets flag
+        }
+    }
+}
+
+
+//PRIVATE-----------------------------------------------------------------------
+
 void Front::frontsetup(N5110 &lcd, Gamepad &pad, int submenu)
 {
+    a=17; //range from 1->35
+    d=17;
+    s=17;
+    r=17;
     lcd.clear();
     lcd.printString("A D S R",3,5);
     printfader(lcd,3,3);
@@ -81,18 +104,17 @@
     printfader(lcd,39,3);
     lcd.drawRect(50,3,30,8,FILL_TRANSPARENT);
     printwav(lcd,submenu);
+    printsliders(lcd,a,d,s,r);
     lcd.refresh();
-    frontrun(lcd,pad,submenu);
+    
 }
-
-void Front::frontrun(N5110 &lcd, Gamepad &pad, int submenu)
+void Front::printsliders(N5110 &lcd, int a, int d, int s, int r)
 {
- lcd.refresh();
+    lcd.drawRect(3,37-a,5,2,FILL_BLACK);
+    lcd.drawRect(15,37-d,5,2,FILL_BLACK); 
+    lcd.drawRect(27,37-s,5,2,FILL_BLACK); 
+    lcd.drawRect(39,37-r,5,2,FILL_BLACK);     
 }
-
-
-//PRIVATE-----------------------------------------------------------------------
-
 void Front::printfader(N5110 &lcd, int x, int y)
 {
     // x origin, y origin, rows, cols, sprite