1.1 --- a/MiniDisplay/FutabaVfd.cpp Thu May 29 17:25:06 2014 +0200
1.2 +++ b/MiniDisplay/FutabaVfd.cpp Thu May 29 19:46:57 2014 +0200
1.3 @@ -109,20 +109,27 @@
1.4 */
1.5 void GP1212A01A::SetPixel(unsigned char aX, unsigned char aY, bool aOn)
1.6 {
1.7 - //Just specify a one pixel block
1.8 - //SetPixelBlock(aX,aY,0x00,0x01,aOn);
1.9 //
1.10 //int byteOffset=(aX*HeightInPixels()+aY)/8;
1.11 //int bitOffset=(aX*HeightInPixels()+aY)%8;
1.12 //iFrameBuffer[byteOffset] |= ( (aOn?0x01:0x00) << bitOffset );
1.13 - if (aOn)
1.14 - {
1.15 - iFrameBuffer->SetBit(aX*HeightInPixels()+aY);
1.16 - }
1.17 - else
1.18 - {
1.19 - iFrameBuffer->ClearBit(aX*HeightInPixels()+aY);
1.20 - }
1.21 +
1.22 + if (iOffScreenMode)
1.23 + {
1.24 + if (aOn)
1.25 + {
1.26 + iFrameBuffer->SetBit(aX*HeightInPixels()+aY);
1.27 + }
1.28 + else
1.29 + {
1.30 + iFrameBuffer->ClearBit(aX*HeightInPixels()+aY);
1.31 + }
1.32 + }
1.33 + else
1.34 + {
1.35 + //Just specify a one pixel block
1.36 + SetPixelBlock(aX,aY,0x00,0x01,aOn);
1.37 + }
1.38 }
1.39
1.40 /**
1.41 @@ -151,38 +158,19 @@
1.42 //memset(screen,0xFF,sizeof(screen));
1.43 //SetPixelBlock(0,0,63,sizeof(screen),screen);
1.44
1.45 - //Using pattern SetPixelBlock variant.
1.46 - memset(iFrameBuffer->Ptr(),aPattern,FrameBufferSizeInBytes());
1.47 +
1.48 + if (iOffScreenMode)
1.49 + {
1.50 + memset(iFrameBuffer->Ptr(),aPattern,FrameBufferSizeInBytes());
1.51 + }
1.52 + else
1.53 + {
1.54 + //Using pattern SetPixelBlock variant.
1.55 + SetPixelBlock(0,0,63,FrameBufferSizeInBytes(),aPattern);
1.56 + }
1.57 //
1.58 -
1.59 -
1.60 }
1.61
1.62 -/**
1.63 -Set our screen brightness.
1.64 -@param The desired brightness level. Must be between MinBrightness and MaxBrightness.
1.65 -*/
1.66 -void GP1212A01A::SetBrightness(int aBrightness)
1.67 - {
1.68 - if (aBrightness<MinBrightness()||aBrightness>MaxBrightness())
1.69 - {
1.70 - //Brightness out of range.
1.71 - //Just ignore that request.
1.72 - return;
1.73 - }
1.74 -
1.75 - FutabaVfdReport report;
1.76 - report[0]=0x00; //Report ID
1.77 - report[1]=0x06; //Report size
1.78 - report[2]=0x1B; //Command ID
1.79 - report[3]=0x5C; //Command ID
1.80 - report[4]=0x3F; //Command ID
1.81 - report[5]=0x4C; //Command ID
1.82 - report[6]=0x44; //Command ID
1.83 - report[7]=0x30+aBrightness; //Brightness level
1.84 - Write(report);
1.85 -
1.86 - }
1.87
1.88 /**
1.89 Set the defined pixel block to the given value.
1.90 @@ -272,7 +260,14 @@
1.91 void GP1212A01A::Clear()
1.92 {
1.93 //memset(iFrameBuffer->Ptr(),0x00,FrameBufferSizeInBytes());
1.94 - iFrameBuffer->ClearAll();
1.95 + if (iOffScreenMode)
1.96 + {
1.97 + iFrameBuffer->ClearAll();
1.98 + }
1.99 + else
1.100 + {
1.101 + SendClearCommand();
1.102 + }
1.103 }
1.104
1.105 /**
1.106 @@ -468,6 +463,28 @@
1.107 }
1.108
1.109 /**
1.110 + * @brief GP1212A01A::SetOffScreenMode
1.111 + * @param aOn
1.112 + * @return
1.113 + */
1.114 +void GP1212A01A::SetOffScreenMode(bool aOn)
1.115 + {
1.116 + if (aOn==iOffScreenMode)
1.117 + {
1.118 + //Nothing to do here
1.119 + return;
1.120 + }
1.121 +
1.122 + iOffScreenMode=aOn;
1.123 +
1.124 + //Clean up our buffers upon switching modes
1.125 + SetDisplayPosition(0,0);
1.126 + Clear();
1.127 + SwapBuffers();
1.128 + Clear();
1.129 + }
1.130 +
1.131 +/**
1.132 */
1.133 GP1212A01A::Request GP1212A01A::AttemptRequestCompletion()
1.134 {
1.135 @@ -502,3 +519,31 @@
1.136
1.137 return completed;
1.138 }
1.139 +
1.140 +
1.141 +/**
1.142 +Set our screen brightness.
1.143 +@param The desired brightness level. Must be between MinBrightness and MaxBrightness.
1.144 +*/
1.145 +void GP1212A01A::SetBrightness(int aBrightness)
1.146 + {
1.147 + if (aBrightness<MinBrightness()||aBrightness>MaxBrightness())
1.148 + {
1.149 + //Brightness out of range.
1.150 + //Just ignore that request.
1.151 + return;
1.152 + }
1.153 +
1.154 + FutabaVfdReport report;
1.155 + report[0]=0x00; //Report ID
1.156 + report[1]=0x06; //Report size
1.157 + report[2]=0x1B; //Command ID
1.158 + report[3]=0x5C; //Command ID
1.159 + report[4]=0x3F; //Command ID
1.160 + report[5]=0x4C; //Command ID
1.161 + report[6]=0x44; //Command ID
1.162 + report[7]=0x30+aBrightness; //Brightness level
1.163 + Write(report);
1.164 + }
1.165 +
1.166 +