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 Hotboards MX

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Key.cpp Source File

Key.cpp

00001 /*
00002 || @file Key.cpp
00003 || @version 1.0
00004 || @author Mark Stanley
00005 || @contact mstanley@technologist.com
00006 ||
00007 || @description
00008 || | Key class provides an abstract definition of a key or button
00009 || | and was initially designed to be used in conjunction with a
00010 || | state-machine.
00011 || #
00012 ||
00013 || @license
00014 || | This library is free software; you can redistribute it and/or
00015 || | modify it under the terms of the GNU Lesser General Public
00016 || | License as published by the Free Software Foundation; version
00017 || | 2.1 of the License.
00018 || |
00019 || | This library is distributed in the hope that it will be useful,
00020 || | but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 || | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022 || | Lesser General Public License for more details.
00023 || |
00024 || | You should have received a copy of the GNU Lesser General Public
00025 || | License along with this library; if not, write to the Free Software
00026 || | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00027 || #
00028 ||
00029 */
00030 #include "Key.h"
00031 
00032 
00033 // default constructor
00034 Key::Key() {
00035     kchar = NO_KEY;
00036     kstate = IDLE;
00037     stateChanged = false;
00038 }
00039 
00040 // constructor
00041 Key::Key(char userKeyChar) {
00042     kchar = userKeyChar;
00043     kcode = -1;
00044     kstate = IDLE;
00045     stateChanged = false;
00046 }
00047 
00048 
00049 void Key::key_update (char userKeyChar, KeyState userState, bool userStatus) {
00050     kchar = userKeyChar;
00051     kstate = userState;
00052     stateChanged = userStatus;
00053 }
00054 
00055 
00056 
00057 /*
00058 || @changelog
00059 || | 1.0 2012-06-04 - Mark Stanley : Initial Release
00060 || #
00061 */