Código para o menu no LCD

Dependencies:   mbed SDFileSystemSD TextLCD

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

Revision:
30:614dcbd74cdc
Parent:
29:558eccdfc079
Child:
31:77eb51d4ee18
--- a/classes.h	Mon May 21 19:45:56 2018 +0000
+++ b/classes.h	Tue May 22 13:58:18 2018 +0000
@@ -433,13 +433,13 @@
         
         wait(1);
         
-        status = sdcard.get_file_names();
+        /*status = sdcard.get_file_names();
         if(status){
             printf("Filenames: \n\r");
             for(int i = 0; i < filenames.size(); i++){
                  printf("%s\n\r", filenames[i]);
             }    
-        }
+        }*/
         
         wait(1);
         func = 1;
@@ -799,7 +799,7 @@
     void salvarprog(){
         lcd.cls();
         bot_enter = 0;
-        lcd.printf("Voce deseja salvar este programa?");
+        lcd.printf("Voce deseja salvar  este programa?");
         lcd.locate(5,2);
         lcd.printf("Sim");
         lcd.locate(5,3);
@@ -808,11 +808,12 @@
         if (bot_enter!=penter){
             if (linha==2){
                 salvar = 1;
-                func = 7;
+                printf("salvar\n\r");
+                //func = 20;
                 }
             if (linha==3){
                 salvar = 0;
-                func = 7;
+                //func = 7;
                 }
             }
         }
@@ -845,6 +846,54 @@
         func = 4;
         }
         
+    //func 20
+    void nomeprog(){
+        lcd.cls();
+        bot_enter = 0;
+        lcd.printf("oieeee");
+        printf("tela\n\r");
+        escrever(3);
+        if (bot_enter!=penter){
+            func = 1;
+            }
+        }
+        
+    //função para escrever nome arquivo
+    void escrever(int coluna){
+        char alfabeto[38] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
+        '0','1','2','3','4','5','6','7','8','9','-','_'};
+        /*string alfabeto = "abcdefghijklmnopqrstuvwxyz0123456789-_";*/
+        int imax = 37;
+        int imin = 0;
+        int i = 0;
+        printf("entrou\n\r");
+        //while (){
+            while (bot_enter==penter){
+                if (bot_cima == 1){
+                    if (i==imin){
+                        i = imax;
+                        }
+                    else if (i>imin && i<=imax){
+                        i--;
+                        }
+                    bot_cima = 0;
+                    }
+                else if (bot_baixo == 1){
+                    if (i==imax){
+                        i = imin;
+                        }
+                    else if (i<imax && i>=imin){
+                        i++;
+                        }
+                    bot_baixo = 0;
+                    }  
+               // }
+            lcd.locate(coluna, 1);
+            lcd.printf("%c", alfabeto[i]);
+            //lcd.printf("oi");
+            }
+        }
+        
     //função para ler os pontos
     void readSerial(){
         char recv;