FutabaVfd.h
author sl
Thu, 21 Aug 2014 21:30:38 +0200
changeset 8 5a9dbbc40c6b
parent 6 b1c1b2be9a1c
child 9 6b08e3e81cf3
permissions -rw-r--r--
Ground work to support multiple type of display, notably GP1212A02
     1 //
     2 //
     3 //
     4 
     5 #ifndef FUTABA_VFD_H
     6 #define FUTABA_VFD_H
     7 
     8 #include "hidapi.h"
     9 #include "HidDevice.h"
    10 #include "BitArray.h"
    11 #include "MiniDisplay.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 = 0x1013; //Or is it 0x1015
    34 const int KGP12xWidthInPixels = 256;
    35 const int KGP12xHeightInPixels = 64;
    36 const int KGP12xPixelsPerByte = 8;
    37 const int KGP12xFrameBufferSizeInBytes = KGP12xWidthInPixels*KGP12xHeightInPixels/KGP12xPixelsPerByte; //256*64/8=2048
    38 const int KGP12xFrameBufferPixelCount = KGP12xWidthInPixels*KGP12xHeightInPixels;
    39 
    40 //typedef struct hid_device_info HidDeviceInfo;
    41 
    42 /**
    43 Define a Futaba HID report.
    44 */
    45 class FutabaVfdReport: public HidReport<KFutabaMaxHidReportSize>
    46 	{
    47 
    48 private:
    49 
    50 	};
    51 
    52 
    53 /**
    54 Define a generic Futaba VFD command.
    55 */
    56 class FutabaVfdCommand
    57     {
    58 public:
    59     FutabaVfdCommand();
    60     ~FutabaVfdCommand();
    61     //
    62     //void Create(int aMaxSize);
    63     //void Delete();
    64 
    65     //inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];}
    66 
    67     void Reset();
    68 
    69 private:
    70     //unsigned char* iBuffer;
    71     FutabaVfdReport iReports[KFutabaMaxCommandOutputReport];
    72     int iSize;
    73     int iMaxSize;
    74     };
    75 
    76 
    77 #endif