driver to control n by m matrix keyboard with external pull-ups on columns
Dependents: LoopCounter HelloKeypad MultiKey EventKeypad ... more
Key.cpp@2:e870110f753b, 2016-03-04 (annotated)
- Committer:
- Hotboards
- Date:
- Fri Mar 04 02:37:55 2016 +0000
- Revision:
- 2:e870110f753b
- Parent:
- 0:4ca112f96484
first fucntional release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Hotboards | 0:4ca112f96484 | 1 | /* |
Hotboards | 0:4ca112f96484 | 2 | || @file Key.cpp |
Hotboards | 0:4ca112f96484 | 3 | || @version 1.0 |
Hotboards | 0:4ca112f96484 | 4 | || @author Mark Stanley |
Hotboards | 0:4ca112f96484 | 5 | || @contact mstanley@technologist.com |
Hotboards | 0:4ca112f96484 | 6 | || |
Hotboards | 0:4ca112f96484 | 7 | || @description |
Hotboards | 0:4ca112f96484 | 8 | || | Key class provides an abstract definition of a key or button |
Hotboards | 0:4ca112f96484 | 9 | || | and was initially designed to be used in conjunction with a |
Hotboards | 0:4ca112f96484 | 10 | || | state-machine. |
Hotboards | 0:4ca112f96484 | 11 | || # |
Hotboards | 0:4ca112f96484 | 12 | || |
Hotboards | 0:4ca112f96484 | 13 | || @license |
Hotboards | 0:4ca112f96484 | 14 | || | This library is free software; you can redistribute it and/or |
Hotboards | 0:4ca112f96484 | 15 | || | modify it under the terms of the GNU Lesser General Public |
Hotboards | 0:4ca112f96484 | 16 | || | License as published by the Free Software Foundation; version |
Hotboards | 0:4ca112f96484 | 17 | || | 2.1 of the License. |
Hotboards | 0:4ca112f96484 | 18 | || | |
Hotboards | 0:4ca112f96484 | 19 | || | This library is distributed in the hope that it will be useful, |
Hotboards | 0:4ca112f96484 | 20 | || | but WITHOUT ANY WARRANTY; without even the implied warranty of |
Hotboards | 0:4ca112f96484 | 21 | || | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Hotboards | 0:4ca112f96484 | 22 | || | Lesser General Public License for more details. |
Hotboards | 0:4ca112f96484 | 23 | || | |
Hotboards | 0:4ca112f96484 | 24 | || | You should have received a copy of the GNU Lesser General Public |
Hotboards | 0:4ca112f96484 | 25 | || | License along with this library; if not, write to the Free Software |
Hotboards | 0:4ca112f96484 | 26 | || | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Hotboards | 0:4ca112f96484 | 27 | || # |
Hotboards | 0:4ca112f96484 | 28 | || |
Hotboards | 0:4ca112f96484 | 29 | */ |
Hotboards | 0:4ca112f96484 | 30 | #include "Key.h" |
Hotboards | 0:4ca112f96484 | 31 | |
Hotboards | 0:4ca112f96484 | 32 | |
Hotboards | 0:4ca112f96484 | 33 | // default constructor |
Hotboards | 0:4ca112f96484 | 34 | Key::Key() { |
Hotboards | 0:4ca112f96484 | 35 | kchar = NO_KEY; |
Hotboards | 0:4ca112f96484 | 36 | kstate = IDLE; |
Hotboards | 0:4ca112f96484 | 37 | stateChanged = false; |
Hotboards | 0:4ca112f96484 | 38 | } |
Hotboards | 0:4ca112f96484 | 39 | |
Hotboards | 0:4ca112f96484 | 40 | // constructor |
Hotboards | 0:4ca112f96484 | 41 | Key::Key(char userKeyChar) { |
Hotboards | 0:4ca112f96484 | 42 | kchar = userKeyChar; |
Hotboards | 0:4ca112f96484 | 43 | kcode = -1; |
Hotboards | 0:4ca112f96484 | 44 | kstate = IDLE; |
Hotboards | 0:4ca112f96484 | 45 | stateChanged = false; |
Hotboards | 0:4ca112f96484 | 46 | } |
Hotboards | 0:4ca112f96484 | 47 | |
Hotboards | 0:4ca112f96484 | 48 | |
Hotboards | 0:4ca112f96484 | 49 | void Key::key_update (char userKeyChar, KeyState userState, bool userStatus) { |
Hotboards | 0:4ca112f96484 | 50 | kchar = userKeyChar; |
Hotboards | 0:4ca112f96484 | 51 | kstate = userState; |
Hotboards | 0:4ca112f96484 | 52 | stateChanged = userStatus; |
Hotboards | 0:4ca112f96484 | 53 | } |
Hotboards | 0:4ca112f96484 | 54 | |
Hotboards | 0:4ca112f96484 | 55 | |
Hotboards | 0:4ca112f96484 | 56 | |
Hotboards | 0:4ca112f96484 | 57 | /* |
Hotboards | 0:4ca112f96484 | 58 | || @changelog |
Hotboards | 0:4ca112f96484 | 59 | || | 1.0 2012-06-04 - Mark Stanley : Initial Release |
Hotboards | 0:4ca112f96484 | 60 | || # |
Hotboards | 0:4ca112f96484 | 61 | */ |