Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos mbed-src
Fork of DMSupport by
Diff: Display/BiosDisplayAndTouch.h
- Revision:
- 11:dedcebcfc869
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Display/BiosDisplayAndTouch.h Fri Dec 19 09:03:46 2014 +0100
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2014 Embedded Artists AB
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIOSDISPLAYANDTOUCH_H
+#define BIOSDISPLAYANDTOUCH_H
+
+#include "mbed.h"
+#include "TouchPanel.h"
+#include "Display.h"
+#include "bios.h"
+
+/**
+ * Glue between the BIOS and the Display/TouchPanel interfaces.
+ */
+class BiosDisplayAndTouch : public TouchPanel, public Display {
+public:
+
+ /** Get the only instance of the BiosDisplayAndTouch
+ *
+ * @returns The display
+ */
+ static BiosDisplayAndTouch& instance()
+ {
+ static BiosDisplayAndTouch singleton;
+ return singleton;
+ }
+
+
+ /** Initializes the display but does not turn it on
+ *
+ * @returns
+ * Ok on success
+ * An error code on failure
+ */
+ DisplayError initDisplay();
+
+ /**
+ * Initialize the touch controller. This method must be called before
+ * calibrating or reading data from the controller
+ *
+ * @returns
+ * Ok on success
+ * An error code on failure
+ */
+ TouchError initTouchController();
+
+ /**
+ * Tests if a touch controller is available or not.
+ *
+ * Note that this function only returns a valid value
+ * after the display has been intitialized.
+ *
+ * @return true if there is a touch controller
+ */
+ bool isTouchSupported();
+
+ void handleTouchInterrupt();
+ void changeTouchInterrupt(bool enable, bool rising);
+
+ // From the Display interface
+ virtual DisplayError powerUp(void* framebuffer, Resolution wanted = Resolution_16bit_rgb565);
+ virtual DisplayError powerDown();
+ virtual DisplayError backlight(int percent);
+ virtual uint16_t width();
+ virtual uint16_t height();
+ virtual uint16_t bytesPerPixel();
+ virtual uint32_t fbSize();
+ virtual bool landscape();
+ virtual bool isSupported(Resolution res);
+ virtual Resolution currentResolution();
+ virtual void setFramebuffer(void* buff);
+ virtual void* swapFramebuffer(void* buff);
+ virtual void* allocateFramebuffer(Resolution res=Resolution_16bit_rgb565);
+
+ // From the TouchPanel interface
+ virtual TouchError read(touchCoordinate_t &coord);
+ virtual TouchError calibrateStart();
+ virtual TouchError getNextCalibratePoint(uint16_t* x, uint16_t* y, bool* last=NULL);
+ virtual TouchError waitForCalibratePoint(bool* morePoints, uint32_t timeout);
+
+private:
+
+ bool _initializedDisplay;
+ bool _poweredOn;
+ bool _initializedTouch;
+ InterruptIn _touchIRQ;
+ //FunctionPointer _touchFP;
+
+ bios_header_t _bios;
+ void* _biosData;
+
+ uint16_t _width;
+ uint16_t _height;
+ uint16_t _bpp;
+ uint16_t _supportedRes;
+ Resolution_t _activeRes;
+ bool _landscape;
+ bool _supportsTouch;
+
+ explicit BiosDisplayAndTouch();
+ // hide copy constructor
+ BiosDisplayAndTouch(const BiosDisplayAndTouch&);
+ // hide assign operator
+ BiosDisplayAndTouch& operator=(const BiosDisplayAndTouch&);
+ ~BiosDisplayAndTouch();
+};
+
+#endif /* BIOSDISPLAYANDTOUCH_H */
