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:
Thu Feb 18 08:15:37 2021 +0000
Parent:
4:0564f82dd0ef
Commit message:
run on mbed-os6.6.0 (online compiler)

Changed in this revision

Keypad.lib Show annotated file Show diff for this revision Revisions of this file
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
diff -r 0564f82dd0ef -r 53fb9eed6b67 Keypad.lib
--- a/Keypad.lib	Sat Aug 01 07:49:39 2020 +0000
+++ b/Keypad.lib	Thu Feb 18 08:15:37 2021 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/kenjiArai/code/Keypad/#f74ca02cdba1
+https://os.mbed.com/users/kenjiArai/code/Keypad/#8929ce2f393c
diff -r 0564f82dd0ef -r 53fb9eed6b67 check_revision.cpp
--- a/check_revision.cpp	Sat Aug 01 07:49:39 2020 +0000
+++ b/check_revision.cpp	Thu Feb 18 08:15:37 2021 +0000
@@ -1,25 +1,22 @@
 /*
  * Check Mbed revision
  *
- * Copyright (c) 2020 Kenji Arai / JH1PJL
+ * Copyright (c) 2020,'21 Kenji Arai / JH1PJL
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
- *      Revised:    Feburary  16th, 2020
- *      Revised:    August     1st, 2020
+ *      Revised:    February  16th, 2020
+ *      Revised:    February  18th, 2021
  */
 
 #include "mbed.h"
  
-//    RUN ONLY ON mbed-os-6.2.0
-//      https://github.com/ARMmbed/mbed-os/releases/tag/mbed-os-6.2.0
+//    RUN ONLY ON mbed-os-6.6.0
+//      https://github.com/ARMmbed/mbed-os/releases/tag/mbed-os-6.6.0
 #if (MBED_MAJOR_VERSION == 6) &&\
-    (MBED_MINOR_VERSION == 2) &&\
+    (MBED_MINOR_VERSION == 6) &&\
     (MBED_PATCH_VERSION == 0)
-#elif (MBED_MAJOR_VERSION == 2) &&\
-      (MBED_MINOR_VERSION == 0) &&\
-      (MBED_PATCH_VERSION == 165)
 #else
-//#     error "Please use mbed-os-6.2.0-alpha-3 or mbed2-165"
+#   warning "tested on mbed-os-6.6.0"
 #endif
 
 void print_revision(void)
diff -r 0564f82dd0ef -r 53fb9eed6b67 key_3x4.cpp
--- a/key_3x4.cpp	Sat Aug 01 07:49:39 2020 +0000
+++ b/key_3x4.cpp	Thu Feb 18 08:15:37 2021 +0000
@@ -4,11 +4,11 @@
  *      Akizuki AE-KIT45-KEYPAD4X3
  *      http://akizukidenshi.com/catalog/g/gK-12229/
  *
- * Copyright (c) 2017,'20 Kenji Arai / JH1PJL
+ * Copyright (c) 2017,'20,'21 Kenji Arai / JH1PJL
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    September 27th, 2017
- *      Revised:    August     1st, 2020
+ *      Revised:    February  18th, 2021
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -21,6 +21,11 @@
 #include "Keypad.h"
 
 //  Definition -----------------------------------------------------------------
+#if (MBED_MAJOR_VERSION == 2) || (MBED_MAJOR_VERSION == 5)
+#   define  WAIT_100MS()     {wait_us(100000);}
+#else
+#   define  WAIT_100MS()     {ThisThread::sleep_for(100ms);}
+#endif
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
@@ -38,6 +43,7 @@
 //                              123456789012
 
 //  Function prototypes --------------------------------------------------------
+extern void print_revision(void);
 
 //------------------------------------------------------------------------------
 //  Control Program
@@ -47,13 +53,14 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
+    print_revision();
     printf("Start Key-Pad test 3x4 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
-        wait_us(100000);
+        WAIT_100MS();
     }
 }
 
diff -r 0564f82dd0ef -r 53fb9eed6b67 key_4x4.cpp
--- a/key_4x4.cpp	Sat Aug 01 07:49:39 2020 +0000
+++ b/key_4x4.cpp	Thu Feb 18 08:15:37 2021 +0000
@@ -1,11 +1,11 @@
 /*
  * Mbed Application program
  *
- * Copyright (c) 2020 Kenji Arai / JH1PJL
+ * Copyright (c) 2020,'21 Kenji Arai / JH1PJL
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    August     1st, 2020
+ *      Revised:    February  18th, 2021
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -18,6 +18,11 @@
 #include "Keypad.h"
 
 //  Definition -----------------------------------------------------------------
+#if (MBED_MAJOR_VERSION == 2) || (MBED_MAJOR_VERSION == 5)
+#   define  WAIT_100MS()     {wait_us(100000);}
+#else
+#   define  WAIT_100MS()     {ThisThread::sleep_for(100ms);}
+#endif
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
@@ -36,6 +41,7 @@
 //                              1234567890123456
 
 //  Function prototypes --------------------------------------------------------
+extern void print_revision(void);
 
 //------------------------------------------------------------------------------
 //  Control Program
@@ -45,13 +51,14 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
+    print_revision();
     printf("Start Key-Pad test 4x4 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
-        wait_us(100000);
+        WAIT_100MS();
     }
 }
 
diff -r 0564f82dd0ef -r 53fb9eed6b67 key_4x5.cpp
--- a/key_4x5.cpp	Sat Aug 01 07:49:39 2020 +0000
+++ b/key_4x5.cpp	Thu Feb 18 08:15:37 2021 +0000
@@ -1,11 +1,11 @@
 /*
  * Mbed Application program
  *
- * Copyright (c) 2020 Kenji Arai / JH1PJL
+ * Copyright (c) 2020,'21 Kenji Arai / JH1PJL
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    August     1st, 2020
+ *      Revised:    February  18th, 2021
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -18,6 +18,11 @@
 #include "Keypad.h"
 
 //  Definition -----------------------------------------------------------------
+#if (MBED_MAJOR_VERSION == 2) || (MBED_MAJOR_VERSION == 5)
+#   define  WAIT_100MS()     {wait_us(100000);}
+#else
+#   define  WAIT_100MS()     {ThisThread::sleep_for(100ms);}
+#endif
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
@@ -36,6 +41,7 @@
 //                              12345678901234567890
 
 //  Function prototypes --------------------------------------------------------
+extern void print_revision(void);
 
 //------------------------------------------------------------------------------
 //  Control Program
@@ -45,13 +51,14 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
+    print_revision();
     printf("Start Key-Pad test 4x5 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
-        wait_us(100000);
+        WAIT_100MS();
     }
 }
 
diff -r 0564f82dd0ef -r 53fb9eed6b67 key_5x5.cpp
--- a/key_5x5.cpp	Sat Aug 01 07:49:39 2020 +0000
+++ b/key_5x5.cpp	Thu Feb 18 08:15:37 2021 +0000
@@ -1,11 +1,11 @@
 /*
  * Mbed Application program
  *
- * Copyright (c) 2020 Kenji Arai / JH1PJL
+ * Copyright (c) 2020,'21 Kenji Arai / JH1PJL
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    August     1st, 2020
+ *      Revised:    February  18th, 2021
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -18,6 +18,11 @@
 #include "Keypad.h"
 
 //  Definition -----------------------------------------------------------------
+#if (MBED_MAJOR_VERSION == 2) || (MBED_MAJOR_VERSION == 5)
+#   define  WAIT_100MS()     {wait_us(100000);}
+#else
+#   define  WAIT_100MS()     {ThisThread::sleep_for(100ms);}
+#endif
 
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(LED1);
@@ -37,6 +42,7 @@
 //                              1234567890123456789012345
 
 //  Function prototypes --------------------------------------------------------
+extern void print_revision(void);
 
 //------------------------------------------------------------------------------
 //  Control Program
@@ -46,13 +52,14 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
+    print_revision();
     printf("Start Key-Pad test 5x5 keys\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
             printf("%2u:[%2d] %c\r\n",
                       counter++, key_num, *(key_table + key_num));
         }
-        wait_us(100000);
+        WAIT_100MS();
     }
 }
 
diff -r 0564f82dd0ef -r 53fb9eed6b67 key_complex.cpp
--- a/key_complex.cpp	Sat Aug 01 07:49:39 2020 +0000
+++ b/key_complex.cpp	Thu Feb 18 08:15:37 2021 +0000
@@ -1,11 +1,11 @@
 /*
  * Mbed Application program
  *
- * Copyright (c) 2020 Kenji Arai / JH1PJL
+ * Copyright (c) 2020,'21 Kenji Arai / JH1PJL
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    August     1st, 2020
+ *      Revised:    February  18th, 2021
  */
 
 //  Pre-selection --------------------------------------------------------------
@@ -22,6 +22,12 @@
 #define B_SW     3      // see key_table[3]  = B
 #define C_SW     8      // see key_table[8]  = C
 
+#if (MBED_MAJOR_VERSION == 2) || (MBED_MAJOR_VERSION == 5)
+#   define  WAIT_100MS()     {wait_us(100000);}
+#else
+#   define  WAIT_100MS()     {ThisThread::sleep_for(100ms);}
+#endif
+
 //  Object ---------------------------------------------------------------------
 DigitalOut  my_led(D13);
 //DigitalOut  my_led(LED1);
@@ -46,6 +52,7 @@
                          };
 
 //  Function prototypes --------------------------------------------------------
+extern void print_revision(void);
 
 //------------------------------------------------------------------------------
 //  Control Program
@@ -55,6 +62,7 @@
     uint32_t key_num;
     uint32_t counter = 0;
 
+    print_revision();
     printf("Start Key-Pad test 5x5 keys and/or state hold switch\r\n");
     while(true) {
         while ((key_num = key.read()) != 0) {
@@ -76,7 +84,7 @@
         } else {
             led2 = 0;
         }
-        wait_us(100000);
+        WAIT_100MS();
     }
 }
 
diff -r 0564f82dd0ef -r 53fb9eed6b67 mbed-os.lib
--- a/mbed-os.lib	Sat Aug 01 07:49:39 2020 +0000
+++ b/mbed-os.lib	Thu Feb 18 08:15:37 2021 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#a2ada74770f043aff3e61e29d164a8e78274fcd4
+https://github.com/ARMmbed/mbed-os/#26606218ad9d1ee1c8781aa73774fd7ea3a7658e
diff -r 0564f82dd0ef -r 53fb9eed6b67 select_example.h
--- a/select_example.h	Sat Aug 01 07:49:39 2020 +0000
+++ b/select_example.h	Thu Feb 18 08:15:37 2021 +0000
@@ -1,11 +1,11 @@
 /*
  * Mbed Application program
  *
- * Copyright (c) 2020 Kenji Arai / JH1PJL
+ * Copyright (c) 2020,'21 Kenji Arai / JH1PJL
  *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      5th, 2020
- *      Revised:    August     1st, 2020
+ *      Revised:    February  18th, 2021
  */
 /*
     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     1       // select 0 to 4
 
 //----------------- You don't need any modification ----------------------------
 #if PROG_NUMBER      == 0