Display.h
author StephaneLenclud
Mon, 22 Sep 2014 22:03:28 +0200
changeset 23 e63ba12d7a18
parent 17 591e9f922c63
child 29 9b44c6e1651c
permissions -rw-r--r--
HTPC documentation and optimization for GP1212A02.
     1 //
     2 //
     3 //
     4 
     5 #ifndef DISPLAY_H
     6 #define DISPLAY_H
     7 
     8 
     9 #include "HidDevice.h"
    10 const int KMaxDisplayStringLength = 256;
    11 
    12 /**
    13 Define an interface to some basic display functionality
    14 */
    15 class DisplayBase: public HidDevice
    16 	{
    17 public:
    18 	DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false)
    19 		{	    
    20 		iDeviceId[0]=0;
    21 		iFirmwareRevision[0]=0;
    22 		}
    23 
    24 	virtual ~DisplayBase(){};
    25 	//
    26 	virtual int Open()=0;
    27 	virtual void Close()=0;
    28 	//
    29 	virtual int MinBrightness() const=0;
    30 	virtual int MaxBrightness() const=0;
    31 	virtual void SetBrightness(int aBrightness)=0;
    32 	virtual void Clear()=0;
    33 	virtual void Fill()=0;
    34 	//
    35 	virtual void SwapBuffers()=0;
    36 
    37 	//Request management
    38 	virtual void Request(TMiniDisplayRequest /*aRequest*/){ /*No request supported by default*/ };
    39 	virtual TMiniDisplayRequest AttemptRequestCompletion()=0;
    40 	
    41 	virtual TMiniDisplayRequest CurrentRequest(){return iRequest;}
    42     virtual void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
    43 	virtual bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
    44 
    45     virtual bool IsPowerOn()	{return iPowerOn;}
    46 	virtual char* DeviceId() {return iDeviceId;}
    47 	virtual char* FirmwareRevision() {return iFirmwareRevision;}
    48 
    49 	virtual void TurnPowerOn(){}
    50 	virtual void TurnPowerOff(){}
    51 	virtual bool SupportPowerOnOff(){return false;}
    52 
    53 	virtual void ShowClock(){}
    54 	virtual void HideClock(){}
    55 	virtual bool SupportClock(){return false;}
    56 
    57 protected:
    58 	void SetRequest(TMiniDisplayRequest aRequest) { iRequest=aRequest; }
    59 
    60 protected:
    61 	char iDeviceId[KMaxDisplayStringLength];
    62 	char iFirmwareRevision[KMaxDisplayStringLength];
    63     bool iPowerOn;
    64 
    65 
    66 private:
    67 	TMiniDisplayRequest iRequest;
    68 	};
    69 
    70 
    71 /**
    72 */
    73 class GraphicDisplay : public DisplayBase
    74 	{
    75 public:
    76 	virtual int WidthInPixels() const=0;
    77 	virtual int HeightInPixels() const=0;
    78 	virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel)=0;
    79 	virtual void SetAllPixels(unsigned char aOn)=0;
    80 	virtual int FrameBufferSizeInBytes() const=0;
    81 	//virtual int BitBlit(unsigned char* aSrc, unsigned char aSrcWidth, unsigned char aSrcHeight, unsigned char aTargetX, unsigned char aTargetY) const=0;
    82 
    83 	};
    84 
    85 
    86 
    87 #endif