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:
39:e1cb4dd9bfeb
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 BIOSDISPLAY_H
embeddedartists 22:1a58a518435c 18 #define BIOSDISPLAY_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
embeddedartists 22:1a58a518435c 25 /**
embeddedartists 22:1a58a518435c 26 * Glue between the BIOS and the Display interface.
embeddedartists 22:1a58a518435c 27 */
embeddedartists 22:1a58a518435c 28 class BiosDisplay : public Display {
embeddedartists 22:1a58a518435c 29 public:
embeddedartists 22:1a58a518435c 30
embeddedartists 22:1a58a518435c 31 /** Get the only instance of the BiosDisplay
embeddedartists 22:1a58a518435c 32 *
embeddedartists 22:1a58a518435c 33 * @returns The display
embeddedartists 22:1a58a518435c 34 */
embeddedartists 22:1a58a518435c 35 static BiosDisplay& instance()
embeddedartists 22:1a58a518435c 36 {
embeddedartists 22:1a58a518435c 37 static BiosDisplay singleton;
embeddedartists 22:1a58a518435c 38 return singleton;
embeddedartists 22:1a58a518435c 39 }
embeddedartists 22:1a58a518435c 40
embeddedartists 22:1a58a518435c 41
embeddedartists 22:1a58a518435c 42 /** Initializes the display but does not turn it on
embeddedartists 22:1a58a518435c 43 *
embeddedartists 22:1a58a518435c 44 * @returns
embeddedartists 22:1a58a518435c 45 * Ok on success
embeddedartists 22:1a58a518435c 46 * An error code on failure
embeddedartists 22:1a58a518435c 47 */
embeddedartists 22:1a58a518435c 48 DisplayError init();
embeddedartists 22:1a58a518435c 49
embeddedartists 22:1a58a518435c 50 // From the Display interface
alindvall 39:e1cb4dd9bfeb 51 virtual DisplayError powerUp(void* framebuffer, Resolution wanted = Resolution_16bit_rgb565, FrameRate_t rate = FrameRate_Normal);
embeddedartists 22:1a58a518435c 52 virtual DisplayError powerDown();
embeddedartists 22:1a58a518435c 53 virtual DisplayError backlight(int percent);
embeddedartists 22:1a58a518435c 54 virtual uint16_t width();
embeddedartists 22:1a58a518435c 55 virtual uint16_t height();
embeddedartists 22:1a58a518435c 56 virtual uint16_t bytesPerPixel();
embeddedartists 22:1a58a518435c 57 virtual uint32_t fbSize();
embeddedartists 22:1a58a518435c 58 virtual bool landscape();
embeddedartists 22:1a58a518435c 59 virtual bool isSupported(Resolution res);
embeddedartists 22:1a58a518435c 60 virtual Resolution currentResolution();
embeddedartists 22:1a58a518435c 61 virtual void setFramebuffer(void* buff);
embeddedartists 22:1a58a518435c 62 virtual void* swapFramebuffer(void* buff);
embeddedartists 22:1a58a518435c 63 virtual void* allocateFramebuffer(Resolution res=Resolution_16bit_rgb565);
embeddedartists 31:d47cffcb0a3e 64 virtual void* allocateFramebuffers(uint32_t num=1, Resolution res=Resolution_16bit_rgb565);
embeddedartists 22:1a58a518435c 65
embeddedartists 22:1a58a518435c 66 private:
embeddedartists 22:1a58a518435c 67
embeddedartists 22:1a58a518435c 68 bool _initialized;
embeddedartists 22:1a58a518435c 69 bool _poweredOn;
embeddedartists 22:1a58a518435c 70
embeddedartists 22:1a58a518435c 71 bios_header_t* _bios;
embeddedartists 22:1a58a518435c 72 void* _biosData;
embeddedartists 22:1a58a518435c 73
embeddedartists 22:1a58a518435c 74 uint16_t _width;
embeddedartists 22:1a58a518435c 75 uint16_t _height;
embeddedartists 22:1a58a518435c 76 uint16_t _bpp;
embeddedartists 22:1a58a518435c 77 uint16_t _supportedRes;
embeddedartists 22:1a58a518435c 78 Resolution_t _activeRes;
embeddedartists 22:1a58a518435c 79 bool _landscape;
embeddedartists 22:1a58a518435c 80
embeddedartists 22:1a58a518435c 81 explicit BiosDisplay();
embeddedartists 22:1a58a518435c 82 // hide copy constructor
embeddedartists 22:1a58a518435c 83 BiosDisplay(const BiosDisplay&);
embeddedartists 22:1a58a518435c 84 // hide assign operator
embeddedartists 22:1a58a518435c 85 BiosDisplay& operator=(const BiosDisplay&);
embeddedartists 22:1a58a518435c 86 ~BiosDisplay();
alindvall 39:e1cb4dd9bfeb 87
alindvall 39:e1cb4dd9bfeb 88 uint32_t bpp(Resolution res) { return ((res == Resolution_16bit_rgb565) ? 2 : 4); }
embeddedartists 22:1a58a518435c 89 };
embeddedartists 22:1a58a518435c 90
embeddedartists 22:1a58a518435c 91 #endif /* BIOSDISPLAY_H */