Class library for a touchscreen-based keypad for the LCD display present on the DISCO_F429ZI board.
Dependents: WIRE-BANDING_FT810 WIRE-BANDING_copy
KEYPAD_DISCO_F429ZI.h
- Committer:
- grantphillips
- Date:
- 2016-05-08
- Revision:
- 1:1db4c6c394bb
- Parent:
- 0:8cc22acc00d2
- Child:
- 2:51f454b7c9ab
File content as of revision 1:1db4c6c394bb:
/* KEYPAD_DISCO_F429ZI Library v1.0 * Copyright (c) 2016 Grant Phillips * grant.phillips@nmmu.ac.za * * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef KEYPAD_DISCO_F429ZI_H #define KEYPAD_DISCO_F429ZI_H #include "mbed.h" #include "TS_DISCO_F429ZI.h" #include "LCD_DISCO_F429ZI.h" /** Class library for a touchscreen-based keypad for the LCD display present on the DISCO_F429ZI board. * * Example: * @code * #include "mbed.h" * #include "HCSR04.h" * * HCSR04 distance(PB_8, PA_1); * * int main() { * while(1){ * SWO.printf("Distance = %d (us) %f (cm)\n", distance.read_us(), distance.read_cm()); * } * } * @endcode */ class KEYPAD_DISCO_F429ZI { public: /** Create a KEYPAD_DISCO_F429ZI object. */ KEYPAD_DISCO_F429ZI(); /** Draws the keys for the keypad and the Message Box and Output Box areas if enabled. * @param * MessageBoxEnable Enable (=1) or disable(=0 the drawing of a Message Box area on the keypad screen. * @param * OutBoxEnable Enable (=1) or disable(=0 the drawing of a Output Box area on the keypad screen. */ void Show(int MessageBoxEnable, int OutBoxEnable); /** Return the current key pressed on the keypad. * @param * None * @return * ASCII character of the key pressed. Will be NULL ('/0') if no key is pressed. */ char ReadKey(); private: LCD_DISCO_F429ZI lcd; TS_DISCO_F429ZI ts; uint16_t LastkeyX, LastkeyY; uint8_t LastKey; uint8_t ReadKeyState; uint16_t KeysTopY; uint8_t row, col; uint8_t Keys[4][4]; uint32_t MsgBColor, MsgFColor; uint32_t OutBColor, OutFColor; uint32_t KeyBColor, KeyFColor, KeyPressColor; uint32_t BackColor; int MessageBoxEnabledFlag, OutBoxEnabledFlag; }; #endif