FutabaGP1212A02.h
author sl
Sat, 30 Aug 2014 18:43:54 +0200
changeset 14 86faea78ddf0
parent 13 70907579a3b6
child 15 105f2c0d3cf1
permissions -rw-r--r--
GP1212A02A: Some proper commands implementation and experimenting with various
setup trying to get a descent frame rate.
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@13
    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@13
    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@13
    38
	//Specific to GP1212A02A
sl@14
    39
	
sl@10
    40
	
sl@10
    41
    //
sl@10
    42
    void RequestDeviceId();
sl@10
    43
    void RequestFirmwareRevision();
sl@10
    44
    void RequestPowerSupplyStatus();
sl@10
    45
	//
sl@10
    46
	void ToggleOffScreenMode();
sl@10
    47
    void SetOffScreenMode(bool aOn);
sl@10
    48
    bool OffScreenMode() const {return iOffScreenMode;}
sl@10
    49
    //
sl@10
    50
    void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
sl@10
    51
    bool FrameDifferencing() const {return iUseFrameDifferencing;}
sl@11
    52
    //    
sl@10
    53
    TMiniDisplayRequest AttemptRequestCompletion();
sl@10
    54
    FutabaVfdReport& InputReport() {return iInputReport;}
sl@10
    55
    bool PowerOn();
sl@10
    56
	char* DeviceId();
sl@10
    57
	char* FirmwareRevision();
sl@10
    58
sl@14
    59
	enum TBmpBoxId
sl@14
    60
	{
sl@14
    61
		EBmpBoxIdNull=0x30,
sl@14
    62
		EBmpBoxIdOne=0x31,
sl@14
    63
		EBmpBoxIdTwo=0x32,
sl@14
    64
		EBmpBoxIdThree=0x33
sl@14
    65
	};
sl@14
    66
sl@14
    67
	enum TTarget
sl@14
    68
	{
sl@14
    69
		ETargetDisplayWindow=0x30,
sl@14
    70
		ETargetDataMemory=0x31
sl@14
    71
	};
sl@14
    72
sl@14
    73
sl@14
    74
	enum TDirection
sl@14
    75
	{
sl@14
    76
		EDirectionY=0x30,
sl@14
    77
		EDirectionX=0x31
sl@14
    78
	};
sl@14
    79
sl@14
    80
sl@14
    81
	//General setting command
sl@14
    82
	void BmpDataInput(TTarget aTarget, unsigned short aAddress, TDirection aDirection, unsigned short aSize, unsigned char* aPixels);
sl@14
    83
sl@14
    84
	//BMP box
sl@14
    85
	void BmpBoxSetting(TBmpBoxId aBoxId, unsigned short aAddress, int aWidth, int aHeight);
sl@14
    86
	void BmpBoxSelect(TBmpBoxId aBoxId);
sl@14
    87
	void BmpBoxDataMemoryTransfer(unsigned short aAddress);
sl@14
    88
	void BmpBoxDataInput(unsigned short aSize, unsigned char* aPixels);
sl@14
    89
sl@10
    90
private:
sl@10
    91
	unsigned char OffScreenY() const;
sl@10
    92
	void SendClearCommand();
sl@10
    93
	void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
sl@10
    94
	void ResetBuffers();
sl@10
    95
sl@10
    96
private:
sl@10
    97
	unsigned char iDisplayPositionX;
sl@10
    98
	unsigned char iDisplayPositionY;
sl@10
    99
	///Off screen mode is the recommended default settings to avoid tearing.
sl@10
   100
	///Though turning it off can be useful for debugging
sl@10
   101
	bool iOffScreenMode;
sl@10
   102
    ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
sl@10
   103
    bool iUseFrameDifferencing;
sl@10
   104
	///
sl@10
   105
	//FutabaVfdReport iReport;
sl@10
   106
	///
sl@10
   107
	//unsigned char iFrameBuffer[256*64];
sl@13
   108
    BitArrayLow* iFrameNext;
sl@13
   109
    BitArrayLow* iFrameCurrent;
sl@13
   110
    BitArrayLow* iFramePrevious;
sl@10
   111
    //
sl@13
   112
    BitArrayLow* iFrameAlpha;
sl@13
   113
    BitArrayLow* iFrameBeta;
sl@13
   114
    BitArrayLow* iFrameGamma;
sl@10
   115
    //
sl@10
   116
    int iNeedFullFrameUpdate;
sl@10
   117
	//unsigned char iFrameBeta[256*64];
sl@10
   118
	//unsigned char *iFrontBuffer;
sl@10
   119
	//unsigned char *iBackBuffer;
sl@10
   120
    FutabaVfdReport iInputReport;
sl@10
   121
	//
sl@10
   122
	char iDeviceId[KFutabaMaxHidReportSize];
sl@10
   123
	char iFirmwareRevision[KFutabaMaxHidReportSize];
sl@10
   124
    bool iPowerOn;
sl@10
   125
	};
sl@10
   126
sl@8
   127
sl@8
   128
sl@8
   129
#endif