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.
Dependencies: DM_FATFileSystem EthernetInterface HTTPClient mbed-rtos mbed-src
Fork of DMSupport by
Display/TouchPanel.h@10:1ac4b213f0f7, 2014-12-19 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Dec 19 09:03:25 2014 +0100
- Revision:
- 10:1ac4b213f0f7
- Parent:
- 9:a33326afd686
- Child:
- 22:1a58a518435c
- Added support for executing code in SDRAM.
- Restructured the Display/Touch interfaces.
- Added loading of Display/Touch BIOS.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| embeddedartists | 0:6b68dac0d986 | 1 | /* |
| embeddedartists | 9:a33326afd686 | 2 | * Copyright 2014 Embedded Artists AB |
| embeddedartists | 0:6b68dac0d986 | 3 | * |
| embeddedartists | 0:6b68dac0d986 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| embeddedartists | 0:6b68dac0d986 | 5 | * you may not use this file except in compliance with the License. |
| embeddedartists | 0:6b68dac0d986 | 6 | * You may obtain a copy of the License at |
| embeddedartists | 0:6b68dac0d986 | 7 | * |
| embeddedartists | 0:6b68dac0d986 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| embeddedartists | 0:6b68dac0d986 | 9 | * |
| embeddedartists | 0:6b68dac0d986 | 10 | * Unless required by applicable law or agreed to in writing, software |
| embeddedartists | 0:6b68dac0d986 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| embeddedartists | 0:6b68dac0d986 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| embeddedartists | 0:6b68dac0d986 | 13 | * See the License for the specific language governing permissions and |
| embeddedartists | 0:6b68dac0d986 | 14 | * limitations under the License. |
| embeddedartists | 0:6b68dac0d986 | 15 | */ |
| embeddedartists | 0:6b68dac0d986 | 16 | |
| embeddedartists | 0:6b68dac0d986 | 17 | #ifndef TOUCHPANEL_H |
| embeddedartists | 0:6b68dac0d986 | 18 | #define TOUCHPANEL_H |
| embeddedartists | 0:6b68dac0d986 | 19 | |
| embeddedartists | 10:1ac4b213f0f7 | 20 | #include "bios.h" |
| embeddedartists | 10:1ac4b213f0f7 | 21 | |
| embeddedartists | 0:6b68dac0d986 | 22 | /** |
| embeddedartists | 0:6b68dac0d986 | 23 | * An abstract class that represents touch panels. |
| embeddedartists | 0:6b68dac0d986 | 24 | */ |
| embeddedartists | 0:6b68dac0d986 | 25 | class TouchPanel { |
| embeddedartists | 0:6b68dac0d986 | 26 | public: |
| embeddedartists | 0:6b68dac0d986 | 27 | |
| embeddedartists | 0:6b68dac0d986 | 28 | typedef struct { |
| embeddedartists | 10:1ac4b213f0f7 | 29 | uint16_t x; |
| embeddedartists | 10:1ac4b213f0f7 | 30 | uint16_t y; |
| embeddedartists | 10:1ac4b213f0f7 | 31 | uint16_t z; |
| embeddedartists | 0:6b68dac0d986 | 32 | } touchCoordinate_t; |
| embeddedartists | 0:6b68dac0d986 | 33 | |
| embeddedartists | 10:1ac4b213f0f7 | 34 | enum TouchError { |
| embeddedartists | 10:1ac4b213f0f7 | 35 | TouchError_Ok = BiosError_Ok, |
| embeddedartists | 10:1ac4b213f0f7 | 36 | TouchError_ConfigError = BiosError_ConfigError, |
| embeddedartists | 10:1ac4b213f0f7 | 37 | TouchError_WrongBPP = BiosError_WrongBPP, |
| embeddedartists | 10:1ac4b213f0f7 | 38 | TouchError_InvalidParam = BiosError_InvalidParam, |
| embeddedartists | 10:1ac4b213f0f7 | 39 | TouchError_NoInit = BiosError_NoInit, |
| embeddedartists | 10:1ac4b213f0f7 | 40 | TouchError_CalibrationError = BiosError_Calibration, |
| embeddedartists | 10:1ac4b213f0f7 | 41 | TouchError_MemoryError, |
| embeddedartists | 10:1ac4b213f0f7 | 42 | TouchError_TouchNotSupported, |
| embeddedartists | 10:1ac4b213f0f7 | 43 | TouchError_Timeout, |
| embeddedartists | 10:1ac4b213f0f7 | 44 | }; |
| embeddedartists | 0:6b68dac0d986 | 45 | |
| embeddedartists | 0:6b68dac0d986 | 46 | /** |
| embeddedartists | 0:6b68dac0d986 | 47 | * Read coordinates from the touch panel. |
| embeddedartists | 0:6b68dac0d986 | 48 | * |
| embeddedartists | 0:6b68dac0d986 | 49 | * @param coord pointer to coordinate object. The read coordinates will be |
| embeddedartists | 0:6b68dac0d986 | 50 | * written to this object. |
| embeddedartists | 10:1ac4b213f0f7 | 51 | * |
| embeddedartists | 10:1ac4b213f0f7 | 52 | * @returns |
| embeddedartists | 10:1ac4b213f0f7 | 53 | * Ok on success |
| embeddedartists | 10:1ac4b213f0f7 | 54 | * An error code on failure |
| embeddedartists | 0:6b68dac0d986 | 55 | */ |
| embeddedartists | 10:1ac4b213f0f7 | 56 | virtual TouchError read(touchCoordinate_t &coord) = 0; |
| embeddedartists | 0:6b68dac0d986 | 57 | |
| embeddedartists | 0:6b68dac0d986 | 58 | /** |
| embeddedartists | 0:6b68dac0d986 | 59 | * Start to calibrate the display |
| embeddedartists | 0:6b68dac0d986 | 60 | * |
| embeddedartists | 10:1ac4b213f0f7 | 61 | * @returns |
| embeddedartists | 10:1ac4b213f0f7 | 62 | * Ok on success |
| embeddedartists | 10:1ac4b213f0f7 | 63 | * An error code on failure |
| embeddedartists | 0:6b68dac0d986 | 64 | */ |
| embeddedartists | 10:1ac4b213f0f7 | 65 | virtual TouchError calibrateStart() = 0; |
| embeddedartists | 0:6b68dac0d986 | 66 | |
| embeddedartists | 0:6b68dac0d986 | 67 | /** |
| embeddedartists | 0:6b68dac0d986 | 68 | * Get the next calibration point. Draw an indicator on the screen |
| embeddedartists | 0:6b68dac0d986 | 69 | * at the coordinates and ask the user to press/click on the indicator. |
| embeddedartists | 0:6b68dac0d986 | 70 | * Please note that waitForCalibratePoint() must be called after this |
| embeddedartists | 0:6b68dac0d986 | 71 | * method. |
| embeddedartists | 0:6b68dac0d986 | 72 | * |
| embeddedartists | 4:6fdcdf7aff8d | 73 | * @param x the x coordinate is written to this argument |
| embeddedartists | 4:6fdcdf7aff8d | 74 | * @param y the y coordinate is written to this argument |
| embeddedartists | 4:6fdcdf7aff8d | 75 | * @param last true if this is the last coordinate in the series |
| embeddedartists | 0:6b68dac0d986 | 76 | * |
| embeddedartists | 10:1ac4b213f0f7 | 77 | * @returns |
| embeddedartists | 10:1ac4b213f0f7 | 78 | * Ok on success |
| embeddedartists | 10:1ac4b213f0f7 | 79 | * An error code on failure |
| embeddedartists | 0:6b68dac0d986 | 80 | */ |
| embeddedartists | 10:1ac4b213f0f7 | 81 | virtual TouchError getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL) = 0; |
| embeddedartists | 0:6b68dac0d986 | 82 | |
| embeddedartists | 0:6b68dac0d986 | 83 | /** |
| embeddedartists | 0:6b68dac0d986 | 84 | * Wait for a calibration point to have been pressed and recored. |
| embeddedartists | 0:6b68dac0d986 | 85 | * This method must be called just after getNextCalibratePoint(). |
| embeddedartists | 0:6b68dac0d986 | 86 | * |
| embeddedartists | 0:6b68dac0d986 | 87 | * @param morePoints true is written to this argument if there |
| embeddedartists | 0:6b68dac0d986 | 88 | * are more calibrations points available; otherwise it will be false |
| embeddedartists | 0:6b68dac0d986 | 89 | * @param timeout maximum number of milliseconds to wait for |
| embeddedartists | 0:6b68dac0d986 | 90 | * a calibration point. Set this argument to 0 to wait indefinite. |
| embeddedartists | 0:6b68dac0d986 | 91 | * |
| embeddedartists | 10:1ac4b213f0f7 | 92 | * @returns |
| embeddedartists | 10:1ac4b213f0f7 | 93 | * Ok on success |
| embeddedartists | 10:1ac4b213f0f7 | 94 | * An error code on failure |
| embeddedartists | 0:6b68dac0d986 | 95 | */ |
| embeddedartists | 10:1ac4b213f0f7 | 96 | virtual TouchError waitForCalibratePoint(bool* morePoints, uint32_t timeout) = 0; |
| embeddedartists | 0:6b68dac0d986 | 97 | }; |
| embeddedartists | 0:6b68dac0d986 | 98 | |
| embeddedartists | 0:6b68dac0d986 | 99 | #endif |
