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_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();
     }
 }