sergio burbano
/
lcd_teclado
LDC_TECLADO_MATRICIAL
keypad.h@0:5ea4be70fe49, 2017-09-16 (annotated)
- Committer:
- grupo3
- Date:
- Sat Sep 16 21:55:16 2017 +0000
- Revision:
- 0:5ea4be70fe49
Grupo 3; LCD_TECLADO_MATRICIAL;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
grupo3 | 0:5ea4be70fe49 | 1 | /* Copyright (c) 2010 Dimiter Kentri |
grupo3 | 0:5ea4be70fe49 | 2 | |
grupo3 | 0:5ea4be70fe49 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy |
grupo3 | 0:5ea4be70fe49 | 4 | of this software and associated documentation files (the "Software"), to deal |
grupo3 | 0:5ea4be70fe49 | 5 | in the Software without restriction, including without limitation the rights |
grupo3 | 0:5ea4be70fe49 | 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
grupo3 | 0:5ea4be70fe49 | 7 | copies of the Software, and to permit persons to whom the Software is |
grupo3 | 0:5ea4be70fe49 | 8 | furnished to do so, subject to the following conditions: |
grupo3 | 0:5ea4be70fe49 | 9 | |
grupo3 | 0:5ea4be70fe49 | 10 | The above copyright notice and this permission notice shall be included in |
grupo3 | 0:5ea4be70fe49 | 11 | all copies or substantial portions of the Software. |
grupo3 | 0:5ea4be70fe49 | 12 | |
grupo3 | 0:5ea4be70fe49 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
grupo3 | 0:5ea4be70fe49 | 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
grupo3 | 0:5ea4be70fe49 | 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
grupo3 | 0:5ea4be70fe49 | 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
grupo3 | 0:5ea4be70fe49 | 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
grupo3 | 0:5ea4be70fe49 | 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
grupo3 | 0:5ea4be70fe49 | 19 | THE SOFTWARE. |
grupo3 | 0:5ea4be70fe49 | 20 | */ |
grupo3 | 0:5ea4be70fe49 | 21 | |
grupo3 | 0:5ea4be70fe49 | 22 | #ifndef KEYPAD_H |
grupo3 | 0:5ea4be70fe49 | 23 | #define KEYPAD_H |
grupo3 | 0:5ea4be70fe49 | 24 | |
grupo3 | 0:5ea4be70fe49 | 25 | #include "DigitalIn.h" |
grupo3 | 0:5ea4be70fe49 | 26 | #include "BusOut.h" |
grupo3 | 0:5ea4be70fe49 | 27 | |
grupo3 | 0:5ea4be70fe49 | 28 | |
grupo3 | 0:5ea4be70fe49 | 29 | namespace mbed{ |
grupo3 | 0:5ea4be70fe49 | 30 | |
grupo3 | 0:5ea4be70fe49 | 31 | const char NO_KEY = '\0'; |
grupo3 | 0:5ea4be70fe49 | 32 | #define KEY_RELEASED NO_KEY |
grupo3 | 0:5ea4be70fe49 | 33 | |
grupo3 | 0:5ea4be70fe49 | 34 | |
grupo3 | 0:5ea4be70fe49 | 35 | |
grupo3 | 0:5ea4be70fe49 | 36 | const int keys[16] = {'1','2','3','A', |
grupo3 | 0:5ea4be70fe49 | 37 | '4','5','6','B', |
grupo3 | 0:5ea4be70fe49 | 38 | '7','8','9','C', |
grupo3 | 0:5ea4be70fe49 | 39 | '*','0','#','D'}; |
grupo3 | 0:5ea4be70fe49 | 40 | |
grupo3 | 0:5ea4be70fe49 | 41 | class Keypad{ |
grupo3 | 0:5ea4be70fe49 | 42 | public: |
grupo3 | 0:5ea4be70fe49 | 43 | Keypad(PinName col1, PinName col2, PinName col3, PinName col4, PinName row1,PinName row2, PinName row3, PinName row4); |
grupo3 | 0:5ea4be70fe49 | 44 | int getKeyIndex(); |
grupo3 | 0:5ea4be70fe49 | 45 | char getKey(); |
grupo3 | 0:5ea4be70fe49 | 46 | |
grupo3 | 0:5ea4be70fe49 | 47 | protected: |
grupo3 | 0:5ea4be70fe49 | 48 | DigitalIn _col1,_col2,_col3,_col4; |
grupo3 | 0:5ea4be70fe49 | 49 | BusOut _rows; |
grupo3 | 0:5ea4be70fe49 | 50 | }; |
grupo3 | 0:5ea4be70fe49 | 51 | |
grupo3 | 0:5ea4be70fe49 | 52 | } |
grupo3 | 0:5ea4be70fe49 | 53 | #endif |