Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
F7_TSKeypad_MultiKey.h
00001 /* F7 TS Keypad Multi Key Library v1.0 00002 * Copyright (c) 2017 Armand Coetzer 00003 * s213293048@nmmu.ac.za 00004 * 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a copy 00007 * of this software and associated documentation files (the "Software"), to deal 00008 * in the Software without restriction, including without limitation the rights 00009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00010 * copies of the Software, and to permit persons to whom the Software is 00011 * furnished to do so, subject to the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included in 00014 * all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00022 * THE SOFTWARE. 00023 */ 00024 00025 #ifndef F7_TSKeypad_MultiKey_H 00026 #define F7_TSKeypad_MultiKey_H 00027 00028 #include "mbed.h" 00029 #include "LCD_DISCO_F746NG.h" 00030 #include "TS_DISCO_F746NG.h" 00031 00032 /** Class library for a TS Keypad and retrieving multiple keys, then press enter and the values are stored and the keypad disappears. 00033 * 00034 * Example: 00035 * @code 00036 *#include "mbed.h" 00037 *#include "F7_TSKeypad_MultiKey.h" 00038 00039 *F7_TSKeypad_MultiKey keypad; 00040 *LCD_DISCO_F746NG lcd; 00041 * 00042 *uint8_t text1[30]; 00043 *char s[100]; 00044 * 00045 *int main() 00046 *{ 00047 * lcd.SetFont(&Font12); 00048 * lcd.Clear(LCD_COLOR_BLUE); 00049 * lcd.SetBackColor(LCD_COLOR_BLUE); 00050 * lcd.SetTextColor(LCD_COLOR_WHITE); 00051 * 00052 * while(1) 00053 * { 00054 * keypad.getkeys(s, 170, 20, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'); 00055 * 00056 * sprintf((char*)text1, "%s", s); 00057 * lcd.DisplayStringAt(0, LINE(5), (uint8_t *)&text1, LEFT_MODE); 00058 * 00059 * wait(1); 00060 * } 00061 *} 00062 * @endcode 00063 */ 00064 00065 class F7_TSKeypad_MultiKey 00066 { 00067 00068 public: 00069 /** Constructor. 00070 */ 00071 F7_TSKeypad_MultiKey(); 00072 00073 /** Retrieves the keys selected as a string. 00074 * @param str[] - stores the keys selected in this array. 00075 * @param startx - to set x start pos of the keypad. 00076 * @param starty - to set y start pos of the keypad. 00077 * @param char1 - char16 to change the keys of the keypad. 00078 * @retval None. 00079 */ 00080 void getkeys(char str[], uint8_t startx, uint8_t starty,char char1, char char2, char char3, char char4, char char5, char char6, char char7, char char8, char char9, char char10, char char11, char char12, char char13, char char14, char char15, char char16); 00081 00082 private: 00083 00084 void Detect_isr(); 00085 void DrawKeypad(uint8_t startpointx, uint8_t startpointy,char char1, char char2, char char3, char char4, char char5, char char6, char char7, char char8, char char9, char char10, char char11, char char12, char char13, char char14, char char15, char char16); 00086 00087 Ticker ticker; 00088 sFONT *FontSize; 00089 LCD_DISCO_F746NG lcd; 00090 TS_DISCO_F746NG ts; 00091 TS_StateTypeDef TS_State; 00092 00093 uint8_t state, btnsize; 00094 int OK; 00095 uint32_t Bckclr, Txtclr; 00096 uint8_t correcttouch, button, key; 00097 uint16_t frstprsx, frstprsy; 00098 char keypressed; 00099 int a, b, recv; 00100 int keypad; 00101 int keypadstartX[4][4]; 00102 int keypadstartY[4][4]; 00103 int keypadendX[4][4]; 00104 int keypadendY[4][4]; 00105 uint8_t status; 00106 int m, textx, Enter; 00107 }; 00108 00109 #endif
Generated on Thu Sep 22 2022 04:31:38 by
1.7.2