Trying to debug

Dependencies:   mbed TextLCD keypad

Files at this revision

API Documentation at this revision

Comitter:
baet6458
Date:
Tue Feb 05 00:57:07 2019 +0000
Parent:
6:d2f4c1f6877c
Commit message:
changed to display index;

Changed in this revision

keypadandlc.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r d2f4c1f6877c -r 022c8579e8c7 keypadandlc.cpp
--- a/keypadandlc.cpp	Thu Jan 31 00:48:02 2019 +0000
+++ b/keypadandlc.cpp	Tue Feb 05 00:57:07 2019 +0000
@@ -16,7 +16,7 @@
  const char* menu[]={"Select harness:","1. Harness A","2. Harness B","3. Harness C","4. Harness D","5. Harness E","6. Harness F","7. Harness G","8. Harness H","9. Harness I","Test in progress"};
  
  //array to display and tracker 
- char LCDdisplay[16];
+ char LCDdisplay;
  int displayTracker=0;
 
 //key presesed holder
@@ -24,75 +24,10 @@
  
  bool special =false;
  
- //enter function
- void enterFunc(){
-     //do something eventually
-}
-
-void updateDisplayArray(int pos, bool comma=false){
-    if (comma == false)
-        LCDdisplay[displayTracker]=Keytable[pos];
-    else
-        LCDdisplay[displayTracker]='-';
-    
-    special=false;
- }
- 
  
  uint32_t LCDUpdate(uint32_t index) {
       //see which key is pressed
-      switch (index){
-        //if up button is presseed
-        case 3:
-            //do something
-            break;
-            
-        //if down button is pressed
-        case 7:
-            //do something
-            break;
-            
-        //if 2nd button is pressed
-        case 11:
-            //say if 2nd is pressed
-            special=!special;
-            break;
-        //if clear is pressed
-        case 12:
-            //reset key Tracker
-            keyTracker=0;
-            //put blanks back in array 
-            for(int i=0;i<16;i++){
-                LCDdisplay[i]=' ';
-                }
-            break;
-        //if comma is pressed
-        case 14:
-            //if 2nd is pressed put in dash
-            if (special==true)
-                updateDisplayArray(index,special);
-            else
-            //otherwise it is a comma
-                updateDisplayArray(index);
-            break;
-          //if enter is pressed
-        case 15:
-        //call enter function
-            enterFunc(); 
-            break;
-      
-        default://update the keypressed
-        
-            //may remove this later
-            keyTracker=keyTracker*10+int(Keytable[index]);
-            
-            updateDisplayArray(index);
-            
-      }
-      
-      displayTracker++;
-      if(displayTracker>16)
-        displayTracker=0;
+        LCDdisplay= char(index);
       return 0;
  }
  
@@ -106,9 +41,7 @@
             lcd.cls();
             lcd.printf("Please Enter wires:");
             lcd.locate(0,1);
-            for(int j=0;j<16;j++){
-                    lcd.putc(LCDdisplay[j]);
-            }
+            lcd.putc(LCDdisplay);
          }
          
 }
\ No newline at end of file