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