t

Dependencies:   DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos

Fork of DMSupport by Embedded Artists

Committer:
embeddedartists
Date:
Mon Dec 08 12:48:44 2014 +0000
Revision:
4:6fdcdf7aff8d
Parent:
0:6b68dac0d986
Child:
9:a33326afd686
Changed touch interface to report last point. Added GPIO-time-measuring support. Fixed USB Host MSD bug that caused HTTPServer to crash

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 4:6fdcdf7aff8d 69 * @param x the x coordinate is written to this argument
embeddedartists 4:6fdcdf7aff8d 70 * @param y the y coordinate is written to this argument
embeddedartists 4:6fdcdf7aff8d 71 * @param last true if this is the last coordinate in the series
embeddedartists 0:6b68dac0d986 72 *
embeddedartists 0:6b68dac0d986 73 * @return true if the request was successful; otherwise false
embeddedartists 0:6b68dac0d986 74 */
embeddedartists 4:6fdcdf7aff8d 75 virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL) = 0;
embeddedartists 0:6b68dac0d986 76
embeddedartists 0:6b68dac0d986 77 /**
embeddedartists 0:6b68dac0d986 78 * Wait for a calibration point to have been pressed and recored.
embeddedartists 0:6b68dac0d986 79 * This method must be called just after getNextCalibratePoint().
embeddedartists 0:6b68dac0d986 80 *
embeddedartists 0:6b68dac0d986 81 * @param morePoints true is written to this argument if there
embeddedartists 0:6b68dac0d986 82 * are more calibrations points available; otherwise it will be false
embeddedartists 0:6b68dac0d986 83 * @param timeout maximum number of milliseconds to wait for
embeddedartists 0:6b68dac0d986 84 * a calibration point. Set this argument to 0 to wait indefinite.
embeddedartists 0:6b68dac0d986 85 *
embeddedartists 0:6b68dac0d986 86 * @return true if the request was successful; otherwise false
embeddedartists 0:6b68dac0d986 87 */
embeddedartists 0:6b68dac0d986 88 virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout) = 0;
embeddedartists 0:6b68dac0d986 89
embeddedartists 0:6b68dac0d986 90
embeddedartists 0:6b68dac0d986 91 };
embeddedartists 0:6b68dac0d986 92
embeddedartists 0:6b68dac0d986 93 #endif