1 |
// Display (Crystalfontz CFA-635 USB LCD) |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Display_hpp_ |
8 |
#define _Display_hpp_ |
9 |
|
10 |
#include <posix.hpp> |
11 |
#include <truck.hpp> |
12 |
|
13 |
class Display |
14 |
{ |
15 |
int ucom; |
16 |
struct Packet |
17 |
{ |
18 |
enum Command |
19 |
{ |
20 |
PingCommand = 0x00, |
21 |
GetHardwareAndFirmwareVersion = 0x01, |
22 |
WriteUserFlashArea = 0x02, |
23 |
ReadUserFlashArea = 0x03, |
24 |
StoreCurrentStateAsBootState = 0x04, |
25 |
RebootResetHostOrPowerOffHost = 0x05, |
26 |
ClearLCDScreen = 0x06, |
27 |
SetLCDSpecialCharacterData = 0x09, |
28 |
Read8ByesOfLCDMemory = 0x0a, |
29 |
SetLCDCursorPosition = 0x0b, |
30 |
SetLCDCursorStyle = 0x0c, |
31 |
SetLCDContrast = 0x0d, |
32 |
SetLCDKeypadAndBacklight = 0x0e, |
33 |
SetUpFanReporting = 0x10, |
34 |
SetFanPower = 0x11, |
35 |
ReadDOWDeviceInformation = 0x12, |
36 |
SetUpTemperatureReporting = 0x13, |
37 |
ArbitraryDOWTransaction = 0x14, |
38 |
SendCommandDirectlyToTheLCDController = 0x16, |
39 |
ConfigureKeyReporting = 0x17, |
40 |
ReadKeypad = 0x18, |
41 |
SetFanPowerFailSafe = 0x19, |
42 |
SetFanTachometerGlitchFilter = 0x1a, |
43 |
QueryFanPowerAndFailSafeMask = 0x1b, |
44 |
SetATXPowerSwitchFunctionality = 0x1c, |
45 |
EnableDisableAndResetTheWatchdog = 0x1d, |
46 |
ReadReportingAndStatus = 0x1e, |
47 |
SendDataToLCD = 0x1f, |
48 |
SetBaudRate = 0x21, |
49 |
SetOrSetAndConfigureGPIOPin = 0x22, |
50 |
ReadGPIOPinLevelsAndConfigurationState = 0x23, |
51 |
Response = 0x40, |
52 |
KeyActivity = 0x80, |
53 |
FanSpeedReport = 0x81, |
54 |
TemperatureSensorReport = 0x82, |
55 |
Error = 0xc0, |
56 |
}; |
57 |
|
58 |
uint8_t command; |
59 |
uint8_t length; |
60 |
uint8_t data[22]; |
61 |
uint16_t crc; |
62 |
|
63 |
Packet() {} |
64 |
Packet(Command command, const std::string &data = std::string()); |
65 |
}; |
66 |
|
67 |
public: |
68 |
Display(const std::string &device); |
69 |
~Display() { Posix::Close(ucom); } |
70 |
|
71 |
bool Ping(const std::string &data = std::string()); |
72 |
}; |
73 |
|
74 |
#endif//_Display_hpp_ |