g13d: Reformat all the files to Google style

This is closer to what I'm looking for, and gives us a style guide to boot.
This commit is contained in:
June Tate-Gans 2021-04-25 20:30:56 -05:00
parent 234b5aac7f
commit 1918d6875c
26 changed files with 766 additions and 654 deletions

View File

@ -1,27 +1,27 @@
--- ---
Language: Cpp Language: Cpp
# BasedOnStyle: LLVM BasedOnStyle: Google
AccessModifierOffset: -2 AccessModifierOffset: -1
AlignAfterOpenBracket: Align AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right AlignEscapedNewlines: Left
AlignOperands: true AlignOperands: true
AlignTrailingComments: true AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: false
AllowShortLambdasOnASingleLine: All AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: MultiLine AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true BinPackArguments: true
BinPackParameters: true BinPackParameters: true
BraceWrapping: BraceWrapping:
@ -53,12 +53,12 @@ BreakStringLiterals: true
ColumnLimit: 80 ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:' CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4 ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4 ContinuationIndentWidth: 4
Cpp11BracedListStyle: true Cpp11BracedListStyle: true
DeriveLineEnding: true DeriveLineEnding: true
DerivePointerAlignment: false DerivePointerAlignment: true
DisableFormat: false DisableFormat: false
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true FixNamespaceComments: true
@ -66,18 +66,21 @@ ForEachMacros:
- foreach - foreach
- Q_FOREACH - Q_FOREACH
- BOOST_FOREACH - BOOST_FOREACH
IncludeBlocks: Preserve IncludeBlocks: Regroup
IncludeCategories: IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Regex: '^<ext/.*\.h>'
Priority: 2 Priority: 2
SortPriority: 0 SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)' - Regex: '^<.*\.h>'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1 Priority: 1
SortPriority: 0 SortPriority: 0
IncludeIsMainRegex: '(Test)?$' - Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: '' IncludeIsMainSourceRegex: ''
IndentCaseLabels: true IndentCaseLabels: true
IndentGotoLabels: true IndentGotoLabels: true
@ -86,24 +89,52 @@ IndentWidth: 2
IndentWrappedFunctionNames: false IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave JavaScriptQuotes: Leave
JavaScriptWrapImports: true JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: '' MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
NamespaceIndentation: None NamespaceIndentation: None
ObjCBinPackProtocolList: Auto ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2 ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2 PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300 PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120 PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000 PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10 PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000 PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60 PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true ReflowComments: true
SortIncludes: true SortIncludes: true
SortUsingDeclarations: true SortUsingDeclarations: true
@ -118,7 +149,7 @@ SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1 SpacesBeforeTrailingComments: 2
SpacesInAngles: false SpacesInAngles: false
SpacesInConditionalStatement: false SpacesInConditionalStatement: false
SpacesInContainerLiterals: true SpacesInContainerLiterals: true
@ -126,7 +157,7 @@ SpacesInCStyleCastParentheses: false
SpacesInParentheses: false SpacesInParentheses: false
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false SpaceBeforeSquareBrackets: false
Standard: Latest Standard: Auto
StatementMacros: StatementMacros:
- Q_UNUSED - Q_UNUSED
- QT_REQUIRE_VERSION - QT_REQUIRE_VERSION

View File

@ -1,16 +1,18 @@
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/foreach.hpp>
#include "action.h" #include "action.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include "manager.h" #include "manager.h"
#include "repr.h" #include "repr.h"
namespace G13 { namespace G13 {
G13_Action::~G13_Action() {} G13_Action::~G13_Action() {
}
G13_Action_Keys::G13_Action_Keys(G13_Device &keypad, G13_Action_Keys::G13_Action_Keys(G13_Device &keypad,
const std::string &keys_string) const std::string &keys_string)
@ -29,7 +31,8 @@ G13_Action_Keys::G13_Action_Keys(G13_Device &keypad,
std::vector<int> _keys; std::vector<int> _keys;
} }
G13_Action_Keys::~G13_Action_Keys() {} G13_Action_Keys::~G13_Action_Keys() {
}
void G13_Action_Keys::act(G13_Device &g13, bool is_down) { void G13_Action_Keys::act(G13_Device &g13, bool is_down) {
for (auto key : _keys) { for (auto key : _keys) {
@ -42,16 +45,18 @@ void G13_Action_Keys::dump(std::ostream &out) const {
out << " SEND KEYS: "; out << " SEND KEYS: ";
for (size_t i = 0; i < _keys.size(); i++) { for (size_t i = 0; i < _keys.size(); i++) {
if (i) if (i) out << " + ";
out << " + ";
out << manager().find_input_key_name(_keys[i]); out << manager().find_input_key_name(_keys[i]);
} }
} }
G13_Action_PipeOut::G13_Action_PipeOut(G13_Device &keypad, G13_Action_PipeOut::G13_Action_PipeOut(G13_Device &keypad,
const std::string &out) const std::string &out)
: G13_Action(keypad), _out(out + "\n") {} : G13_Action(keypad),
G13_Action_PipeOut::~G13_Action_PipeOut() {} _out(out + "\n") {
}
G13_Action_PipeOut::~G13_Action_PipeOut() {
}
void G13_Action_PipeOut::act(G13_Device &kp, bool is_down) { void G13_Action_PipeOut::act(G13_Device &kp, bool is_down) {
if (is_down) { if (is_down) {
@ -65,8 +70,11 @@ void G13_Action_PipeOut::dump(std::ostream &o) const {
G13_Action_Command::G13_Action_Command(G13_Device &keypad, G13_Action_Command::G13_Action_Command(G13_Device &keypad,
const std::string &cmd) const std::string &cmd)
: G13_Action(keypad), _cmd(cmd) {} : G13_Action(keypad),
G13_Action_Command::~G13_Action_Command() {} _cmd(cmd) {
}
G13_Action_Command::~G13_Action_Command() {
}
void G13_Action_Command::act(G13_Device &kp, bool is_down) { void G13_Action_Command::act(G13_Device &kp, bool is_down) {
if (is_down) { if (is_down) {
@ -78,4 +86,4 @@ void G13_Action_Command::dump(std::ostream &o) const {
o << "COMMAND : " << repr(_cmd); o << "COMMAND : " << repr(_cmd);
} }
} } // namespace G13

View File

@ -1,9 +1,9 @@
#ifndef ACTION_H #ifndef ACTION_H
#define ACTION_H #define ACTION_H
#include <memory>
#include <ostream> #include <ostream>
#include <vector> #include <vector>
#include <memory>
#include "g13.h" #include "g13.h"
@ -16,22 +16,30 @@ class G13_Manager;
* *
*/ */
class G13_Action { class G13_Action {
public: public:
G13_Action(G13_Device &keypad) : _keypad(keypad) {} G13_Action(G13_Device &keypad) : _keypad(keypad) {
}
virtual ~G13_Action(); virtual ~G13_Action();
virtual void act(G13_Device &, bool is_down) = 0; virtual void act(G13_Device &, bool is_down) = 0;
virtual void dump(std::ostream &) const = 0; virtual void dump(std::ostream &) const = 0;
void act(bool is_down) { act(keypad(), is_down); } void act(bool is_down) {
act(keypad(), is_down);
}
G13_Device &keypad() { return _keypad; } G13_Device &keypad() {
const G13_Device &keypad() const { return _keypad; } return _keypad;
}
const G13_Device &keypad() const {
return _keypad;
}
G13_Manager &manager(); G13_Manager &manager();
const G13_Manager &manager() const; const G13_Manager &manager() const;
private: private:
G13_Device &_keypad; G13_Device &_keypad;
}; };
@ -39,7 +47,7 @@ private:
* action to send one or more keystrokes * action to send one or more keystrokes
*/ */
class G13_Action_Keys : public G13_Action { class G13_Action_Keys : public G13_Action {
public: public:
G13_Action_Keys(G13_Device &keypad, const std::string &keys); G13_Action_Keys(G13_Device &keypad, const std::string &keys);
virtual ~G13_Action_Keys(); virtual ~G13_Action_Keys();
@ -53,7 +61,7 @@ public:
* action to send a string to the output pipe * action to send a string to the output pipe
*/ */
class G13_Action_PipeOut : public G13_Action { class G13_Action_PipeOut : public G13_Action {
public: public:
G13_Action_PipeOut(G13_Device &keypad, const std::string &out); G13_Action_PipeOut(G13_Device &keypad, const std::string &out);
virtual ~G13_Action_PipeOut(); virtual ~G13_Action_PipeOut();
@ -67,7 +75,7 @@ public:
* action to send a command to the g13 * action to send a command to the g13
*/ */
class G13_Action_Command : public G13_Action { class G13_Action_Command : public G13_Action {
public: public:
G13_Action_Command(G13_Device &keypad, const std::string &cmd); G13_Action_Command(G13_Device &keypad, const std::string &cmd);
virtual ~G13_Action_Command(); virtual ~G13_Action_Command();
@ -79,33 +87,49 @@ public:
typedef std::shared_ptr<G13_Action> G13_ActionPtr; typedef std::shared_ptr<G13_Action> G13_ActionPtr;
template <class PARENT_T> class G13_Actionable { template <class PARENT_T>
public: class G13_Actionable {
public:
G13_Actionable(PARENT_T &parent_arg, const std::string &name) G13_Actionable(PARENT_T &parent_arg, const std::string &name)
: _name(name), _parent_ptr(&parent_arg) { : _name(name),
_parent_ptr(&parent_arg) {
} }
virtual ~G13_Actionable() { virtual ~G13_Actionable() {
_parent_ptr = 0; _parent_ptr = 0;
} }
G13_ActionPtr action() const { return _action; } G13_ActionPtr action() const {
const std::string &name() const { return _name; } return _action;
PARENT_T &parent() { return *_parent_ptr; } }
const PARENT_T &parent() const { return *_parent_ptr; } const std::string &name() const {
G13_Manager &manager() { return _parent_ptr->manager(); } return _name;
const G13_Manager &manager() const { return _parent_ptr->manager(); } }
PARENT_T &parent() {
return *_parent_ptr;
}
const PARENT_T &parent() const {
return *_parent_ptr;
}
G13_Manager &manager() {
return _parent_ptr->manager();
}
const G13_Manager &manager() const {
return _parent_ptr->manager();
}
virtual void set_action(const G13_ActionPtr &action) { _action = action; } virtual void set_action(const G13_ActionPtr &action) {
_action = action;
}
protected: protected:
std::string _name; std::string _name;
G13_ActionPtr _action; G13_ActionPtr _action;
private: private:
PARENT_T *_parent_ptr; PARENT_T *_parent_ptr;
}; };
} // namespace G13 } // namespace G13
#endif // ACTION_H #endif // ACTION_H

View File

@ -7,10 +7,10 @@
namespace G13 { namespace G13 {
template <class T> class Bounds { template <class T>
public: class Bounds {
Bounds(const Coord<T> &_tl, const Coord<T> &_br) public:
: tl(_tl), br(_br) { Bounds(const Coord<T> &_tl, const Coord<T> &_br) : tl(_tl), br(_br) {
} }
Bounds(T x1, T y1, T x2, T y2) : tl(x1, y1), br(x2, y2) { Bounds(T x1, T y1, T x2, T y2) : tl(x1, y1), br(x2, y2) {
@ -21,14 +21,10 @@ public:
} }
void expand(const Coord<T> &pos) { void expand(const Coord<T> &pos) {
if (pos.x < tl.x) if (pos.x < tl.x) tl.x = pos.x;
tl.x = pos.x; if (pos.y < tl.y) tl.y = pos.y;
if (pos.y < tl.y) if (pos.x > br.x) br.x = pos.x;
tl.y = pos.y; if (pos.y > br.y) br.y = pos.y;
if (pos.x > br.x)
br.x = pos.x;
if (pos.y > br.y)
br.y = pos.y;
} }
Coord<T> tl; Coord<T> tl;
@ -37,15 +33,12 @@ public:
template <class T> template <class T>
std::ostream &operator<<(std::ostream &o, const Bounds<T> &b) { std::ostream &operator<<(std::ostream &o, const Bounds<T> &b) {
o << "{ " o << "{ " << b.tl.x << " x " << b.tl.y << " / " << b.br.x << " x " << b.br.y
<< b.tl.x << " x " << b.tl.y
<< " / "
<< b.br.x << " x " << b.br.y
<< " }"; << " }";
return o; return o;
}; };
} // namespace G13 } // namespace G13
#endif // BOUNDS_H #endif // BOUNDS_H

View File

@ -3,14 +3,13 @@
namespace G13 { namespace G13 {
template <class T> class Coord { template <class T>
public: class Coord {
Coord() public:
: x(), y() { Coord() : x(), y() {
} }
Coord(T _x, T _y) Coord(T _x, T _y) : x(_x), y(_y) {
: x(_x), y(_y) {
} }
T x; T x;
@ -23,6 +22,6 @@ std::ostream &operator<<(std::ostream &o, const Coord<T> &c) {
return o; return o;
}; };
} // namespace G13 } // namespace G13
#endif // COORD_H #endif // COORD_H

View File

@ -1,32 +1,30 @@
#include <fcntl.h> #include "device.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
#include <libusb-1.0/libusb.h> #include <libusb-1.0/libusb.h>
#include <linux/uinput.h> #include <linux/uinput.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/preprocessor/seq/for_each.hpp> #include <boost/algorithm/string/split.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream> #include <boost/preprocessor/seq/for_each.hpp>
#include <fstream> #include <fstream>
#include <iostream>
#include <string> #include <string>
#include "logo.h" #include "logo.h"
#include "manager.h" #include "manager.h"
#include "repr.h" #include "repr.h"
#include "device.h"
namespace G13 { namespace G13 {
static std::string describe_libusb_error_code(int code) { static std::string describe_libusb_error_code(int code) {
#define TEST_libusb_error(r, data, elem) \
#define TEST_libusb_error(r, data, elem) \ case BOOST_PP_CAT(LIBUSB_, elem): \
case BOOST_PP_CAT(LIBUSB_, elem): \
return BOOST_PP_STRINGIZE(elem); return BOOST_PP_STRINGIZE(elem);
switch (code) { switch (code) {
@ -194,7 +192,6 @@ void G13_Device::cleanup() {
libusb_close(handle); libusb_close(handle);
} }
/*! reads and processes key state report from G13 /*! reads and processes key state report from G13
* *
*/ */
@ -206,7 +203,6 @@ int G13_Device::read_keys() {
buffer, G13_REPORT_SIZE, &size, 100); buffer, G13_REPORT_SIZE, &size, 100);
if (error && error != LIBUSB_ERROR_TIMEOUT) { if (error && error != LIBUSB_ERROR_TIMEOUT) {
G13_LOG(error, "Error while reading keys: " G13_LOG(error, "Error while reading keys: "
<< error << " (" << describe_libusb_error_code(error) << error << " (" << describe_libusb_error_code(error)
<< ")"); << ")");
@ -226,7 +222,6 @@ void G13_Device::read_config_file(const std::string &filename) {
G13_LOG(info, "reading configuration from " << filename); G13_LOG(info, "reading configuration from " << filename);
while (s.good()) { while (s.good()) {
// grab a line // grab a line
char buf[1024]; char buf[1024];
buf[0] = 0; buf[0] = 0;
@ -265,7 +260,7 @@ void G13_Device::read_commands() {
G13_LOG(trace, "read " << ret << " characters"); G13_LOG(trace, "read " << ret << " characters");
if (ret == if (ret ==
960) { // TODO probably image, for now, don't test, just assume image 960) { // TODO probably image, for now, don't test, just assume image
lcd().image(buf, ret); lcd().image(buf, ret);
} else { } else {
std::string buffer = reinterpret_cast<const char *>(buf); std::string buffer = reinterpret_cast<const char *>(buf);
@ -288,8 +283,13 @@ void G13_Device::read_commands() {
G13_Device::G13_Device(G13_Manager &manager, libusb_device_handle *handle, G13_Device::G13_Device(G13_Manager &manager, libusb_device_handle *handle,
int _id) int _id)
: _id_within_manager(_id), handle(handle), ctx(0), _uinput_fid(-1), : _id_within_manager(_id),
_manager(manager), _lcd(*this), _stick(*this) { handle(handle),
ctx(0),
_uinput_fid(-1),
_manager(manager),
_lcd(*this),
_stick(*this) {
_current_profile = ProfilePtr(new G13_Profile(*this, "default")); _current_profile = ProfilePtr(new G13_Profile(*this, "default"));
_profiles["default"] = _current_profile; _profiles["default"] = _current_profile;
@ -324,7 +324,6 @@ ProfilePtr G13_Device::profile(const std::string &name) {
return rv; return rv;
} }
G13_ActionPtr G13_Device::make_action(const std::string &action) { G13_ActionPtr G13_Device::make_action(const std::string &action) {
if (!action.size()) { if (!action.size()) {
throw G13_CommandException("empty action string"); throw G13_CommandException("empty action string");
@ -361,7 +360,7 @@ void G13_Device::dump(std::ostream &o, int detail) {
} }
} }
inline const char *advance_ws(const char* &source, std::string &dest) { inline const char *advance_ws(const char *&source, std::string &dest) {
const char *space = source ? strchr(source, ' ') : 0; const char *space = source ? strchr(source, ' ') : 0;
if (space) { if (space) {
@ -377,7 +376,9 @@ inline const char *advance_ws(const char* &source, std::string &dest) {
struct command_adder { struct command_adder {
command_adder(G13_Device::CommandFunctionTable &t, const char *name) command_adder(G13_Device::CommandFunctionTable &t, const char *name)
: _t(t), _name(name) {} : _t(t),
_name(name) {
}
G13_Device::CommandFunctionTable &_t; G13_Device::CommandFunctionTable &_t;
std::string _name; std::string _name;
@ -387,16 +388,16 @@ struct command_adder {
}; };
}; };
#define RETURN_FAIL(message) \ #define RETURN_FAIL(message) \
{ \ { \
G13_LOG(error, message); \ G13_LOG(error, message); \
return; \ return; \
} }
#define G13_DEVICE_COMMAND(name) \ #define G13_DEVICE_COMMAND(name) \
; \ ; \
command_adder BOOST_PP_CAT(add_, name)(_command_table, \ command_adder BOOST_PP_CAT(add_, name)(_command_table, \
BOOST_PP_STRINGIZE(name)); \ BOOST_PP_STRINGIZE(name)); \
BOOST_PP_CAT(add_, name) += [this](const char *remainder) BOOST_PP_CAT(add_, name) += [this](const char *remainder)
void G13_Device::_init_commands() { void G13_Device::_init_commands() {
@ -432,10 +433,18 @@ void G13_Device::_init_commands() {
} }
} }
G13_DEVICE_COMMAND(profile) { switch_to_profile(remainder); } G13_DEVICE_COMMAND(profile) {
G13_DEVICE_COMMAND(font) { switch_to_font(remainder); } switch_to_profile(remainder);
G13_DEVICE_COMMAND(mod) { set_mode_leds(atoi(remainder)); } }
G13_DEVICE_COMMAND(textmode) { lcd().text_mode = atoi(remainder); } G13_DEVICE_COMMAND(font) {
switch_to_font(remainder);
}
G13_DEVICE_COMMAND(mod) {
set_mode_leds(atoi(remainder));
}
G13_DEVICE_COMMAND(textmode) {
lcd().text_mode = atoi(remainder);
}
G13_DEVICE_COMMAND(rgb) { G13_DEVICE_COMMAND(rgb) {
int red, green, blue; int red, green, blue;
@ -446,10 +455,10 @@ void G13_Device::_init_commands() {
} }
} }
#define STICKMODE_TEST(r, data, elem) \ #define STICKMODE_TEST(r, data, elem) \
if (mode == BOOST_PP_STRINGIZE(elem)) { \ if (mode == BOOST_PP_STRINGIZE(elem)) { \
_stick.set_mode(BOOST_PP_CAT(STICK_, elem)); \ _stick.set_mode(BOOST_PP_CAT(STICK_, elem)); \
return; \ return; \
} else } else
G13_DEVICE_COMMAND(stickmode) { G13_DEVICE_COMMAND(stickmode) {
@ -543,7 +552,6 @@ void G13_Device::command(char const *str) {
} }
} }
void G13_Device::init_lcd() { void G13_Device::init_lcd() {
int error = libusb_control_transfer(handle, 0, 9, 1, 0, 0, 0, 1000); int error = libusb_control_transfer(handle, 0, 9, 1, 0, 0, 0, 1000);
if (error) { if (error) {
@ -594,4 +602,4 @@ void G13_Device::parse_joystick(unsigned char *buf) {
_stick.parse_joystick(buf); _stick.parse_joystick(buf);
} }
} // namespace G13 } // namespace G13

View File

@ -1,33 +1,45 @@
#ifndef DEVICE_H #ifndef DEVICE_H
#define DEVICE_H #define DEVICE_H
#include <linux/input.h>
#include <libusb-1.0/libusb.h> #include <libusb-1.0/libusb.h>
#include <linux/input.h>
#include <map>
#include <ostream> #include <ostream>
#include <string> #include <string>
#include <map>
#include "lcd.h"
#include "stick.h"
#include "font.h" #include "font.h"
#include "lcd.h"
#include "profile.h" #include "profile.h"
#include "stick.h"
namespace G13 { namespace G13 {
class G13_Manager; class G13_Manager;
class G13_Device { class G13_Device {
public: public:
G13_Device(G13_Manager &manager, libusb_device_handle *handle, int id); G13_Device(G13_Manager &manager, libusb_device_handle *handle, int id);
G13_Manager &manager() { return _manager; } G13_Manager &manager() {
const G13_Manager &manager() const { return _manager; } return _manager;
}
const G13_Manager &manager() const {
return _manager;
}
G13_LCD &lcd() { return _lcd; } G13_LCD &lcd() {
const G13_LCD &lcd() const { return _lcd; } return _lcd;
G13_Stick &stick() { return _stick; } }
const G13_Stick &stick() const { return _stick; } const G13_LCD &lcd() const {
return _lcd;
}
G13_Stick &stick() {
return _stick;
}
const G13_Stick &stick() const {
return _stick;
}
FontPtr switch_to_font(const std::string &name); FontPtr switch_to_font(const std::string &name);
void switch_to_profile(const std::string &name); void switch_to_profile(const std::string &name);
@ -60,15 +72,21 @@ public:
void register_context(libusb_context *ctx); void register_context(libusb_context *ctx);
void write_lcd_file(const std::string &filename); void write_lcd_file(const std::string &filename);
G13_Font &current_font() { return *_current_font; } G13_Font &current_font() {
G13_Profile &current_profile() { return *_current_profile; } return *_current_font;
}
G13_Profile &current_profile() {
return *_current_profile;
}
int id_within_manager() const { return _id_within_manager; } int id_within_manager() const {
return _id_within_manager;
}
typedef std::function<void(const char *)> COMMAND_FUNCTION; typedef std::function<void(const char *)> COMMAND_FUNCTION;
typedef std::map<std::string, COMMAND_FUNCTION> CommandFunctionTable; typedef std::map<std::string, COMMAND_FUNCTION> CommandFunctionTable;
protected: protected:
void _init_fonts(); void _init_fonts();
void init_lcd(); void init_lcd();
void _init_commands(); void _init_commands();
@ -112,6 +130,6 @@ inline bool G13_Device::update(int key, bool v) {
return old != v; return old != v;
} }
} // namespace G13 } // namespace G13
#endif // DEVICE_H #endif // DEVICE_H

View File

@ -6,13 +6,13 @@
namespace G13 { namespace G13 {
class NotFoundException : public std::exception { class NotFoundException : public std::exception {
public: public:
const char *what() throw(); const char *what() throw();
}; };
template<class K_T, class V_T> template <class K_T, class V_T>
inline const V_T &find_or_throw(const std::map<K_T, V_T> &m, inline const V_T &find_or_throw(const std::map<K_T, V_T> &m,
const K_T &target) { const K_T &target) {
auto i = m.find(target); auto i = m.find(target);
if (i == m.end()) { if (i == m.end()) {
@ -22,7 +22,7 @@ inline const V_T &find_or_throw(const std::map<K_T, V_T> &m,
return i->second; return i->second;
}; };
template<class K_T, class V_T> template <class K_T, class V_T>
inline V_T &find_or_throw(std::map<K_T, V_T> &m, const K_T &target) { inline V_T &find_or_throw(std::map<K_T, V_T> &m, const K_T &target) {
auto i = m.find(target); auto i = m.find(target);
@ -33,6 +33,6 @@ inline V_T &find_or_throw(std::map<K_T, V_T> &m, const K_T &target) {
return i->second; return i->second;
}; };
} // namespace G13 } // namespace G13
#endif // FIND_OR_THROW_H #endif // FIND_OR_THROW_H

View File

@ -1,16 +1,20 @@
#include "device.h"
#include "font.h" #include "font.h"
#include "device.h"
using namespace std; using namespace std;
namespace G13 { namespace G13 {
#include "font8x8.h" #include "font8x8.h"
G13_Font::G13_Font() : _name("default"), _width(8) {} G13_Font::G13_Font() : _name("default"), _width(8) {
}
G13_Font::G13_Font(const std::string &name, unsigned int width) G13_Font::G13_Font(const std::string &name, unsigned int width)
: _name(name), _width(width) {} : _name(name),
_width(width) {
}
void G13_FontChar::set_character(unsigned char *data, int width, void G13_FontChar::set_character(unsigned char *data, int width,
unsigned flags) { unsigned flags) {
@ -35,7 +39,8 @@ void G13_FontChar::set_character(unsigned char *data, int width,
} }
} }
template <typename T, int size> int GetFontCharacterCount(T (&)[size]) { template <typename T, int size>
int GetFontCharacterCount(T (&)[size]) {
return size; return size;
} }
@ -57,4 +62,4 @@ void G13_Device::_init_fonts() {
_fonts[fiveXeight->name()] = fiveXeight; _fonts[fiveXeight->name()] = fiveXeight;
} }
} // namespace G13 } // namespace G13

View File

@ -1,14 +1,14 @@
#ifndef FONT_H #ifndef FONT_H
#define FONT_H #define FONT_H
#include <memory>
#include <memory.h> #include <memory.h>
#include <memory>
namespace G13 { namespace G13 {
class G13_FontChar { class G13_FontChar {
public: public:
static const int CHAR_BUF_SIZE = 8; static const int CHAR_BUF_SIZE = 8;
enum FONT_FLAGS { FF_ROTATE = 0x01 }; enum FONT_FLAGS { FF_ROTATE = 0x01 };
@ -23,21 +23,27 @@ public:
}; };
class G13_Font { class G13_Font {
public: public:
G13_Font(); G13_Font();
G13_Font(const std::string &name, unsigned int width = 8); G13_Font(const std::string &name, unsigned int width = 8);
void set_character(unsigned int c, unsigned char *data); void set_character(unsigned int c, unsigned char *data);
template<class ARRAY_T, class FLAGST> template <class ARRAY_T, class FLAGST>
void install_font(ARRAY_T &data, FLAGST flags, int first = 0); void install_font(ARRAY_T &data, FLAGST flags, int first = 0);
const std::string &name() const { return _name; } const std::string &name() const {
unsigned int width() const { return _width; } return _name;
}
unsigned int width() const {
return _width;
}
const G13_FontChar &char_data(unsigned int x) { return _chars[x]; } const G13_FontChar &char_data(unsigned int x) {
return _chars[x];
}
protected: protected:
std::string _name; std::string _name;
unsigned int _width; unsigned int _width;
@ -46,6 +52,6 @@ protected:
typedef std::shared_ptr<G13_Font> FontPtr; typedef std::shared_ptr<G13_Font> FontPtr;
} // namespace G13 } // namespace G13
#endif // FONT_H #endif // FONT_H

View File

@ -2,359 +2,359 @@
// Constant: font8x8_basic // Constant: font8x8_basic
// Contains an 8x8 font map for unicode points U+0000 - U+007F (basic latin) // Contains an 8x8 font map for unicode points U+0000 - U+007F (basic latin)
unsigned char font8x8_basic[128][8] = { unsigned char font8x8_basic[128][8] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space)
{0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) {0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!)
{0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") {0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (")
{0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) {0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#)
{0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) {0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($)
{0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) {0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%)
{0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) {0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&)
{0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') {0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (')
{0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() {0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (()
{0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) {0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ())
{0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) {0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*)
{0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) {0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) {0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,)
{0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) {0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) {0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.)
{0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) {0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/)
{0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) {0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0)
{0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) {0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1)
{0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) {0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2)
{0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) {0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3)
{0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) {0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4)
{0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) {0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5)
{0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) {0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6)
{0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) {0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7)
{0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) {0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8)
{0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) {0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9)
{0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) {0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:)
{0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) {0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//)
{0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) {0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<)
{0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) {0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=)
{0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) {0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>)
{0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) {0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?)
{0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) {0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@)
{0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) {0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A)
{0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) {0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B)
{0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) {0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C)
{0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) {0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D)
{0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) {0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E)
{0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) {0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F)
{0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) {0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G)
{0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) {0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H)
{0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) {0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I)
{0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) {0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J)
{0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) {0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K)
{0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) {0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L)
{0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) {0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M)
{0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) {0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N)
{0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) {0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O)
{0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) {0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P)
{0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) {0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q)
{0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) {0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R)
{0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) {0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S)
{0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) {0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T)
{0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) {0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U)
{0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) {0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V)
{0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) {0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W)
{0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) {0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X)
{0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) {0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y)
{0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) {0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z)
{0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) {0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([)
{0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) {0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\)
{0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) {0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (])
{0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) {0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_)
{0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) {0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`)
{0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) {0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a)
{0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) {0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b)
{0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) {0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c)
{0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) {0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d)
{0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) {0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e)
{0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) {0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f)
{0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) {0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g)
{0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) {0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h)
{0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) {0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i)
{0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) {0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j)
{0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) {0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k)
{0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) {0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l)
{0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) {0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m)
{0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) {0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n)
{0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) {0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o)
{0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) {0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p)
{0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) {0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q)
{0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) {0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r)
{0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) {0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s)
{0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) {0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t)
{0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) {0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u)
{0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) {0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v)
{0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) {0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w)
{0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) {0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x)
{0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) {0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y)
{0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) {0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z)
{0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) {0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({)
{0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) {0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|)
{0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) {0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (})
{0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) {0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F
}; };
unsigned char font5x8[][5] = { unsigned char font5x8[][5] = {
{0x00, 0x00, 0x00, 0x00, 0x00}, // 0x20 (Space) {0x00, 0x00, 0x00, 0x00, 0x00}, // 0x20 (Space)
{0x00, 0x00, 0x9E, 0x00, 0x00}, // 0x21 ! {0x00, 0x00, 0x9E, 0x00, 0x00}, // 0x21 !
{0x00, 0x0E, 0x00, 0x0E, 0x00}, // 0x22 " {0x00, 0x0E, 0x00, 0x0E, 0x00}, // 0x22 "
{0x28, 0xFE, 0x28, 0xFE, 0x28}, // 0x23 # {0x28, 0xFE, 0x28, 0xFE, 0x28}, // 0x23 #
{0x48, 0x54, 0xFE, 0x54, 0x24}, // 0x24 $ {0x48, 0x54, 0xFE, 0x54, 0x24}, // 0x24 $
{0x46, 0x26, 0x10, 0xC8, 0xC4}, // 0x25 % {0x46, 0x26, 0x10, 0xC8, 0xC4}, // 0x25 %
{0x6C, 0x92, 0xAA, 0x44, 0xA0}, // 0x26 & {0x6C, 0x92, 0xAA, 0x44, 0xA0}, // 0x26 &
{0x00, 0x0A, 0x06, 0x00, 0x00}, // 0x27 ' {0x00, 0x0A, 0x06, 0x00, 0x00}, // 0x27 '
{0x00, 0x38, 0x44, 0x82, 0x00}, // 0x28 ( {0x00, 0x38, 0x44, 0x82, 0x00}, // 0x28 (
{0x00, 0x82, 0x44, 0x38, 0x00}, // 0x29 ) {0x00, 0x82, 0x44, 0x38, 0x00}, // 0x29 )
{0x10, 0x54, 0x38, 0x54, 0x10}, // 0x2A * {0x10, 0x54, 0x38, 0x54, 0x10}, // 0x2A *
{0x10, 0x10, 0x7C, 0x10, 0x10}, // 0x2B + {0x10, 0x10, 0x7C, 0x10, 0x10}, // 0x2B +
{0x00, 0xA0, 0x60, 0x00, 0x00}, // 0x2C , {0x00, 0xA0, 0x60, 0x00, 0x00}, // 0x2C ,
{0x10, 0x10, 0x10, 0x10, 0x10}, // 0x2D - {0x10, 0x10, 0x10, 0x10, 0x10}, // 0x2D -
{0x00, 0x60, 0x60, 0x00, 0x00}, // 0x2E . {0x00, 0x60, 0x60, 0x00, 0x00}, // 0x2E .
{0x40, 0x20, 0x10, 0x08, 0x04}, // 0x2F / {0x40, 0x20, 0x10, 0x08, 0x04}, // 0x2F /
{0x7C, 0xA2, 0x92, 0x8A, 0x7C}, // 0x30 0 {0x7C, 0xA2, 0x92, 0x8A, 0x7C}, // 0x30 0
{0x00, 0x84, 0xFE, 0x80, 0x00}, // 0x31 1 {0x00, 0x84, 0xFE, 0x80, 0x00}, // 0x31 1
{0x84, 0xC2, 0xA2, 0x92, 0x8C}, // 0x32 2 {0x84, 0xC2, 0xA2, 0x92, 0x8C}, // 0x32 2
{0x42, 0x82, 0x8A, 0x96, 0x62}, // 0x33 3 {0x42, 0x82, 0x8A, 0x96, 0x62}, // 0x33 3
{0x30, 0x28, 0x24, 0xFE, 0x20}, // 0x34 4 {0x30, 0x28, 0x24, 0xFE, 0x20}, // 0x34 4
{0x4E, 0x8A, 0x8A, 0x8A, 0x72}, // 0x35 5 {0x4E, 0x8A, 0x8A, 0x8A, 0x72}, // 0x35 5
{0x78, 0x94, 0x92, 0x92, 0x60}, // 0x36 6 {0x78, 0x94, 0x92, 0x92, 0x60}, // 0x36 6
{0x02, 0xE2, 0x12, 0x0A, 0x06}, // 0x37 7 {0x02, 0xE2, 0x12, 0x0A, 0x06}, // 0x37 7
{0x6C, 0x92, 0x92, 0x92, 0x6C}, // 0x38 8 {0x6C, 0x92, 0x92, 0x92, 0x6C}, // 0x38 8
{0x0C, 0x92, 0x92, 0x52, 0x3C}, // 0x39 9 {0x0C, 0x92, 0x92, 0x52, 0x3C}, // 0x39 9
{0x00, 0x6C, 0x6C, 0x00, 0x00}, // 0x3A : {0x00, 0x6C, 0x6C, 0x00, 0x00}, // 0x3A :
{0x00, 0xAC, 0x6C, 0x00, 0x00}, // 0x3B ; {0x00, 0xAC, 0x6C, 0x00, 0x00}, // 0x3B ;
{0x00, 0x10, 0x28, 0x44, 0x82}, // 0x3C < {0x00, 0x10, 0x28, 0x44, 0x82}, // 0x3C <
{0x28, 0x28, 0x28, 0x28, 0x28}, // 0x3D = {0x28, 0x28, 0x28, 0x28, 0x28}, // 0x3D =
{0x82, 0x44, 0x28, 0x10, 0x00}, // 0x3E > {0x82, 0x44, 0x28, 0x10, 0x00}, // 0x3E >
{0x04, 0x02, 0xA2, 0x12, 0x0C}, // 0x3F ? {0x04, 0x02, 0xA2, 0x12, 0x0C}, // 0x3F ?
{0x64, 0x92, 0xF2, 0x82, 0x7C}, // 0x40 @ {0x64, 0x92, 0xF2, 0x82, 0x7C}, // 0x40 @
{0xFC, 0x22, 0x22, 0x22, 0xFC}, // 0x41 A {0xFC, 0x22, 0x22, 0x22, 0xFC}, // 0x41 A
{0xFE, 0x92, 0x92, 0x92, 0x6C}, // 0x42 B {0xFE, 0x92, 0x92, 0x92, 0x6C}, // 0x42 B
{0x7C, 0x82, 0x82, 0x82, 0x44}, // 0x43 C {0x7C, 0x82, 0x82, 0x82, 0x44}, // 0x43 C
{0xFE, 0x82, 0x82, 0x44, 0x38}, // 0x44 D {0xFE, 0x82, 0x82, 0x44, 0x38}, // 0x44 D
{0xFE, 0x92, 0x92, 0x92, 0x82}, // 0x45 E {0xFE, 0x92, 0x92, 0x92, 0x82}, // 0x45 E
{0xFE, 0x12, 0x12, 0x02, 0x02}, // 0x46 F {0xFE, 0x12, 0x12, 0x02, 0x02}, // 0x46 F
{0x7C, 0x82, 0x82, 0xA2, 0x64}, // 0x47 G {0x7C, 0x82, 0x82, 0xA2, 0x64}, // 0x47 G
{0xFE, 0x10, 0x10, 0x10, 0xFE}, // 0x48 H {0xFE, 0x10, 0x10, 0x10, 0xFE}, // 0x48 H
{0x00, 0x82, 0xFE, 0x82, 0x00}, // 0x49 I {0x00, 0x82, 0xFE, 0x82, 0x00}, // 0x49 I
{0x40, 0x80, 0x82, 0x7E, 0x02}, // 0x4A J {0x40, 0x80, 0x82, 0x7E, 0x02}, // 0x4A J
{0xFE, 0x10, 0x28, 0x44, 0x82}, // 0x4B K {0xFE, 0x10, 0x28, 0x44, 0x82}, // 0x4B K
{0xFE, 0x80, 0x80, 0x80, 0x80}, // 0x4C L {0xFE, 0x80, 0x80, 0x80, 0x80}, // 0x4C L
{0xFE, 0x04, 0x08, 0x04, 0xFE}, // 0x4D M {0xFE, 0x04, 0x08, 0x04, 0xFE}, // 0x4D M
{0xFE, 0x08, 0x10, 0x20, 0xFE}, // 0x4E N {0xFE, 0x08, 0x10, 0x20, 0xFE}, // 0x4E N
{0x7C, 0x82, 0x82, 0x82, 0x7C}, // 0x4F O {0x7C, 0x82, 0x82, 0x82, 0x7C}, // 0x4F O
{0xFE, 0x12, 0x12, 0x12, 0x0C}, // 0x50 P {0xFE, 0x12, 0x12, 0x12, 0x0C}, // 0x50 P
{0x7C, 0x82, 0xA2, 0x42, 0xBC}, // 0x51 Q {0x7C, 0x82, 0xA2, 0x42, 0xBC}, // 0x51 Q
{0xFE, 0x12, 0x32, 0x52, 0x8C}, // 0x52 R {0xFE, 0x12, 0x32, 0x52, 0x8C}, // 0x52 R
{0x8C, 0x92, 0x92, 0x92, 0x62}, // 0x53 S {0x8C, 0x92, 0x92, 0x92, 0x62}, // 0x53 S
{0x02, 0x02, 0xFE, 0x02, 0x02}, // 0x54 T {0x02, 0x02, 0xFE, 0x02, 0x02}, // 0x54 T
{0x7E, 0x80, 0x80, 0x80, 0x7E}, // 0x55 U {0x7E, 0x80, 0x80, 0x80, 0x7E}, // 0x55 U
{0x3E, 0x40, 0x80, 0x40, 0x3E}, // 0x56 V {0x3E, 0x40, 0x80, 0x40, 0x3E}, // 0x56 V
{0xFE, 0x40, 0x30, 0x40, 0xFE}, // 0x57 W {0xFE, 0x40, 0x30, 0x40, 0xFE}, // 0x57 W
{0xC6, 0x28, 0x10, 0x28, 0xC6}, // 0x58 X {0xC6, 0x28, 0x10, 0x28, 0xC6}, // 0x58 X
{0x06, 0x08, 0xF0, 0x08, 0x06}, // 0x59 Y {0x06, 0x08, 0xF0, 0x08, 0x06}, // 0x59 Y
{0xC2, 0xA2, 0x92, 0x8A, 0x86}, // 0x5A Z {0xC2, 0xA2, 0x92, 0x8A, 0x86}, // 0x5A Z
{0x00, 0x00, 0xFE, 0x82, 0x82}, // 0x5B [ {0x00, 0x00, 0xFE, 0x82, 0x82}, // 0x5B [
{0x04, 0x08, 0x10, 0x20, 0x40}, // 0x5C "\" {0x04, 0x08, 0x10, 0x20, 0x40}, // 0x5C "\"
{0x82, 0x82, 0xFE, 0x00, 0x00}, // 0x5D ] {0x82, 0x82, 0xFE, 0x00, 0x00}, // 0x5D ]
{0x08, 0x04, 0x02, 0x04, 0x08}, // 0x5E ^ {0x08, 0x04, 0x02, 0x04, 0x08}, // 0x5E ^
{0x80, 0x80, 0x80, 0x80, 0x80}, // 0x5F _ {0x80, 0x80, 0x80, 0x80, 0x80}, // 0x5F _
{0x00, 0x02, 0x04, 0x08, 0x00}, // 0x60 ` {0x00, 0x02, 0x04, 0x08, 0x00}, // 0x60 `
{0x40, 0xA8, 0xA8, 0xA8, 0xF0}, // 0x61 a {0x40, 0xA8, 0xA8, 0xA8, 0xF0}, // 0x61 a
{0xFE, 0x90, 0x88, 0x88, 0x70}, // 0x62 b {0xFE, 0x90, 0x88, 0x88, 0x70}, // 0x62 b
{0x70, 0x88, 0x88, 0x88, 0x40}, // 0x63 c {0x70, 0x88, 0x88, 0x88, 0x40}, // 0x63 c
{0x70, 0x88, 0x88, 0x90, 0xFE}, // 0x64 d {0x70, 0x88, 0x88, 0x90, 0xFE}, // 0x64 d
{0x70, 0xA8, 0xA8, 0xA8, 0x30}, // 0x65 e {0x70, 0xA8, 0xA8, 0xA8, 0x30}, // 0x65 e
{0x10, 0xFC, 0x12, 0x02, 0x04}, // 0x66 f {0x10, 0xFC, 0x12, 0x02, 0x04}, // 0x66 f
{0x10, 0x28, 0xA8, 0xA8, 0x78}, // 0x67 g {0x10, 0x28, 0xA8, 0xA8, 0x78}, // 0x67 g
{0xFE, 0x10, 0x08, 0x08, 0xF0}, // 0x68 h {0xFE, 0x10, 0x08, 0x08, 0xF0}, // 0x68 h
{0x00, 0x88, 0xFA, 0x80, 0x00}, // 0x69 i {0x00, 0x88, 0xFA, 0x80, 0x00}, // 0x69 i
{0x40, 0x80, 0x88, 0x7A, 0x00}, // 0x6A j {0x40, 0x80, 0x88, 0x7A, 0x00}, // 0x6A j
{0x00, 0xFE, 0x20, 0x50, 0x88}, // 0x6B k {0x00, 0xFE, 0x20, 0x50, 0x88}, // 0x6B k
{0x00, 0x82, 0xFE, 0x80, 0x00}, // 0x6C l {0x00, 0x82, 0xFE, 0x80, 0x00}, // 0x6C l
{0xF8, 0x08, 0x30, 0x08, 0xF0}, // 0x6D m {0xF8, 0x08, 0x30, 0x08, 0xF0}, // 0x6D m
{0xF8, 0x10, 0x08, 0x08, 0xF0}, // 0x6E n {0xF8, 0x10, 0x08, 0x08, 0xF0}, // 0x6E n
{0x70, 0x88, 0x88, 0x88, 0x70}, // 0x6F o {0x70, 0x88, 0x88, 0x88, 0x70}, // 0x6F o
{0xF8, 0x28, 0x28, 0x28, 0x10}, // 0x70 p {0xF8, 0x28, 0x28, 0x28, 0x10}, // 0x70 p
{0x10, 0x28, 0x28, 0x30, 0xF8}, // 0x71 q {0x10, 0x28, 0x28, 0x30, 0xF8}, // 0x71 q
{0xF8, 0x10, 0x08, 0x08, 0x10}, // 0x72 r {0xF8, 0x10, 0x08, 0x08, 0x10}, // 0x72 r
{0x90, 0xA8, 0xA8, 0xA8, 0x40}, // 0x73 s {0x90, 0xA8, 0xA8, 0xA8, 0x40}, // 0x73 s
{0x08, 0x7E, 0x88, 0x80, 0x40}, // 0x74 t {0x08, 0x7E, 0x88, 0x80, 0x40}, // 0x74 t
{0x78, 0x80, 0x80, 0x40, 0xF8}, // 0x75 u {0x78, 0x80, 0x80, 0x40, 0xF8}, // 0x75 u
{0x38, 0x40, 0x80, 0x40, 0x38}, // 0x76 v {0x38, 0x40, 0x80, 0x40, 0x38}, // 0x76 v
{0x78, 0x80, 0x60, 0x80, 0x78}, // 0x77 w {0x78, 0x80, 0x60, 0x80, 0x78}, // 0x77 w
{0x88, 0x50, 0x20, 0x50, 0x88}, // 0x78 x {0x88, 0x50, 0x20, 0x50, 0x88}, // 0x78 x
{0x18, 0xA0, 0xA0, 0xA0, 0x78}, // 0x79 y {0x18, 0xA0, 0xA0, 0xA0, 0x78}, // 0x79 y
{0x88, 0xC8, 0xA8, 0x98, 0x88}, // 0x7A z {0x88, 0xC8, 0xA8, 0x98, 0x88}, // 0x7A z
{0x00, 0x10, 0x6C, 0x82, 0x00}, // 0x7B { {0x00, 0x10, 0x6C, 0x82, 0x00}, // 0x7B {
{0x00, 0x00, 0xFE, 0x00, 0x00}, // 0x7C | {0x00, 0x00, 0xFE, 0x00, 0x00}, // 0x7C |
{0x00, 0x82, 0x6C, 0x10, 0x00}, // 0x7D } {0x00, 0x82, 0x6C, 0x10, 0x00}, // 0x7D }
{0x20, 0x10, 0x10, 0x20, 0x10}, // 0x7E {0x20, 0x10, 0x10, 0x20, 0x10}, // 0x7E
{0xF0, 0x88, 0x84, 0x88, 0xF0}, // 0x7F  {0xF0, 0x88, 0x84, 0x88, 0xF0}, // 0x7F 
{0x28, 0x7C, 0xAA, 0x82, 0x44}, // 0x80 € {0x28, 0x7C, 0xAA, 0x82, 0x44}, // 0x80 €
{0xF0, 0x29, 0x27, 0x21, 0xFF}, // 0x81  {0xF0, 0x29, 0x27, 0x21, 0xFF}, // 0x81 
{0x00, 0xA0, 0x60, 0x00, 0x00}, // 0x82 {0x00, 0xA0, 0x60, 0x00, 0x00}, // 0x82
{0x40, 0x90, 0x7C, 0x12, 0x04}, // 0x83 ƒ {0x40, 0x90, 0x7C, 0x12, 0x04}, // 0x83 ƒ
{0xC0, 0xA0, 0x00, 0xC0, 0xA0}, // 0x84 „ {0xC0, 0xA0, 0x00, 0xC0, 0xA0}, // 0x84 „
{0x80, 0x00, 0x80, 0x00, 0x80}, // 0x85 … {0x80, 0x00, 0x80, 0x00, 0x80}, // 0x85 …
{0x00, 0x04, 0xFE, 0x04, 0x00}, // 0x86 † {0x00, 0x04, 0xFE, 0x04, 0x00}, // 0x86 †
{0x00, 0x44, 0xFE, 0x44, 0x00}, // 0x87 ‡ {0x00, 0x44, 0xFE, 0x44, 0x00}, // 0x87 ‡
{0x00, 0x04, 0x02, 0x04, 0x00}, // 0x88 ˆ {0x00, 0x04, 0x02, 0x04, 0x00}, // 0x88 ˆ
{0xC3, 0xD3, 0x08, 0xC4, 0xC2}, // 0x89 ‰ {0xC3, 0xD3, 0x08, 0xC4, 0xC2}, // 0x89 ‰
{0x4C, 0x93, 0x92, 0x93, 0x64}, // 0x8A Š {0x4C, 0x93, 0x92, 0x93, 0x64}, // 0x8A Š
{0x00, 0x10, 0x28, 0x00, 0x00}, // 0x8B {0x00, 0x10, 0x28, 0x00, 0x00}, // 0x8B
{0x7C, 0x82, 0x82, 0x7C, 0x92}, // 0x8C Œ {0x7C, 0x82, 0x82, 0x7C, 0x92}, // 0x8C Œ
{0x02, 0xFE, 0x90, 0x90, 0x60}, // 0x8D  {0x02, 0xFE, 0x90, 0x90, 0x60}, // 0x8D 
{0xC2, 0xA3, 0x92, 0x8B, 0x86}, // 0x8E Ž {0xC2, 0xA3, 0x92, 0x8B, 0x86}, // 0x8E Ž
{0x44, 0x92, 0x8A, 0x92, 0x7C}, // 0x8F  {0x44, 0x92, 0x8A, 0x92, 0x7C}, // 0x8F 
{0x70, 0x88, 0x90, 0x60, 0x98}, // 0x90  {0x70, 0x88, 0x90, 0x60, 0x98}, // 0x90 
{0x00, 0x02, 0x04, 0x08, 0x00}, // 0x91 {0x00, 0x02, 0x04, 0x08, 0x00}, // 0x91
{0x00, 0x08, 0x04, 0x02, 0x00}, // 0x92 {0x00, 0x08, 0x04, 0x02, 0x00}, // 0x92
{0x02, 0x04, 0x0A, 0x04, 0x08}, // 0x93 “ {0x02, 0x04, 0x0A, 0x04, 0x08}, // 0x93 “
{0x08, 0x04, 0x0A, 0x04, 0x02}, // 0x94 ” {0x08, 0x04, 0x0A, 0x04, 0x02}, // 0x94 ”
{0x00, 0x38, 0x38, 0x38, 0x00}, // 0x95 • {0x00, 0x38, 0x38, 0x38, 0x00}, // 0x95 •
{0x00, 0x10, 0x10, 0x10, 0x10}, // 0x96 {0x00, 0x10, 0x10, 0x10, 0x10}, // 0x96
{0x10, 0x10, 0x10, 0x10, 0x10}, // 0x97 — {0x10, 0x10, 0x10, 0x10, 0x10}, // 0x97 —
{0x02, 0x01, 0x02, 0x04, 0x02}, // 0x98 ˜ {0x02, 0x01, 0x02, 0x04, 0x02}, // 0x98 ˜
{0xF1, 0x5B, 0x55, 0x51, 0x51}, // 0x99 ™ {0xF1, 0x5B, 0x55, 0x51, 0x51}, // 0x99 ™
{0x90, 0xA9, 0xAA, 0xA9, 0x40}, // 0x9A š {0x90, 0xA9, 0xAA, 0xA9, 0x40}, // 0x9A š
{0x00, 0x88, 0x50, 0x20, 0x00}, // 0x9B {0x00, 0x88, 0x50, 0x20, 0x00}, // 0x9B
{0x70, 0x88, 0x70, 0xA8, 0xB0}, // 0x9C ϡ {0x70, 0x88, 0x70, 0xA8, 0xB0}, // 0x9C ϡ
{0x38, 0x7C, 0xF8, 0x7C, 0x38}, // 0x9D  {0x38, 0x7C, 0xF8, 0x7C, 0x38}, // 0x9D 
{0x88, 0xC9, 0xAA, 0x99, 0x88}, // 0x9E ž {0x88, 0xC9, 0xAA, 0x99, 0x88}, // 0x9E ž
{0x1C, 0x21, 0xC0, 0x21, 0x1C}, // 0x9F Ÿ {0x1C, 0x21, 0xC0, 0x21, 0x1C}, // 0x9F Ÿ
{0x00, 0x00, 0x00, 0x00, 0x00}, // 0xA0 {0x00, 0x00, 0x00, 0x00, 0x00}, // 0xA0
{0x00, 0x00, 0xF2, 0x00, 0x00}, // 0xA1 ¡ {0x00, 0x00, 0xF2, 0x00, 0x00}, // 0xA1 ¡
{0x38, 0x44, 0xFE, 0x44, 0x20}, // 0xA2 ¢ {0x38, 0x44, 0xFE, 0x44, 0x20}, // 0xA2 ¢
{0x90, 0x7C, 0x92, 0x82, 0x40}, // 0xA3 £ {0x90, 0x7C, 0x92, 0x82, 0x40}, // 0xA3 £
{0x44, 0x38, 0x28, 0x38, 0x44}, // 0xA4 ¤ {0x44, 0x38, 0x28, 0x38, 0x44}, // 0xA4 ¤
{0x2A, 0x2C, 0xF8, 0x2C, 0x2A}, // 0xA5 ¥ {0x2A, 0x2C, 0xF8, 0x2C, 0x2A}, // 0xA5 ¥
{0x00, 0x00, 0xEE, 0x00, 0x00}, // 0xA6 ¦ {0x00, 0x00, 0xEE, 0x00, 0x00}, // 0xA6 ¦
{0x40, 0x94, 0xAA, 0x52, 0x04}, // 0xA7 § {0x40, 0x94, 0xAA, 0x52, 0x04}, // 0xA7 §
{0x00, 0x02, 0x00, 0x02, 0x00}, // 0xA8 ¨ {0x00, 0x02, 0x00, 0x02, 0x00}, // 0xA8 ¨
{0xFE, 0x82, 0xBA, 0x92, 0xFE}, // 0xA9 © {0xFE, 0x82, 0xBA, 0x92, 0xFE}, // 0xA9 ©
{0x90, 0xAA, 0xAA, 0xAA, 0xBC}, // 0xAA ª {0x90, 0xAA, 0xAA, 0xAA, 0xBC}, // 0xAA ª
{0x20, 0x50, 0xA8, 0x50, 0x88}, // 0xAB « {0x20, 0x50, 0xA8, 0x50, 0x88}, // 0xAB «
{0x20, 0x20, 0x20, 0x20, 0xE0}, // 0xAC ¬ {0x20, 0x20, 0x20, 0x20, 0xE0}, // 0xAC ¬
{0x20, 0x20, 0x20, 0x20, 0x20}, // 0xAD ­ {0x20, 0x20, 0x20, 0x20, 0x20}, // 0xAD ­
{0xFE, 0x82, 0xCA, 0xA2, 0xFE}, // 0xAE ® {0xFE, 0x82, 0xCA, 0xA2, 0xFE}, // 0xAE ®
{0x02, 0x02, 0x02, 0x02, 0x02}, // 0xAF ¯ {0x02, 0x02, 0x02, 0x02, 0x02}, // 0xAF ¯
{0x0E, 0x11, 0x11, 0x0E, 0x00}, // 0xB0 ° {0x0E, 0x11, 0x11, 0x0E, 0x00}, // 0xB0 °
{0x88, 0x88, 0xBE, 0x88, 0x88}, // 0xB1 ± {0x88, 0x88, 0xBE, 0x88, 0x88}, // 0xB1 ±
{0x12, 0x19, 0x15, 0x12, 0x00}, // 0xB2 ² {0x12, 0x19, 0x15, 0x12, 0x00}, // 0xB2 ²
{0x11, 0x15, 0x15, 0x0A, 0x00}, // 0xB3 ³ {0x11, 0x15, 0x15, 0x0A, 0x00}, // 0xB3 ³
{0x00, 0x08, 0x04, 0x02, 0x00}, // 0xB4 ´ {0x00, 0x08, 0x04, 0x02, 0x00}, // 0xB4 ´
{0xFE, 0x20, 0x20, 0x10, 0x3E}, // 0xB5 µ {0xFE, 0x20, 0x20, 0x10, 0x3E}, // 0xB5 µ
{0x0C, 0x12, 0x12, 0xFE, 0xFE}, // 0xB6 ¶ {0x0C, 0x12, 0x12, 0xFE, 0xFE}, // 0xB6 ¶
{0x00, 0x30, 0x30, 0x00, 0x00}, // 0xB7 · {0x00, 0x30, 0x30, 0x00, 0x00}, // 0xB7 ·
{0x00, 0x80, 0xB0, 0x40, 0x00}, // 0xB8 ¸ {0x00, 0x80, 0xB0, 0x40, 0x00}, // 0xB8 ¸
{0x00, 0x02, 0x0F, 0x00, 0x00}, // 0xB9 ¹ {0x00, 0x02, 0x0F, 0x00, 0x00}, // 0xB9 ¹
{0x00, 0x02, 0x05, 0x02, 0x00}, // 0xBA º {0x00, 0x02, 0x05, 0x02, 0x00}, // 0xBA º
{0x44, 0x28, 0x54, 0x28, 0x10}, // 0xBB » {0x44, 0x28, 0x54, 0x28, 0x10}, // 0xBB »
{0x22, 0x1F, 0x68, 0x54, 0xFA}, // 0xBC ¼ {0x22, 0x1F, 0x68, 0x54, 0xFA}, // 0xBC ¼
{0x02, 0x1F, 0x90, 0xC8, 0xB0}, // 0xBD ½ {0x02, 0x1F, 0x90, 0xC8, 0xB0}, // 0xBD ½
{0x15, 0x1F, 0x60, 0x50, 0xF8}, // 0xBE ¾ {0x15, 0x1F, 0x60, 0x50, 0xF8}, // 0xBE ¾
{0x60, 0x90, 0x8A, 0x80, 0x40}, // 0xBF ¿ {0x60, 0x90, 0x8A, 0x80, 0x40}, // 0xBF ¿
{0xF0, 0x29, 0x26, 0x28, 0xF0}, // 0xC0 À {0xF0, 0x29, 0x26, 0x28, 0xF0}, // 0xC0 À
{0xF0, 0x28, 0x26, 0x29, 0xF0}, // 0xC1 Á {0xF0, 0x28, 0x26, 0x29, 0xF0}, // 0xC1 Á
{0xF0, 0x2A, 0x29, 0x2A, 0xF0}, // 0xC2 Â {0xF0, 0x2A, 0x29, 0x2A, 0xF0}, // 0xC2 Â
{0xF2, 0x29, 0x29, 0x2A, 0xF1}, // 0xC3 Ã {0xF2, 0x29, 0x29, 0x2A, 0xF1}, // 0xC3 Ã
{0xF0, 0x29, 0x24, 0x29, 0xF0}, // 0xC4 Ä {0xF0, 0x29, 0x24, 0x29, 0xF0}, // 0xC4 Ä
{0xF0, 0x2A, 0x2D, 0x2A, 0xF0}, // 0xC5 Å {0xF0, 0x2A, 0x2D, 0x2A, 0xF0}, // 0xC5 Å
{0xF8, 0x24, 0xFE, 0x92, 0x92}, // 0xC6 Æ {0xF8, 0x24, 0xFE, 0x92, 0x92}, // 0xC6 Æ
{0x1E, 0x21, 0xA1, 0xE1, 0x12}, // 0xC7 Ç {0x1E, 0x21, 0xA1, 0xE1, 0x12}, // 0xC7 Ç
{0xF8, 0xA9, 0xAA, 0xA8, 0x88}, // 0xC8 È {0xF8, 0xA9, 0xAA, 0xA8, 0x88}, // 0xC8 È
{0xF8, 0xA8, 0xAA, 0xA9, 0x88}, // 0xC9 É {0xF8, 0xA8, 0xAA, 0xA9, 0x88}, // 0xC9 É
{0xF8, 0xAA, 0xA9, 0xAA, 0x88}, // 0xCA Ê {0xF8, 0xAA, 0xA9, 0xAA, 0x88}, // 0xCA Ê
{0xF8, 0xAA, 0xA8, 0xAA, 0x88}, // 0xCB Ë {0xF8, 0xAA, 0xA8, 0xAA, 0x88}, // 0xCB Ë
{0x00, 0x89, 0xFA, 0x88, 0x00}, // 0xCC Ì {0x00, 0x89, 0xFA, 0x88, 0x00}, // 0xCC Ì
{0x00, 0x88, 0xFA, 0x89, 0x00}, // 0xCD Í {0x00, 0x88, 0xFA, 0x89, 0x00}, // 0xCD Í
{0x00, 0x8A, 0xF9, 0x8A, 0x00}, // 0xCE Î {0x00, 0x8A, 0xF9, 0x8A, 0x00}, // 0xCE Î
{0x00, 0x8A, 0xF8, 0x8A, 0x00}, // 0xCF Ï {0x00, 0x8A, 0xF8, 0x8A, 0x00}, // 0xCF Ï
{0x10, 0xFE, 0x92, 0x82, 0x7C}, // 0xD0 Ð {0x10, 0xFE, 0x92, 0x82, 0x7C}, // 0xD0 Ð
{0xFA, 0x11, 0x21, 0x42, 0xF9}, // 0xD1 Ñ {0xFA, 0x11, 0x21, 0x42, 0xF9}, // 0xD1 Ñ
{0x78, 0x85, 0x86, 0x84, 0x78}, // 0xD2 Ò {0x78, 0x85, 0x86, 0x84, 0x78}, // 0xD2 Ò
{0x78, 0x84, 0x86, 0x85, 0x78}, // 0xD3 Ó {0x78, 0x84, 0x86, 0x85, 0x78}, // 0xD3 Ó
{0x70, 0x8A, 0x89, 0x8A, 0x70}, // 0xD4 Ô {0x70, 0x8A, 0x89, 0x8A, 0x70}, // 0xD4 Ô
{0x72, 0x89, 0x89, 0x8A, 0x71}, // 0xD5 Õ {0x72, 0x89, 0x89, 0x8A, 0x71}, // 0xD5 Õ
{0x78, 0x85, 0x84, 0x85, 0x78}, // 0xD6 Ö {0x78, 0x85, 0x84, 0x85, 0x78}, // 0xD6 Ö
{0x44, 0x28, 0x10, 0x28, 0x44}, // 0xD7 × {0x44, 0x28, 0x10, 0x28, 0x44}, // 0xD7 ×
{0x10, 0xAA, 0xFE, 0xAA, 0x10}, // 0xD8 Ø {0x10, 0xAA, 0xFE, 0xAA, 0x10}, // 0xD8 Ø
{0x7C, 0x81, 0x82, 0x80, 0x7C}, // 0xD9 Ù {0x7C, 0x81, 0x82, 0x80, 0x7C}, // 0xD9 Ù
{0x7C, 0x80, 0x82, 0x81, 0x7C}, // 0xDA Ú {0x7C, 0x80, 0x82, 0x81, 0x7C}, // 0xDA Ú
{0x78, 0x82, 0x81, 0x82, 0x78}, // 0xDB Û {0x78, 0x82, 0x81, 0x82, 0x78}, // 0xDB Û
{0x7C, 0x81, 0x80, 0x81, 0x7C}, // 0xDC Ü {0x7C, 0x81, 0x80, 0x81, 0x7C}, // 0xDC Ü
{0x04, 0x08, 0xF2, 0x09, 0x04}, // 0xDD Ý {0x04, 0x08, 0xF2, 0x09, 0x04}, // 0xDD Ý
{0x81, 0xFF, 0x24, 0x24, 0x18}, // 0xDE Þ {0x81, 0xFF, 0x24, 0x24, 0x18}, // 0xDE Þ
{0x80, 0x7C, 0x92, 0x92, 0x6C}, // 0xDF ß {0x80, 0x7C, 0x92, 0x92, 0x6C}, // 0xDF ß
{0x40, 0xA9, 0xAA, 0xA8, 0xF0}, // 0xE0 à {0x40, 0xA9, 0xAA, 0xA8, 0xF0}, // 0xE0 à
{0x40, 0xA8, 0xAA, 0xA9, 0xF0}, // 0xE1 á {0x40, 0xA8, 0xAA, 0xA9, 0xF0}, // 0xE1 á
{0x40, 0xAA, 0xA9, 0xAA, 0xF0}, // 0xE2 â {0x40, 0xAA, 0xA9, 0xAA, 0xF0}, // 0xE2 â
{0x42, 0xA9, 0xA9, 0xAA, 0xF1}, // 0xE3 ã {0x42, 0xA9, 0xA9, 0xAA, 0xF1}, // 0xE3 ã
{0x40, 0xAA, 0xA8, 0xAA, 0xF0}, // 0xE4 ä {0x40, 0xAA, 0xA8, 0xAA, 0xF0}, // 0xE4 ä
{0x40, 0xAA, 0xAD, 0xAA, 0xF0}, // 0xE5 å {0x40, 0xAA, 0xAD, 0xAA, 0xF0}, // 0xE5 å
{0x64, 0x94, 0x78, 0x94, 0x58}, // 0xE6 æ {0x64, 0x94, 0x78, 0x94, 0x58}, // 0xE6 æ
{0x18, 0x24, 0xA4, 0xE4, 0x10}, // 0xE7 ç {0x18, 0x24, 0xA4, 0xE4, 0x10}, // 0xE7 ç
{0x70, 0xA9, 0xAA, 0xA8, 0x30}, // 0xE8 è {0x70, 0xA9, 0xAA, 0xA8, 0x30}, // 0xE8 è
{0x70, 0xA8, 0xAA, 0xA9, 0x30}, // 0xE9 é {0x70, 0xA8, 0xAA, 0xA9, 0x30}, // 0xE9 é
{0x70, 0xAA, 0xA9, 0xAA, 0x30}, // 0xEA ê {0x70, 0xAA, 0xA9, 0xAA, 0x30}, // 0xEA ê
{0x70, 0xAA, 0xA8, 0xAA, 0x30}, // 0xEB ë {0x70, 0xAA, 0xA8, 0xAA, 0x30}, // 0xEB ë
{0x00, 0x91, 0xFA, 0x80, 0x00}, // 0xEC ì {0x00, 0x91, 0xFA, 0x80, 0x00}, // 0xEC ì
{0x00, 0x90, 0xFA, 0x81, 0x00}, // 0xED í {0x00, 0x90, 0xFA, 0x81, 0x00}, // 0xED í
{0x00, 0x92, 0xF9, 0x82, 0x00}, // 0xEE î {0x00, 0x92, 0xF9, 0x82, 0x00}, // 0xEE î
{0x00, 0x92, 0xF8, 0x82, 0x00}, // 0xEF ï {0x00, 0x92, 0xF8, 0x82, 0x00}, // 0xEF ï
{0x4A, 0xA4, 0xAA, 0xB0, 0x60}, // 0xF0 ð {0x4A, 0xA4, 0xAA, 0xB0, 0x60}, // 0xF0 ð
{0xFA, 0x11, 0x09, 0x0A, 0xF1}, // 0xF1 ñ {0xFA, 0x11, 0x09, 0x0A, 0xF1}, // 0xF1 ñ
{0x70, 0x89, 0x8A, 0x88, 0x70}, // 0xF2 ò {0x70, 0x89, 0x8A, 0x88, 0x70}, // 0xF2 ò
{0x70, 0x88, 0x8A, 0x89, 0x70}, // 0xF3 ó {0x70, 0x88, 0x8A, 0x89, 0x70}, // 0xF3 ó
{0x60, 0x94, 0x92, 0x94, 0x60}, // 0xF4 ô {0x60, 0x94, 0x92, 0x94, 0x60}, // 0xF4 ô
{0x64, 0x92, 0x92, 0x94, 0x62}, // 0xF5 õ {0x64, 0x92, 0x92, 0x94, 0x62}, // 0xF5 õ
{0x70, 0x8A, 0x88, 0x8A, 0x70}, // 0xF6 ö {0x70, 0x8A, 0x88, 0x8A, 0x70}, // 0xF6 ö
{0x10, 0x10, 0x54, 0x10, 0x10}, // 0xF7 ÷ {0x10, 0x10, 0x54, 0x10, 0x10}, // 0xF7 ÷
{0x10, 0xA8, 0x7C, 0x2A, 0x10}, // 0xF8 ø {0x10, 0xA8, 0x7C, 0x2A, 0x10}, // 0xF8 ø
{0x78, 0x81, 0x82, 0x40, 0xF8}, // 0xF9 ù {0x78, 0x81, 0x82, 0x40, 0xF8}, // 0xF9 ù
{0x78, 0x80, 0x82, 0x41, 0xF8}, // 0xFA ú {0x78, 0x80, 0x82, 0x41, 0xF8}, // 0xFA ú
{0x78, 0x82, 0x81, 0x42, 0xF8}, // 0xFB û {0x78, 0x82, 0x81, 0x42, 0xF8}, // 0xFB û
{0x78, 0x82, 0x80, 0x42, 0xF8}, // 0xFC ü {0x78, 0x82, 0x80, 0x42, 0xF8}, // 0xFC ü
{0x18, 0xA0, 0xA4, 0xA2, 0x78}, // 0xFD v {0x18, 0xA0, 0xA4, 0xA2, 0x78}, // 0xFD v
{0x00, 0x82, 0xFE, 0xA8, 0x10}, // 0xFE þ {0x00, 0x82, 0xFE, 0xA8, 0x10}, // 0xFE þ
{0x18, 0xA2, 0xA0, 0xA2, 0x78} // 0xFF ÿ {0x18, 0xA2, 0xA0, 0xA2, 0x78} // 0xFF ÿ
}; };

View File

@ -2,7 +2,6 @@
#define G13_H #define G13_H
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <string> #include <string>
namespace G13 { namespace G13 {
@ -42,14 +41,18 @@ const LINUX_KEY_VALUE BAD_KEY_VALUE = -1;
typedef int G13_KEY_INDEX; typedef int G13_KEY_INDEX;
class G13_CommandException : public std::exception { class G13_CommandException : public std::exception {
public: public:
G13_CommandException(const std::string &reason) : _reason(reason) {} G13_CommandException(const std::string &reason) : _reason(reason) {
virtual ~G13_CommandException() throw() {} }
virtual const char *what() const throw() { return _reason.c_str(); } virtual ~G13_CommandException() throw() {
}
virtual const char *what() const throw() {
return _reason.c_str();
}
std::string _reason; std::string _reason;
}; };
} // namespace G13 } // namespace G13
#endif // __G13_H__ #endif // __G13_H__

View File

@ -37,12 +37,9 @@
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/seq.hpp> #include <boost/preprocessor/seq.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <exception>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <exception>
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
@ -53,9 +50,9 @@ namespace Helper {
// ************************************************************************* // *************************************************************************
template <class MAP_T> struct _map_keys_out { template <class MAP_T>
_map_keys_out(const MAP_T &c, const std::string &s) struct _map_keys_out {
: container(c), sep(s) { _map_keys_out(const MAP_T &c, const std::string &s) : container(c), sep(s) {
} }
const MAP_T &container; const MAP_T &container;
@ -84,8 +81,8 @@ _map_keys_out<MAP_T> map_keys_out(const MAP_T &c,
// ************************************************************************* // *************************************************************************
}; // namespace Helper }; // namespace Helper
// ************************************************************************* // *************************************************************************
#endif // __HELPER_HPP__ #endif // __HELPER_HPP__

View File

@ -18,10 +18,11 @@
A0.01 A1.01 A2.01 ... A0.01 A1.01 A2.01 ...
*/ */
#include <iostream>
#include <fstream>
#include "lcd.h" #include "lcd.h"
#include <fstream>
#include <iostream>
#include "device.h" #include "device.h"
namespace G13 { namespace G13 {
@ -38,7 +39,7 @@ G13_LCD::G13_LCD(G13_Device &keypad) : _keypad(keypad) {
void G13_LCD::image_setpixel(unsigned row, unsigned col) { void G13_LCD::image_setpixel(unsigned row, unsigned col) {
unsigned offset = unsigned offset =
image_byte_offset(row, col); // col + (row /8 ) * BYTES_PER_ROW * 8; image_byte_offset(row, col); // col + (row /8 ) * BYTES_PER_ROW * 8;
unsigned char mask = 1 << ((row)&7); unsigned char mask = 1 << ((row)&7);
if (offset >= G13_LCD_BUF_SIZE) { if (offset >= G13_LCD_BUF_SIZE) {
@ -51,9 +52,8 @@ void G13_LCD::image_setpixel(unsigned row, unsigned col) {
} }
void G13_LCD::image_clearpixel(unsigned row, unsigned col) { void G13_LCD::image_clearpixel(unsigned row, unsigned col) {
unsigned offset = unsigned offset =
image_byte_offset(row, col); // col + (row /8 ) * BYTES_PER_ROW * 8; image_byte_offset(row, col); // col + (row /8 ) * BYTES_PER_ROW * 8;
unsigned char mask = 1 << ((row)&7); unsigned char mask = 1 << ((row)&7);
if (offset >= G13_LCD_BUF_SIZE) { if (offset >= G13_LCD_BUF_SIZE) {
@ -88,7 +88,7 @@ void G13_LCD::write_char(char c, int row, int col) {
} }
unsigned offset = image_byte_offset(row * G13_LCD_TEXT_CHEIGHT, unsigned offset = image_byte_offset(row * G13_LCD_TEXT_CHEIGHT,
col); //*_keypad._current_font->_width ); col); //*_keypad._current_font->_width );
if (text_mode) { if (text_mode) {
memcpy(&image_buf[offset], memcpy(&image_buf[offset],
&_keypad.current_font().char_data(c).bits_inverted, &_keypad.current_font().char_data(c).bits_inverted,
@ -157,4 +157,4 @@ void G13_LCD::image_test(int x, int y) {
image_send(); image_send();
} }
} // namespace G13 } // namespace G13

View File

@ -1,16 +1,16 @@
#ifndef LCD_H #ifndef LCD_H
#define LCD_H #define LCD_H
#include "g13.h"
#include <memory.h> #include <memory.h>
#include "g13.h"
namespace G13 { namespace G13 {
class G13_Device; class G13_Device;
class G13_LCD { class G13_LCD {
public: public:
G13_LCD(G13_Device &keypad); G13_LCD(G13_Device &keypad);
G13_Device &_keypad; G13_Device &_keypad;
@ -20,10 +20,14 @@ public:
int text_mode; int text_mode;
void image(unsigned char *data, int size); void image(unsigned char *data, int size);
void image_send() { image(image_buf, G13_LCD_BUF_SIZE); } void image_send() {
image(image_buf, G13_LCD_BUF_SIZE);
}
void image_test(int x, int y); void image_test(int x, int y);
void image_clear() { memset(image_buf, 0, G13_LCD_BUF_SIZE); } void image_clear() {
memset(image_buf, 0, G13_LCD_BUF_SIZE);
}
unsigned image_byte_offset(unsigned row, unsigned col) { unsigned image_byte_offset(unsigned row, unsigned col) {
return col + (row / 8) * G13_LCD_BYTES_PER_ROW * 8; return col + (row / 8) * G13_LCD_BYTES_PER_ROW * 8;
@ -37,6 +41,6 @@ public:
void write_pos(int row, int col); void write_pos(int row, int col);
}; };
} // namespace G13 } // namespace G13
#endif // LCD_H #endif // LCD_H

View File

@ -83,4 +83,4 @@ static unsigned char g13_logo[160 * 48 / 8] = {
0x00, 0x01, 0x00, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#endif // G13_LOGO_H #endif // G13_LOGO_H

View File

@ -1,7 +1,6 @@
#include <iostream>
#include <boost/program_options.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/program_options.hpp>
#include <iostream>
#include "g13.h" #include "g13.h"
#include "manager.h" #include "manager.h"
@ -64,5 +63,4 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} }
} }

View File

@ -1,5 +1,8 @@
#include "manager.h"
#include <signal.h> #include <signal.h>
#include <boost/foreach.hpp>
#include <boost/log/attributes.hpp> #include <boost/log/attributes.hpp>
#include <boost/log/core/core.hpp> #include <boost/log/core/core.hpp>
#include <boost/log/expressions.hpp> #include <boost/log/expressions.hpp>
@ -12,15 +15,12 @@
#include <boost/log/utility/setup/console.hpp> #include <boost/log/utility/setup/console.hpp>
#include <boost/preprocessor/seq/for_each.hpp> #include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/stringize.hpp> #include <boost/preprocessor/stringize.hpp>
#include <boost/foreach.hpp>
#include <fstream> #include <fstream>
#include <vector> #include <vector>
#include "helper.h"
#include "device.h" #include "device.h"
#include "manager.h"
#include "find_or_throw.h" #include "find_or_throw.h"
#include "helper.h"
#include "repr.h" #include "repr.h"
namespace G13 { namespace G13 {
@ -61,11 +61,10 @@ void G13_Manager::set_log_level(::boost::log::trivial::severity_level lvl) {
} }
void G13_Manager::set_log_level(const std::string &level) { void G13_Manager::set_log_level(const std::string &level) {
#define CHECK_LEVEL(L) \
#define CHECK_LEVEL(L) \ if (level == BOOST_PP_STRINGIZE(L)) { \
if (level == BOOST_PP_STRINGIZE(L)) { \ set_log_level(::boost::log::trivial::L); \
set_log_level(::boost::log::trivial::L); \ return; \
return; \
} }
CHECK_LEVEL(trace); CHECK_LEVEL(trace);
@ -89,13 +88,13 @@ void G13_Manager::cleanup() {
libusb_exit(ctx); libusb_exit(ctx);
} }
G13_Manager::G13_Manager() : devs(0), ctx(0) {
G13_Manager::G13_Manager()
: devs(0), ctx(0) {
} }
bool G13_Manager::running = true; bool G13_Manager::running = true;
void G13_Manager::set_stop(int) { running = false; } void G13_Manager::set_stop(int) {
running = false;
}
std::string G13_Manager::string_config_value(const std::string &name) const { std::string G13_Manager::string_config_value(const std::string &name) const {
try { try {
@ -206,21 +205,21 @@ int G13_Manager::run() {
} }
// setup maps to let us convert between strings and G13 key names // setup maps to let us convert between strings and G13 key names
#define ADD_G13_KEY_MAPPING(r, data, elem) \ #define ADD_G13_KEY_MAPPING(r, data, elem) \
{ \ { \
std::string name = BOOST_PP_STRINGIZE(elem); \ std::string name = BOOST_PP_STRINGIZE(elem); \
g13_key_to_name[key_index] = name; \ g13_key_to_name[key_index] = name; \
g13_name_to_key[name] = key_index; \ g13_name_to_key[name] = key_index; \
key_index++; \ key_index++; \
} }
// setup maps to let us convert between strings and linux key names // setup maps to let us convert between strings and linux key names
#define ADD_KB_KEY_MAPPING(r, data, elem) \ #define ADD_KB_KEY_MAPPING(r, data, elem) \
{ \ { \
std::string name = BOOST_PP_STRINGIZE(elem); \ std::string name = BOOST_PP_STRINGIZE(elem); \
int keyval = BOOST_PP_CAT(KEY_, elem); \ int keyval = BOOST_PP_CAT(KEY_, elem); \
input_key_to_name[keyval] = name; \ input_key_to_name[keyval] = name; \
input_name_to_key[name] = keyval; \ input_name_to_key[name] = keyval; \
} }
void G13_Manager::init_keynames() { void G13_Manager::init_keynames() {
@ -241,7 +240,6 @@ G13_Manager::find_g13_key_value(const std::string &keyname) const {
LINUX_KEY_VALUE LINUX_KEY_VALUE
G13_Manager::find_input_key_value(const std::string &keyname) const { G13_Manager::find_input_key_value(const std::string &keyname) const {
// if there is a KEY_ prefix, strip it off // if there is a KEY_ prefix, strip it off
if (!strncmp(keyname.c_str(), "KEY_", 4)) { if (!strncmp(keyname.c_str(), "KEY_", 4)) {
return find_input_key_value(keyname.c_str() + 4); return find_input_key_value(keyname.c_str() + 4);
@ -278,4 +276,4 @@ void G13_Manager::display_keys() {
G13_OUT(Helper::map_keys_out(input_name_to_key)); G13_OUT(Helper::map_keys_out(input_name_to_key));
} }
} // namespace G13 } // namespace G13

View File

@ -1,9 +1,9 @@
#ifndef MANAGER_H #ifndef MANAGER_H
#define MANAGER_H #define MANAGER_H
#include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
#include "action.h" #include "action.h"
#include "device.h" #include "device.h"
@ -14,7 +14,7 @@ namespace G13 {
* top level class, holds what would otherwise be in global variables * top level class, holds what would otherwise be in global variables
*/ */
class G13_Manager { class G13_Manager {
public: public:
G13_Manager(); G13_Manager();
G13_KEY_INDEX find_g13_key_value(const std::string &keyname) const; G13_KEY_INDEX find_g13_key_value(const std::string &keyname) const;
@ -23,7 +23,9 @@ public:
LINUX_KEY_VALUE find_input_key_value(const std::string &keyname) const; LINUX_KEY_VALUE find_input_key_value(const std::string &keyname) const;
std::string find_input_key_name(LINUX_KEY_VALUE) const; std::string find_input_key_name(LINUX_KEY_VALUE) const;
void set_logo(const std::string &fn) { logo_filename = fn; } void set_logo(const std::string &fn) {
logo_filename = fn;
}
int run(); int run();
std::string string_config_value(const std::string &name) const; std::string string_config_value(const std::string &name) const;
@ -34,7 +36,7 @@ public:
void set_log_level(::boost::log::trivial::severity_level lvl); void set_log_level(::boost::log::trivial::severity_level lvl);
void set_log_level(const std::string &); void set_log_level(const std::string &);
protected: protected:
void init_keynames(); void init_keynames();
void display_keys(); void display_keys();
void discover_g13s(libusb_device **devs, ssize_t count, void discover_g13s(libusb_device **devs, ssize_t count,
@ -74,6 +76,6 @@ inline const G13_Manager &G13_Profile::manager() const {
return _keypad.manager(); return _keypad.manager();
} }
} // namespace G13 } // namespace G13
#endif // MANAGER_H #endif // MANAGER_H

View File

@ -1,6 +1,7 @@
#include <string.h>
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#include <string.h>
#include <string> #include <string>
using namespace std; using namespace std;
// convert a .pbm raw file to our custom .lpbm format // convert a .pbm raw file to our custom .lpbm format
@ -32,10 +33,8 @@ int main(int argc, char *argv[]) {
unsigned char buf[160 * 48]; unsigned char buf[160 * 48];
memset(buf, 0, 160 * 43); memset(buf, 0, 160 * 43);
while (cin >> c) { while (cin >> c) {
if (i % 20 == 0) if (i % 20 == 0) row++;
row++; if (row == 8) row = 0;
if (row == 8)
row = 0;
buf[7 + (i % 20) * 8 + i / 160 * 160] |= ((c >> 0) & 0x01) << row; buf[7 + (i % 20) * 8 + i / 160 * 160] |= ((c >> 0) & 0x01) << row;
buf[6 + (i % 20) * 8 + i / 160 * 160] |= ((c >> 1) & 0x01) << row; buf[6 + (i % 20) * 8 + i / 160 * 160] |= ((c >> 1) & 0x01) << row;
buf[5 + (i % 20) * 8 + i / 160 * 160] |= ((c >> 2) & 0x01) << row; buf[5 + (i % 20) * 8 + i / 160 * 160] |= ((c >> 2) & 0x01) << row;

View File

@ -2,14 +2,15 @@
* *
*/ */
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/foreach.hpp>
#include "profile.h" #include "profile.h"
#include "manager.h"
#include "repr.h" #include <boost/foreach.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include "find_or_throw.h" #include "find_or_throw.h"
#include "helper.h" #include "helper.h"
#include "manager.h"
#include "repr.h"
namespace G13 { namespace G13 {
// ************************************************************************* // *************************************************************************
@ -37,10 +38,10 @@ void G13_Profile::_init_keys() {
int key_index = 0; int key_index = 0;
// create a G13_Key entry for every key in G13_KEY_SEQ // create a G13_Key entry for every key in G13_KEY_SEQ
#define INIT_KEY(r, data, elem) \ #define INIT_KEY(r, data, elem) \
{ \ { \
G13_Key key(*this, BOOST_PP_STRINGIZE(elem), key_index++); \ G13_Key key(*this, BOOST_PP_STRINGIZE(elem), key_index++); \
_keys.push_back(key); \ _keys.push_back(key); \
} }
BOOST_PP_SEQ_FOR_EACH(INIT_KEY, _, G13_KEY_SEQ) BOOST_PP_SEQ_FOR_EACH(INIT_KEY, _, G13_KEY_SEQ)
@ -48,11 +49,11 @@ void G13_Profile::_init_keys() {
assert(_keys.size() == G13_NUM_KEYS); assert(_keys.size() == G13_NUM_KEYS);
// now disable testing for keys in G13_NONPARSED_KEY_SEQ // now disable testing for keys in G13_NONPARSED_KEY_SEQ
#define MARK_NON_PARSED_KEY(r, data, elem) \ #define MARK_NON_PARSED_KEY(r, data, elem) \
{ \ { \
G13_Key *key = find_key(BOOST_PP_STRINGIZE(elem)); \ G13_Key *key = find_key(BOOST_PP_STRINGIZE(elem)); \
assert(key); \ assert(key); \
key->_should_parse = false; \ key->_should_parse = false; \
} }
BOOST_PP_SEQ_FOR_EACH(MARK_NON_PARSED_KEY, _, G13_NONPARSED_KEY_SEQ) BOOST_PP_SEQ_FOR_EACH(MARK_NON_PARSED_KEY, _, G13_NONPARSED_KEY_SEQ)
@ -88,4 +89,4 @@ G13_Key *G13_Profile::find_key(const std::string &keyname) {
return 0; return 0;
} }
} // namespace G13 } // namespace G13

View File

@ -11,18 +11,18 @@
* item corresponding to a specific bit in the G13's USB message * item corresponding to a specific bit in the G13's USB message
* format. Do NOT remove or insert items in this list. * format. Do NOT remove or insert items in this list.
*/ */
#define G13_KEY_SEQ \ #define G13_KEY_SEQ \
/* byte 3 */ (G1)(G2)(G3)(G4)(G5)(G6)(G7)(G8) /* byte 4 */ \ /* byte 3 */ (G1)(G2)(G3)(G4)(G5)(G6)(G7)(G8) /* byte 4 */ \
(G9)(G10)(G11)(G12)(G13)(G14)(G15)(G16) /* byte 5 */ (G17)(G18)(G19)( \ (G9)(G10)(G11)(G12)(G13)(G14)(G15)(G16) /* byte 5 */ (G17)(G18)(G19)( \
G20)(G21)(G22)(UNDEF1)(LIGHT_STATE) /* byte 6 */ \ G20)(G21)(G22)(UNDEF1)(LIGHT_STATE) /* byte 6 */ \
(BD)(L1)(L2)(L3)(L4)(M1)(M2)(M3) /* byte 7 */ (MR)(LEFT)(DOWN)(TOP)( \ (BD)(L1)(L2)(L3)(L4)(M1)(M2)(M3) /* byte 7 */ (MR)(LEFT)(DOWN)(TOP)( \
UNDEF3)(LIGHT)(LIGHT2)(MISC_TOGGLE) UNDEF3)(LIGHT)(LIGHT2)(MISC_TOGGLE)
/*! G13_NONPARSED_KEY_SEQ is a Boost Preprocessor sequence containing the /*! G13_NONPARSED_KEY_SEQ is a Boost Preprocessor sequence containing the
* G13 keys that shouldn't be tested input. These aren't actually keys, * G13 keys that shouldn't be tested input. These aren't actually keys,
* but they are in the bitmap defined by G13_KEY_SEQ. * but they are in the bitmap defined by G13_KEY_SEQ.
*/ */
#define G13_NONPARSED_KEY_SEQ \ #define G13_NONPARSED_KEY_SEQ \
(UNDEF1)(LIGHT_STATE)(UNDEF3)(LIGHT)(LIGHT2)(UNDEF3)(MISC_TOGGLE) (UNDEF1)(LIGHT_STATE)(UNDEF3)(LIGHT)(LIGHT2)(UNDEF3)(MISC_TOGGLE)
/*! KB_INPUT_KEY_SEQ is a Boost Preprocessor sequence containing the /*! KB_INPUT_KEY_SEQ is a Boost Preprocessor sequence containing the
@ -50,15 +50,18 @@ class G13_Profile;
* *
*/ */
class G13_Key : public G13_Actionable<G13_Profile> { class G13_Key : public G13_Actionable<G13_Profile> {
public: public:
void dump(std::ostream &o) const; void dump(std::ostream &o) const;
G13_KEY_INDEX index() const { return _index.index; } G13_KEY_INDEX index() const {
return _index.index;
}
void parse_key(unsigned char *byte, G13_Device *g13); void parse_key(unsigned char *byte, G13_Device *g13);
protected: protected:
struct KeyIndex { struct KeyIndex {
KeyIndex(int key) : index(key), offset(key / 8), mask(1 << (key % 8)) {} KeyIndex(int key) : index(key), offset(key / 8), mask(1 << (key % 8)) {
}
int index; int index;
unsigned char offset; unsigned char offset;
@ -69,12 +72,14 @@ protected:
friend class G13_Profile; friend class G13_Profile;
G13_Key(G13_Profile &mode, const std::string &name, int index) G13_Key(G13_Profile &mode, const std::string &name, int index)
: G13_Actionable<G13_Profile>(mode, name), _index(index), : G13_Actionable<G13_Profile>(mode, name),
_index(index),
_should_parse(true) { _should_parse(true) {
} }
G13_Key(G13_Profile &mode, const G13_Key &key) G13_Key(G13_Profile &mode, const G13_Key &key)
: G13_Actionable<G13_Profile>(mode, key.name()), _index(key._index), : G13_Actionable<G13_Profile>(mode, key.name()),
_index(key._index),
_should_parse(key._should_parse) { _should_parse(key._should_parse) {
set_action(key.action()); set_action(key.action());
} }
@ -90,14 +95,17 @@ protected:
* profiles and switch between them easily * profiles and switch between them easily
*/ */
class G13_Profile { class G13_Profile {
public: public:
G13_Profile(G13_Device &keypad, const std::string &name_arg) G13_Profile(G13_Device &keypad, const std::string &name_arg)
: _keypad(keypad), _name(name_arg) { : _keypad(keypad),
_name(name_arg) {
_init_keys(); _init_keys();
} }
G13_Profile(const G13_Profile &other, const std::string &name_arg) G13_Profile(const G13_Profile &other, const std::string &name_arg)
: _keypad(other._keypad), _name(name_arg), _keys(other._keys) { : _keypad(other._keypad),
_name(name_arg),
_keys(other._keys) {
} }
// search key by G13 keyname // search key by G13 keyname
@ -106,11 +114,13 @@ public:
void dump(std::ostream &o) const; void dump(std::ostream &o) const;
void parse_keys(unsigned char *buf); void parse_keys(unsigned char *buf);
const std::string &name() const { return _name; } const std::string &name() const {
return _name;
}
const G13_Manager &manager() const; const G13_Manager &manager() const;
protected: protected:
G13_Device &_keypad; G13_Device &_keypad;
std::string _name; std::string _name;
std::vector<G13_Key> _keys; std::vector<G13_Key> _keys;
@ -120,6 +130,6 @@ protected:
typedef std::shared_ptr<G13_Profile> ProfilePtr; typedef std::shared_ptr<G13_Profile> ProfilePtr;
} // namespace G13 } // namespace G13
#endif // PROFILE_H #endif // PROFILE_H

View File

@ -1,7 +1,7 @@
#include <ostream>
#include "repr.h" #include "repr.h"
#include <ostream>
namespace G13 { namespace G13 {
void string_repr_out::write_on(std::ostream &o) const { void string_repr_out::write_on(std::ostream &o) const {
@ -52,4 +52,4 @@ void string_repr_out::write_on(std::ostream &o) const {
o << "\""; o << "\"";
}; };
} // namespace G13 } // namespace G13

View File

@ -1,13 +1,14 @@
#ifndef REPR_H #ifndef REPR_H
#define REPR_H #define REPR_H
#include <string>
#include <ostream> #include <ostream>
#include <string>
namespace G13 { namespace G13 {
struct string_repr_out { struct string_repr_out {
string_repr_out(const std::string &str) : s(str) {} string_repr_out(const std::string &str) : s(str) {
}
void write_on(std::ostream &) const; void write_on(std::ostream &) const;
std::string s; std::string s;
@ -18,7 +19,8 @@ inline std::ostream &operator<<(std::ostream &o, const string_repr_out &sro) {
return o; return o;
} }
template <class T> inline const T &repr(const T &v) { template <class T>
inline const T &repr(const T &v) {
return v; return v;
} }
@ -30,6 +32,6 @@ inline string_repr_out repr(const std::string &s) {
return string_repr_out(s); return string_repr_out(s);
} }
} } // namespace G13
#endif // REPR_H #endif // REPR_H

View File

@ -2,17 +2,18 @@
* *
*/ */
#include <boost/foreach.hpp>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <boost/foreach.hpp>
#include "device.h" #include "device.h"
namespace G13 { namespace G13 {
G13_Stick::G13_Stick(G13_Device &keypad) G13_Stick::G13_Stick(G13_Device &keypad)
: _keypad(keypad), _bounds(0, 0, 255, 255), _center_pos(127, 127), : _keypad(keypad),
_bounds(0, 0, 255, 255),
_center_pos(127, 127),
_north_pos(127, 0) { _north_pos(127, 0) {
_stick_mode = STICK_KEYS; _stick_mode = STICK_KEYS;
@ -52,8 +53,7 @@ void G13_Stick::set_mode(stick_mode_t m) {
return; return;
} }
if (_stick_mode == STICK_CALCENTER || if (_stick_mode == STICK_CALCENTER || _stick_mode == STICK_CALBOUNDS ||
_stick_mode == STICK_CALBOUNDS ||
_stick_mode == STICK_CALNORTH) { _stick_mode == STICK_CALNORTH) {
_recalc_calibrated(); _recalc_calibrated();
} }
@ -106,7 +106,9 @@ void G13_StickZone::test(const G13_ZoneCoord &loc) {
G13_StickZone::G13_StickZone(G13_Stick &stick, const std::string &name, G13_StickZone::G13_StickZone(G13_Stick &stick, const std::string &name,
const G13_ZoneBounds &b, G13_ActionPtr action) const G13_ZoneBounds &b, G13_ActionPtr action)
: G13_Actionable<G13_Stick>(stick, name), _active(false), _bounds(b) { : G13_Actionable<G13_Stick>(stick, name),
_active(false),
_bounds(b) {
set_action(action); set_action(action);
} }
@ -166,4 +168,4 @@ void G13_Stick::parse_joystick(unsigned char *buf) {
} }
} }
} // namespace G13 } // namespace G13

View File

@ -1,9 +1,9 @@
#ifndef STICK_H #ifndef STICK_H
#define STICK_H #define STICK_H
#include "coord.h"
#include "bounds.h"
#include "action.h" #include "action.h"
#include "bounds.h"
#include "coord.h"
namespace G13 { namespace G13 {
@ -15,7 +15,7 @@ typedef Coord<double> G13_ZoneCoord;
typedef Bounds<double> G13_ZoneBounds; typedef Bounds<double> G13_ZoneBounds;
class G13_StickZone : public G13_Actionable<G13_Stick> { class G13_StickZone : public G13_Actionable<G13_Stick> {
public: public:
G13_StickZone(G13_Stick &, const std::string &name, const G13_ZoneBounds &, G13_StickZone(G13_Stick &, const std::string &name, const G13_ZoneBounds &,
G13_ActionPtr = 0); G13_ActionPtr = 0);
@ -27,9 +27,11 @@ public:
void parse_key(unsigned char *byte, G13_Device *g13); void parse_key(unsigned char *byte, G13_Device *g13);
void test(const G13_ZoneCoord &loc); void test(const G13_ZoneCoord &loc);
void set_bounds(const G13_ZoneBounds &bounds) { _bounds = bounds; } void set_bounds(const G13_ZoneBounds &bounds) {
_bounds = bounds;
}
protected: protected:
bool _active; bool _active;
G13_ZoneBounds _bounds; G13_ZoneBounds _bounds;
}; };
@ -37,7 +39,7 @@ protected:
typedef boost::shared_ptr<G13_StickZone> G13_StickZonePtr; typedef boost::shared_ptr<G13_StickZone> G13_StickZonePtr;
class G13_Stick { class G13_Stick {
public: public:
G13_Stick(G13_Device &keypad); G13_Stick(G13_Device &keypad);
void parse_joystick(unsigned char *buf); void parse_joystick(unsigned char *buf);
@ -46,11 +48,13 @@ public:
G13_StickZone *zone(const std::string &, bool create = false); G13_StickZone *zone(const std::string &, bool create = false);
void remove_zone(const G13_StickZone &zone); void remove_zone(const G13_StickZone &zone);
const std::vector<G13_StickZone> &zones() const { return _zones; } const std::vector<G13_StickZone> &zones() const {
return _zones;
}
void dump(std::ostream &) const; void dump(std::ostream &) const;
protected: protected:
void _recalc_calibrated(); void _recalc_calibrated();
G13_Device &_keypad; G13_Device &_keypad;
@ -65,6 +69,6 @@ protected:
stick_mode_t _stick_mode; stick_mode_t _stick_mode;
}; };
} // namespace G13 } // namespace G13
#endif // STICK_H #endif // STICK_H