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