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