Adding APIs for string and requests.
1.1 --- a/FutabaVfd.cpp Mon Jul 07 22:27:56 2014 +0200
1.2 +++ b/FutabaVfd.cpp Tue Jul 08 18:59:41 2014 +0200
1.3 @@ -82,7 +82,7 @@
1.4 iFrameBeta(NULL),
1.5 iFrameGamma(NULL),
1.6 iNeedFullFrameUpdate(0),
1.7 - iRequest(ERequestNone),iPowerOn(false)
1.8 + iRequest(EMiniDisplayRequestNone),iPowerOn(false)
1.9 {
1.10 //ResetBuffers();
1.11 }
1.12 @@ -547,7 +547,7 @@
1.13 report[6]=0x44; //Command ID
1.14 if (Write(report)==report.Size())
1.15 {
1.16 - iRequest=ERequestDeviceId;
1.17 + iRequest=EMiniDisplayRequestDeviceId;
1.18 }
1.19 }
1.20
1.21 @@ -573,7 +573,7 @@
1.22 report[6]=0x52; //Command ID
1.23 if (Write(report)==report.Size())
1.24 {
1.25 - iRequest=ERequestFirmwareRevision;
1.26 + iRequest=EMiniDisplayRequestFirmwareRevision;
1.27 }
1.28 }
1.29
1.30 @@ -598,7 +598,7 @@
1.31 report[6]=0x4D; //Command ID
1.32 if (Write(report)==report.Size())
1.33 {
1.34 - iRequest=ERequestPowerSupplyStatus;
1.35 + iRequest=EMiniDisplayRequestPowerSupplyStatus;
1.36 }
1.37 }
1.38
1.39 @@ -636,22 +636,22 @@
1.40
1.41 /**
1.42 */
1.43 -GP1212A01A::Request GP1212A01A::AttemptRequestCompletion()
1.44 +TMiniDisplayRequest GP1212A01A::AttemptRequestCompletion()
1.45 {
1.46 if (!RequestPending())
1.47 {
1.48 - return ERequestNone;
1.49 + return EMiniDisplayRequestNone;
1.50 }
1.51
1.52 int res=Read(iInputReport);
1.53
1.54 if (!res)
1.55 {
1.56 - return ERequestNone;
1.57 + return EMiniDisplayRequestNone;
1.58 }
1.59
1.60 //Process our request
1.61 - if (CurrentRequest()==GP1212A01A::ERequestPowerSupplyStatus)
1.62 + if (CurrentRequest()==EMiniDisplayRequestPowerSupplyStatus)
1.63 {
1.64 if (iInputReport[1]==0x4F && iInputReport[2]==0x4E)
1.65 {
1.66 @@ -663,9 +663,9 @@
1.67 }
1.68 }
1.69
1.70 - Request completed=iRequest;
1.71 + TMiniDisplayRequest completed=iRequest;
1.72 //Our request was completed
1.73 - iRequest=ERequestNone;
1.74 + iRequest=EMiniDisplayRequestNone;
1.75
1.76 return completed;
1.77 }
2.1 --- a/FutabaVfd.h Mon Jul 07 22:27:56 2014 +0200
2.2 +++ b/FutabaVfd.h Tue Jul 08 18:59:41 2014 +0200
2.3 @@ -8,6 +8,7 @@
2.4 #include "hidapi.h"
2.5 #include "HidDevice.h"
2.6 #include "BitArray.h"
2.7 +#include "MiniDisplay.h"
2.8
2.9 #ifndef MIN
2.10 #define MIN(a,b) (((a)<(b))?(a):(b))
2.11 @@ -117,13 +118,7 @@
2.12 class GP1212A01A : public GP1212XXXX
2.13 {
2.14 public:
2.15 - enum Request
2.16 - {
2.17 - ERequestNone,
2.18 - ERequestDeviceId,
2.19 - ERequestFirmwareRevision,
2.20 - ERequestPowerSupplyStatus
2.21 - };
2.22 +
2.23
2.24 public:
2.25 GP1212A01A();
2.26 @@ -163,10 +158,10 @@
2.27 void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
2.28 bool FrameDifferencing() const {return iUseFrameDifferencing;}
2.29 //
2.30 - bool RequestPending(){return iRequest!=ERequestNone;}
2.31 - Request CurrentRequest(){return iRequest;}
2.32 - void CancelRequest(){iRequest=ERequestNone;}
2.33 - Request AttemptRequestCompletion();
2.34 + bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
2.35 + TMiniDisplayRequest CurrentRequest(){return iRequest;}
2.36 + void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
2.37 + TMiniDisplayRequest AttemptRequestCompletion();
2.38 FutabaVfdReport& InputReport() {return iInputReport;}
2.39 bool PowerOn(){return iPowerOn;}
2.40
2.41 @@ -208,7 +203,7 @@
2.42 //unsigned char iFrameBeta[256*64];
2.43 //unsigned char *iFrontBuffer;
2.44 //unsigned char *iBackBuffer;
2.45 - Request iRequest;
2.46 + TMiniDisplayRequest iRequest;
2.47 FutabaVfdReport iInputReport;
2.48 bool iPowerOn;
2.49 };
3.1 --- a/MiniDisplay.cpp Mon Jul 07 22:27:56 2014 +0200
3.2 +++ b/MiniDisplay.cpp Tue Jul 08 18:59:41 2014 +0200
3.3 @@ -22,7 +22,7 @@
3.4 }
3.5
3.6 void MiniDisplayClose(MiniDisplayDevice aDevice)
3.7 - {
3.8 + {
3.9 delete aDevice;
3.10 //device = NULL;
3.11 }
3.12 @@ -45,7 +45,7 @@
3.13 {
3.14 return;
3.15 }
3.16 -
3.17 +
3.18 ((GP1212A01A*)aDevice)->SetAllPixels(0xFF);
3.19 }
3.20
3.21 @@ -56,7 +56,7 @@
3.22 {
3.23 return;
3.24 }
3.25 -
3.26 +
3.27 ((GP1212A01A*)aDevice)->SwapBuffers();
3.28 }
3.29
3.30 @@ -122,3 +122,57 @@
3.31 return ((GP1212A01A*)aDevice)->SetPixel(aX,aY,aValue);
3.32 }
3.33
3.34 +//-------------------------------------------------------------
3.35 +wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice)
3.36 + {
3.37 + return ((GP1212A01A*)aDevice)->Vendor();
3.38 + }
3.39 +
3.40 +//-------------------------------------------------------------
3.41 +wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice)
3.42 + {
3.43 + return ((GP1212A01A*)aDevice)->Product();
3.44 + }
3.45 +
3.46 +//-------------------------------------------------------------
3.47 +wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice)
3.48 + {
3.49 + return ((GP1212A01A*)aDevice)->SerialNumber();
3.50 + }
3.51 +
3.52 +//-------------------------------------------------------------
3.53 +void MiniDisplayRequestDeviceId(MiniDisplayDevice aDevice)
3.54 + {
3.55 + ((GP1212A01A*)aDevice)->RequestDeviceId();
3.56 + }
3.57 +
3.58 +//-------------------------------------------------------------
3.59 +void MiniDisplayRequestPowerSupplyStatus(MiniDisplayDevice aDevice)
3.60 + {
3.61 + ((GP1212A01A*)aDevice)->RequestPowerSupplyStatus();
3.62 + }
3.63 +
3.64 +//-------------------------------------------------------------
3.65 +void MiniDisplayRequestFirmwareRevision(MiniDisplayDevice aDevice)
3.66 + {
3.67 + ((GP1212A01A*)aDevice)->RequestFirmwareRevision();
3.68 + }
3.69 +
3.70 +//-------------------------------------------------------------
3.71 +bool MiniDisplayRequestPending(MiniDisplayDevice aDevice)
3.72 + {
3.73 + return ((GP1212A01A*)aDevice)->RequestPending();
3.74 + }
3.75 +
3.76 +//-------------------------------------------------------------
3.77 +TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice)
3.78 + {
3.79 + return ((GP1212A01A*)aDevice)->CurrentRequest();
3.80 + }
3.81 +
3.82 +//-------------------------------------------------------------
3.83 +void MiniDisplayCancelRequest(MiniDisplayDevice aDevice)
3.84 + {
3.85 + ((GP1212A01A*)aDevice)->CancelRequest();
3.86 + }
3.87 +
4.1 --- a/MiniDisplay.h Mon Jul 07 22:27:56 2014 +0200
4.2 +++ b/MiniDisplay.h Tue Jul 08 18:59:41 2014 +0200
4.3 @@ -13,7 +13,7 @@
4.4 */
4.5 // We are using the Visual Studio Compiler and building Shared libraries
4.6
4.7 -#if defined (_WIN32)
4.8 +#if defined (_WIN32)
4.9 #if defined(MiniDisplay_EXPORTS)
4.10 #define MDAPI __declspec(dllexport)
4.11 #else
4.12 @@ -25,6 +25,15 @@
4.13
4.14 typedef void* MiniDisplayDevice;
4.15
4.16 +typedef enum
4.17 + {
4.18 + EMiniDisplayRequestNone,
4.19 + EMiniDisplayRequestDeviceId,
4.20 + EMiniDisplayRequestFirmwareRevision,
4.21 + EMiniDisplayRequestPowerSupplyStatus
4.22 + }
4.23 +TMiniDisplayRequest;
4.24 +
4.25 //Open & Close functions
4.26 extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen();
4.27 extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice);
4.28 @@ -93,6 +102,66 @@
4.29
4.30 //TODO: Have an API to specify pixel depth
4.31
4.32 +/**
4.33 +Provide vendor name.
4.34 +@param [IN] The device to apply this command to.
4.35 +@return Vendor name.
4.36 +*/
4.37 +extern "C" MDAPI wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice);
4.38 +
4.39 +/**
4.40 +Provide product name.
4.41 +@param [IN] The device to apply this command to.
4.42 +@return Product name.
4.43 +*/
4.44 +extern "C" MDAPI wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice);
4.45 +
4.46 +/**
4.47 +Provide Serial number.
4.48 +@param [IN] The device to apply this command to.
4.49 +@return Serial number name.
4.50 +*/
4.51 +extern "C" MDAPI wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice);
4.52 +
4.53 +/**
4.54 +Request device ID.
4.55 +@param [IN] The device to apply this command to.
4.56 +*/
4.57 +extern "C" MDAPI void MiniDisplayRequestDeviceId(MiniDisplayDevice aDevice);
4.58 +
4.59 +/**
4.60 +Request power status.
4.61 +@param [IN] The device to apply this command to.
4.62 +*/
4.63 +extern "C" MDAPI void MiniDisplayRequestPowerSupplyStatus(MiniDisplayDevice aDevice);
4.64 +
4.65 +/**
4.66 +Request firmware version.
4.67 +@param [IN] The device to apply this command to.
4.68 +*/
4.69 +extern "C" MDAPI void MiniDisplayRequestFirmwareRevision(MiniDisplayDevice aDevice);
4.70 +
4.71 +/**
4.72 +Tell whether or not a request is pending.
4.73 +@param [IN] The device to apply this command to.
4.74 +@return true if we have a request pending, false otherwise.
4.75 +*/
4.76 +extern "C" MDAPI bool MiniDisplayRequestPending(MiniDisplayDevice aDevice);
4.77 +
4.78 +
4.79 +/**
4.80 +Provide the current request if any.
4.81 +@param [IN] The device to apply this command to.
4.82 +@return The current request if any.
4.83 +*/
4.84 +extern "C" MDAPI TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice);
4.85 +
4.86 +
4.87 +/**
4.88 +Cancel any pending request.
4.89 +@param [IN] The device to apply this command to.
4.90 +*/
4.91 +extern "C" MDAPI void MiniDisplayCancelRequest(MiniDisplayDevice aDevice);
4.92
4.93 #endif
4.94