t

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

Fork of DMSupport by Embedded Artists

Committer:
JVI_1556
Date:
Fri Oct 26 11:19:35 2018 +0000
Revision:
41:096931c776eb
Parent:
28:8ae20cb0b943
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 22:1a58a518435c 1 /*
embeddedartists 22:1a58a518435c 2 * Copyright 2014 Embedded Artists AB
embeddedartists 22:1a58a518435c 3 *
embeddedartists 22:1a58a518435c 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 22:1a58a518435c 5 * you may not use this file except in compliance with the License.
embeddedartists 22:1a58a518435c 6 * You may obtain a copy of the License at
embeddedartists 22:1a58a518435c 7 *
embeddedartists 22:1a58a518435c 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 22:1a58a518435c 9 *
embeddedartists 22:1a58a518435c 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 22:1a58a518435c 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 22:1a58a518435c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 22:1a58a518435c 13 * See the License for the specific language governing permissions and
embeddedartists 22:1a58a518435c 14 * limitations under the License.
embeddedartists 22:1a58a518435c 15 */
embeddedartists 22:1a58a518435c 16
embeddedartists 22:1a58a518435c 17 #ifndef BIOSTOUCH_H
embeddedartists 22:1a58a518435c 18 #define BIOSTOUCH_H
embeddedartists 22:1a58a518435c 19
embeddedartists 22:1a58a518435c 20 #include "mbed.h"
embeddedartists 22:1a58a518435c 21 #include "TouchPanel.h"
embeddedartists 22:1a58a518435c 22 #include "Display.h"
embeddedartists 22:1a58a518435c 23 #include "bios.h"
embeddedartists 22:1a58a518435c 24 #include "rtos.h"
embeddedartists 22:1a58a518435c 25
embeddedartists 22:1a58a518435c 26 class TouchHandler;
embeddedartists 22:1a58a518435c 27
embeddedartists 22:1a58a518435c 28 /**
embeddedartists 22:1a58a518435c 29 * Glue between the BIOS and the TouchPanel interface.
embeddedartists 22:1a58a518435c 30 */
embeddedartists 22:1a58a518435c 31 class BiosTouch : public TouchPanel {
embeddedartists 22:1a58a518435c 32 public:
embeddedartists 22:1a58a518435c 33
embeddedartists 22:1a58a518435c 34 /** Get the only instance of the BiosTouch
embeddedartists 22:1a58a518435c 35 *
embeddedartists 22:1a58a518435c 36 * @returns The display
embeddedartists 22:1a58a518435c 37 */
embeddedartists 22:1a58a518435c 38 static BiosTouch& instance()
embeddedartists 22:1a58a518435c 39 {
embeddedartists 22:1a58a518435c 40 static BiosTouch singleton;
embeddedartists 22:1a58a518435c 41 return singleton;
embeddedartists 22:1a58a518435c 42 }
embeddedartists 22:1a58a518435c 43
embeddedartists 22:1a58a518435c 44 /**
embeddedartists 22:1a58a518435c 45 * Initialize the touch controller. This method must be called before
embeddedartists 22:1a58a518435c 46 * calibrating or reading data from the controller
embeddedartists 22:1a58a518435c 47 *
embeddedartists 22:1a58a518435c 48 * @returns
embeddedartists 22:1a58a518435c 49 * Ok on success
embeddedartists 22:1a58a518435c 50 * An error code on failure
embeddedartists 22:1a58a518435c 51 */
embeddedartists 22:1a58a518435c 52 TouchError init();
embeddedartists 22:1a58a518435c 53
embeddedartists 22:1a58a518435c 54 /**
embeddedartists 22:1a58a518435c 55 * Tests if a touch controller is available or not.
embeddedartists 22:1a58a518435c 56 *
embeddedartists 22:1a58a518435c 57 * Note that this function only returns a valid value
embeddedartists 22:1a58a518435c 58 * after the display has been intitialized.
embeddedartists 22:1a58a518435c 59 *
embeddedartists 22:1a58a518435c 60 * @return true if there is a touch controller
embeddedartists 22:1a58a518435c 61 */
embeddedartists 22:1a58a518435c 62 bool isTouchSupported();
embeddedartists 22:1a58a518435c 63
embeddedartists 22:1a58a518435c 64 // From the TouchPanel interface
embeddedartists 22:1a58a518435c 65 virtual TouchError read(touch_coordinate_t &coord);
embeddedartists 22:1a58a518435c 66 virtual TouchError read(touch_coordinate_t* coord, int num);
embeddedartists 22:1a58a518435c 67 virtual TouchError info(bool* resistive, int* maxPoints, bool* calibrated);
embeddedartists 22:1a58a518435c 68 virtual TouchError calibrateStart();
embeddedartists 22:1a58a518435c 69 virtual TouchError getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL);
embeddedartists 22:1a58a518435c 70 virtual TouchError waitForCalibratePoint(bool* morePoints, uint32_t timeout);
embeddedartists 22:1a58a518435c 71 virtual FunctionPointer* setListener(FunctionPointer* listener);
embeddedartists 22:1a58a518435c 72
embeddedartists 22:1a58a518435c 73 private:
embeddedartists 22:1a58a518435c 74
embeddedartists 22:1a58a518435c 75 bool _initialized;
embeddedartists 22:1a58a518435c 76 bool _haveInfo;
embeddedartists 22:1a58a518435c 77 bool _poweredOn;
embeddedartists 22:1a58a518435c 78
embeddedartists 22:1a58a518435c 79 bios_header_t* _bios;
embeddedartists 22:1a58a518435c 80 void* _biosData;
embeddedartists 22:1a58a518435c 81
embeddedartists 22:1a58a518435c 82 Thread* _handlerThread;
embeddedartists 22:1a58a518435c 83 TouchHandler* _handler;
embeddedartists 22:1a58a518435c 84
embeddedartists 22:1a58a518435c 85 bool _supportsTouch;
embeddedartists 22:1a58a518435c 86 bool _supportsTouchCalibration;
embeddedartists 22:1a58a518435c 87 uint8_t _touchNumFingers;
embeddedartists 22:1a58a518435c 88
embeddedartists 22:1a58a518435c 89 explicit BiosTouch();
embeddedartists 22:1a58a518435c 90 // hide copy constructor
embeddedartists 22:1a58a518435c 91 BiosTouch(const BiosTouch&);
embeddedartists 22:1a58a518435c 92 // hide assign operator
embeddedartists 22:1a58a518435c 93 BiosTouch& operator=(const BiosTouch&);
embeddedartists 22:1a58a518435c 94 ~BiosTouch();
embeddedartists 22:1a58a518435c 95 };
embeddedartists 22:1a58a518435c 96
embeddedartists 22:1a58a518435c 97 #endif /* BIOSTOUCH_H */