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:
Mon Nov 04 14:32:50 2019 +0000
Revision:
42:bbfe299d4a0c
Parent:
41:e06e764ff4fd
More updates related to mbed OS 5

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 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 10:1ac4b213f0f7 28 enum TouchError {
embeddedartists 10:1ac4b213f0f7 29 TouchError_Ok = BiosError_Ok,
embeddedartists 10:1ac4b213f0f7 30 TouchError_ConfigError = BiosError_ConfigError,
embeddedartists 10:1ac4b213f0f7 31 TouchError_WrongBPP = BiosError_WrongBPP,
embeddedartists 10:1ac4b213f0f7 32 TouchError_InvalidParam = BiosError_InvalidParam,
embeddedartists 10:1ac4b213f0f7 33 TouchError_NoInit = BiosError_NoInit,
embeddedartists 22:1a58a518435c 34 TouchError_CalibrationError = BiosError_Calibration,
embeddedartists 22:1a58a518435c 35 TouchError_Timeout = BiosError_Timeout,
embeddedartists 22:1a58a518435c 36 TouchError_TouchNotSupported = BiosError_NotSupported,
embeddedartists 10:1ac4b213f0f7 37 TouchError_MemoryError,
embeddedartists 10:1ac4b213f0f7 38 };
embeddedartists 0:6b68dac0d986 39
embeddedartists 0:6b68dac0d986 40 /**
embeddedartists 0:6b68dac0d986 41 * Read coordinates from the touch panel.
embeddedartists 0:6b68dac0d986 42 *
embeddedartists 22:1a58a518435c 43 * In case of multitouch (capacitive touch screen) only the first touch
embeddedartists 22:1a58a518435c 44 * will be returned.
embeddedartists 22:1a58a518435c 45 *
embeddedartists 0:6b68dac0d986 46 * @param coord pointer to coordinate object. The read coordinates will be
embeddedartists 0:6b68dac0d986 47 * written to this object.
embeddedartists 10:1ac4b213f0f7 48 *
embeddedartists 10:1ac4b213f0f7 49 * @returns
embeddedartists 10:1ac4b213f0f7 50 * Ok on success
embeddedartists 10:1ac4b213f0f7 51 * An error code on failure
embeddedartists 0:6b68dac0d986 52 */
embeddedartists 22:1a58a518435c 53 virtual TouchError read(touch_coordinate_t &coord) = 0;
embeddedartists 22:1a58a518435c 54
embeddedartists 22:1a58a518435c 55 /**
embeddedartists 22:1a58a518435c 56 * Read up to num coordinates from the touch panel.
embeddedartists 22:1a58a518435c 57 *
embeddedartists 22:1a58a518435c 58 * @param coords a list of at least num coordinates
embeddedartists 22:1a58a518435c 59 * @param num the number of coordinates to read
embeddedartists 22:1a58a518435c 60 *
embeddedartists 22:1a58a518435c 61 * @returns
embeddedartists 22:1a58a518435c 62 * Ok on success
embeddedartists 22:1a58a518435c 63 * An error code on failure
embeddedartists 22:1a58a518435c 64 */
embeddedartists 22:1a58a518435c 65 virtual TouchError read(touch_coordinate_t* coord, int num) = 0;
embeddedartists 22:1a58a518435c 66
embeddedartists 22:1a58a518435c 67 /**
embeddedartists 22:1a58a518435c 68 * Returns information about the touch panel
embeddedartists 22:1a58a518435c 69 *
embeddedartists 22:1a58a518435c 70 * @param resistive true for Resistive, false for Capacitive
embeddedartists 22:1a58a518435c 71 * @param maxPoints the maximum number of simultaneous touches
embeddedartists 22:1a58a518435c 72 * @param calibration true if the controller can be calibrated
embeddedartists 22:1a58a518435c 73 *
embeddedartists 22:1a58a518435c 74 * @returns
embeddedartists 22:1a58a518435c 75 * Ok on success
embeddedartists 22:1a58a518435c 76 * An error code on failure
embeddedartists 22:1a58a518435c 77 */
embeddedartists 22:1a58a518435c 78 virtual TouchError info(bool* resistive, int* maxPoints, bool* calibrated) = 0;
embeddedartists 0:6b68dac0d986 79
embeddedartists 0:6b68dac0d986 80 /**
embeddedartists 0:6b68dac0d986 81 * Start to calibrate the display
embeddedartists 0:6b68dac0d986 82 *
embeddedartists 10:1ac4b213f0f7 83 * @returns
embeddedartists 10:1ac4b213f0f7 84 * Ok on success
embeddedartists 10:1ac4b213f0f7 85 * An error code on failure
embeddedartists 0:6b68dac0d986 86 */
embeddedartists 10:1ac4b213f0f7 87 virtual TouchError calibrateStart() = 0;
embeddedartists 0:6b68dac0d986 88
embeddedartists 0:6b68dac0d986 89 /**
embeddedartists 0:6b68dac0d986 90 * Get the next calibration point. Draw an indicator on the screen
embeddedartists 0:6b68dac0d986 91 * at the coordinates and ask the user to press/click on the indicator.
embeddedartists 0:6b68dac0d986 92 * Please note that waitForCalibratePoint() must be called after this
embeddedartists 0:6b68dac0d986 93 * method.
embeddedartists 0:6b68dac0d986 94 *
embeddedartists 4:6fdcdf7aff8d 95 * @param x the x coordinate is written to this argument
embeddedartists 4:6fdcdf7aff8d 96 * @param y the y coordinate is written to this argument
embeddedartists 4:6fdcdf7aff8d 97 * @param last true if this is the last coordinate in the series
embeddedartists 0:6b68dac0d986 98 *
embeddedartists 10:1ac4b213f0f7 99 * @returns
embeddedartists 10:1ac4b213f0f7 100 * Ok on success
embeddedartists 10:1ac4b213f0f7 101 * An error code on failure
embeddedartists 0:6b68dac0d986 102 */
embeddedartists 10:1ac4b213f0f7 103 virtual TouchError getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL) = 0;
embeddedartists 0:6b68dac0d986 104
embeddedartists 0:6b68dac0d986 105 /**
embeddedartists 0:6b68dac0d986 106 * Wait for a calibration point to have been pressed and recored.
embeddedartists 0:6b68dac0d986 107 * This method must be called just after getNextCalibratePoint().
embeddedartists 0:6b68dac0d986 108 *
embeddedartists 0:6b68dac0d986 109 * @param morePoints true is written to this argument if there
embeddedartists 0:6b68dac0d986 110 * are more calibrations points available; otherwise it will be false
embeddedartists 0:6b68dac0d986 111 * @param timeout maximum number of milliseconds to wait for
embeddedartists 0:6b68dac0d986 112 * a calibration point. Set this argument to 0 to wait indefinite.
embeddedartists 0:6b68dac0d986 113 *
embeddedartists 10:1ac4b213f0f7 114 * @returns
embeddedartists 10:1ac4b213f0f7 115 * Ok on success
embeddedartists 10:1ac4b213f0f7 116 * An error code on failure
embeddedartists 0:6b68dac0d986 117 */
embeddedartists 10:1ac4b213f0f7 118 virtual TouchError waitForCalibratePoint(bool* morePoints, uint32_t timeout) = 0;
embeddedartists 41:e06e764ff4fd 119
embeddedartists 41:e06e764ff4fd 120 virtual void setListener(Callback<void()> listener) = 0;
embeddedartists 0:6b68dac0d986 121 };
embeddedartists 0:6b68dac0d986 122
embeddedartists 0:6b68dac0d986 123 #endif