First working version of GP1212A02A.
authorsl
Fri, 29 Aug 2014 22:32:13 +0200
changeset 1370907579a3b6
parent 12 62356e3ecb84
child 14 86faea78ddf0
First working version of GP1212A02A.
BitArray.cpp
BitArray.h
Display.h
FutabaGP1212A01.cpp
FutabaGP1212A01.h
FutabaGP1212A02.cpp
FutabaGP1212A02.h
     1.1 --- a/BitArray.cpp	Tue Aug 26 19:24:57 2014 +0200
     1.2 +++ b/BitArray.cpp	Fri Aug 29 22:32:13 2014 +0200
     1.3 @@ -102,8 +102,12 @@
     1.4  /* array index for character containing bit */
     1.5  //SL: We had to change that macro since bits in our frame buffer are the other way around
     1.6  //TODO: Find a solution to tackle that problem
     1.7 +
     1.8 +//Bits are indexed: 01234567
     1.9  //#define BIT_IN_CHAR(bit)      (1 << (CHAR_BIT - 1 - ((bit)  % CHAR_BIT)))
    1.10 -#define BIT_IN_CHAR(bit)      (1 << (((bit)  % CHAR_BIT)))
    1.11 +
    1.12 +//Bits are indexed: 76543210
    1.13 +//#define BIT_IN_CHAR(bit)      (1 << (((bit)  % CHAR_BIT)))
    1.14  
    1.15  /* number of characters required to contain number of bits */
    1.16  #define BITS_TO_CHARS(bits)   ((((bits) - 1) / CHAR_BIT) + 1)
    1.17 @@ -123,7 +127,8 @@
    1.18  *   Effects    : Allocates vectory for array bits
    1.19  *   Returned   : None
    1.20  ***************************************************************************/
    1.21 -BitArray::BitArray(const int numBits):
    1.22 +template <TBitInChar F>
    1.23 +BitArray<F>::BitArray(const int numBits):
    1.24      m_NumBits(numBits),
    1.25      m_Array(NULL),
    1.26      m_OwnsBuffer(true)
    1.27 @@ -148,7 +153,8 @@
    1.28  *   Effects    : Allocates vectory for array bits
    1.29  *   Returned   : None
    1.30  ***************************************************************************/
    1.31 -BitArray::BitArray(unsigned char *array, const int numBits,bool aOwnsBuffer):
    1.32 +template <TBitInChar F>
    1.33 +BitArray<F>::BitArray(unsigned char *array, const int numBits,bool aOwnsBuffer):
    1.34      m_NumBits(numBits),
    1.35      m_Array(array),
    1.36      m_OwnsBuffer(aOwnsBuffer)
    1.37 @@ -164,7 +170,8 @@
    1.38  *   Effects    : None
    1.39  *   Returned   : None
    1.40  ***************************************************************************/
    1.41 -BitArray::~BitArray(void)
    1.42 +template <TBitInChar F>
    1.43 +BitArray<F>::~BitArray(void)
    1.44  {
    1.45      if (m_OwnsBuffer)
    1.46      {
    1.47 @@ -182,7 +189,8 @@
    1.48  *   Effects    : Array contents are dumped to stdout
    1.49  *   Returned   : None
    1.50  ***************************************************************************/
    1.51 -void BitArray::Dump(std::ostream &outStream)
    1.52 +template <TBitInChar F>
    1.53 +void BitArray<F>::Dump(std::ostream &outStream)
    1.54  {
    1.55      int size;
    1.56  
    1.57 @@ -216,7 +224,8 @@
    1.58  *                Unused (spare) bits are set to 0.
    1.59  *   Returned   : None
    1.60  ***************************************************************************/
    1.61 -void BitArray::SetAll(void)
    1.62 +template <TBitInChar F>
    1.63 +void BitArray<F>::SetAll(void)
    1.64  {
    1.65      int bits, size;
    1.66      unsigned char mask;
    1.67 @@ -242,7 +251,8 @@
    1.68  *   Effects    : Each of the bits in the bit array are set to 0.
    1.69  *   Returned   : None
    1.70  ***************************************************************************/
    1.71 -void BitArray::ClearAll(void)
    1.72 +template <TBitInChar F>
    1.73 +void BitArray<F>::ClearAll(void)
    1.74  {
    1.75      int size;
    1.76  
    1.77 @@ -259,19 +269,21 @@
    1.78  *   Effects    : The specified bit will be set to 1.
    1.79  *   Returned   : None
    1.80  ***************************************************************************/
    1.81 -void BitArray::SetBit(const unsigned int bit)
    1.82 +template <TBitInChar F>
    1.83 +void BitArray<F>::SetBit(const unsigned int bit)
    1.84  {
    1.85      if (m_NumBits <= bit)
    1.86      {
    1.87          return;         /* bit out of range */
    1.88      }
    1.89  
    1.90 -    m_Array[BIT_CHAR(bit)] |= BIT_IN_CHAR(bit);
    1.91 +    m_Array[BIT_CHAR(bit)] |= F(bit);
    1.92  }
    1.93  
    1.94  /**
    1.95  */
    1.96 -void BitArray::SetBitValue(const unsigned int bit, bool aValue)
    1.97 +template <TBitInChar F>
    1.98 +void BitArray<F>::SetBitValue(const unsigned int bit, bool aValue)
    1.99  	{
   1.100  	if (aValue)
   1.101  		{
   1.102 @@ -290,7 +302,8 @@
   1.103  *   Effects    : The specified bit will be set to 0.
   1.104  *   Returned   : None
   1.105  ***************************************************************************/
   1.106 -void BitArray::ClearBit(const unsigned int bit)
   1.107 +template <TBitInChar F>
   1.108 +void BitArray<F>::ClearBit(const unsigned int bit)
   1.109  {
   1.110      unsigned char mask;
   1.111  
   1.112 @@ -300,7 +313,7 @@
   1.113      }
   1.114  
   1.115      /* create a mask to zero out desired bit */
   1.116 -    mask =  BIT_IN_CHAR(bit);
   1.117 +    mask =  F(bit);
   1.118      mask = ~mask;
   1.119  
   1.120      m_Array[BIT_CHAR(bit)] &= mask;
   1.121 @@ -316,9 +329,10 @@
   1.122  *   Effects    : None
   1.123  *   Returned   : bit_array_index_c (pointer to bit)
   1.124  ***************************************************************************/
   1.125 -BitArrayIndex BitArray::operator()(const unsigned int bit)
   1.126 +template <TBitInChar F>
   1.127 +BitArrayIndex<F> BitArray<F>::operator()(const unsigned int bit)
   1.128  {
   1.129 -    BitArrayIndex result(this, bit);
   1.130 +    BitArrayIndex<F> result(this, bit);
   1.131  
   1.132      return result;
   1.133  }
   1.134 @@ -331,9 +345,10 @@
   1.135  *   Effects    : None
   1.136  *   Returned   : The value of the specified bit.
   1.137  ***************************************************************************/
   1.138 -bool BitArray::operator[](const unsigned int bit) const
   1.139 +template <TBitInChar F>
   1.140 +bool BitArray<F>::operator[](const unsigned int bit) const
   1.141  {
   1.142 -    return((m_Array[BIT_CHAR(bit)] & BIT_IN_CHAR(bit)) != 0);
   1.143 +    return((m_Array[BIT_CHAR(bit)] & F(bit)) != 0);
   1.144  }
   1.145  
   1.146  /***************************************************************************
   1.147 @@ -343,7 +358,8 @@
   1.148  *   Effects    : None
   1.149  *   Returned   : True if this == other.  Otherwise false.
   1.150  ***************************************************************************/
   1.151 -bool BitArray::operator==(const BitArray &other) const
   1.152 +template <TBitInChar F>
   1.153 +bool BitArray<F>::operator==(const BitArray &other) const
   1.154  {
   1.155      if (m_NumBits != other.m_NumBits)
   1.156      {
   1.157 @@ -361,7 +377,8 @@
   1.158  *   Effects    : None
   1.159  *   Returned   : True if this != other.  Otherwise false.
   1.160  ***************************************************************************/
   1.161 -bool BitArray::operator!=(const BitArray &other) const
   1.162 +template <TBitInChar F>
   1.163 +bool BitArray<F>::operator!=(const BitArray &other) const
   1.164  {
   1.165      if (m_NumBits != other.m_NumBits)
   1.166      {
   1.167 @@ -379,7 +396,8 @@
   1.168  *   Effects    : None
   1.169  *   Returned   : True if this < other.  Otherwise false.
   1.170  ***************************************************************************/
   1.171 -bool BitArray::operator<(const BitArray &other) const
   1.172 +template <TBitInChar F>
   1.173 +bool BitArray<F>::operator<(const BitArray &other) const
   1.174  {
   1.175      if (m_NumBits != other.m_NumBits)
   1.176      {
   1.177 @@ -397,7 +415,8 @@
   1.178  *   Effects    : None
   1.179  *   Returned   : True if this <= other.  Otherwise false.
   1.180  ***************************************************************************/
   1.181 -bool BitArray::operator<=(const BitArray &other) const
   1.182 +template <TBitInChar F>
   1.183 +bool BitArray<F>::operator<=(const BitArray &other) const
   1.184  {
   1.185      if (m_NumBits != other.m_NumBits)
   1.186      {
   1.187 @@ -415,7 +434,8 @@
   1.188  *   Effects    : None
   1.189  *   Returned   : True if this > other.  Otherwise false.
   1.190  ***************************************************************************/
   1.191 -bool BitArray::operator>(const BitArray &other) const
   1.192 +template <TBitInChar F>
   1.193 +bool BitArray<F>::operator>(const BitArray &other) const
   1.194  {
   1.195      if (m_NumBits != other.m_NumBits)
   1.196      {
   1.197 @@ -433,7 +453,8 @@
   1.198  *   Effects    : None
   1.199  *   Returned   : True if this >= other.  Otherwise false.
   1.200  ***************************************************************************/
   1.201 -bool BitArray::operator>=(const BitArray &other) const
   1.202 +template <TBitInChar F>
   1.203 +bool BitArray<F>::operator>=(const BitArray &other) const
   1.204  {
   1.205      if (m_NumBits != other.m_NumBits)
   1.206      {
   1.207 @@ -452,7 +473,8 @@
   1.208  *   Effects    : None
   1.209  *   Returned   : value of this after bitwise not
   1.210  ***************************************************************************/
   1.211 -BitArray BitArray::operator~(void) const
   1.212 +template <TBitInChar F>
   1.213 +BitArray<F> BitArray<F>::operator~(void) const
   1.214  {
   1.215      BitArray result(this->m_NumBits);
   1.216      result = *this;
   1.217 @@ -469,9 +491,10 @@
   1.218  *   Effects    : None
   1.219  *   Returned   : value of bitwise and of this and other.
   1.220  ***************************************************************************/
   1.221 -BitArray BitArray::operator&(const BitArray &other) const
   1.222 +template <TBitInChar F>
   1.223 +BitArray<F> BitArray<F>::operator&(const BitArray<F> &other) const
   1.224  {
   1.225 -    BitArray result(this->m_NumBits);
   1.226 +    BitArray<F> result(this->m_NumBits);
   1.227      result = *this;
   1.228      result &= other;
   1.229  
   1.230 @@ -487,9 +510,10 @@
   1.231  *   Effects    : None
   1.232  *   Returned   : value of bitwise xor of this and other.
   1.233  ***************************************************************************/
   1.234 -BitArray BitArray::operator^(const BitArray &other) const
   1.235 +template <TBitInChar F>
   1.236 +BitArray<F> BitArray<F>::operator^(const BitArray<F> &other) const
   1.237  {
   1.238 -    BitArray result(this->m_NumBits);
   1.239 +    BitArray<F> result(this->m_NumBits);
   1.240      result = *this;
   1.241      result ^= other;
   1.242  
   1.243 @@ -504,9 +528,10 @@
   1.244  *   Effects    : None
   1.245  *   Returned   : value of bitwise or of this and other.
   1.246  ***************************************************************************/
   1.247 -BitArray BitArray::operator|(const BitArray &other) const
   1.248 +template <TBitInChar F>
   1.249 +BitArray<F> BitArray<F>::operator|(const BitArray<F> &other) const
   1.250  {
   1.251 -    BitArray result(this->m_NumBits);
   1.252 +    BitArray<F> result(this->m_NumBits);
   1.253      result = *this;
   1.254      result |= other;
   1.255  
   1.256 @@ -521,9 +546,10 @@
   1.257  *   Effects    : None
   1.258  *   Returned   : result of bitwise left shift
   1.259  ***************************************************************************/
   1.260 -BitArray BitArray::operator<<(const unsigned int count) const
   1.261 +template <TBitInChar F>
   1.262 +BitArray<F> BitArray<F>::operator<<(const unsigned int count) const
   1.263  {
   1.264 -    BitArray result(this->m_NumBits);
   1.265 +    BitArray<F> result(this->m_NumBits);
   1.266      result = *this;
   1.267      result <<= count;
   1.268  
   1.269 @@ -538,9 +564,10 @@
   1.270  *   Effects    : None
   1.271  *   Returned   : result of bitwise right shift
   1.272  ***************************************************************************/
   1.273 -BitArray BitArray::operator>>(const unsigned int count) const
   1.274 +template <TBitInChar F>
   1.275 +BitArray<F> BitArray<F>::operator>>(const unsigned int count) const
   1.276  {
   1.277 -    BitArray result(this->m_NumBits);
   1.278 +    BitArray<F> result(this->m_NumBits);
   1.279      result = *this;
   1.280      result >>= count;
   1.281  
   1.282 @@ -555,7 +582,8 @@
   1.283  *   Effects    : Bit array contents are incremented
   1.284  *   Returned   : Reference to this array after increment
   1.285  ***************************************************************************/
   1.286 -BitArray& BitArray::operator++(void)
   1.287 +template <TBitInChar F>
   1.288 +BitArray<F>& BitArray<F>::operator++(void)
   1.289  {
   1.290      int i;
   1.291      unsigned char maxValue;     /* maximum value for current char */
   1.292 @@ -608,7 +636,8 @@
   1.293  *   Effects    : Bit array contents are incremented
   1.294  *   Returned   : Reference to this array after increment
   1.295  ***************************************************************************/
   1.296 -BitArray& BitArray::operator++(int dummy)
   1.297 +template <TBitInChar F>
   1.298 +BitArray<F>& BitArray<F>::operator++(int dummy)
   1.299  {
   1.300      ++(*this);
   1.301      return *this;
   1.302 @@ -622,7 +651,8 @@
   1.303  *   Effects    : Bit array contents are decremented
   1.304  *   Returned   : None
   1.305  ***************************************************************************/
   1.306 -BitArray& BitArray::operator--(void)
   1.307 +template <TBitInChar F>
   1.308 +BitArray<F>& BitArray<F>::operator--(void)
   1.309  {
   1.310      int i;
   1.311      unsigned char maxValue;     /* maximum value for current char */
   1.312 @@ -675,7 +705,8 @@
   1.313  *   Effects    : Bit array contents are decremented
   1.314  *   Returned   : None
   1.315  ***************************************************************************/
   1.316 -BitArray& BitArray::operator--(int dummy)
   1.317 +template <TBitInChar F>
   1.318 +BitArray<F>& BitArray<F>::operator--(int dummy)
   1.319  {
   1.320      --(*this);
   1.321      return *this;
   1.322 @@ -689,7 +720,8 @@
   1.323  *   Effects    : Source bit array contents are copied into this array
   1.324  *   Returned   : Reference to this array after copy
   1.325  ***************************************************************************/
   1.326 -BitArray& BitArray::operator=(const BitArray &src)
   1.327 +template <TBitInChar F>
   1.328 +BitArray<F>& BitArray<F>::operator=(const BitArray<F> &src)
   1.329  {
   1.330      if (*this == src)
   1.331      {
   1.332 @@ -726,7 +758,8 @@
   1.333  *   Effects    : Results of bitwise and are stored in this array
   1.334  *   Returned   : Reference to this array after and
   1.335  ***************************************************************************/
   1.336 -BitArray& BitArray::operator&=(const BitArray &src)
   1.337 +template <TBitInChar F>
   1.338 +BitArray<F>& BitArray<F>::operator&=(const BitArray<F> &src)
   1.339  {
   1.340      int size;
   1.341  
   1.342 @@ -756,7 +789,8 @@
   1.343  *   Effects    : Results of bitwise xor are stored in this array
   1.344  *   Returned   : Reference to this array after xor
   1.345  ***************************************************************************/
   1.346 -BitArray& BitArray::operator^=(const BitArray &src)
   1.347 +template <TBitInChar F>
   1.348 +BitArray<F>& BitArray<F>::operator^=(const BitArray<F> &src)
   1.349  {
   1.350      int size;
   1.351  
   1.352 @@ -786,7 +820,8 @@
   1.353  *   Effects    : Results of bitwise or are stored in this array
   1.354  *   Returned   : Reference to this array after or
   1.355  ***************************************************************************/
   1.356 -BitArray& BitArray::operator|=(const BitArray &src)
   1.357 +template <TBitInChar F>
   1.358 +BitArray<F>& BitArray<F>::operator|=(const BitArray<F> &src)
   1.359  {
   1.360      int size;
   1.361  
   1.362 @@ -815,7 +850,8 @@
   1.363  *                left at 0.
   1.364  *   Returned   : Reference to this array after not
   1.365  ***************************************************************************/
   1.366 -BitArray& BitArray::Not(void)
   1.367 +template <TBitInChar F>
   1.368 +BitArray<F>& BitArray<F>::Not(void)
   1.369  {
   1.370      int bits;
   1.371      unsigned char mask;
   1.372 @@ -854,7 +890,8 @@
   1.373  *   Effects    : Results of the shifts are stored in this array
   1.374  *   Returned   : Reference to this array after shift
   1.375  ***************************************************************************/
   1.376 -BitArray& BitArray::operator<<=(const unsigned int shifts)
   1.377 +template <TBitInChar F>
   1.378 +BitArray<F>& BitArray<F>::operator<<=(const unsigned int shifts)
   1.379  {
   1.380      int i;
   1.381      int chars = shifts / CHAR_BIT; /* number of whole byte shifts */
   1.382 @@ -913,7 +950,8 @@
   1.383  *   Effects    : Results of the shifts are stored in this array
   1.384  *   Returned   : Reference to this array after shift
   1.385  ***************************************************************************/
   1.386 -BitArray& BitArray::operator>>=(const unsigned int shifts)
   1.387 +template <TBitInChar F>
   1.388 +BitArray<F>& BitArray<F>::operator>>=(const unsigned int shifts)
   1.389  {
   1.390      int i;
   1.391      char mask;
   1.392 @@ -981,7 +1019,8 @@
   1.393  *   Effects    : Pointer to bit array and bit index are stored.
   1.394  *   Returned   : None
   1.395  ***************************************************************************/
   1.396 -BitArrayIndex::BitArrayIndex(BitArray *array,
   1.397 +template <TBitInChar F>
   1.398 +BitArrayIndex<F>::BitArrayIndex(BitArray<F> *array,
   1.399      const unsigned int index)
   1.400  {
   1.401      m_BitArray = array;
   1.402 @@ -997,7 +1036,8 @@
   1.403  *                source.
   1.404  *   Returned   : None
   1.405  ***************************************************************************/
   1.406 -void BitArrayIndex::operator=(const bool src)
   1.407 +template <TBitInChar F>
   1.408 +void BitArrayIndex<F>::operator=(const bool src)
   1.409  {
   1.410      if (m_BitArray == NULL)
   1.411      {
   1.412 @@ -1018,3 +1058,9 @@
   1.413          m_BitArray->ClearBit(m_Index);
   1.414      }
   1.415  }
   1.416 +
   1.417 +
   1.418 +template class BitArray<HighBitHighIndex>;
   1.419 +template class BitArray<HighBitLowIndex>;
   1.420 +template class BitArrayIndex<HighBitHighIndex>;
   1.421 +template class BitArrayIndex<HighBitLowIndex>;
   1.422 \ No newline at end of file
     2.1 --- a/BitArray.h	Tue Aug 26 19:24:57 2014 +0200
     2.2 +++ b/BitArray.h	Fri Aug 29 22:32:13 2014 +0200
     2.3 @@ -71,26 +71,39 @@
     2.4  /***************************************************************************
     2.5  *                            TYPE DEFINITIONS
     2.6  ***************************************************************************/
     2.7 +typedef unsigned char (*TBitInChar)(const unsigned int aBit);
     2.8 +template <TBitInChar F>
     2.9  class BitArray;
    2.10  
    2.11 +
    2.12 +//Bits are indexed: 76543210
    2.13 +inline unsigned char HighBitHighIndex(const unsigned int aBit) { return (1 << (((aBit)  % CHAR_BIT)));};
    2.14 +
    2.15 +//Bits are indexed: 01234567
    2.16 +inline unsigned char HighBitLowIndex(const unsigned int aBit) { return (1 << (CHAR_BIT - 1 - ((aBit)  % CHAR_BIT)));};
    2.17 +
    2.18 +
    2.19 +
    2.20  /**
    2.21  */
    2.22 +template <TBitInChar F>
    2.23  class BitArrayIndex
    2.24  {
    2.25      public:
    2.26 -        BitArrayIndex(BitArray *array, const unsigned int index);
    2.27 +        BitArrayIndex(BitArray<F> *array, const unsigned int index);
    2.28  
    2.29          /* assignment */
    2.30          void operator=(const bool src);
    2.31  
    2.32      private:
    2.33 -        BitArray *m_BitArray;        /* array index applies to */
    2.34 +        BitArray<F> *m_BitArray;        /* array index applies to */
    2.35          unsigned int m_Index;           /* index of bit in array */
    2.36  };
    2.37  
    2.38  /**
    2.39  TODO: Derive a Bit Frame class from this one for X Y access to pixels.
    2.40  */
    2.41 +template <TBitInChar F>
    2.42  class BitArray
    2.43  {
    2.44      public:
    2.45 @@ -111,42 +124,42 @@
    2.46  		void SetBitValue(const unsigned int bit, bool aValue);
    2.47          void ClearBit(const unsigned int bit);
    2.48  
    2.49 -        BitArrayIndex operator()(const unsigned int bit);
    2.50 +        BitArrayIndex<F> operator()(const unsigned int bit);
    2.51  
    2.52          /* boolean operator */
    2.53          bool operator[](const unsigned int bit) const;
    2.54 -        bool operator==(const BitArray &other) const;
    2.55 -        bool operator!=(const BitArray &other) const;
    2.56 -        bool operator<(const BitArray &other) const;
    2.57 -        bool operator<=(const BitArray &other) const;
    2.58 -        bool operator>(const BitArray &other) const;
    2.59 -        bool operator>=(const BitArray &other) const;
    2.60 +        bool operator==(const BitArray<F> &other) const;
    2.61 +        bool operator!=(const BitArray<F> &other) const;
    2.62 +        bool operator<(const BitArray<F> &other) const;
    2.63 +        bool operator<=(const BitArray<F> &other) const;
    2.64 +        bool operator>(const BitArray<F> &other) const;
    2.65 +        bool operator>=(const BitArray<F> &other) const;
    2.66  
    2.67          /* bitwise operators */
    2.68 -        BitArray operator&(const BitArray &other) const;
    2.69 -        BitArray operator^(const BitArray &other) const;
    2.70 -        BitArray operator|(const BitArray &other) const;
    2.71 -        BitArray operator~(void) const;
    2.72 +        BitArray<F> operator&(const BitArray<F> &other) const;
    2.73 +        BitArray<F> operator^(const BitArray<F> &other) const;
    2.74 +        BitArray<F> operator|(const BitArray<F> &other) const;
    2.75 +        BitArray<F> operator~(void) const;
    2.76  
    2.77 -        BitArray operator<<(const unsigned int count) const;
    2.78 -        BitArray operator>>(const unsigned int count) const;
    2.79 +        BitArray<F> operator<<(const unsigned int count) const;
    2.80 +        BitArray<F> operator>>(const unsigned int count) const;
    2.81  
    2.82          /* increment/decrement */
    2.83 -        BitArray& operator++(void);          /* prefix */
    2.84 -        BitArray& operator++(int dummy);     /* postfix */
    2.85 -        BitArray& operator--(void);          /* prefix */
    2.86 -        BitArray& operator--(int dummy);     /* postfix */
    2.87 +        BitArray<F>& operator++(void);          /* prefix */
    2.88 +        BitArray<F>& operator++(int dummy);     /* postfix */
    2.89 +        BitArray<F>& operator--(void);          /* prefix */
    2.90 +        BitArray<F>& operator--(int dummy);     /* postfix */
    2.91  
    2.92          /* assignments */
    2.93 -        BitArray& operator=(const BitArray &src);
    2.94 +        BitArray<F>& operator=(const BitArray<F> &src);
    2.95  
    2.96 -        BitArray& operator&=(const BitArray &src);
    2.97 -        BitArray& operator^=(const BitArray &src);
    2.98 -        BitArray& operator|=(const BitArray &src);
    2.99 -        BitArray& Not(void);                 /* negate (~=) */
   2.100 +        BitArray<F>& operator&=(const BitArray<F> &src);
   2.101 +        BitArray<F>& operator^=(const BitArray<F> &src);
   2.102 +        BitArray<F>& operator|=(const BitArray<F> &src);
   2.103 +        BitArray<F>& Not(void);                 /* negate (~=) */
   2.104  
   2.105 -        BitArray& operator<<=(unsigned const int shifts);
   2.106 -        BitArray& operator>>=(unsigned const int shifts);
   2.107 +        BitArray<F>& operator<<=(unsigned const int shifts);
   2.108 +        BitArray<F>& operator>>=(unsigned const int shifts);
   2.109  
   2.110  		unsigned char* Ptr(){return m_Array;}
   2.111  		const unsigned char* Ptr() const{return m_Array;}
   2.112 @@ -158,4 +171,7 @@
   2.113          bool m_OwnsBuffer;
   2.114  };
   2.115  
   2.116 +typedef BitArray<HighBitHighIndex> BitArrayHigh;
   2.117 +typedef BitArray<HighBitLowIndex> BitArrayLow;
   2.118 +
   2.119  #endif  /* ndef BIT_ARRAY_H */
     3.1 --- a/Display.h	Tue Aug 26 19:24:57 2014 +0200
     3.2 +++ b/Display.h	Fri Aug 29 22:32:13 2014 +0200
     3.3 @@ -13,10 +13,12 @@
     3.4  class DisplayBase
     3.5  	{
     3.6  public:
     3.7 -	DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false){	    
     3.8 -	iDeviceId[0]=0;
     3.9 -	iFirmwareRevision[0]=0;
    3.10 -}
    3.11 +	DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false)
    3.12 +		{	    
    3.13 +		iDeviceId[0]=0;
    3.14 +		iFirmwareRevision[0]=0;
    3.15 +		}
    3.16 +
    3.17  	virtual ~DisplayBase(){};
    3.18  	//
    3.19  	virtual int Open()=0;
     4.1 --- a/FutabaGP1212A01.cpp	Tue Aug 26 19:24:57 2014 +0200
     4.2 +++ b/FutabaGP1212A01.cpp	Fri Aug 29 22:32:13 2014 +0200
     4.3 @@ -55,15 +55,15 @@
     4.4          //Allocate both frames
     4.5          delete iFrameAlpha;
     4.6          iFrameAlpha=NULL;
     4.7 -        iFrameAlpha=new BitArray(KGP12xFrameBufferPixelCount);
     4.8 +        iFrameAlpha=new BitArrayHigh(KGP12xFrameBufferPixelCount);
     4.9          //
    4.10          delete iFrameBeta;
    4.11          iFrameBeta=NULL;
    4.12 -        iFrameBeta=new BitArray(KGP12xFrameBufferPixelCount);
    4.13 +        iFrameBeta=new BitArrayHigh(KGP12xFrameBufferPixelCount);
    4.14          //
    4.15          delete iFrameGamma;
    4.16          iFrameGamma=NULL;
    4.17 -        iFrameGamma=new BitArray(KGP12xFrameBufferPixelCount);
    4.18 +        iFrameGamma=new BitArrayHigh(KGP12xFrameBufferPixelCount);
    4.19          //
    4.20          iFrameNext=iFrameAlpha;
    4.21          iFrameCurrent=iFrameBeta;
    4.22 @@ -111,6 +111,7 @@
    4.23  
    4.24  /**
    4.25  */
    4.26 +/*
    4.27  void GP1212A01A::BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const
    4.28  	{
    4.29  	//TODO: amend loop values so that we don't keep on looping past our frame buffer dimensions.
    4.30 @@ -122,6 +123,7 @@
    4.31  			}
    4.32  		}
    4.33  	}
    4.34 +*/
    4.35  
    4.36  /**
    4.37  Clear our client side back buffer.
    4.38 @@ -342,7 +344,7 @@
    4.39          //We can then compare previous and next frame and send only the differences to our device.
    4.40          //This mechanism allows us to reduce traffic over our USB bus thus improving our frame rate from 14 FPS to 30 FPS.
    4.41          //Keep our previous frame pointer
    4.42 -        BitArray* previousFrame=iFramePrevious;
    4.43 +        BitArrayHigh* previousFrame=iFramePrevious;
    4.44          //Current frame becomes the previous one
    4.45          iFramePrevious = iFrameCurrent;
    4.46          //Next frame becomes the current one
    4.47 @@ -392,8 +394,8 @@
    4.48          }
    4.49      */
    4.50  
    4.51 -    BitArray nextBlock(KPixelBlockSizeInBits);
    4.52 -    BitArray previousBlock(KPixelBlockSizeInBits);
    4.53 +    BitArrayHigh nextBlock(KPixelBlockSizeInBits);
    4.54 +    BitArrayHigh previousBlock(KPixelBlockSizeInBits);
    4.55  
    4.56      for (int i=0;i<w;i+=KPixelBlockEdge)
    4.57          {
     5.1 --- a/FutabaGP1212A01.h	Tue Aug 26 19:24:57 2014 +0200
     5.2 +++ b/FutabaGP1212A01.h	Fri Aug 29 22:32:13 2014 +0200
     5.3 @@ -28,7 +28,7 @@
     5.4  	virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
     5.5  	virtual void SetAllPixels(unsigned char aPattern);
     5.6      virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
     5.7 -    virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
     5.8 +    //virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
     5.9  	//From FutabaVfd
    5.10  	virtual void SetBrightness(int aBrightness);
    5.11  	virtual void Clear();
    5.12 @@ -88,13 +88,13 @@
    5.13  	//FutabaVfdReport iReport;
    5.14  	///
    5.15  	//unsigned char iFrameBuffer[256*64];
    5.16 -    BitArray* iFrameNext;
    5.17 -    BitArray* iFrameCurrent;
    5.18 -    BitArray* iFramePrevious;
    5.19 +    BitArrayHigh* iFrameNext;
    5.20 +    BitArrayHigh* iFrameCurrent;
    5.21 +    BitArrayHigh* iFramePrevious;
    5.22      //
    5.23 -    BitArray* iFrameAlpha;
    5.24 -    BitArray* iFrameBeta;
    5.25 -    BitArray* iFrameGamma;
    5.26 +    BitArrayHigh* iFrameAlpha;
    5.27 +    BitArrayHigh* iFrameBeta;
    5.28 +    BitArrayHigh* iFrameGamma;
    5.29      //
    5.30      int iNeedFullFrameUpdate;
    5.31  	//unsigned char iFrameBeta[256*64];
     6.1 --- a/FutabaGP1212A02.cpp	Tue Aug 26 19:24:57 2014 +0200
     6.2 +++ b/FutabaGP1212A02.cpp	Fri Aug 29 22:32:13 2014 +0200
     6.3 @@ -59,15 +59,15 @@
     6.4          //Allocate both frames
     6.5          delete iFrameAlpha;
     6.6          iFrameAlpha=NULL;
     6.7 -        iFrameAlpha=new BitArray(KGP12xFrameBufferPixelCount);
     6.8 +        iFrameAlpha=new BitArrayLow(KGP12xFrameBufferPixelCount);
     6.9          //
    6.10          delete iFrameBeta;
    6.11          iFrameBeta=NULL;
    6.12 -        iFrameBeta=new BitArray(KGP12xFrameBufferPixelCount);
    6.13 +        iFrameBeta=new BitArrayLow(KGP12xFrameBufferPixelCount);
    6.14          //
    6.15          delete iFrameGamma;
    6.16          iFrameGamma=NULL;
    6.17 -        iFrameGamma=new BitArray(KGP12xFrameBufferPixelCount);
    6.18 +        iFrameGamma=new BitArrayLow(KGP12xFrameBufferPixelCount);
    6.19          //
    6.20          iFrameNext=iFrameAlpha;
    6.21          iFrameCurrent=iFrameBeta;
    6.22 @@ -78,10 +78,8 @@
    6.23          iNeedFullFrameUpdate=0;
    6.24          //
    6.25  		SetNonBlocking(1);
    6.26 -        //Since we can't get our display position we force it to our default
    6.27 -		//This makes sure frames are in sync from the start
    6.28 -        //Clever clients will have taken care of putting back frame (0,0) before closing
    6.29 -		SetDisplayPosition(iDisplayPositionX,iDisplayPositionY);
    6.30 +		//
    6.31 +		SendClearCommand();
    6.32  		}
    6.33  	return success;
    6.34  	}
    6.35 @@ -109,12 +107,13 @@
    6.36      else
    6.37          {
    6.38          //Just specify a one pixel block
    6.39 -        SetPixelBlock(aX,aY,0x00,0x01,aOn);
    6.40 +        //TODO
    6.41          }
    6.42  	}
    6.43  
    6.44  /**
    6.45  */
    6.46 +/*
    6.47  void GP1212A02A::BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const
    6.48  	{
    6.49  	//TODO: amend loop values so that we don't keep on looping past our frame buffer dimensions.
    6.50 @@ -126,6 +125,7 @@
    6.51  			}
    6.52  		}
    6.53  	}
    6.54 +*/
    6.55  
    6.56  /**
    6.57  Clear our client side back buffer.
    6.58 @@ -173,74 +173,31 @@
    6.59      else
    6.60          {
    6.61          //Using pattern SetPixelBlock variant.
    6.62 -        SetPixelBlock(0,0,63,FrameBufferSizeInBytes(),aPattern);
    6.63 +        //TODO
    6.64          }
    6.65  	//
    6.66  	}
    6.67  
    6.68  
    6.69 +
    6.70 +
    6.71  /**
    6.72 -Set the defined pixel block to the given value.
    6.73 -@param X coordinate of our pixel block starting point.
    6.74 -@param Y coordinate of our pixel block starting point.
    6.75 -@param The height of our pixel block.
    6.76 -@param The size of our pixel data. Number of pixels divided by 8.
    6.77 -@param The value set to 8 pixels used as a pattern.
    6.78 +Using this function is advised against as is causes tearing.
    6.79 +Use Clear instead.
    6.80  */
    6.81 -void GP1212A02A::SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue)
    6.82 -	{
    6.83 -	OffScreenTranslation(aX,aY);
    6.84 -    FutabaVfdReport report;
    6.85 +void GP1212A02A::SetFrame(int aSize, unsigned char* aPixels)
    6.86 +{
    6.87 +	FutabaVfdReport report;
    6.88      report[0]=0x00; //Report ID
    6.89      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
    6.90      report[2]=0x1B; //Command ID
    6.91 -    report[3]=0x5B; //Command ID
    6.92 -    report[4]=0xF0; //Command ID
    6.93 -    report[5]=aX;   //X
    6.94 -    report[6]=aY;   //Y
    6.95 -    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.
    6.96 -	report[8]=aSize>>8; //Size of pixel data in bytes (MSB)
    6.97 -	report[9]=aSize;	//Size of pixel data in bytes (LSB)
    6.98 -    int sizeWritten=MIN(aSize,report.Size()-10);
    6.99 -    memset(report.Buffer()+10, aValue, sizeWritten);
   6.100 -    Write(report);
   6.101 -
   6.102 -    int remainingSize=aSize;
   6.103 -    //We need to keep on sending our pixel data until we are done
   6.104 -    while (report[1]==64)
   6.105 -        {
   6.106 -        report.Reset();
   6.107 -        remainingSize-=sizeWritten;
   6.108 -        report[0]=0x00; //Report ID
   6.109 -        report[1]=(remainingSize<=report.Size()-2?remainingSize:64); //Report length, should be 64 or the remaining size
   6.110 -        sizeWritten=(report[1]==64?63:report[1]);
   6.111 -        memset(report.Buffer()+2, aValue, sizeWritten);
   6.112 -        Write(report);
   6.113 -        }
   6.114 -	}
   6.115 -
   6.116 -/**
   6.117 -Set the defined pixel block to the given value.
   6.118 -@param X coordinate of our pixel block starting point.
   6.119 -@param Y coordinate of our pixel block starting point.
   6.120 -@param The height of our pixel block.
   6.121 -@param The size of our pixel data. Number of pixels divided by 8.
   6.122 -@param Pointer to our pixel data.
   6.123 -*/
   6.124 -void GP1212A02A::SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels)
   6.125 -    {
   6.126 -	OffScreenTranslation(aX,aY);
   6.127 -    FutabaVfdReport report;
   6.128 -    report[0]=0x00; //Report ID
   6.129 -    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
   6.130 -    report[2]=0x1B; //Command ID
   6.131 -    report[3]=0x5B; //Command ID
   6.132 -    report[4]=0xF0; //Command ID
   6.133 -    report[5]=aX;   //X
   6.134 -    report[6]=aY;   //Y
   6.135 -    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.
   6.136 -	report[8]=aSize>>8; //Size of pixel data in bytes (MSB)
   6.137 -	report[9]=aSize;	//Size of pixel data in bytes (LSB)
   6.138 +    report[3]=0x4A; //Command ID
   6.139 +    report[4]=0x30; //DW Display Window
   6.140 +    report[5]=0x00; //aL = DW lower byte
   6.141 +    report[6]=0x00; //aH = DW upper byte
   6.142 +    report[7]=0x30; //Direction of writing: Y
   6.143 +	report[8]=aSize; //Size of pixel data in bytes (LSB)
   6.144 +	report[9]=aSize>>8;	//Size of pixel data in bytes (MSB)
   6.145      int sizeWritten=MIN(aSize,report.Size()-10);
   6.146      memcpy(report.Buffer()+10, aPixels, sizeWritten);
   6.147      Write(report);
   6.148 @@ -257,7 +214,7 @@
   6.149          memcpy(report.Buffer()+2, aPixels+(aSize-remainingSize), sizeWritten);
   6.150          Write(report);
   6.151          }
   6.152 -    }
   6.153 +}
   6.154  
   6.155  /**
   6.156  Using this function is advised against as is causes tearing.
   6.157 @@ -265,48 +222,18 @@
   6.158  */
   6.159  void GP1212A02A::SendClearCommand()
   6.160  	{
   6.161 -    //1BH,5BH,32H,4AH
   6.162 +    //1BH,4AH,43H,44H
   6.163      //Send Clear Display Command
   6.164  	FutabaVfdReport report;
   6.165  	report[0]=0x00; //Report ID
   6.166  	report[1]=0x04; //Report length
   6.167  	report[2]=0x1B; //Command ID
   6.168 -	report[3]=0x5B; //Command ID
   6.169 -	report[4]=0x32; //Command ID
   6.170 -	report[5]=0x4A; //Command ID
   6.171 +	report[3]=0x4A; //Command ID
   6.172 +	report[4]=0x43; //Command ID
   6.173 +	report[5]=0x44; //Command ID
   6.174  	Write(report);
   6.175  	}
   6.176  
   6.177 -/**
   6.178 -Change our display position within our buffer.
   6.179 -*/
   6.180 -void GP1212A02A::SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY)
   6.181 -    {
   6.182 -    //1BH,5BH,Dw,Px,Py
   6.183 -    //Send Display Position Settings Command
   6.184 -    FutabaVfdReport report;
   6.185 -    report[0]=0x00; //Report ID
   6.186 -    report[1]=0x05; //Report length
   6.187 -    report[2]=0x1B; //Command ID
   6.188 -    report[3]=0x5B; //Command ID
   6.189 -    report[4]=aDw;  //Specify our DW
   6.190 -    report[5]=aX;   //X coordinate of our DW top-left corner
   6.191 -    report[6]=aY;   //Y coordinate of our DW top-left corner
   6.192 -    Write(report);
   6.193 -    }
   6.194 -
   6.195 -/**
   6.196 -Change our display position within our buffer.
   6.197 -*/
   6.198 -void GP1212A02A::SetDisplayPosition(unsigned char aX, unsigned char aY)
   6.199 -	{
   6.200 -	//Specs apparently says both DW should remain the same
   6.201 -	//Just don't ask
   6.202 -    SetDisplayPosition(GP1212A02A::DW1,aX,aY);
   6.203 -    SetDisplayPosition(GP1212A02A::DW2,aX,aY);
   6.204 -	iDisplayPositionX=aX;
   6.205 -	iDisplayPositionY=aY;
   6.206 -	}
   6.207  
   6.208  /**
   6.209  Provide Y coordinate of our off screen buffer.
   6.210 @@ -327,26 +254,14 @@
   6.211  	if (OffScreenMode())
   6.212  		{
   6.213  		//Send host back buffer to device back buffer
   6.214 -        if (!iUseFrameDifferencing || iNeedFullFrameUpdate<KNumberOfFrameBeforeDiffAlgo)
   6.215 -            {
   6.216 -            iNeedFullFrameUpdate++;
   6.217 -            SetPixelBlock(0,0,63,FrameBufferSizeInBytes(),iFrameNext->Ptr());
   6.218 -            }
   6.219 -        else
   6.220 -            {
   6.221 -            //Frame diff algo is enabled
   6.222 -            //We are going to send to our device only the differences between next frame and previous frame
   6.223 -            SendModifiedPixelBlocks();
   6.224 -            }
   6.225 -		//Swap device front and back buffer
   6.226 -		SetDisplayPosition(iDisplayPositionX,OffScreenY());
   6.227 +		SetFrame(FrameBufferSizeInBytes(),iFrameNext->Ptr());
   6.228  
   6.229          //Cycle through our frame buffers
   6.230          //We keep track of previous frame which is in fact our device back buffer.
   6.231          //We can then compare previous and next frame and send only the differences to our device.
   6.232          //This mechanism allows us to reduce traffic over our USB bus thus improving our frame rate from 14 FPS to 30 FPS.
   6.233          //Keep our previous frame pointer
   6.234 -        BitArray* previousFrame=iFramePrevious;
   6.235 +        BitArrayLow* previousFrame=iFramePrevious;
   6.236          //Current frame becomes the previous one
   6.237          iFramePrevious = iFrameCurrent;
   6.238          //Next frame becomes the current one
   6.239 @@ -366,95 +281,6 @@
   6.240  
   6.241  
   6.242  /**
   6.243 - * @brief GP1212A02A::SendModifiedPixelBlocks
   6.244 - * Compare our back and front buffer and send to the device only the modified pixels.
   6.245 - */
   6.246 -void GP1212A02A::SendModifiedPixelBlocks()
   6.247 -    {
   6.248 -    int w=WidthInPixels();
   6.249 -    int h=HeightInPixels();
   6.250 -
   6.251 -
   6.252 -    //TODO: optimize with memcmp and 16 inc
   6.253 -    /*
   6.254 -
   6.255 -    for (int i=0;i<w;i++)
   6.256 -        {
   6.257 -        for (int j=0;j<h;j++)
   6.258 -            {
   6.259 -            //aX*HeightInPixels()+aY
   6.260 -            if ((*iFrameNext)[i*h+j]!=(*iFramePrevious)[i*h+j])
   6.261 -                {
   6.262 -                //We need to update that pixel
   6.263 -                SetPixelBlock(i,j,0,1,((*iFrameNext)[i*h+j]?0x01:0x00));
   6.264 -                //SetDisplayPosition(iDisplayPositionX,OffScreenY());
   6.265 -                //SetDisplayPosition(iDisplayPositionX,OffScreenY());
   6.266 -
   6.267 -                //SetPixelBlock(i,j,15,32,iNextFrame->Ptr()+offset);
   6.268 -                }
   6.269 -            }
   6.270 -        }
   6.271 -    */
   6.272 -
   6.273 -    BitArray nextBlock(KPixelBlockSizeInBits);
   6.274 -    BitArray previousBlock(KPixelBlockSizeInBits);
   6.275 -
   6.276 -    for (int i=0;i<w;i+=KPixelBlockEdge)
   6.277 -        {
   6.278 -        for (int j=0;j<h;j+=KPixelBlockEdge)
   6.279 -            {
   6.280 -            //aX*HeightInPixels()+aY
   6.281 -            //int offset=(i*w/8)+(j/8);
   6.282 -
   6.283 -#ifdef DEBUG_FRAME_DIFF
   6.284 -            QImage imagePrevious(KPixelBlockEdge,KPixelBlockEdge,QImage::Format_RGB32);
   6.285 -            QImage imageNext(KPixelBlockEdge,KPixelBlockEdge,QImage::Format_RGB32);
   6.286 -#endif
   6.287 -
   6.288 -            //Get both our blocks from our buffers
   6.289 -            for (int x=i;x<i+KPixelBlockEdge;x++)
   6.290 -                {
   6.291 -                for (int y=j;y<j+KPixelBlockEdge;y++)
   6.292 -                    {
   6.293 -                    int blockOffset=(x-i)*KPixelBlockEdge+(y-j);
   6.294 -                    int frameOffset=x*h+y;
   6.295 -                    nextBlock.SetBitValue(blockOffset,(*iFrameNext)[frameOffset]);
   6.296 -                    previousBlock.SetBitValue(blockOffset,(*iFramePrevious)[frameOffset]);
   6.297 -
   6.298 -#ifdef DEBUG_FRAME_DIFF
   6.299 -                    imageNext.setPixel(x-i,y-j,(nextBlock[blockOffset]?0xFFFFFFFF:0x00000000));
   6.300 -                    imagePrevious.setPixel(x-i,y-j,(previousBlock[blockOffset]?0xFFFFFFFF:0x00000000));
   6.301 -#endif
   6.302 -                    }
   6.303 -                }
   6.304 -
   6.305 -#ifdef DEBUG_FRAME_DIFF
   6.306 -            QString previousName;
   6.307 -            QString nextName;
   6.308 -            QTextStream(&previousName) << "p" << i << "x" << j << ".png";
   6.309 -            QTextStream(&nextName) << "n" << i << "x" << j << ".png";
   6.310 -            imagePrevious.save(previousName);
   6.311 -            imageNext.save(nextName);
   6.312 -#endif
   6.313 -
   6.314 -
   6.315 -            //if (memcmp(iFrameNext->Ptr()+offset,iFramePrevious->Ptr()+offset,32 )) //32=(16*16/8)
   6.316 -            if (memcmp(nextBlock.Ptr(),previousBlock.Ptr(),KPixelBlockSizeInBytes)!=0)
   6.317 -                {
   6.318 -                //We need to update that block
   6.319 -                SetPixelBlock(i,j,KPixelBlockEdge-1,KPixelBlockSizeInBytes,nextBlock.Ptr());
   6.320 -                //SetPixelBlock(i,j,15,32,0xFF/*nextBlock.Ptr()*/);
   6.321 -                //SetDisplayPosition(iDisplayPositionX,OffScreenY());
   6.322 -                //SetDisplayPosition(iDisplayPositionX,OffScreenY());
   6.323 -
   6.324 -                //SetPixelBlock(i,j,15,32,iFrameNext->Ptr()+offset);
   6.325 -                }
   6.326 -            }
   6.327 -        }
   6.328 -
   6.329 -    }
   6.330 -
   6.331 -/**
   6.332  Translate the given pixel coordinate according to our off screen mode.
   6.333  */
   6.334  void GP1212A02A::OffScreenTranslation(unsigned char& aX, unsigned char& aY)
   6.335 @@ -523,7 +349,6 @@
   6.336      iOffScreenMode=aOn;
   6.337  
   6.338      //Clean up our buffers upon switching modes
   6.339 -    SetDisplayPosition(0,0);
   6.340      Clear();
   6.341      SwapBuffers();
   6.342      Clear();
   6.343 @@ -558,7 +383,7 @@
   6.344      report[2]=0x1B; //Command ID
   6.345      report[3]=0x4A; //Command ID
   6.346      report[4]=0x44; //Command ID
   6.347 -    report[7]=0x30+aBrightness; //Brightness level
   6.348 +    report[5]=0x30+aBrightness; //Brightness level
   6.349      Write(report);
   6.350      }
   6.351  
     7.1 --- a/FutabaGP1212A02.h	Tue Aug 26 19:24:57 2014 +0200
     7.2 +++ b/FutabaGP1212A02.h	Fri Aug 29 22:32:13 2014 +0200
     7.3 @@ -13,7 +13,7 @@
     7.4  /**
     7.5  GP1212A01A is a graphic display module using a FUTABA 256x64dots VFD.
     7.6  The module do not include character ROM, the customer will compile the character
     7.7 -by themselves (from main system).
     7.8 +by themselves (from main system). 
     7.9  */
    7.10  class GP1212A02A : public GP1212XXXX
    7.11  	{
    7.12 @@ -30,18 +30,13 @@
    7.13  	virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
    7.14  	virtual void SetAllPixels(unsigned char aPattern);
    7.15      virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
    7.16 -    virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
    7.17 +    //virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
    7.18  	virtual void SetBrightness(int aBrightness);
    7.19  	virtual void Clear();
    7.20  	virtual void Fill();
    7.21  
    7.22 -	//Specific to GP1212A01A
    7.23 -	void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue);
    7.24 -    void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels);
    7.25 -    //Define display position within our display RAM
    7.26 -	void SetDisplayPosition(unsigned char aX, unsigned char aY);
    7.27 -    unsigned char DisplayPositionX() const {return iDisplayPositionX;}
    7.28 -    unsigned char DisplayPositionY() const {return iDisplayPositionY;}
    7.29 +	//Specific to GP1212A02A
    7.30 +	void SetFrame(int aSize, unsigned char* aPixels);
    7.31  	
    7.32      //
    7.33      void RequestDeviceId();
    7.34 @@ -62,18 +57,10 @@
    7.35  	char* FirmwareRevision();
    7.36  
    7.37  private:
    7.38 -	enum DW
    7.39 -		{
    7.40 -        DW1=0xC0,
    7.41 -        DW2=0xD0
    7.42 -		};
    7.43 -
    7.44 -	void SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY);
    7.45  	unsigned char OffScreenY() const;
    7.46  	void SendClearCommand();
    7.47  	void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
    7.48  	void ResetBuffers();
    7.49 -    void SendModifiedPixelBlocks();
    7.50  
    7.51  private:
    7.52  	unsigned char iDisplayPositionX;
    7.53 @@ -87,13 +74,13 @@
    7.54  	//FutabaVfdReport iReport;
    7.55  	///
    7.56  	//unsigned char iFrameBuffer[256*64];
    7.57 -    BitArray* iFrameNext;
    7.58 -    BitArray* iFrameCurrent;
    7.59 -    BitArray* iFramePrevious;
    7.60 +    BitArrayLow* iFrameNext;
    7.61 +    BitArrayLow* iFrameCurrent;
    7.62 +    BitArrayLow* iFramePrevious;
    7.63      //
    7.64 -    BitArray* iFrameAlpha;
    7.65 -    BitArray* iFrameBeta;
    7.66 -    BitArray* iFrameGamma;
    7.67 +    BitArrayLow* iFrameAlpha;
    7.68 +    BitArrayLow* iFrameBeta;
    7.69 +    BitArrayLow* iFrameGamma;
    7.70      //
    7.71      int iNeedFullFrameUpdate;
    7.72  	//unsigned char iFrameBeta[256*64];