Keypad program runs on OS2. Extended not only 3x4 but 4x4,4x5 and 5x5 keys.

Dependencies:   mbed Keypad

see /users/kenjiArai/notebook/keypadkey-matrix--control/

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Mon Apr 13 02:07:27 2020 +0000
Parent:
2:d0ae519c229c
Commit message:
modified keypad library and changed port assign

Changed in this revision

Keypad.lib Show annotated file Show diff for this revision Revisions of this file
key_3x4.cpp Show annotated file Show diff for this revision Revisions of this file
key_4x4.cpp Show annotated file Show diff for this revision Revisions of this file
key_4x5.cpp Show annotated file Show diff for this revision Revisions of this file
key_5x5.cpp Show annotated file Show diff for this revision Revisions of this file
key_complex.cpp Show annotated file Show diff for this revision Revisions of this file
select_example.h Show annotated file Show diff for this revision Revisions of this file
--- a/Keypad.lib	Mon Apr 06 04:59:45 2020 +0000
+++ b/Keypad.lib	Mon Apr 13 02:07:27 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/kenjiArai/code/Keypad/#0ea41738b560
+https://os.mbed.com/users/kenjiArai/code/Keypad/#f74ca02cdba1
--- a/key_3x4.cpp	Mon Apr 06 04:59:45 2020 +0000
+++ b/key_3x4.cpp	Mon Apr 13 02:07:27 2020 +0000
@@ -8,7 +8,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    September 27th, 2017
- *      Revised:    April      6th, 2020
+ *      Revised:    April     13th, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -25,10 +25,8 @@
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
 Serial      pc(USBTX,USBRX);
-//              X    Y   Z   A   B   C   D   OUT(XYZ), IN(ABCD)
-Keypad      key(D10, D9, D8, D7, D6, D5, D4);
-//              X    Y   Z   A   B   C   D   OUT(XYZ), IN(ABCD)
-//Keypad      key(D10, D9, D8, D6, D5, D4, D3);
+//              X    Y    Z   A   B   C   D   OUT(XYZ), IN(ABCD)
+Keypad      key(D11, D10, D9, D6, D5, D4, D3);
 
 //  RAM ------------------------------------------------------------------------
 
@@ -50,7 +48,7 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test\r\n");
+    pc.printf("Start Key-Pad test 3x4 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             pc.printf("%2u:[%2d] %c\r\n",
--- a/key_4x4.cpp	Mon Apr 06 04:59:45 2020 +0000
+++ b/key_4x4.cpp	Mon Apr 13 02:07:27 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April      6th, 2020
+ *      Revised:    April     13th, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -22,8 +22,8 @@
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
 Serial      pc(USBTX,USBRX);
-//              X    Y   Z   W    A   B   C   D   OUT(XYZW), IN(ABCD)
-Keypad      key(D10, D9, D8, D7, D6, D5, D4, D3);
+//              X    Y    Z   W    A   B   C   D   OUT(XYZW), IN(ABCD)
+Keypad      key(D11, D10, D9, D8, D6, D5, D4, D3);
 
 //  RAM ------------------------------------------------------------------------
 
@@ -46,7 +46,7 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test\r\n");
+    pc.printf("Start Key-Pad test 4x4 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             pc.printf("%2u:[%2d] %c\r\n",
--- a/key_4x5.cpp	Mon Apr 06 04:59:45 2020 +0000
+++ b/key_4x5.cpp	Mon Apr 13 02:07:27 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April      6th, 2020
+ *      Revised:    April     13th, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -22,8 +22,8 @@
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
 Serial      pc(USBTX,USBRX);
-//              X    Y   Z   W    A   B   C   D   E   OUT(XYZW), IN(ABCDE)
-Keypad      key(D10, D9, D8, D7, D6, D5, D4, D3, D2);
+//              X    Y    Z   W    A   B   C   D   E   OUT(XYZW), IN(ABCDE)
+Keypad      key(D11, D10, D9, D8, D6, D5, D4, D3, D2);
 
 //  RAM ------------------------------------------------------------------------
 
@@ -46,7 +46,7 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test\r\n");
+    pc.printf("Start Key-Pad test 4x5 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             pc.printf("%2u:[%2d] %c\r\n",
--- a/key_5x5.cpp	Mon Apr 06 04:59:45 2020 +0000
+++ b/key_5x5.cpp	Mon Apr 13 02:07:27 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April      6th, 2020
+ *      Revised:    April     13th, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -47,7 +47,7 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test\r\n");
+    pc.printf("Start Key-Pad test 5x5 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             pc.printf("%2u:[%2d] %c\r\n",
--- a/key_complex.cpp	Mon Apr 06 04:59:45 2020 +0000
+++ b/key_complex.cpp	Mon Apr 13 02:07:27 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April      6th, 2020
+ *      Revised:    April     13th, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -29,8 +29,8 @@
 DigitalOut  led1(A1);
 DigitalOut  led2(A2);
 Serial      pc(USBTX,USBRX);
-//              X   Y   Z   W   V   A    B    C   D   E   OUT(XYZWV), IN(ABCDE)
-Keypad      key(D6, D5, D4, D3, D2, D11, D10, D9, D8, D7);
+//              X    Y    Z   W   V   A   B   C   D   E   OUT(XYZWV), IN(ABCDE)
+Keypad      key(D11, D10, D9, D8, D7, D6, D5, D4, D3, D2);
 
 //  RAM ------------------------------------------------------------------------
 
@@ -56,7 +56,7 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test\r\n");
+    pc.printf("Start Key-Pad test 5x5 keys and/or state hold switch\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             pc.printf("%2u:[%2d] %c\r\n",
--- a/select_example.h	Mon Apr 06 04:59:45 2020 +0000
+++ b/select_example.h	Mon Apr 13 02:07:27 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April      6th, 2020
+ *      Revised:    April     13th, 2020
  */
 /*
     You can select several examples as followings.
@@ -15,7 +15,7 @@
     3.  key_5x5.cpp
     4.  key_complex.cpp
  */
-#define PROG_NUMBER     4       // select 0 to 4
+#define PROG_NUMBER     0       // select 0 to 4
 
 //----------------- You don't need any modification ----------------------------
 #if PROG_NUMBER      == 0