A library with drivers for different peripherals on the LPC4088 QuickStart Board or related add-on boards.

Dependencies:   FATFileSystem

Fork of EALib by EmbeddedArtists AB

Committer:
msamadani
Date:
Mon May 22 19:58:24 2017 +0000
Revision:
21:5ac242986175
Parent:
12:15597e45eea0
Working version of the library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 12:15597e45eea0 1 /*
embeddedartists 12:15597e45eea0 2 * Copyright 2013 Embedded Artists AB
embeddedartists 12:15597e45eea0 3 *
embeddedartists 12:15597e45eea0 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 12:15597e45eea0 5 * you may not use this file except in compliance with the License.
embeddedartists 12:15597e45eea0 6 * You may obtain a copy of the License at
embeddedartists 12:15597e45eea0 7 *
embeddedartists 12:15597e45eea0 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 12:15597e45eea0 9 *
embeddedartists 12:15597e45eea0 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 12:15597e45eea0 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 12:15597e45eea0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 12:15597e45eea0 13 * See the License for the specific language governing permissions and
embeddedartists 12:15597e45eea0 14 * limitations under the License.
embeddedartists 12:15597e45eea0 15 */
embeddedartists 4:b32cf4ef45c5 16
embeddedartists 4:b32cf4ef45c5 17 #ifndef TOUCHPANEL_H
embeddedartists 4:b32cf4ef45c5 18 #define TOUCHPANEL_H
embeddedartists 4:b32cf4ef45c5 19
embeddedartists 4:b32cf4ef45c5 20
embeddedartists 4:b32cf4ef45c5 21 /**
embeddedartists 4:b32cf4ef45c5 22 * An abstract class that represents touch panels.
embeddedartists 4:b32cf4ef45c5 23 */
embeddedartists 4:b32cf4ef45c5 24 class TouchPanel {
embeddedartists 4:b32cf4ef45c5 25 public:
embeddedartists 4:b32cf4ef45c5 26
embeddedartists 4:b32cf4ef45c5 27 typedef struct {
embeddedartists 4:b32cf4ef45c5 28 int32_t x;
embeddedartists 4:b32cf4ef45c5 29 int32_t y;
embeddedartists 4:b32cf4ef45c5 30 int32_t z;
embeddedartists 4:b32cf4ef45c5 31 } touchCoordinate_t;
embeddedartists 4:b32cf4ef45c5 32
embeddedartists 4:b32cf4ef45c5 33
embeddedartists 4:b32cf4ef45c5 34 /**
embeddedartists 4:b32cf4ef45c5 35 * Initialize the touch controller. This method must be called before
embeddedartists 4:b32cf4ef45c5 36 * calibrating or reading data from the controller
embeddedartists 4:b32cf4ef45c5 37 *
embeddedartists 4:b32cf4ef45c5 38 * @param width the width of the touch panel. This is usually the same as
embeddedartists 4:b32cf4ef45c5 39 * the width of the display
embeddedartists 4:b32cf4ef45c5 40 * @param height the height of the touch panel. This is usually the same
embeddedartists 4:b32cf4ef45c5 41 * as the height of the display.
embeddedartists 4:b32cf4ef45c5 42 *
embeddedartists 4:b32cf4ef45c5 43 * @return true if the request was successful; otherwise false
embeddedartists 4:b32cf4ef45c5 44 */
embeddedartists 4:b32cf4ef45c5 45 virtual bool init(uint16_t width, uint16_t height) = 0;
embeddedartists 4:b32cf4ef45c5 46
embeddedartists 4:b32cf4ef45c5 47 /**
embeddedartists 4:b32cf4ef45c5 48 * Read coordinates from the touch panel.
embeddedartists 4:b32cf4ef45c5 49 *
embeddedartists 4:b32cf4ef45c5 50 * @param coord pointer to coordinate object. The read coordinates will be
embeddedartists 4:b32cf4ef45c5 51 * written to this object.
embeddedartists 4:b32cf4ef45c5 52 */
embeddedartists 4:b32cf4ef45c5 53 virtual bool read(touchCoordinate_t &coord) = 0;
embeddedartists 4:b32cf4ef45c5 54
embeddedartists 4:b32cf4ef45c5 55
embeddedartists 4:b32cf4ef45c5 56 /**
embeddedartists 4:b32cf4ef45c5 57 * Start to calibrate the display
embeddedartists 4:b32cf4ef45c5 58 *
embeddedartists 4:b32cf4ef45c5 59 * @return true if the request was successful; otherwise false
embeddedartists 4:b32cf4ef45c5 60 */
embeddedartists 4:b32cf4ef45c5 61 virtual bool calibrateStart() = 0;
embeddedartists 4:b32cf4ef45c5 62
embeddedartists 4:b32cf4ef45c5 63 /**
embeddedartists 4:b32cf4ef45c5 64 * Get the next calibration point. Draw an indicator on the screen
embeddedartists 4:b32cf4ef45c5 65 * at the coordinates and ask the user to press/click on the indicator.
embeddedartists 4:b32cf4ef45c5 66 * Please note that waitForCalibratePoint() must be called after this
embeddedartists 4:b32cf4ef45c5 67 * method.
embeddedartists 4:b32cf4ef45c5 68 *
embeddedartists 4:b32cf4ef45c5 69 * @param x the x coordinate is written to this argument
embeddedartists 4:b32cf4ef45c5 70 * @param y the y coordinate is written to this argument
embeddedartists 4:b32cf4ef45c5 71 *
embeddedartists 4:b32cf4ef45c5 72 * @return true if the request was successful; otherwise false
embeddedartists 4:b32cf4ef45c5 73 */
embeddedartists 4:b32cf4ef45c5 74 virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y) = 0;
embeddedartists 4:b32cf4ef45c5 75
embeddedartists 4:b32cf4ef45c5 76 /**
embeddedartists 4:b32cf4ef45c5 77 * Wait for a calibration point to have been pressed and recored.
embeddedartists 4:b32cf4ef45c5 78 * This method must be called just after getNextCalibratePoint().
embeddedartists 4:b32cf4ef45c5 79 *
embeddedartists 4:b32cf4ef45c5 80 * @param morePoints true is written to this argument if there
embeddedartists 4:b32cf4ef45c5 81 * are more calibrations points available; otherwise it will be false
embeddedartists 4:b32cf4ef45c5 82 * @param timeout maximum number of milliseconds to wait for
embeddedartists 4:b32cf4ef45c5 83 * a calibration point. Set this argument to 0 to wait indefinite.
embeddedartists 4:b32cf4ef45c5 84 *
embeddedartists 4:b32cf4ef45c5 85 * @return true if the request was successful; otherwise false
embeddedartists 4:b32cf4ef45c5 86 */
embeddedartists 4:b32cf4ef45c5 87 virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout) = 0;
embeddedartists 4:b32cf4ef45c5 88
embeddedartists 4:b32cf4ef45c5 89
embeddedartists 4:b32cf4ef45c5 90 };
embeddedartists 4:b32cf4ef45c5 91
embeddedartists 4:b32cf4ef45c5 92 #endif