FutabaGP1212A01.h
author StephaneLenclud
Sat, 26 Sep 2015 11:45:26 +0200
changeset 39 c32f4955c166
parent 22 ea9ccfdb5563
permissions -rw-r--r--
More fixes to our NuGet package targets file.
     1 //
     2 // Copyright (C) 2014-2015 Stéphane Lenclud.
     3 //
     4 // This file is part of MiniDisplay.
     5 //
     6 // MiniDisplay is free software: you can redistribute it and/or modify
     7 // it under the terms of the GNU General Public License as published by
     8 // the Free Software Foundation, either version 3 of the License, or
     9 // (at your option) any later version.
    10 //
    11 // MiniDisplay is distributed in the hope that it will be useful,
    12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14 // GNU General Public License for more details.
    15 //
    16 // You should have received a copy of the GNU General Public License
    17 // along with MiniDisplay.  If not, see <http://www.gnu.org/licenses/>.
    18 //
    19 
    20 #ifndef FUTABA_GP1212A01_H
    21 #define FUTABA_GP1212A01_H
    22 
    23 #include "FutabaGP1212.h"
    24 #include "FutabaVfd.h"
    25 
    26 /**
    27 GP1212A01A is a graphic display module using a FUTABA 256x64dots VFD.
    28 The module do not include character ROM, the customer will compile the character
    29 by themselves (from main system).
    30 */
    31 class GP1212A01A : public GP1212XXXX
    32 	{
    33 public:
    34 
    35 
    36 public:
    37     GP1212A01A();
    38     ~GP1212A01A();
    39 
    40 	//From DisplayBase
    41 	int Open();
    42 	//From FutabaGraphicVfd
    43 	virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel);
    44 	virtual void SetAllPixels(unsigned char aPattern);
    45     virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
    46     //virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
    47 	//From FutabaVfd
    48 	virtual void SetBrightness(int aBrightness);
    49 	virtual void Clear();
    50 	virtual void Fill();
    51 
    52 	//Specific to GP1212A01A
    53 	void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue);
    54     void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels);
    55     //Define display position within our display RAM
    56 	void SetDisplayPosition(unsigned char aX, unsigned char aY);
    57     unsigned char DisplayPositionX() const {return iDisplayPositionX;}
    58     unsigned char DisplayPositionY() const {return iDisplayPositionY;}
    59     //
    60 	void SwapBuffers();
    61     //
    62 	virtual void Request(TMiniDisplayRequest aRequest);
    63 	//
    64 	void ToggleOffScreenMode();
    65     void SetOffScreenMode(bool aOn);
    66     bool OffScreenMode() const {return iOffScreenMode;}
    67     //
    68     void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
    69     bool FrameDifferencing() const {return iUseFrameDifferencing;}
    70     //
    71     TMiniDisplayRequest AttemptRequestCompletion();
    72     FutabaVfdReport& InputReport() {return iInputReport;}
    73 
    74 private:
    75 	void RequestDeviceId();
    76     void RequestFirmwareRevision();
    77     void RequestPowerSupplyStatus();
    78 
    79 
    80 private:
    81 	enum DW
    82 		{
    83         DW1=0xC0,
    84         DW2=0xD0
    85 		};
    86 
    87 	void SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY);
    88 	unsigned char OffScreenY() const;
    89 	void SendClearCommand();
    90 	void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
    91 	void ResetBuffers();
    92     void SendModifiedPixelBlocks();
    93 
    94 private:
    95 	unsigned char iDisplayPositionX;
    96 	unsigned char iDisplayPositionY;
    97 	///Off screen mode is the recommended default settings to avoid tearing.
    98 	///Though turning it off can be useful for debugging
    99 	bool iOffScreenMode;
   100     ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
   101     bool iUseFrameDifferencing;
   102 	///
   103 	//FutabaVfdReport iReport;
   104 	///
   105 	//unsigned char iFrameBuffer[256*64];
   106     BitArrayHigh* iFrameNext;
   107     BitArrayHigh* iFrameCurrent;
   108     BitArrayHigh* iFramePrevious;
   109     //
   110     BitArrayHigh* iFrameAlpha;
   111     BitArrayHigh* iFrameBeta;
   112     BitArrayHigh* iFrameGamma;
   113     //
   114     int iNeedFullFrameUpdate;
   115 	//unsigned char iFrameBeta[256*64];
   116 	//unsigned char *iFrontBuffer;
   117 	//unsigned char *iBackBuffer;
   118     FutabaVfdReport iInputReport;
   119 	};
   120 
   121 
   122 #endif