// Display (Crystalfontz CFA-635 USB LCD) // // Douglas Thrift // // $Id$ #ifndef _Display_hpp_ #define _Display_hpp_ #include #include class Display { int ucom; struct Packet { enum Command { PingCommand = 0x00, GetHardwareAndFirmwareVersion = 0x01, WriteUserFlashArea = 0x02, ReadUserFlashArea = 0x03, StoreCurrentStateAsBootState = 0x04, RebootResetHostOrPowerOffHost = 0x05, ClearLCDScreen = 0x06, SetLCDSpecialCharacterData = 0x09, Read8ByesOfLCDMemory = 0x0a, SetLCDCursorPosition = 0x0b, SetLCDCursorStyle = 0x0c, SetLCDContrast = 0x0d, SetLCDKeypadAndBacklight = 0x0e, SetUpFanReporting = 0x10, SetFanPower = 0x11, ReadDOWDeviceInformation = 0x12, SetUpTemperatureReporting = 0x13, ArbitraryDOWTransaction = 0x14, SendCommandDirectlyToTheLCDController = 0x16, ConfigureKeyReporting = 0x17, ReadKeypad = 0x18, SetFanPowerFailSafe = 0x19, SetFanTachometerGlitchFilter = 0x1a, QueryFanPowerAndFailSafeMask = 0x1b, SetATXPowerSwitchFunctionality = 0x1c, EnableDisableAndResetTheWatchdog = 0x1d, ReadReportingAndStatus = 0x1e, SendDataToLCD = 0x1f, SetBaudRate = 0x21, SetOrSetAndConfigureGPIOPin = 0x22, ReadGPIOPinLevelsAndConfigurationState = 0x23, Response = 0x40, KeyActivity = 0x80, FanSpeedReport = 0x81, TemperatureSensorReport = 0x82, Error = 0xc0, }; uint8_t command; uint8_t length; uint8_t data[22]; uint16_t crc; Packet() {} Packet(Command command, const std::string &data = std::string()); }; public: Display(const std::string &device); ~Display() { Posix::Close(ucom); } bool Ping(const std::string &data = std::string()); }; #endif//_Display_hpp_