3 by 4 edited

Dependents:   Lab3 Lab3

Fork of keypad by HM Yoong

Files at this revision

API Documentation at this revision

Comitter:
Dorsh
Date:
Fri Nov 04 17:49:53 2016 +0000
Parent:
10:da060f8c03e8
Commit message:
ok

Changed in this revision

Keypad.cpp Show annotated file Show diff for this revision Revisions of this file
Keypad.h Show annotated file Show diff for this revision Revisions of this file
--- a/Keypad.cpp	Wed Jan 01 17:45:53 2014 +0000
+++ b/Keypad.cpp	Fri Nov 04 17:49:53 2016 +0000
@@ -53,12 +53,12 @@
 ,PinName      c0
 ,PinName      c1
 ,PinName      c2
-,PinName      c3
+//,PinName      c3
 ,int          debounce_ms
 )
 {
     PinName rPins[4] = {r0, r1, r2, r3};
-    PinName cPins[4] = {c0, c1, c2, c3};
+    PinName cPins[3] = {c0, c1, c2};
 
     for (int i = 0; i < 4; i++) {
         _rows[i] = NULL;
@@ -76,7 +76,7 @@
     _setupRiseTrigger();
     
     _nCol = 0;
-    for (int i = 0; i < 4; i++) {
+    for (int i = 0; i < 3; i++) {
         if (cPins[i] != NC) {
             _cols[i] = new DigitalOut(cPins[i]);
             _nCol++;
@@ -95,7 +95,7 @@
             delete _rows[i];
     }
 
-    for (int i = 0; i < 4; i++) {
+    for (int i = 0; i < 3; i++) {
         if (_cols[i] != 0)
             delete _cols[i];
     }
--- a/Keypad.h	Wed Jan 01 17:45:53 2014 +0000
+++ b/Keypad.h	Fri Nov 04 17:49:53 2016 +0000
@@ -85,7 +85,7 @@
      *  @param debounce_ms   Debounce in ms (Default to 20ms)
      */
     Keypad(PinName r0, PinName r1, PinName r2, PinName r3,
-           PinName c0, PinName c1, PinName c2, PinName c3,
+           PinName c0, PinName c1, PinName c2,
            int debounce_ms = 20);
 
     /** Destructor
@@ -108,7 +108,7 @@
 
 protected:
     InterruptIn     *_rows[4];
-    DigitalOut      *_cols[4];
+    DigitalOut      *_cols[3];
     int              _debounce;  // miliseconds
     int              _nRow;
     int              _nCol;