Trying to debug

Dependencies:   mbed TextLCD keypad

Revision:
1:c57c18e1ca87
Parent:
0:9b646298bdc9
Child:
2:c25102764602
diff -r 9b646298bdc9 -r c57c18e1ca87 keypadandlc.cpp
--- a/keypadandlc.cpp	Wed Jan 30 02:34:25 2019 +0000
+++ b/keypadandlc.cpp	Wed Jan 30 03:24:44 2019 +0000
@@ -9,23 +9,41 @@
                      'C', '0', ',', 'E'    // r3 C = clear, E = enter
                    };
                   // c0   c1   c2   c3
+
+//displayed menu items 
+ 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"};
+
+//key pressed holder
+ char keyPressed[]={0,0};
+ //track the key presed
+ int keyTracker=0;
  
- uint32_t Index;
+ //enter function
+ void enterFunc(){
+     //do something eventually
+}
  
- uint32_t cbAfterInput(uint32_t index) {
-     Index = index;
-     return 0;
+ 
+ uint32_t LCDUpdate(uint32_t index) {
+      //if enter is pressed
+      if(index==15){
+        //call enter function
+        enterFunc();    
+      }
+      
+      keyPressed[keyTracker]=Keytable[index];
+      keyTracker++;
+      
+      
+      return 0;
  }
  
+
  int main() {
                  // r0   r1   r2   r3   c0   c1   c2   c3
      Keypad keypad(D0, D1, D2, D3, D10, D11, D12, D13);
-     keypad.attach(&cbAfterInput);
-     keypad.start();  // energize the keypad via c0-c3
- 
+     keypad.attach(&LCDUpdate);
      while (1) {
          __wfi();
-         printf("Interrupted\r\n");
-         printf("Index:%d => Key:%c\r\n", Index, Keytable[Index]); 
          }
 }
\ No newline at end of file