FutabaGP1212A02.h
author sl
Tue, 26 Aug 2014 19:24:57 +0200
changeset 12 62356e3ecb84
parent 10 1c3a4964a5bd
child 13 70907579a3b6
permissions -rw-r--r--
Request results getters moved to display base.
     1 //
     2 //
     3 //
     4 
     5 #ifndef FUTABA_GP1212A02_H
     6 #define FUTABA_GP1212A02_H
     7 
     8 #include "FutabaGP1212.h"
     9 
    10 #include "FutabaGP1212.h"
    11 #include "FutabaVfd.h"
    12 
    13 /**
    14 GP1212A01A is a graphic display module using a FUTABA 256x64dots VFD.
    15 The module do not include character ROM, the customer will compile the character
    16 by themselves (from main system).
    17 */
    18 class GP1212A02A : public GP1212XXXX
    19 	{
    20 public:
    21 
    22     GP1212A02A();
    23     ~GP1212A02A();
    24 
    25 	//From DisplayBase
    26 	int Open();
    27 	virtual void SwapBuffers();
    28 
    29 	//From GraphicDisplay
    30 	virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
    31 	virtual void SetAllPixels(unsigned char aPattern);
    32     virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
    33     virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
    34 	virtual void SetBrightness(int aBrightness);
    35 	virtual void Clear();
    36 	virtual void Fill();
    37 
    38 	//Specific to GP1212A01A
    39 	void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue);
    40     void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels);
    41     //Define display position within our display RAM
    42 	void SetDisplayPosition(unsigned char aX, unsigned char aY);
    43     unsigned char DisplayPositionX() const {return iDisplayPositionX;}
    44     unsigned char DisplayPositionY() const {return iDisplayPositionY;}
    45 	
    46     //
    47     void RequestDeviceId();
    48     void RequestFirmwareRevision();
    49     void RequestPowerSupplyStatus();
    50 	//
    51 	void ToggleOffScreenMode();
    52     void SetOffScreenMode(bool aOn);
    53     bool OffScreenMode() const {return iOffScreenMode;}
    54     //
    55     void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
    56     bool FrameDifferencing() const {return iUseFrameDifferencing;}
    57     //    
    58     TMiniDisplayRequest AttemptRequestCompletion();
    59     FutabaVfdReport& InputReport() {return iInputReport;}
    60     bool PowerOn();
    61 	char* DeviceId();
    62 	char* FirmwareRevision();
    63 
    64 private:
    65 	enum DW
    66 		{
    67         DW1=0xC0,
    68         DW2=0xD0
    69 		};
    70 
    71 	void SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY);
    72 	unsigned char OffScreenY() const;
    73 	void SendClearCommand();
    74 	void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
    75 	void ResetBuffers();
    76     void SendModifiedPixelBlocks();
    77 
    78 private:
    79 	unsigned char iDisplayPositionX;
    80 	unsigned char iDisplayPositionY;
    81 	///Off screen mode is the recommended default settings to avoid tearing.
    82 	///Though turning it off can be useful for debugging
    83 	bool iOffScreenMode;
    84     ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
    85     bool iUseFrameDifferencing;
    86 	///
    87 	//FutabaVfdReport iReport;
    88 	///
    89 	//unsigned char iFrameBuffer[256*64];
    90     BitArray* iFrameNext;
    91     BitArray* iFrameCurrent;
    92     BitArray* iFramePrevious;
    93     //
    94     BitArray* iFrameAlpha;
    95     BitArray* iFrameBeta;
    96     BitArray* iFrameGamma;
    97     //
    98     int iNeedFullFrameUpdate;
    99 	//unsigned char iFrameBeta[256*64];
   100 	//unsigned char *iFrontBuffer;
   101 	//unsigned char *iBackBuffer;
   102     FutabaVfdReport iInputReport;
   103 	//
   104 	char iDeviceId[KFutabaMaxHidReportSize];
   105 	char iFirmwareRevision[KFutabaMaxHidReportSize];
   106     bool iPowerOn;
   107 	};
   108 
   109 
   110 
   111 #endif