# HG changeset patch # User sl # Date 1409502811 -7200 # Node ID 42ba42be810d109a8b17f5c43390f3661708c2b1 # Parent 105f2c0d3cf19edd8fe51c6e6190362ba0bf78be Adding support for power on/off. diff -r 105f2c0d3cf1 -r 42ba42be810d Display.h --- a/Display.h Sun Aug 31 17:42:10 2014 +0200 +++ b/Display.h Sun Aug 31 18:33:31 2014 +0200 @@ -41,10 +41,14 @@ virtual void CancelRequest(){iRequest=EMiniDisplayRequestNone;} virtual bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;} - virtual bool PowerOn() {return iPowerOn;} + virtual bool IsPowerOn() {return iPowerOn;} virtual char* DeviceId() {return iDeviceId;} virtual char* FirmwareRevision() {return iFirmwareRevision;} + virtual void TurnPowerOn(){} + virtual void TurnPowerOff(){} + virtual bool SupportPowerOnOff(){return false;} + protected: void SetRequest(TMiniDisplayRequest aRequest) { iRequest=aRequest; } diff -r 105f2c0d3cf1 -r 42ba42be810d FutabaGP1212A02.cpp --- a/FutabaGP1212A02.cpp Sun Aug 31 17:42:10 2014 +0200 +++ b/FutabaGP1212A02.cpp Sun Aug 31 18:33:31 2014 +0200 @@ -629,7 +629,7 @@ /** */ -bool GP1212A02A::PowerOn() +bool GP1212A02A::IsPowerOn() { return iPowerOn; } @@ -647,3 +647,41 @@ { return iFirmwareRevision; } + +/** +VFD Power ON/OFF +[Code]1BH,4AH,42H,Ps +[Function]Control of the power supply for VFD +* If VFD power ON or OFF, at interval of 10s or more. +* When the VFD power off, VFD display is turn off, but the module can receive a data and +process. +Ps = VFD Power control +[Definable area] +Ps = 30H : VFD Power OFF +Ps = 31H : VFD Power ON (Default) +*/ +void GP1212A02A::SendCommandPower(TPowerStatus aPowerStatus) + { + FutabaVfdReport report; + report[0]=0x00; //Report ID + report[1]=0x04; //Report size + report[2]=0x1B; //Command ID + report[3]=0x4A; //Command ID + report[4]=0x42; //Command ID + report[5]=aPowerStatus; //ON or OFF + Write(report); + } + +/** +*/ +void GP1212A02A::TurnPowerOn() + { + SendCommandPower(EPowerOn); + } + +/** +*/ +void GP1212A02A::TurnPowerOff() + { + SendCommandPower(EPowerOff); + } diff -r 105f2c0d3cf1 -r 42ba42be810d FutabaGP1212A02.h --- a/FutabaGP1212A02.h Sun Aug 31 17:42:10 2014 +0200 +++ b/FutabaGP1212A02.h Sun Aug 31 18:33:31 2014 +0200 @@ -25,6 +25,10 @@ //From DisplayBase int Open(); virtual void SwapBuffers(); + virtual void TurnPowerOn(); + virtual void TurnPowerOff(); + virtual bool SupportPowerOnOff(){return true;} + //From GraphicDisplay virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn); @@ -47,7 +51,7 @@ // TMiniDisplayRequest AttemptRequestCompletion(); FutabaVfdReport& InputReport() {return iInputReport;} - bool PowerOn(); + bool IsPowerOn(); char* DeviceId(); char* FirmwareRevision(); @@ -71,6 +75,11 @@ EDirectionX=0x31 }; + enum TPowerStatus + { + EPowerOff=0x30, + EPowerOn=0x31 + }; private: //Specific to GP1212A02A @@ -82,6 +91,8 @@ void BmpBoxSelect(TBmpBoxId aBoxId); void BmpBoxDataMemoryTransfer(unsigned short aAddress); void BmpBoxDataInput(unsigned short aSize, unsigned char* aPixels); + // + void SendCommandPower(TPowerStatus aPowerStatus); private: void RequestDeviceId(); diff -r 105f2c0d3cf1 -r 42ba42be810d MiniDisplay.cpp --- a/MiniDisplay.cpp Sun Aug 31 17:42:10 2014 +0200 +++ b/MiniDisplay.cpp Sun Aug 31 18:33:31 2014 +0200 @@ -201,5 +201,23 @@ //------------------------------------------------------------- bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice) { - return ((GraphicDisplay*)aDevice)->PowerOn(); - } \ No newline at end of file + return ((GraphicDisplay*)aDevice)->IsPowerOn(); + } + +//------------------------------------------------------------- +void MiniDisplayPowerOn(MiniDisplayDevice aDevice) + { + ((GraphicDisplay*)aDevice)->TurnPowerOn(); + } + +//------------------------------------------------------------- +void MiniDisplayPowerOff(MiniDisplayDevice aDevice) + { + ((GraphicDisplay*)aDevice)->TurnPowerOff(); + } + +//------------------------------------------------------------- +bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice) + { + return ((GraphicDisplay*)aDevice)->SupportPowerOnOff(); + } \ No newline at end of file diff -r 105f2c0d3cf1 -r 42ba42be810d MiniDisplay.h --- a/MiniDisplay.h Sun Aug 31 17:42:10 2014 +0200 +++ b/MiniDisplay.h Sun Aug 31 18:33:31 2014 +0200 @@ -185,6 +185,24 @@ */ extern "C" MDAPI bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice); +/** +Turn device Power ON. +@param [IN] The device to apply this command to. +*/ +extern "C" MDAPI void MiniDisplayPowerOn(MiniDisplayDevice aDevice); + +/** +Turn device Power OFF. +@param [IN] The device to apply this command to. +*/ +extern "C" MDAPI void MiniDisplayPowerOff(MiniDisplayDevice aDevice); + +/** +Specifies whether or not this display supports power ON/OFF functions. +@param [IN] The device to apply this command to. +@return True if one can turn display power on and off, false otherwise. +*/ +extern "C" MDAPI bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice); #endif