Sense keypresses from a 4x4 keypad A derivative ot he Hotboard_keypad library
Dependents: 26_Hotboards_MultiKey 26_Hotboards_EventKeypad
Fork of Hotboards_keypad by
Key.h
00001 /* 00002 || 00003 || @file Key.h 00004 || @version 1.0 00005 || @author Mark Stanley 00006 || @contact mstanley@technologist.com 00007 || 00008 || @description 00009 || | Key class provides an abstract definition of a key or button 00010 || | and was initially designed to be used in conjunction with a 00011 || | state-machine. 00012 || # 00013 || 00014 || @license 00015 || | This library is free software; you can redistribute it and/or 00016 || | modify it under the terms of the GNU Lesser General Public 00017 || | License as published by the Free Software Foundation; version 00018 || | 2.1 of the License. 00019 || | 00020 || | This library is distributed in the hope that it will be useful, 00021 || | but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 || | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00023 || | Lesser General Public License for more details. 00024 || | 00025 || | You should have received a copy of the GNU Lesser General Public 00026 || | License along with this library; if not, write to the Free Software 00027 || | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00028 || # 00029 || 00030 */ 00031 00032 #ifndef KEY_H 00033 #define KEY_H 00034 00035 #include "mbed.h" 00036 00037 #define OPEN 0 00038 #define CLOSED 1 00039 00040 typedef unsigned int uint; 00041 typedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState; 00042 00043 const char NO_KEY = '\0'; 00044 00045 class Key { 00046 public: 00047 // members 00048 char kchar; 00049 int kcode; 00050 KeyState kstate; 00051 bool stateChanged; 00052 00053 // methods 00054 Key(); 00055 Key(char userKeyChar); 00056 void key_update(char userKeyChar, KeyState userState, bool userStatus); 00057 00058 private: 00059 00060 }; 00061 00062 #endif 00063 00064 /* 00065 || @changelog 00066 || | 1.0 2012-06-04 - Mark Stanley : Initial Release 00067 || # 00068 */
Generated on Fri Jul 15 2022 01:02:16 by 1.7.2