author | StephaneLenclud |
Wed, 06 May 2015 21:25:49 +0200 | |
changeset 37 | d3b88ef66bfe |
parent 25 | 3fa4007c0b19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
// |
StephaneLenclud@35 | 2 |
// Copyright (C) 2014-2015 Stéphane Lenclud. |
sl@0 | 3 |
// |
StephaneLenclud@35 | 4 |
// This file is part of MiniDisplay. |
StephaneLenclud@35 | 5 |
// |
StephaneLenclud@35 | 6 |
// MiniDisplay is free software: you can redistribute it and/or modify |
StephaneLenclud@35 | 7 |
// it under the terms of the GNU General Public License as published by |
StephaneLenclud@35 | 8 |
// the Free Software Foundation, either version 3 of the License, or |
StephaneLenclud@35 | 9 |
// (at your option) any later version. |
StephaneLenclud@35 | 10 |
// |
StephaneLenclud@35 | 11 |
// MiniDisplay is distributed in the hope that it will be useful, |
StephaneLenclud@35 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
StephaneLenclud@35 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
StephaneLenclud@35 | 14 |
// GNU General Public License for more details. |
StephaneLenclud@35 | 15 |
// |
StephaneLenclud@35 | 16 |
// You should have received a copy of the GNU General Public License |
StephaneLenclud@35 | 17 |
// along with MiniDisplay. If not, see <http://www.gnu.org/licenses/>. |
sl@0 | 18 |
// |
sl@0 | 19 |
|
sl@0 | 20 |
#ifndef FUTABA_VFD_H |
sl@0 | 21 |
#define FUTABA_VFD_H |
sl@0 | 22 |
|
sl@0 | 23 |
#include "hidapi.h" |
sl@0 | 24 |
#include "BitArray.h" |
sl@4 | 25 |
#include "MiniDisplay.h" |
sl@9 | 26 |
#include "Display.h" |
sl@0 | 27 |
|
sl@0 | 28 |
#ifndef MIN |
sl@0 | 29 |
#define MIN(a,b) (((a)<(b))?(a):(b)) |
sl@0 | 30 |
#endif |
sl@0 | 31 |
|
sl@0 | 32 |
#ifndef MAX |
sl@0 | 33 |
#define MAX(a,b) (((a)>(b))?(a):(b)) |
sl@0 | 34 |
#endif |
sl@0 | 35 |
|
sl@0 | 36 |
|
sl@0 | 37 |
//This was computed from our number of pixels as follow 256x64/8/64 = 32 + 1 = 33 |
sl@0 | 38 |
//+1 was added for our header |
sl@0 | 39 |
const int KFutabaMaxCommandOutputReport = 33; |
sl@0 | 40 |
//TODO: Get ride of that constant once we figure out a way to get it from hidapi |
sl@0 | 41 |
const int KFutabaMaxHidReportSize = 65; |
sl@0 | 42 |
|
sl@0 | 43 |
const int KHidReportIdIndex=0; |
sl@0 | 44 |
const int KFutabaHidReportSizeIndex=1; |
sl@0 | 45 |
//Define Futaba vendor ID to filter our list of device |
StephaneLenclud@25 | 46 |
const unsigned short KTargaVendorId = 0x19C2; |
sl@0 | 47 |
const unsigned short KFutabaVendorId = 0x1008; |
sl@0 | 48 |
const unsigned short KFutabaProductIdGP1212A01A = 0x100C; |
sl@10 | 49 |
const unsigned short KFutabaProductIdGP1212A02A = 0x1015; |
StephaneLenclud@25 | 50 |
const unsigned short KFutabaProductIdMDM166AA = 0x6A11; |
StephaneLenclud@25 | 51 |
|
sl@0 | 52 |
|
sl@0 | 53 |
//typedef struct hid_device_info HidDeviceInfo; |
sl@0 | 54 |
|
sl@0 | 55 |
/** |
sl@0 | 56 |
Define a Futaba HID report. |
sl@0 | 57 |
*/ |
sl@0 | 58 |
class FutabaVfdReport: public HidReport<KFutabaMaxHidReportSize> |
sl@0 | 59 |
{ |
sl@0 | 60 |
|
sl@0 | 61 |
private: |
sl@0 | 62 |
|
sl@0 | 63 |
}; |
sl@0 | 64 |
|
sl@0 | 65 |
|
sl@0 | 66 |
/** |
sl@0 | 67 |
Define a generic Futaba VFD command. |
sl@0 | 68 |
*/ |
sl@0 | 69 |
class FutabaVfdCommand |
sl@0 | 70 |
{ |
sl@0 | 71 |
public: |
sl@0 | 72 |
FutabaVfdCommand(); |
sl@0 | 73 |
~FutabaVfdCommand(); |
sl@0 | 74 |
// |
sl@0 | 75 |
//void Create(int aMaxSize); |
sl@0 | 76 |
//void Delete(); |
sl@0 | 77 |
|
sl@0 | 78 |
//inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];} |
sl@0 | 79 |
|
sl@0 | 80 |
void Reset(); |
sl@0 | 81 |
|
sl@0 | 82 |
private: |
sl@0 | 83 |
//unsigned char* iBuffer; |
sl@0 | 84 |
FutabaVfdReport iReports[KFutabaMaxCommandOutputReport]; |
sl@0 | 85 |
int iSize; |
sl@0 | 86 |
int iMaxSize; |
sl@0 | 87 |
}; |
sl@0 | 88 |
|
sl@9 | 89 |
/** |
sl@9 | 90 |
*/ |
sl@15 | 91 |
class FutabaGraphicDisplay : public GraphicDisplay |
sl@9 | 92 |
{ |
sl@9 | 93 |
public: |
sl@9 | 94 |
//From DisplayBase |
sl@9 | 95 |
virtual void Close(); |
sl@9 | 96 |
|
sl@9 | 97 |
}; |
sl@9 | 98 |
|
sl@0 | 99 |
|
sl@0 | 100 |
#endif |