Adding support for power on/off.
1.1 --- a/Display.h Sun Aug 31 17:42:10 2014 +0200
1.2 +++ b/Display.h Sun Aug 31 18:33:31 2014 +0200
1.3 @@ -41,10 +41,14 @@
1.4 virtual void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
1.5 virtual bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
1.6
1.7 - virtual bool PowerOn() {return iPowerOn;}
1.8 + virtual bool IsPowerOn() {return iPowerOn;}
1.9 virtual char* DeviceId() {return iDeviceId;}
1.10 virtual char* FirmwareRevision() {return iFirmwareRevision;}
1.11
1.12 + virtual void TurnPowerOn(){}
1.13 + virtual void TurnPowerOff(){}
1.14 + virtual bool SupportPowerOnOff(){return false;}
1.15 +
1.16 protected:
1.17 void SetRequest(TMiniDisplayRequest aRequest) { iRequest=aRequest; }
1.18
2.1 --- a/FutabaGP1212A02.cpp Sun Aug 31 17:42:10 2014 +0200
2.2 +++ b/FutabaGP1212A02.cpp Sun Aug 31 18:33:31 2014 +0200
2.3 @@ -629,7 +629,7 @@
2.4
2.5 /**
2.6 */
2.7 -bool GP1212A02A::PowerOn()
2.8 +bool GP1212A02A::IsPowerOn()
2.9 {
2.10 return iPowerOn;
2.11 }
2.12 @@ -647,3 +647,41 @@
2.13 {
2.14 return iFirmwareRevision;
2.15 }
2.16 +
2.17 +/**
2.18 +VFD Power ON/OFF
2.19 +[Code]1BH,4AH,42H,Ps
2.20 +[Function]Control of the power supply for VFD
2.21 +* If VFD power ON or OFF, at interval of 10s or more.
2.22 +* When the VFD power off, VFD display is turn off, but the module can receive a data and
2.23 +process.
2.24 +Ps = VFD Power control
2.25 +[Definable area]
2.26 +Ps = 30H : VFD Power OFF
2.27 +Ps = 31H : VFD Power ON (Default)
2.28 +*/
2.29 +void GP1212A02A::SendCommandPower(TPowerStatus aPowerStatus)
2.30 + {
2.31 + FutabaVfdReport report;
2.32 + report[0]=0x00; //Report ID
2.33 + report[1]=0x04; //Report size
2.34 + report[2]=0x1B; //Command ID
2.35 + report[3]=0x4A; //Command ID
2.36 + report[4]=0x42; //Command ID
2.37 + report[5]=aPowerStatus; //ON or OFF
2.38 + Write(report);
2.39 + }
2.40 +
2.41 +/**
2.42 +*/
2.43 +void GP1212A02A::TurnPowerOn()
2.44 + {
2.45 + SendCommandPower(EPowerOn);
2.46 + }
2.47 +
2.48 +/**
2.49 +*/
2.50 +void GP1212A02A::TurnPowerOff()
2.51 + {
2.52 + SendCommandPower(EPowerOff);
2.53 + }
3.1 --- a/FutabaGP1212A02.h Sun Aug 31 17:42:10 2014 +0200
3.2 +++ b/FutabaGP1212A02.h Sun Aug 31 18:33:31 2014 +0200
3.3 @@ -25,6 +25,10 @@
3.4 //From DisplayBase
3.5 int Open();
3.6 virtual void SwapBuffers();
3.7 + virtual void TurnPowerOn();
3.8 + virtual void TurnPowerOff();
3.9 + virtual bool SupportPowerOnOff(){return true;}
3.10 +
3.11
3.12 //From GraphicDisplay
3.13 virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
3.14 @@ -47,7 +51,7 @@
3.15 //
3.16 TMiniDisplayRequest AttemptRequestCompletion();
3.17 FutabaVfdReport& InputReport() {return iInputReport;}
3.18 - bool PowerOn();
3.19 + bool IsPowerOn();
3.20 char* DeviceId();
3.21 char* FirmwareRevision();
3.22
3.23 @@ -71,6 +75,11 @@
3.24 EDirectionX=0x31
3.25 };
3.26
3.27 + enum TPowerStatus
3.28 + {
3.29 + EPowerOff=0x30,
3.30 + EPowerOn=0x31
3.31 + };
3.32
3.33 private:
3.34 //Specific to GP1212A02A
3.35 @@ -82,6 +91,8 @@
3.36 void BmpBoxSelect(TBmpBoxId aBoxId);
3.37 void BmpBoxDataMemoryTransfer(unsigned short aAddress);
3.38 void BmpBoxDataInput(unsigned short aSize, unsigned char* aPixels);
3.39 + //
3.40 + void SendCommandPower(TPowerStatus aPowerStatus);
3.41
3.42 private:
3.43 void RequestDeviceId();
4.1 --- a/MiniDisplay.cpp Sun Aug 31 17:42:10 2014 +0200
4.2 +++ b/MiniDisplay.cpp Sun Aug 31 18:33:31 2014 +0200
4.3 @@ -201,5 +201,23 @@
4.4 //-------------------------------------------------------------
4.5 bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice)
4.6 {
4.7 - return ((GraphicDisplay*)aDevice)->PowerOn();
4.8 - }
4.9 \ No newline at end of file
4.10 + return ((GraphicDisplay*)aDevice)->IsPowerOn();
4.11 + }
4.12 +
4.13 +//-------------------------------------------------------------
4.14 +void MiniDisplayPowerOn(MiniDisplayDevice aDevice)
4.15 + {
4.16 + ((GraphicDisplay*)aDevice)->TurnPowerOn();
4.17 + }
4.18 +
4.19 +//-------------------------------------------------------------
4.20 +void MiniDisplayPowerOff(MiniDisplayDevice aDevice)
4.21 + {
4.22 + ((GraphicDisplay*)aDevice)->TurnPowerOff();
4.23 + }
4.24 +
4.25 +//-------------------------------------------------------------
4.26 +bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice)
4.27 + {
4.28 + return ((GraphicDisplay*)aDevice)->SupportPowerOnOff();
4.29 + }
4.30 \ No newline at end of file
5.1 --- a/MiniDisplay.h Sun Aug 31 17:42:10 2014 +0200
5.2 +++ b/MiniDisplay.h Sun Aug 31 18:33:31 2014 +0200
5.3 @@ -185,6 +185,24 @@
5.4 */
5.5 extern "C" MDAPI bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice);
5.6
5.7 +/**
5.8 +Turn device Power ON.
5.9 +@param [IN] The device to apply this command to.
5.10 +*/
5.11 +extern "C" MDAPI void MiniDisplayPowerOn(MiniDisplayDevice aDevice);
5.12 +
5.13 +/**
5.14 +Turn device Power OFF.
5.15 +@param [IN] The device to apply this command to.
5.16 +*/
5.17 +extern "C" MDAPI void MiniDisplayPowerOff(MiniDisplayDevice aDevice);
5.18 +
5.19 +/**
5.20 +Specifies whether or not this display supports power ON/OFF functions.
5.21 +@param [IN] The device to apply this command to.
5.22 +@return True if one can turn display power on and off, false otherwise.
5.23 +*/
5.24 +extern "C" MDAPI bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice);
5.25
5.26
5.27 #endif