Display.h
author sl
Sat, 30 Aug 2014 18:43:54 +0200
changeset 14 86faea78ddf0
parent 12 62356e3ecb84
child 15 105f2c0d3cf1
permissions -rw-r--r--
GP1212A02A: Some proper commands implementation and experimenting with various
setup trying to get a descent frame rate.
     1 //
     2 //
     3 //
     4 
     5 #ifndef DISPLAY_H
     6 #define DISPLAY_H
     7 
     8 const int KMaxDisplayStringLength = 256;
     9 
    10 /**
    11 Define an interface to some basic display functionality
    12 */
    13 class DisplayBase
    14 	{
    15 public:
    16 	DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false)
    17 		{	    
    18 		iDeviceId[0]=0;
    19 		iFirmwareRevision[0]=0;
    20 		}
    21 
    22 	virtual ~DisplayBase(){};
    23 	//
    24 	virtual int Open()=0;
    25 	virtual void Close()=0;
    26 	//
    27 	virtual int MinBrightness() const=0;
    28 	virtual int MaxBrightness() const=0;
    29 	virtual void SetBrightness(int aBrightness)=0;
    30 	virtual void Clear()=0;
    31 	virtual void Fill()=0;
    32 	//
    33 	virtual void SwapBuffers()=0;
    34 
    35 	//Request management
    36 	virtual void Request(TMiniDisplayRequest /*aRequest*/){ /*No request supported by default*/ };
    37 	virtual TMiniDisplayRequest AttemptRequestCompletion()=0;
    38 	
    39 	virtual TMiniDisplayRequest CurrentRequest(){return iRequest;}
    40     virtual void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
    41 	virtual bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
    42 
    43     virtual bool PowerOn()	{return iPowerOn;}
    44 	virtual char* DeviceId() {return iDeviceId;}
    45 	virtual char* FirmwareRevision() {return iFirmwareRevision;}
    46 
    47 protected:
    48 	void SetRequest(TMiniDisplayRequest aRequest) { iRequest=aRequest; }
    49 
    50 protected:
    51 	char iDeviceId[KMaxDisplayStringLength];
    52 	char iFirmwareRevision[KMaxDisplayStringLength];
    53     bool iPowerOn;
    54 
    55 
    56 private:
    57 	TMiniDisplayRequest iRequest;
    58 	};
    59 
    60 
    61 /**
    62 */
    63 class GraphicDisplay : public DisplayBase
    64 	{
    65 public:
    66 	virtual int WidthInPixels() const=0;
    67 	virtual int HeightInPixels() const=0;
    68 	virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn)=0;
    69 	virtual void SetAllPixels(unsigned char aOn)=0;
    70 	virtual int FrameBufferSizeInBytes() const=0;
    71 	//virtual int BitBlit(unsigned char* aSrc, unsigned char aSrcWidth, unsigned char aSrcHeight, unsigned char aTargetX, unsigned char aTargetY) const=0;
    72 
    73 	};
    74 
    75 
    76 
    77 #endif