A board support package for the LPC4088 Display Module.

Dependencies:   DM_HttpServer DM_USBHost

Dependents:   lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more

Fork of DMSupport by EmbeddedArtists AB

Committer:
embeddedartists
Date:
Fri Nov 21 11:42:51 2014 +0000
Revision:
0:6b68dac0d986
Child:
4:6fdcdf7aff8d
First version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 0:6b68dac0d986 1 /*
embeddedartists 0:6b68dac0d986 2 * Copyright 2013 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 0:6b68dac0d986 20
embeddedartists 0:6b68dac0d986 21 /**
embeddedartists 0:6b68dac0d986 22 * An abstract class that represents touch panels.
embeddedartists 0:6b68dac0d986 23 */
embeddedartists 0:6b68dac0d986 24 class TouchPanel {
embeddedartists 0:6b68dac0d986 25 public:
embeddedartists 0:6b68dac0d986 26
embeddedartists 0:6b68dac0d986 27 typedef struct {
embeddedartists 0:6b68dac0d986 28 int32_t x;
embeddedartists 0:6b68dac0d986 29 int32_t y;
embeddedartists 0:6b68dac0d986 30 int32_t z;
embeddedartists 0:6b68dac0d986 31 } touchCoordinate_t;
embeddedartists 0:6b68dac0d986 32
embeddedartists 0:6b68dac0d986 33
embeddedartists 0:6b68dac0d986 34 /**
embeddedartists 0:6b68dac0d986 35 * Initialize the touch controller. This method must be called before
embeddedartists 0:6b68dac0d986 36 * calibrating or reading data from the controller
embeddedartists 0:6b68dac0d986 37 *
embeddedartists 0:6b68dac0d986 38 * @param width the width of the touch panel. This is usually the same as
embeddedartists 0:6b68dac0d986 39 * the width of the display
embeddedartists 0:6b68dac0d986 40 * @param height the height of the touch panel. This is usually the same
embeddedartists 0:6b68dac0d986 41 * as the height of the display.
embeddedartists 0:6b68dac0d986 42 *
embeddedartists 0:6b68dac0d986 43 * @return true if the request was successful; otherwise false
embeddedartists 0:6b68dac0d986 44 */
embeddedartists 0:6b68dac0d986 45 virtual bool init(uint16_t width, uint16_t height) = 0;
embeddedartists 0:6b68dac0d986 46
embeddedartists 0:6b68dac0d986 47 /**
embeddedartists 0:6b68dac0d986 48 * Read coordinates from the touch panel.
embeddedartists 0:6b68dac0d986 49 *
embeddedartists 0:6b68dac0d986 50 * @param coord pointer to coordinate object. The read coordinates will be
embeddedartists 0:6b68dac0d986 51 * written to this object.
embeddedartists 0:6b68dac0d986 52 */
embeddedartists 0:6b68dac0d986 53 virtual bool read(touchCoordinate_t &coord) = 0;
embeddedartists 0:6b68dac0d986 54
embeddedartists 0:6b68dac0d986 55
embeddedartists 0:6b68dac0d986 56 /**
embeddedartists 0:6b68dac0d986 57 * Start to calibrate the display
embeddedartists 0:6b68dac0d986 58 *
embeddedartists 0:6b68dac0d986 59 * @return true if the request was successful; otherwise false
embeddedartists 0:6b68dac0d986 60 */
embeddedartists 0:6b68dac0d986 61 virtual bool calibrateStart() = 0;
embeddedartists 0:6b68dac0d986 62
embeddedartists 0:6b68dac0d986 63 /**
embeddedartists 0:6b68dac0d986 64 * Get the next calibration point. Draw an indicator on the screen
embeddedartists 0:6b68dac0d986 65 * at the coordinates and ask the user to press/click on the indicator.
embeddedartists 0:6b68dac0d986 66 * Please note that waitForCalibratePoint() must be called after this
embeddedartists 0:6b68dac0d986 67 * method.
embeddedartists 0:6b68dac0d986 68 *
embeddedartists 0:6b68dac0d986 69 * @param x the x coordinate is written to this argument
embeddedartists 0:6b68dac0d986 70 * @param y the y coordinate is written to this argument
embeddedartists 0:6b68dac0d986 71 *
embeddedartists 0:6b68dac0d986 72 * @return true if the request was successful; otherwise false
embeddedartists 0:6b68dac0d986 73 */
embeddedartists 0:6b68dac0d986 74 virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y) = 0;
embeddedartists 0:6b68dac0d986 75
embeddedartists 0:6b68dac0d986 76 /**
embeddedartists 0:6b68dac0d986 77 * Wait for a calibration point to have been pressed and recored.
embeddedartists 0:6b68dac0d986 78 * This method must be called just after getNextCalibratePoint().
embeddedartists 0:6b68dac0d986 79 *
embeddedartists 0:6b68dac0d986 80 * @param morePoints true is written to this argument if there
embeddedartists 0:6b68dac0d986 81 * are more calibrations points available; otherwise it will be false
embeddedartists 0:6b68dac0d986 82 * @param timeout maximum number of milliseconds to wait for
embeddedartists 0:6b68dac0d986 83 * a calibration point. Set this argument to 0 to wait indefinite.
embeddedartists 0:6b68dac0d986 84 *
embeddedartists 0:6b68dac0d986 85 * @return true if the request was successful; otherwise false
embeddedartists 0:6b68dac0d986 86 */
embeddedartists 0:6b68dac0d986 87 virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout) = 0;
embeddedartists 0:6b68dac0d986 88
embeddedartists 0:6b68dac0d986 89
embeddedartists 0:6b68dac0d986 90 };
embeddedartists 0:6b68dac0d986 91
embeddedartists 0:6b68dac0d986 92 #endif