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