Optimaze with new mbed os for study
Dependencies: TS_DISCO_F746NG BSP_DISCO_F746NG Graphics
PointingDevice/TouchScreen.h@4:66f13188c26b, 2016-11-05 (annotated)
- Committer:
- karpent
- Date:
- Sat Nov 05 20:24:59 2016 +0000
- Revision:
- 4:66f13188c26b
- Parent:
- 2:8db224cc1fcb
Code refactoring, 400ms timeout added when button is pressed.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
karpent | 2:8db224cc1fcb | 1 | /* |
karpent | 2:8db224cc1fcb | 2 | TouchScreen.h - Touchscreen |
karpent | 2:8db224cc1fcb | 3 | |
karpent | 2:8db224cc1fcb | 4 | Copyright(c) 2016 karpent at gmail.com, MIT License |
karpent | 2:8db224cc1fcb | 5 | |
karpent | 2:8db224cc1fcb | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), |
karpent | 2:8db224cc1fcb | 7 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
karpent | 2:8db224cc1fcb | 8 | 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 : |
karpent | 2:8db224cc1fcb | 9 | |
karpent | 2:8db224cc1fcb | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
karpent | 2:8db224cc1fcb | 11 | |
karpent | 2:8db224cc1fcb | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
karpent | 2:8db224cc1fcb | 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
karpent | 2:8db224cc1fcb | 14 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
karpent | 2:8db224cc1fcb | 15 | THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
karpent | 2:8db224cc1fcb | 16 | */ |
karpent | 2:8db224cc1fcb | 17 | |
karpent | 2:8db224cc1fcb | 18 | #pragma once |
karpent | 2:8db224cc1fcb | 19 | |
karpent | 2:8db224cc1fcb | 20 | #include "TS_DISCO_F746NG.h" |
karpent | 2:8db224cc1fcb | 21 | #include "RK043FN48H.h" |
karpent | 2:8db224cc1fcb | 22 | |
karpent | 2:8db224cc1fcb | 23 | /// <summary> |
karpent | 2:8db224cc1fcb | 24 | /// Touchscreen class |
karpent | 2:8db224cc1fcb | 25 | /// </summary> |
karpent | 2:8db224cc1fcb | 26 | class TouchScreen : public TS_DISCO_F746NG |
karpent | 2:8db224cc1fcb | 27 | { |
karpent | 2:8db224cc1fcb | 28 | public: |
karpent | 2:8db224cc1fcb | 29 | /// <summary> |
karpent | 2:8db224cc1fcb | 30 | /// Initializes a new instance of the <see cref="TouchScreen"/> class. |
karpent | 2:8db224cc1fcb | 31 | /// </summary> |
karpent | 4:66f13188c26b | 32 | TouchScreen(Display* display); |
karpent | 2:8db224cc1fcb | 33 | |
karpent | 2:8db224cc1fcb | 34 | /// <summary> |
karpent | 2:8db224cc1fcb | 35 | /// Finalizes an instance of the <see cref="TouchScreen"/> class. |
karpent | 2:8db224cc1fcb | 36 | /// </summary> |
karpent | 2:8db224cc1fcb | 37 | ~TouchScreen(); |
karpent | 2:8db224cc1fcb | 38 | |
karpent | 4:66f13188c26b | 39 | /** |
karpent | 4:66f13188c26b | 40 | * @brief Initializes and configures the touch screen functionalities and |
karpent | 4:66f13188c26b | 41 | * configures all necessary hardware resources (GPIOs, I2C, clocks..). |
karpent | 4:66f13188c26b | 42 | */ |
karpent | 4:66f13188c26b | 43 | void Init(); |
karpent | 4:66f13188c26b | 44 | |
karpent | 4:66f13188c26b | 45 | /// <summary> |
karpent | 4:66f13188c26b | 46 | /// Detect a touch. |
karpent | 4:66f13188c26b | 47 | /// Returns a pointer to tpoch point position or NULL if touch was not detected. |
karpent | 4:66f13188c26b | 48 | /// </summary> |
karpent | 4:66f13188c26b | 49 | pPoint DetectTouch(); |
karpent | 4:66f13188c26b | 50 | |
karpent | 4:66f13188c26b | 51 | Point touchPoint; |
karpent | 4:66f13188c26b | 52 | |
karpent | 4:66f13188c26b | 53 | private: |
karpent | 4:66f13188c26b | 54 | /// Maximum X size of the TS area on LCD |
karpent | 4:66f13188c26b | 55 | uint16_t _width; |
karpent | 4:66f13188c26b | 56 | |
karpent | 4:66f13188c26b | 57 | /// Maximum Y size of the TS area on LCD |
karpent | 4:66f13188c26b | 58 | uint16_t _height; |
karpent | 4:66f13188c26b | 59 | |
karpent | 4:66f13188c26b | 60 | TS_StateTypeDef tsState; |
karpent | 2:8db224cc1fcb | 61 | }; |
karpent | 2:8db224cc1fcb | 62 |