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/

Revision:
5:53fb9eed6b67
Parent:
4:0564f82dd0ef
--- 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();
     }
 }