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
Display/BiosTouch.h@22:1a58a518435c, 2015-01-16 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Jan 16 11:13:39 2015 +0100
- Revision:
- 22:1a58a518435c
- Child:
- 23:6afd6a716e80
- Updated SPIFI code to allow BIOS to id chips not yet supported by DMSupport
- Updated QSPIFileSystem to be chip independant. Erase block info from SPIFI.cpp
- Split BiosDisplayAndTouch into BiosDisplay and BiosTouch
- Added BiosLoader with common functionallity
- Removed BIOS code from DMBoard
- Added first version of a touch listener
Who changed what in which revision?
User | Revision | Line number | New 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 | //void handleTouchInterrupt(); |
embeddedartists | 22:1a58a518435c | 65 | //void changeTouchInterrupt(bool enable, bool rising); |
embeddedartists | 22:1a58a518435c | 66 | |
embeddedartists | 22:1a58a518435c | 67 | // From the TouchPanel interface |
embeddedartists | 22:1a58a518435c | 68 | virtual TouchError read(touch_coordinate_t &coord); |
embeddedartists | 22:1a58a518435c | 69 | virtual TouchError read(touch_coordinate_t* coord, int num); |
embeddedartists | 22:1a58a518435c | 70 | virtual TouchError info(bool* resistive, int* maxPoints, bool* calibrated); |
embeddedartists | 22:1a58a518435c | 71 | virtual TouchError calibrateStart(); |
embeddedartists | 22:1a58a518435c | 72 | virtual TouchError getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL); |
embeddedartists | 22:1a58a518435c | 73 | virtual TouchError waitForCalibratePoint(bool* morePoints, uint32_t timeout); |
embeddedartists | 22:1a58a518435c | 74 | virtual FunctionPointer* setListener(FunctionPointer* listener); |
embeddedartists | 22:1a58a518435c | 75 | |
embeddedartists | 22:1a58a518435c | 76 | private: |
embeddedartists | 22:1a58a518435c | 77 | |
embeddedartists | 22:1a58a518435c | 78 | //bool _initializedDisplay; |
embeddedartists | 22:1a58a518435c | 79 | bool _initialized; |
embeddedartists | 22:1a58a518435c | 80 | bool _haveInfo; |
embeddedartists | 22:1a58a518435c | 81 | bool _poweredOn; |
embeddedartists | 22:1a58a518435c | 82 | //InterruptIn _touchIRQ; |
embeddedartists | 22:1a58a518435c | 83 | //FunctionPointer _touchFP; |
embeddedartists | 22:1a58a518435c | 84 | |
embeddedartists | 22:1a58a518435c | 85 | bios_header_t* _bios; |
embeddedartists | 22:1a58a518435c | 86 | void* _biosData; |
embeddedartists | 22:1a58a518435c | 87 | |
embeddedartists | 22:1a58a518435c | 88 | Thread* _handlerThread; |
embeddedartists | 22:1a58a518435c | 89 | TouchHandler* _handler; |
embeddedartists | 22:1a58a518435c | 90 | |
embeddedartists | 22:1a58a518435c | 91 | //uint16_t _width; |
embeddedartists | 22:1a58a518435c | 92 | //uint16_t _height; |
embeddedartists | 22:1a58a518435c | 93 | //uint16_t _bpp; |
embeddedartists | 22:1a58a518435c | 94 | //uint16_t _supportedRes; |
embeddedartists | 22:1a58a518435c | 95 | //Resolution_t _activeRes; |
embeddedartists | 22:1a58a518435c | 96 | //bool _landscape; |
embeddedartists | 22:1a58a518435c | 97 | bool _supportsTouch; |
embeddedartists | 22:1a58a518435c | 98 | bool _supportsTouchCalibration; |
embeddedartists | 22:1a58a518435c | 99 | uint8_t _touchNumFingers; |
embeddedartists | 22:1a58a518435c | 100 | bool _touchIsResistive; |
embeddedartists | 22:1a58a518435c | 101 | |
embeddedartists | 22:1a58a518435c | 102 | explicit BiosTouch(); |
embeddedartists | 22:1a58a518435c | 103 | // hide copy constructor |
embeddedartists | 22:1a58a518435c | 104 | BiosTouch(const BiosTouch&); |
embeddedartists | 22:1a58a518435c | 105 | // hide assign operator |
embeddedartists | 22:1a58a518435c | 106 | BiosTouch& operator=(const BiosTouch&); |
embeddedartists | 22:1a58a518435c | 107 | ~BiosTouch(); |
embeddedartists | 22:1a58a518435c | 108 | }; |
embeddedartists | 22:1a58a518435c | 109 | |
embeddedartists | 22:1a58a518435c | 110 | #endif /* BIOSTOUCH_H */ |