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