# HG changeset patch # User sl # Date 1409344333 -7200 # Node ID 70907579a3b6422fdacff696e42099450ac2c327 # Parent 62356e3ecb84d0c02de7ca1afda481f61a867bd2 First working version of GP1212A02A. diff -r 62356e3ecb84 -r 70907579a3b6 BitArray.cpp --- a/BitArray.cpp Tue Aug 26 19:24:57 2014 +0200 +++ b/BitArray.cpp Fri Aug 29 22:32:13 2014 +0200 @@ -102,8 +102,12 @@ /* array index for character containing bit */ //SL: We had to change that macro since bits in our frame buffer are the other way around //TODO: Find a solution to tackle that problem + +//Bits are indexed: 01234567 //#define BIT_IN_CHAR(bit) (1 << (CHAR_BIT - 1 - ((bit) % CHAR_BIT))) -#define BIT_IN_CHAR(bit) (1 << (((bit) % CHAR_BIT))) + +//Bits are indexed: 76543210 +//#define BIT_IN_CHAR(bit) (1 << (((bit) % CHAR_BIT))) /* number of characters required to contain number of bits */ #define BITS_TO_CHARS(bits) ((((bits) - 1) / CHAR_BIT) + 1) @@ -123,7 +127,8 @@ * Effects : Allocates vectory for array bits * Returned : None ***************************************************************************/ -BitArray::BitArray(const int numBits): +template +BitArray::BitArray(const int numBits): m_NumBits(numBits), m_Array(NULL), m_OwnsBuffer(true) @@ -148,7 +153,8 @@ * Effects : Allocates vectory for array bits * Returned : None ***************************************************************************/ -BitArray::BitArray(unsigned char *array, const int numBits,bool aOwnsBuffer): +template +BitArray::BitArray(unsigned char *array, const int numBits,bool aOwnsBuffer): m_NumBits(numBits), m_Array(array), m_OwnsBuffer(aOwnsBuffer) @@ -164,7 +170,8 @@ * Effects : None * Returned : None ***************************************************************************/ -BitArray::~BitArray(void) +template +BitArray::~BitArray(void) { if (m_OwnsBuffer) { @@ -182,7 +189,8 @@ * Effects : Array contents are dumped to stdout * Returned : None ***************************************************************************/ -void BitArray::Dump(std::ostream &outStream) +template +void BitArray::Dump(std::ostream &outStream) { int size; @@ -216,7 +224,8 @@ * Unused (spare) bits are set to 0. * Returned : None ***************************************************************************/ -void BitArray::SetAll(void) +template +void BitArray::SetAll(void) { int bits, size; unsigned char mask; @@ -242,7 +251,8 @@ * Effects : Each of the bits in the bit array are set to 0. * Returned : None ***************************************************************************/ -void BitArray::ClearAll(void) +template +void BitArray::ClearAll(void) { int size; @@ -259,19 +269,21 @@ * Effects : The specified bit will be set to 1. * Returned : None ***************************************************************************/ -void BitArray::SetBit(const unsigned int bit) +template +void BitArray::SetBit(const unsigned int bit) { if (m_NumBits <= bit) { return; /* bit out of range */ } - m_Array[BIT_CHAR(bit)] |= BIT_IN_CHAR(bit); + m_Array[BIT_CHAR(bit)] |= F(bit); } /** */ -void BitArray::SetBitValue(const unsigned int bit, bool aValue) +template +void BitArray::SetBitValue(const unsigned int bit, bool aValue) { if (aValue) { @@ -290,7 +302,8 @@ * Effects : The specified bit will be set to 0. * Returned : None ***************************************************************************/ -void BitArray::ClearBit(const unsigned int bit) +template +void BitArray::ClearBit(const unsigned int bit) { unsigned char mask; @@ -300,7 +313,7 @@ } /* create a mask to zero out desired bit */ - mask = BIT_IN_CHAR(bit); + mask = F(bit); mask = ~mask; m_Array[BIT_CHAR(bit)] &= mask; @@ -316,9 +329,10 @@ * Effects : None * Returned : bit_array_index_c (pointer to bit) ***************************************************************************/ -BitArrayIndex BitArray::operator()(const unsigned int bit) +template +BitArrayIndex BitArray::operator()(const unsigned int bit) { - BitArrayIndex result(this, bit); + BitArrayIndex result(this, bit); return result; } @@ -331,9 +345,10 @@ * Effects : None * Returned : The value of the specified bit. ***************************************************************************/ -bool BitArray::operator[](const unsigned int bit) const +template +bool BitArray::operator[](const unsigned int bit) const { - return((m_Array[BIT_CHAR(bit)] & BIT_IN_CHAR(bit)) != 0); + return((m_Array[BIT_CHAR(bit)] & F(bit)) != 0); } /*************************************************************************** @@ -343,7 +358,8 @@ * Effects : None * Returned : True if this == other. Otherwise false. ***************************************************************************/ -bool BitArray::operator==(const BitArray &other) const +template +bool BitArray::operator==(const BitArray &other) const { if (m_NumBits != other.m_NumBits) { @@ -361,7 +377,8 @@ * Effects : None * Returned : True if this != other. Otherwise false. ***************************************************************************/ -bool BitArray::operator!=(const BitArray &other) const +template +bool BitArray::operator!=(const BitArray &other) const { if (m_NumBits != other.m_NumBits) { @@ -379,7 +396,8 @@ * Effects : None * Returned : True if this < other. Otherwise false. ***************************************************************************/ -bool BitArray::operator<(const BitArray &other) const +template +bool BitArray::operator<(const BitArray &other) const { if (m_NumBits != other.m_NumBits) { @@ -397,7 +415,8 @@ * Effects : None * Returned : True if this <= other. Otherwise false. ***************************************************************************/ -bool BitArray::operator<=(const BitArray &other) const +template +bool BitArray::operator<=(const BitArray &other) const { if (m_NumBits != other.m_NumBits) { @@ -415,7 +434,8 @@ * Effects : None * Returned : True if this > other. Otherwise false. ***************************************************************************/ -bool BitArray::operator>(const BitArray &other) const +template +bool BitArray::operator>(const BitArray &other) const { if (m_NumBits != other.m_NumBits) { @@ -433,7 +453,8 @@ * Effects : None * Returned : True if this >= other. Otherwise false. ***************************************************************************/ -bool BitArray::operator>=(const BitArray &other) const +template +bool BitArray::operator>=(const BitArray &other) const { if (m_NumBits != other.m_NumBits) { @@ -452,7 +473,8 @@ * Effects : None * Returned : value of this after bitwise not ***************************************************************************/ -BitArray BitArray::operator~(void) const +template +BitArray BitArray::operator~(void) const { BitArray result(this->m_NumBits); result = *this; @@ -469,9 +491,10 @@ * Effects : None * Returned : value of bitwise and of this and other. ***************************************************************************/ -BitArray BitArray::operator&(const BitArray &other) const +template +BitArray BitArray::operator&(const BitArray &other) const { - BitArray result(this->m_NumBits); + BitArray result(this->m_NumBits); result = *this; result &= other; @@ -487,9 +510,10 @@ * Effects : None * Returned : value of bitwise xor of this and other. ***************************************************************************/ -BitArray BitArray::operator^(const BitArray &other) const +template +BitArray BitArray::operator^(const BitArray &other) const { - BitArray result(this->m_NumBits); + BitArray result(this->m_NumBits); result = *this; result ^= other; @@ -504,9 +528,10 @@ * Effects : None * Returned : value of bitwise or of this and other. ***************************************************************************/ -BitArray BitArray::operator|(const BitArray &other) const +template +BitArray BitArray::operator|(const BitArray &other) const { - BitArray result(this->m_NumBits); + BitArray result(this->m_NumBits); result = *this; result |= other; @@ -521,9 +546,10 @@ * Effects : None * Returned : result of bitwise left shift ***************************************************************************/ -BitArray BitArray::operator<<(const unsigned int count) const +template +BitArray BitArray::operator<<(const unsigned int count) const { - BitArray result(this->m_NumBits); + BitArray result(this->m_NumBits); result = *this; result <<= count; @@ -538,9 +564,10 @@ * Effects : None * Returned : result of bitwise right shift ***************************************************************************/ -BitArray BitArray::operator>>(const unsigned int count) const +template +BitArray BitArray::operator>>(const unsigned int count) const { - BitArray result(this->m_NumBits); + BitArray result(this->m_NumBits); result = *this; result >>= count; @@ -555,7 +582,8 @@ * Effects : Bit array contents are incremented * Returned : Reference to this array after increment ***************************************************************************/ -BitArray& BitArray::operator++(void) +template +BitArray& BitArray::operator++(void) { int i; unsigned char maxValue; /* maximum value for current char */ @@ -608,7 +636,8 @@ * Effects : Bit array contents are incremented * Returned : Reference to this array after increment ***************************************************************************/ -BitArray& BitArray::operator++(int dummy) +template +BitArray& BitArray::operator++(int dummy) { ++(*this); return *this; @@ -622,7 +651,8 @@ * Effects : Bit array contents are decremented * Returned : None ***************************************************************************/ -BitArray& BitArray::operator--(void) +template +BitArray& BitArray::operator--(void) { int i; unsigned char maxValue; /* maximum value for current char */ @@ -675,7 +705,8 @@ * Effects : Bit array contents are decremented * Returned : None ***************************************************************************/ -BitArray& BitArray::operator--(int dummy) +template +BitArray& BitArray::operator--(int dummy) { --(*this); return *this; @@ -689,7 +720,8 @@ * Effects : Source bit array contents are copied into this array * Returned : Reference to this array after copy ***************************************************************************/ -BitArray& BitArray::operator=(const BitArray &src) +template +BitArray& BitArray::operator=(const BitArray &src) { if (*this == src) { @@ -726,7 +758,8 @@ * Effects : Results of bitwise and are stored in this array * Returned : Reference to this array after and ***************************************************************************/ -BitArray& BitArray::operator&=(const BitArray &src) +template +BitArray& BitArray::operator&=(const BitArray &src) { int size; @@ -756,7 +789,8 @@ * Effects : Results of bitwise xor are stored in this array * Returned : Reference to this array after xor ***************************************************************************/ -BitArray& BitArray::operator^=(const BitArray &src) +template +BitArray& BitArray::operator^=(const BitArray &src) { int size; @@ -786,7 +820,8 @@ * Effects : Results of bitwise or are stored in this array * Returned : Reference to this array after or ***************************************************************************/ -BitArray& BitArray::operator|=(const BitArray &src) +template +BitArray& BitArray::operator|=(const BitArray &src) { int size; @@ -815,7 +850,8 @@ * left at 0. * Returned : Reference to this array after not ***************************************************************************/ -BitArray& BitArray::Not(void) +template +BitArray& BitArray::Not(void) { int bits; unsigned char mask; @@ -854,7 +890,8 @@ * Effects : Results of the shifts are stored in this array * Returned : Reference to this array after shift ***************************************************************************/ -BitArray& BitArray::operator<<=(const unsigned int shifts) +template +BitArray& BitArray::operator<<=(const unsigned int shifts) { int i; int chars = shifts / CHAR_BIT; /* number of whole byte shifts */ @@ -913,7 +950,8 @@ * Effects : Results of the shifts are stored in this array * Returned : Reference to this array after shift ***************************************************************************/ -BitArray& BitArray::operator>>=(const unsigned int shifts) +template +BitArray& BitArray::operator>>=(const unsigned int shifts) { int i; char mask; @@ -981,7 +1019,8 @@ * Effects : Pointer to bit array and bit index are stored. * Returned : None ***************************************************************************/ -BitArrayIndex::BitArrayIndex(BitArray *array, +template +BitArrayIndex::BitArrayIndex(BitArray *array, const unsigned int index) { m_BitArray = array; @@ -997,7 +1036,8 @@ * source. * Returned : None ***************************************************************************/ -void BitArrayIndex::operator=(const bool src) +template +void BitArrayIndex::operator=(const bool src) { if (m_BitArray == NULL) { @@ -1018,3 +1058,9 @@ m_BitArray->ClearBit(m_Index); } } + + +template class BitArray; +template class BitArray; +template class BitArrayIndex; +template class BitArrayIndex; \ No newline at end of file diff -r 62356e3ecb84 -r 70907579a3b6 BitArray.h --- a/BitArray.h Tue Aug 26 19:24:57 2014 +0200 +++ b/BitArray.h Fri Aug 29 22:32:13 2014 +0200 @@ -71,26 +71,39 @@ /*************************************************************************** * TYPE DEFINITIONS ***************************************************************************/ +typedef unsigned char (*TBitInChar)(const unsigned int aBit); +template class BitArray; + +//Bits are indexed: 76543210 +inline unsigned char HighBitHighIndex(const unsigned int aBit) { return (1 << (((aBit) % CHAR_BIT)));}; + +//Bits are indexed: 01234567 +inline unsigned char HighBitLowIndex(const unsigned int aBit) { return (1 << (CHAR_BIT - 1 - ((aBit) % CHAR_BIT)));}; + + + /** */ +template class BitArrayIndex { public: - BitArrayIndex(BitArray *array, const unsigned int index); + BitArrayIndex(BitArray *array, const unsigned int index); /* assignment */ void operator=(const bool src); private: - BitArray *m_BitArray; /* array index applies to */ + BitArray *m_BitArray; /* array index applies to */ unsigned int m_Index; /* index of bit in array */ }; /** TODO: Derive a Bit Frame class from this one for X Y access to pixels. */ +template class BitArray { public: @@ -111,42 +124,42 @@ void SetBitValue(const unsigned int bit, bool aValue); void ClearBit(const unsigned int bit); - BitArrayIndex operator()(const unsigned int bit); + BitArrayIndex operator()(const unsigned int bit); /* boolean operator */ bool operator[](const unsigned int bit) const; - bool operator==(const BitArray &other) const; - bool operator!=(const BitArray &other) const; - bool operator<(const BitArray &other) const; - bool operator<=(const BitArray &other) const; - bool operator>(const BitArray &other) const; - bool operator>=(const BitArray &other) const; + bool operator==(const BitArray &other) const; + bool operator!=(const BitArray &other) const; + bool operator<(const BitArray &other) const; + bool operator<=(const BitArray &other) const; + bool operator>(const BitArray &other) const; + bool operator>=(const BitArray &other) const; /* bitwise operators */ - BitArray operator&(const BitArray &other) const; - BitArray operator^(const BitArray &other) const; - BitArray operator|(const BitArray &other) const; - BitArray operator~(void) const; + BitArray operator&(const BitArray &other) const; + BitArray operator^(const BitArray &other) const; + BitArray operator|(const BitArray &other) const; + BitArray operator~(void) const; - BitArray operator<<(const unsigned int count) const; - BitArray operator>>(const unsigned int count) const; + BitArray operator<<(const unsigned int count) const; + BitArray operator>>(const unsigned int count) const; /* increment/decrement */ - BitArray& operator++(void); /* prefix */ - BitArray& operator++(int dummy); /* postfix */ - BitArray& operator--(void); /* prefix */ - BitArray& operator--(int dummy); /* postfix */ + BitArray& operator++(void); /* prefix */ + BitArray& operator++(int dummy); /* postfix */ + BitArray& operator--(void); /* prefix */ + BitArray& operator--(int dummy); /* postfix */ /* assignments */ - BitArray& operator=(const BitArray &src); + BitArray& operator=(const BitArray &src); - BitArray& operator&=(const BitArray &src); - BitArray& operator^=(const BitArray &src); - BitArray& operator|=(const BitArray &src); - BitArray& Not(void); /* negate (~=) */ + BitArray& operator&=(const BitArray &src); + BitArray& operator^=(const BitArray &src); + BitArray& operator|=(const BitArray &src); + BitArray& Not(void); /* negate (~=) */ - BitArray& operator<<=(unsigned const int shifts); - BitArray& operator>>=(unsigned const int shifts); + BitArray& operator<<=(unsigned const int shifts); + BitArray& operator>>=(unsigned const int shifts); unsigned char* Ptr(){return m_Array;} const unsigned char* Ptr() const{return m_Array;} @@ -158,4 +171,7 @@ bool m_OwnsBuffer; }; +typedef BitArray BitArrayHigh; +typedef BitArray BitArrayLow; + #endif /* ndef BIT_ARRAY_H */ diff -r 62356e3ecb84 -r 70907579a3b6 Display.h --- a/Display.h Tue Aug 26 19:24:57 2014 +0200 +++ b/Display.h Fri Aug 29 22:32:13 2014 +0200 @@ -13,10 +13,12 @@ class DisplayBase { public: - DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false){ - iDeviceId[0]=0; - iFirmwareRevision[0]=0; -} + DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false) + { + iDeviceId[0]=0; + iFirmwareRevision[0]=0; + } + virtual ~DisplayBase(){}; // virtual int Open()=0; diff -r 62356e3ecb84 -r 70907579a3b6 FutabaGP1212A01.cpp --- a/FutabaGP1212A01.cpp Tue Aug 26 19:24:57 2014 +0200 +++ b/FutabaGP1212A01.cpp Fri Aug 29 22:32:13 2014 +0200 @@ -55,15 +55,15 @@ //Allocate both frames delete iFrameAlpha; iFrameAlpha=NULL; - iFrameAlpha=new BitArray(KGP12xFrameBufferPixelCount); + iFrameAlpha=new BitArrayHigh(KGP12xFrameBufferPixelCount); // delete iFrameBeta; iFrameBeta=NULL; - iFrameBeta=new BitArray(KGP12xFrameBufferPixelCount); + iFrameBeta=new BitArrayHigh(KGP12xFrameBufferPixelCount); // delete iFrameGamma; iFrameGamma=NULL; - iFrameGamma=new BitArray(KGP12xFrameBufferPixelCount); + iFrameGamma=new BitArrayHigh(KGP12xFrameBufferPixelCount); // iFrameNext=iFrameAlpha; iFrameCurrent=iFrameBeta; @@ -111,6 +111,7 @@ /** */ +/* void GP1212A01A::BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const { //TODO: amend loop values so that we don't keep on looping past our frame buffer dimensions. @@ -122,6 +123,7 @@ } } } +*/ /** Clear our client side back buffer. @@ -342,7 +344,7 @@ //We can then compare previous and next frame and send only the differences to our device. //This mechanism allows us to reduce traffic over our USB bus thus improving our frame rate from 14 FPS to 30 FPS. //Keep our previous frame pointer - BitArray* previousFrame=iFramePrevious; + BitArrayHigh* previousFrame=iFramePrevious; //Current frame becomes the previous one iFramePrevious = iFrameCurrent; //Next frame becomes the current one @@ -392,8 +394,8 @@ } */ - BitArray nextBlock(KPixelBlockSizeInBits); - BitArray previousBlock(KPixelBlockSizeInBits); + BitArrayHigh nextBlock(KPixelBlockSizeInBits); + BitArrayHigh previousBlock(KPixelBlockSizeInBits); for (int i=0;i>8; //Size of pixel data in bytes (MSB) - report[9]=aSize; //Size of pixel data in bytes (LSB) - int sizeWritten=MIN(aSize,report.Size()-10); - memset(report.Buffer()+10, aValue, sizeWritten); - Write(report); - - int remainingSize=aSize; - //We need to keep on sending our pixel data until we are done - while (report[1]==64) - { - report.Reset(); - remainingSize-=sizeWritten; - report[0]=0x00; //Report ID - report[1]=(remainingSize<=report.Size()-2?remainingSize:64); //Report length, should be 64 or the remaining size - sizeWritten=(report[1]==64?63:report[1]); - memset(report.Buffer()+2, aValue, sizeWritten); - Write(report); - } - } - -/** -Set the defined pixel block to the given value. -@param X coordinate of our pixel block starting point. -@param Y coordinate of our pixel block starting point. -@param The height of our pixel block. -@param The size of our pixel data. Number of pixels divided by 8. -@param Pointer to our pixel data. -*/ -void GP1212A02A::SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels) - { - OffScreenTranslation(aX,aY); - FutabaVfdReport report; - report[0]=0x00; //Report ID - report[1]=(aSize<=report.Size()-10?aSize+0x08:64); //Report length. -10 is for our header first 10 bytes. +8 is for our Futaba header size - report[2]=0x1B; //Command ID - report[3]=0x5B; //Command ID - report[4]=0xF0; //Command ID - report[5]=aX; //X - report[6]=aY; //Y - report[7]=aHeight; //Y length before return. Though outside the specs, setting this to zero apparently allows us to modify a single pixel without touching any other. - report[8]=aSize>>8; //Size of pixel data in bytes (MSB) - report[9]=aSize; //Size of pixel data in bytes (LSB) + report[3]=0x4A; //Command ID + report[4]=0x30; //DW Display Window + report[5]=0x00; //aL = DW lower byte + report[6]=0x00; //aH = DW upper byte + report[7]=0x30; //Direction of writing: Y + report[8]=aSize; //Size of pixel data in bytes (LSB) + report[9]=aSize>>8; //Size of pixel data in bytes (MSB) int sizeWritten=MIN(aSize,report.Size()-10); memcpy(report.Buffer()+10, aPixels, sizeWritten); Write(report); @@ -257,7 +214,7 @@ memcpy(report.Buffer()+2, aPixels+(aSize-remainingSize), sizeWritten); Write(report); } - } +} /** Using this function is advised against as is causes tearing. @@ -265,48 +222,18 @@ */ void GP1212A02A::SendClearCommand() { - //1BH,5BH,32H,4AH + //1BH,4AH,43H,44H //Send Clear Display Command FutabaVfdReport report; report[0]=0x00; //Report ID report[1]=0x04; //Report length report[2]=0x1B; //Command ID - report[3]=0x5B; //Command ID - report[4]=0x32; //Command ID - report[5]=0x4A; //Command ID + report[3]=0x4A; //Command ID + report[4]=0x43; //Command ID + report[5]=0x44; //Command ID Write(report); } -/** -Change our display position within our buffer. -*/ -void GP1212A02A::SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY) - { - //1BH,5BH,Dw,Px,Py - //Send Display Position Settings Command - FutabaVfdReport report; - report[0]=0x00; //Report ID - report[1]=0x05; //Report length - report[2]=0x1B; //Command ID - report[3]=0x5B; //Command ID - report[4]=aDw; //Specify our DW - report[5]=aX; //X coordinate of our DW top-left corner - report[6]=aY; //Y coordinate of our DW top-left corner - Write(report); - } - -/** -Change our display position within our buffer. -*/ -void GP1212A02A::SetDisplayPosition(unsigned char aX, unsigned char aY) - { - //Specs apparently says both DW should remain the same - //Just don't ask - SetDisplayPosition(GP1212A02A::DW1,aX,aY); - SetDisplayPosition(GP1212A02A::DW2,aX,aY); - iDisplayPositionX=aX; - iDisplayPositionY=aY; - } /** Provide Y coordinate of our off screen buffer. @@ -327,26 +254,14 @@ if (OffScreenMode()) { //Send host back buffer to device back buffer - if (!iUseFrameDifferencing || iNeedFullFrameUpdatePtr()); - } - else - { - //Frame diff algo is enabled - //We are going to send to our device only the differences between next frame and previous frame - SendModifiedPixelBlocks(); - } - //Swap device front and back buffer - SetDisplayPosition(iDisplayPositionX,OffScreenY()); + SetFrame(FrameBufferSizeInBytes(),iFrameNext->Ptr()); //Cycle through our frame buffers //We keep track of previous frame which is in fact our device back buffer. //We can then compare previous and next frame and send only the differences to our device. //This mechanism allows us to reduce traffic over our USB bus thus improving our frame rate from 14 FPS to 30 FPS. //Keep our previous frame pointer - BitArray* previousFrame=iFramePrevious; + BitArrayLow* previousFrame=iFramePrevious; //Current frame becomes the previous one iFramePrevious = iFrameCurrent; //Next frame becomes the current one @@ -366,95 +281,6 @@ /** - * @brief GP1212A02A::SendModifiedPixelBlocks - * Compare our back and front buffer and send to the device only the modified pixels. - */ -void GP1212A02A::SendModifiedPixelBlocks() - { - int w=WidthInPixels(); - int h=HeightInPixels(); - - - //TODO: optimize with memcmp and 16 inc - /* - - for (int i=0;iPtr()+offset); - } - } - } - */ - - BitArray nextBlock(KPixelBlockSizeInBits); - BitArray previousBlock(KPixelBlockSizeInBits); - - for (int i=0;iPtr()+offset,iFramePrevious->Ptr()+offset,32 )) //32=(16*16/8) - if (memcmp(nextBlock.Ptr(),previousBlock.Ptr(),KPixelBlockSizeInBytes)!=0) - { - //We need to update that block - SetPixelBlock(i,j,KPixelBlockEdge-1,KPixelBlockSizeInBytes,nextBlock.Ptr()); - //SetPixelBlock(i,j,15,32,0xFF/*nextBlock.Ptr()*/); - //SetDisplayPosition(iDisplayPositionX,OffScreenY()); - //SetDisplayPosition(iDisplayPositionX,OffScreenY()); - - //SetPixelBlock(i,j,15,32,iFrameNext->Ptr()+offset); - } - } - } - - } - -/** Translate the given pixel coordinate according to our off screen mode. */ void GP1212A02A::OffScreenTranslation(unsigned char& aX, unsigned char& aY) @@ -523,7 +349,6 @@ iOffScreenMode=aOn; //Clean up our buffers upon switching modes - SetDisplayPosition(0,0); Clear(); SwapBuffers(); Clear(); @@ -558,7 +383,7 @@ report[2]=0x1B; //Command ID report[3]=0x4A; //Command ID report[4]=0x44; //Command ID - report[7]=0x30+aBrightness; //Brightness level + report[5]=0x30+aBrightness; //Brightness level Write(report); } diff -r 62356e3ecb84 -r 70907579a3b6 FutabaGP1212A02.h --- a/FutabaGP1212A02.h Tue Aug 26 19:24:57 2014 +0200 +++ b/FutabaGP1212A02.h Fri Aug 29 22:32:13 2014 +0200 @@ -13,7 +13,7 @@ /** GP1212A01A is a graphic display module using a FUTABA 256x64dots VFD. The module do not include character ROM, the customer will compile the character -by themselves (from main system). +by themselves (from main system). */ class GP1212A02A : public GP1212XXXX { @@ -30,18 +30,13 @@ virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn); virtual void SetAllPixels(unsigned char aPattern); virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;} - virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const; + //virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const; virtual void SetBrightness(int aBrightness); virtual void Clear(); virtual void Fill(); - //Specific to GP1212A01A - void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue); - void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels); - //Define display position within our display RAM - void SetDisplayPosition(unsigned char aX, unsigned char aY); - unsigned char DisplayPositionX() const {return iDisplayPositionX;} - unsigned char DisplayPositionY() const {return iDisplayPositionY;} + //Specific to GP1212A02A + void SetFrame(int aSize, unsigned char* aPixels); // void RequestDeviceId(); @@ -62,18 +57,10 @@ char* FirmwareRevision(); private: - enum DW - { - DW1=0xC0, - DW2=0xD0 - }; - - void SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY); unsigned char OffScreenY() const; void SendClearCommand(); void OffScreenTranslation(unsigned char& aX, unsigned char& aY); void ResetBuffers(); - void SendModifiedPixelBlocks(); private: unsigned char iDisplayPositionX; @@ -87,13 +74,13 @@ //FutabaVfdReport iReport; /// //unsigned char iFrameBuffer[256*64]; - BitArray* iFrameNext; - BitArray* iFrameCurrent; - BitArray* iFramePrevious; + BitArrayLow* iFrameNext; + BitArrayLow* iFrameCurrent; + BitArrayLow* iFramePrevious; // - BitArray* iFrameAlpha; - BitArray* iFrameBeta; - BitArray* iFrameGamma; + BitArrayLow* iFrameAlpha; + BitArrayLow* iFrameBeta; + BitArrayLow* iFrameGamma; // int iNeedFullFrameUpdate; //unsigned char iFrameBeta[256*64];