arduinoprojects

git clone https://git.tarina.org/arduinoprojects
Log | Files | Refs

Key.cpp (1488B)


      1 /*
      2 || @file Key.cpp
      3 || @version 1.0
      4 || @author Mark Stanley
      5 || @contact mstanley@technologist.com
      6 ||
      7 || @description
      8 || | Key class provides an abstract definition of a key or button
      9 || | and was initially designed to be used in conjunction with a
     10 || | state-machine.
     11 || #
     12 ||
     13 || @license
     14 || | This library is free software; you can redistribute it and/or
     15 || | modify it under the terms of the GNU Lesser General Public
     16 || | License as published by the Free Software Foundation; version
     17 || | 2.1 of the License.
     18 || |
     19 || | This library is distributed in the hope that it will be useful,
     20 || | but WITHOUT ANY WARRANTY; without even the implied warranty of
     21 || | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     22 || | Lesser General Public License for more details.
     23 || |
     24 || | You should have received a copy of the GNU Lesser General Public
     25 || | License along with this library; if not, write to the Free Software
     26 || | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     27 || #
     28 ||
     29 */
     30 #include <Key.h>
     31 
     32 
     33 // default constructor
     34 Key::Key() {
     35 	kchar = NO_KEY;
     36 	kstate = IDLE;
     37 	stateChanged = false;
     38 }
     39 
     40 // constructor
     41 Key::Key(char userKeyChar) {
     42 	kchar = userKeyChar;
     43 	kcode = -1;
     44 	kstate = IDLE;
     45 	stateChanged = false;
     46 }
     47 
     48 
     49 void Key::key_update (char userKeyChar, KeyState userState, boolean userStatus) {
     50 	kchar = userKeyChar;
     51 	kstate = userState;
     52 	stateChanged = userStatus;
     53 }
     54 
     55 
     56 
     57 /*
     58 || @changelog
     59 || | 1.0 2012-06-04 - Mark Stanley : Initial Release
     60 || #
     61 */