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:
Thu Dec 11 18:23:07 2014 +0000
Revision:
9:a33326afd686
Parent:
4:6fdcdf7aff8d
Child:
10:1ac4b213f0f7
Updated documentation

Who changed what in which revision?

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