FutabaVfd.h
author StephaneLenclud
Wed, 04 Feb 2015 17:45:46 +0100
changeset 24 9c233658ab28
parent 10 1c3a4964a5bd
child 25 3fa4007c0b19
permissions -rw-r--r--
Adding support for fetching device types count and names.
     1 //
     2 //
     3 //
     4 
     5 #ifndef FUTABA_VFD_H
     6 #define FUTABA_VFD_H
     7 
     8 #include "hidapi.h"
     9 #include "BitArray.h"
    10 #include "MiniDisplay.h"
    11 #include "Display.h"
    12 
    13 #ifndef MIN
    14 #define MIN(a,b) (((a)<(b))?(a):(b))
    15 #endif
    16 
    17 #ifndef MAX
    18 #define MAX(a,b) (((a)>(b))?(a):(b))
    19 #endif
    20 
    21 
    22 //This was computed from our number of pixels as follow 256x64/8/64 = 32 + 1 = 33
    23 //+1 was added for our header
    24 const int KFutabaMaxCommandOutputReport = 33;
    25 //TODO: Get ride of that constant once we figure out a way to get it from hidapi
    26 const int KFutabaMaxHidReportSize = 65;
    27 
    28 const int KHidReportIdIndex=0;
    29 const int KFutabaHidReportSizeIndex=1;
    30 //Define Futaba vendor ID to filter our list of device
    31 const unsigned short KFutabaVendorId = 0x1008;
    32 const unsigned short KFutabaProductIdGP1212A01A = 0x100C;
    33 const unsigned short KFutabaProductIdGP1212A02A = 0x1015;
    34 
    35 //typedef struct hid_device_info HidDeviceInfo;
    36 
    37 /**
    38 Define a Futaba HID report.
    39 */
    40 class FutabaVfdReport: public HidReport<KFutabaMaxHidReportSize>
    41 	{
    42 
    43 private:
    44 
    45 	};
    46 
    47 
    48 /**
    49 Define a generic Futaba VFD command.
    50 */
    51 class FutabaVfdCommand
    52     {
    53 public:
    54     FutabaVfdCommand();
    55     ~FutabaVfdCommand();
    56     //
    57     //void Create(int aMaxSize);
    58     //void Delete();
    59 
    60     //inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];}
    61 
    62     void Reset();
    63 
    64 private:
    65     //unsigned char* iBuffer;
    66     FutabaVfdReport iReports[KFutabaMaxCommandOutputReport];
    67     int iSize;
    68     int iMaxSize;
    69     };
    70 
    71 /**
    72 */
    73 class FutabaGraphicDisplay : public GraphicDisplay
    74 	{
    75 public:
    76 	//From DisplayBase
    77 	virtual void Close();
    78 
    79 	};
    80 
    81 
    82 #endif