test program for keypad(Extended not only 3x4 but 4x4,4x5 and 5x5 keys)

Dependencies:   Keypad

Fork of study_step0 by Team_PjL

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

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Sat Aug 01 07:49:39 2020 +0000
Parent:
3:0c888cad9376
Child:
5:53fb9eed6b67
Commit message:
changed pc.printf to printf

Changed in this revision

check_revision.cpp 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
mbed-os.lib 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/check_revision.cpp	Mon Apr 13 02:07:09 2020 +0000
+++ b/check_revision.cpp	Sat Aug 01 07:49:39 2020 +0000
@@ -5,22 +5,21 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Revised:    Feburary  16th, 2020
- *      Revised:    April      6th, 2020
+ *      Revised:    August     1st, 2020
  */
 
 #include "mbed.h"
-
-// RUN on mbed-os-6.0.0-alpha-3
-//    https://github.com/ARMmbed/mbed-os/releases/tag/mbed-os-6.0.0-alpha-3
-#if   (MBED_MAJOR_VERSION == 5) &&\
-      (MBED_MINOR_VERSION == 15) &&\
-      (MBED_PATCH_VERSION == 1)
-// RUN on mbed 2.0.165
+ 
+//    RUN ONLY ON mbed-os-6.2.0
+//      https://github.com/ARMmbed/mbed-os/releases/tag/mbed-os-6.2.0
+#if (MBED_MAJOR_VERSION == 6) &&\
+    (MBED_MINOR_VERSION == 2) &&\
+    (MBED_PATCH_VERSION == 0)
 #elif (MBED_MAJOR_VERSION == 2) &&\
       (MBED_MINOR_VERSION == 0) &&\
       (MBED_PATCH_VERSION == 165)
 #else
-#     error "Please use mbed-os-6.0.0-alpha-3 or mbed2-165"
+//#     error "Please use mbed-os-6.2.0-alpha-3 or mbed2-165"
 #endif
 
 void print_revision(void)
--- a/key_3x4.cpp	Mon Apr 13 02:07:09 2020 +0000
+++ b/key_3x4.cpp	Sat Aug 01 07:49:39 2020 +0000
@@ -8,7 +8,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    September 27th, 2017
- *      Revised:    April     13th, 2020
+ *      Revised:    August     1st, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -24,7 +24,6 @@
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
-Serial      pc(USBTX,USBRX);
 //              X    Y    Z   A   B   C   D   OUT(XYZ), IN(ABCD)
 Keypad      key(D11, D10, D9, D6, D5, D4, D3);
 
@@ -48,10 +47,10 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test 3x4 keys\r\n");
+    printf("Start Key-Pad test 3x4 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
-            pc.printf("%2u:[%2d] %c\r\n",
+            printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
         wait_us(100000);
--- a/key_4x4.cpp	Mon Apr 13 02:07:09 2020 +0000
+++ b/key_4x4.cpp	Sat Aug 01 07:49:39 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April     13th, 2020
+ *      Revised:    August     1st, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -21,7 +21,6 @@
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
-Serial      pc(USBTX,USBRX);
 //              X    Y    Z   W    A   B   C   D   OUT(XYZW), IN(ABCD)
 Keypad      key(D11, D10, D9, D8, D6, D5, D4, D3);
 
@@ -46,10 +45,10 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test 4x4 keys\r\n");
+    printf("Start Key-Pad test 4x4 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
-            pc.printf("%2u:[%2d] %c\r\n",
+            printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
         wait_us(100000);
--- a/key_4x5.cpp	Mon Apr 13 02:07:09 2020 +0000
+++ b/key_4x5.cpp	Sat Aug 01 07:49:39 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April     13th, 2020
+ *      Revised:    August     1st, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -21,7 +21,6 @@
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
-Serial      pc(USBTX,USBRX);
 //              X    Y    Z   W    A   B   C   D   E   OUT(XYZW), IN(ABCDE)
 Keypad      key(D11, D10, D9, D8, D6, D5, D4, D3, D2);
 
@@ -46,10 +45,10 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test 4x5 keys\r\n");
+    printf("Start Key-Pad test 4x5 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
-            pc.printf("%2u:[%2d] %c\r\n",
+            printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
         wait_us(100000);
--- a/key_5x5.cpp	Mon Apr 13 02:07:09 2020 +0000
+++ b/key_5x5.cpp	Sat Aug 01 07:49:39 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April     13th, 2020
+ *      Revised:    August     1st, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -21,7 +21,6 @@
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
-Serial      pc(USBTX,USBRX);
 //              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);
 
@@ -47,10 +46,10 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test 5x5 keys\r\n");
+    printf("Start Key-Pad test 5x5 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
-            pc.printf("%2u:[%2d] %c\r\n",
+            printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
         wait_us(100000);
--- a/key_complex.cpp	Mon Apr 13 02:07:09 2020 +0000
+++ b/key_complex.cpp	Sat Aug 01 07:49:39 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April     13th, 2020
+ *      Revised:    August     1st, 2020
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -28,7 +28,6 @@
 DigitalOut  led0(A0);
 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(D11, D10, D9, D8, D7, D6, D5, D4, D3, D2);
 
@@ -56,10 +55,10 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
-    pc.printf("Start Key-Pad test 5x5 keys and/or state hold switch\r\n");
+    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",
+            printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, key_table[key_num]);
         }
         if (key.read_state(A_SW) == true) {
--- a/mbed-os.lib	Mon Apr 13 02:07:09 2020 +0000
+++ b/mbed-os.lib	Sat Aug 01 07:49:39 2020 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#532654ebb31c7bf79601042a6fa976b85532ef47
+https://github.com/ARMmbed/mbed-os/#a2ada74770f043aff3e61e29d164a8e78274fcd4
--- a/select_example.h	Mon Apr 13 02:07:09 2020 +0000
+++ b/select_example.h	Sat Aug 01 07:49:39 2020 +0000
@@ -5,7 +5,7 @@
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    April     13th, 2020
+ *      Revised:    August     1st, 2020
  */
 /*
     You can select several examples as followings.