sl@0
|
1 |
//
|
sl@0
|
2 |
//
|
sl@0
|
3 |
//
|
sl@0
|
4 |
|
sl@0
|
5 |
#ifndef FUTABA_VFD_H
|
sl@0
|
6 |
#define FUTABA_VFD_H
|
sl@0
|
7 |
|
sl@0
|
8 |
#include "hidapi.h"
|
sl@0
|
9 |
#include "HidDevice.h"
|
sl@0
|
10 |
#include "BitArray.h"
|
sl@4
|
11 |
#include "MiniDisplay.h"
|
sl@0
|
12 |
|
sl@0
|
13 |
#ifndef MIN
|
sl@0
|
14 |
#define MIN(a,b) (((a)<(b))?(a):(b))
|
sl@0
|
15 |
#endif
|
sl@0
|
16 |
|
sl@0
|
17 |
#ifndef MAX
|
sl@0
|
18 |
#define MAX(a,b) (((a)>(b))?(a):(b))
|
sl@0
|
19 |
#endif
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
//This was computed from our number of pixels as follow 256x64/8/64 = 32 + 1 = 33
|
sl@0
|
23 |
//+1 was added for our header
|
sl@0
|
24 |
const int KFutabaMaxCommandOutputReport = 33;
|
sl@0
|
25 |
//TODO: Get ride of that constant once we figure out a way to get it from hidapi
|
sl@0
|
26 |
const int KFutabaMaxHidReportSize = 65;
|
sl@0
|
27 |
|
sl@0
|
28 |
const int KHidReportIdIndex=0;
|
sl@0
|
29 |
const int KFutabaHidReportSizeIndex=1;
|
sl@0
|
30 |
//Define Futaba vendor ID to filter our list of device
|
sl@0
|
31 |
const unsigned short KFutabaVendorId = 0x1008;
|
sl@0
|
32 |
const unsigned short KFutabaProductIdGP1212A01A = 0x100C;
|
sl@0
|
33 |
const unsigned short KFutabaProductIdGP1212A02A = 0x1013; //Or is it 0x1015
|
sl@0
|
34 |
const int KGP12xWidthInPixels = 256;
|
sl@0
|
35 |
const int KGP12xHeightInPixels = 64;
|
sl@0
|
36 |
const int KGP12xPixelsPerByte = 8;
|
sl@0
|
37 |
const int KGP12xFrameBufferSizeInBytes = KGP12xWidthInPixels*KGP12xHeightInPixels/KGP12xPixelsPerByte; //256*64/8=2048
|
sl@0
|
38 |
const int KGP12xFrameBufferPixelCount = KGP12xWidthInPixels*KGP12xHeightInPixels;
|
sl@0
|
39 |
|
sl@0
|
40 |
//typedef struct hid_device_info HidDeviceInfo;
|
sl@0
|
41 |
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
Define a Futaba HID report.
|
sl@0
|
44 |
*/
|
sl@0
|
45 |
class FutabaVfdReport: public HidReport<KFutabaMaxHidReportSize>
|
sl@0
|
46 |
{
|
sl@0
|
47 |
|
sl@0
|
48 |
private:
|
sl@0
|
49 |
|
sl@0
|
50 |
};
|
sl@0
|
51 |
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
Define a generic Futaba VFD command.
|
sl@0
|
55 |
*/
|
sl@0
|
56 |
class FutabaVfdCommand
|
sl@0
|
57 |
{
|
sl@0
|
58 |
public:
|
sl@0
|
59 |
FutabaVfdCommand();
|
sl@0
|
60 |
~FutabaVfdCommand();
|
sl@0
|
61 |
//
|
sl@0
|
62 |
//void Create(int aMaxSize);
|
sl@0
|
63 |
//void Delete();
|
sl@0
|
64 |
|
sl@0
|
65 |
//inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];}
|
sl@0
|
66 |
|
sl@0
|
67 |
void Reset();
|
sl@0
|
68 |
|
sl@0
|
69 |
private:
|
sl@0
|
70 |
//unsigned char* iBuffer;
|
sl@0
|
71 |
FutabaVfdReport iReports[KFutabaMaxCommandOutputReport];
|
sl@0
|
72 |
int iSize;
|
sl@0
|
73 |
int iMaxSize;
|
sl@0
|
74 |
};
|
sl@0
|
75 |
|
sl@0
|
76 |
|
sl@0
|
77 |
#endif
|