Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
_N0x | 34f390d837 | 2 years ago |
_N0x | 8b64db031a | 2 years ago |
_N0x | 93815d9ed2 | 2 years ago |
_N0x | 4818c739b5 | 2 years ago |
_N0x | e1f4a75cd3 | 2 years ago |
_N0x | 436e1a7191 | 2 years ago |
_N0x | 24429cde26 | 2 years ago |
_N0x | 32197e33d7 | 2 years ago |
_N0x | aabce0aa8d | 2 years ago |
_N0x | 4ce8ed2a08 | 2 years ago |
@ -0,0 +1,175 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: Left
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveAssignments: Consecutive
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: Always
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: TopLevelDefinitions
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BitFieldColonSpacing: Before
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: true
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseLabels: true
|
||||
IndentCaseBlocks: true
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentRequires: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
LambdaBodyIndentation: Signature
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PointerAlignment: Right
|
||||
PPIndentWidth: -1
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseSensitive
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
BitFieldColonSpacing: Both
|
||||
Standard: Latest
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
- NS_SWIFT_NAME
|
||||
- CF_SWIFT_NAME
|
||||
...
|
||||
|
@ -0,0 +1,248 @@
|
||||
# KeyCodes
|
||||
|
||||
A list with the names of different keys that can be used to configure the macros.
|
||||
|
||||
**The names need to be copied exactly to the config file!**
|
||||
|
||||
### Modifier keys
|
||||
These are the available keys for the "mod\_keys" Parameter inside the json file.
|
||||
- MODKEY\_NONE
|
||||
- MODKEY\_LCTR
|
||||
- MODKEY\_LSHI
|
||||
- MODKEY\_LALT
|
||||
- MODKEY\_LWIN
|
||||
- MODKEY\_RCTR
|
||||
- MODKEY\_RSHI
|
||||
- MODKEY\_RALT
|
||||
- MODKEY\_RWIN
|
||||
- MODKEY\_RWIN\_RSHI
|
||||
- MODKEY\_RWIN\_RCTR
|
||||
- MODKEY\_RWIN\_RALT
|
||||
- MODKEY\_RWIN\_RCTR\_RSHI
|
||||
- MODKEY\_RCTR\_RALT
|
||||
- MODKEY\_RCTR\_RSHI
|
||||
- MODKEY\_RALT\_RSHI
|
||||
- MODKEY\_RALT\_RCTR\_RSHI
|
||||
|
||||
|
||||
### Keys (up to 6 per macro-action)
|
||||
These are the available keys to be used inside the macro actions (the "keys" array)
|
||||
- KEY\_NONE
|
||||
- KEY\_ErrorRollOver
|
||||
- KEY\_POSTFail
|
||||
- KEY\_ErrorUndefined
|
||||
- KEY\_a\_A
|
||||
- KEY\_b\_B
|
||||
- KEY\_c\_C
|
||||
- KEY\_d\_D
|
||||
- KEY\_e\_E
|
||||
- KEY\_f\_F
|
||||
- KEY\_g\_G
|
||||
- KEY\_h\_H
|
||||
- KEY\_i\_I
|
||||
- KEY\_j\_J
|
||||
- KEY\_k\_K
|
||||
- KEY\_l\_L
|
||||
- KEY\_m\_M
|
||||
- KEY\_n\_N
|
||||
- KEY\_o\_O
|
||||
- KEY\_p\_P
|
||||
- KEY\_q\_Q
|
||||
- KEY\_r\_R
|
||||
- KEY\_s\_S
|
||||
- KEY\_t\_T
|
||||
- KEY\_u\_U
|
||||
- KEY\_v\_V
|
||||
- KEY\_w\_W
|
||||
- KEY\_x\_X
|
||||
- KEY\_y\_Y
|
||||
- KEY\_z\_Z
|
||||
- KEY\_1\_Exclamation
|
||||
- KEY\_2\_At
|
||||
- KEY\_3\_Pound
|
||||
- KEY\_4\_Dollar
|
||||
- KEY\_5\_Percent
|
||||
- KEY\_6\_Caret
|
||||
- KEY\_7\_Ampersand
|
||||
- KEY\_8\_Asterisk
|
||||
- KEY\_9\_LeftParenthesis
|
||||
- KEY\_0\_RightParenthesis
|
||||
- KEY\_ReturnEnter
|
||||
- KEY\_Escape
|
||||
- KEY\_DeleteBackspace
|
||||
- KEY\_Tab
|
||||
- KEY\_Spacebar
|
||||
- KEY\_Dash\_Underscore
|
||||
- KEY\_Equal\_Plus
|
||||
- KEY\_LeftBracket\_LeftBrace
|
||||
- KEY\_RightBracket\_RightBrace
|
||||
- KEY\_Backslash\_Pipe
|
||||
- KEY\_NonUS\_Pound\_Tilde
|
||||
- KEY\_Semicolon\_Colon
|
||||
- KEY\_SingleQuote\_DoubleQuote
|
||||
- KEY\_GraveAccent\_Tilde
|
||||
- KEY\_Comma\_LessThan
|
||||
- KEY\_Period\_GreaterThan
|
||||
- KEY\_Slash\_Question
|
||||
- KEY\_CapsLock
|
||||
- KEY\_F1
|
||||
- KEY\_F2
|
||||
- KEY\_F3
|
||||
- KEY\_F4
|
||||
- KEY\_F5
|
||||
- KEY\_F6
|
||||
- KEY\_F7
|
||||
- KEY\_F8
|
||||
- KEY\_F9
|
||||
- KEY\_F10
|
||||
- KEY\_F11
|
||||
- KEY\_F12
|
||||
- KEY\_PrintScreen
|
||||
- KEY\_ScrollLock
|
||||
- KEY\_Pause
|
||||
- KEY\_Insert
|
||||
- KEY\_Home
|
||||
- KEY\_PageUp
|
||||
- KEY\_DeleteForward
|
||||
- KEY\_End
|
||||
- KEY\_PageDown
|
||||
- KEY\_RightArrow
|
||||
- KEY\_LeftArrow
|
||||
- KEY\_DownArrow
|
||||
- KEY\_UpArrow
|
||||
- KEYPAD\_NumLock\_Clear
|
||||
- KEYPAD\_Slash
|
||||
- KEYPAD\_Asterisk
|
||||
- KEYPAD\_Minus
|
||||
- KEYPAD\_Plus
|
||||
- KEYPAD\_ENTER
|
||||
- KEYPAD\_1\_End
|
||||
- KEYPAD\_2\_DownArrow
|
||||
- KEYPAD\_3\_PageDown
|
||||
- KEYPAD\_4\_LeftArrow
|
||||
- KEYPAD\_5
|
||||
- KEYPAD\_6\_RightArrow
|
||||
- KEYPAD\_7\_Home
|
||||
- KEYPAD\_8\_UpArrow
|
||||
- KEYPAD\_9\_PageUp
|
||||
- KEYPAD\_0\_Insert
|
||||
- KEYPAD\_Period\_Delete
|
||||
- KEY\_NonUS\_Backslash\_Pipe
|
||||
- KEY\_Application
|
||||
- KEY\_Power
|
||||
- KEYPAD\_Equal
|
||||
- KEY\_F13
|
||||
- KEY\_F14
|
||||
- KEY\_F15
|
||||
- KEY\_F16
|
||||
- KEY\_F17
|
||||
- KEY\_F18
|
||||
- KEY\_F19
|
||||
- KEY\_F20
|
||||
- KEY\_F21
|
||||
- KEY\_F22
|
||||
- KEY\_F23
|
||||
- KEY\_F24
|
||||
- KEY\_Execute
|
||||
- KEY\_Help
|
||||
- KEY\_Menu
|
||||
- KEY\_Select
|
||||
- KEY\_Stop
|
||||
- KEY\_Again
|
||||
- KEY\_Undo
|
||||
- KEY\_Cut
|
||||
- KEY\_Copy
|
||||
- KEY\_Paste
|
||||
- KEY\_Find
|
||||
- KEY\_Mute
|
||||
- KEY\_VolumeUp
|
||||
- KEY\_VolumeDown
|
||||
- KEY\_LockingCapsLock
|
||||
- KEY\_LockingNumLock
|
||||
- KEY\_LockingScrollLock
|
||||
- KEYPAD\_Comma
|
||||
- KEYPAD\_EqualSign
|
||||
- KEY\_International1
|
||||
- KEY\_International2
|
||||
- KEY\_International3
|
||||
- KEY\_International4
|
||||
- KEY\_International5
|
||||
- KEY\_International6
|
||||
- KEY\_International7
|
||||
- KEY\_International8
|
||||
- KEY\_International9
|
||||
- KEY\_LANG1
|
||||
- KEY\_LANG2
|
||||
- KEY\_LANG3
|
||||
- KEY\_LANG4
|
||||
- KEY\_LANG5
|
||||
- KEY\_LANG6
|
||||
- KEY\_LANG7
|
||||
- KEY\_LANG8
|
||||
- KEY\_LANG9
|
||||
- KEY\_AlternateErase
|
||||
- KEY\_SysReq\_Attention
|
||||
- KEY\_Cancel
|
||||
- KEY\_Clear
|
||||
- KEY\_Prior
|
||||
- KEY\_Return
|
||||
- KEY\_Separator
|
||||
- KEY\_Out
|
||||
- KEY\_Oper
|
||||
- KEY\_Clear\_Again
|
||||
- KEY\_CrSel\_Props
|
||||
- KEY\_ExSel
|
||||
- KEYPAD\_00
|
||||
- KEYPAD\_000
|
||||
- KEY\_ThousandsSeparator
|
||||
- KEY\_DecimalSeparator
|
||||
- KEY\_CurrencyUnit
|
||||
- KEY\_CurrencySubunit
|
||||
- KEYPAD\_LeftParenthesis
|
||||
- KEYPAD\_RightParenthesis
|
||||
- KEYPAD\_LeftBrace
|
||||
- KEYPAD\_RightBrace
|
||||
- KEYPAD\_Tab
|
||||
- KEYPAD\_Backspace
|
||||
- KEYPAD\_A
|
||||
- KEYPAD\_B
|
||||
- KEYPAD\_C
|
||||
- KEYPAD\_D
|
||||
- KEYPAD\_E
|
||||
- KEYPAD\_F
|
||||
- KEYPAD\_XOR
|
||||
- KEYPAD\_Caret
|
||||
- KEYPAD\_Percent
|
||||
- KEYPAD\_LessThan
|
||||
- KEYPAD\_GreaterThan
|
||||
- KEYPAD\_Ampersand
|
||||
- KEYPAD\_AmpersandAmpersand
|
||||
- KEYPAD\_Pipe
|
||||
- KEYPAD\_PipePipe
|
||||
- KEYPAD\_Colon
|
||||
- KEYPAD\_Pound
|
||||
- KEYPAD\_Space
|
||||
- KEYPAD\_At
|
||||
- KEYPAD\_Exclamation
|
||||
- KEYPAD\_MemoryStore
|
||||
- KEYPAD\_MemoryRecall
|
||||
- KEYPAD\_MemoryClear
|
||||
- KEYPAD\_MemoryAdd
|
||||
- KEYPAD\_MemorySubtract
|
||||
- KEYPAD\_MemoryMultiply
|
||||
- KEYPAD\_MemoryDivide
|
||||
- KEYPAD\_PlusMinus
|
||||
- KEYPAD\_Clear
|
||||
- KEYPAD\_ClearEntry
|
||||
- KEYPAD\_Binary
|
||||
- KEYPAD\_Octal
|
||||
- KEYPAD\_Decimal
|
||||
- KEYPAD\_Hexadecimal
|
||||
- KEY\_LeftControl
|
||||
- KEY\_LeftShift
|
||||
- KEY\_LeftAlt
|
||||
- KEY\_LeftGUI
|
||||
- KEY\_RightControl
|
||||
- KEY\_RightShift
|
||||
- KEY\_RightAlt
|
||||
- KEY\_RightGUI
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"macros": [
|
||||
{
|
||||
"macro_no": 1,
|
||||
"actions": [
|
||||
{
|
||||
"mod_keys": "",
|
||||
"delay": 0.0,
|
||||
"keys": [
|
||||
"KEY_a_A",
|
||||
"KEY_b_B",
|
||||
"KEY_c_C",
|
||||
"KEY_d_D",
|
||||
"KEY_e_E",
|
||||
"KEY_f_F"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
{
|
||||
"macros": [
|
||||
{
|
||||
"macro_no": 1,
|
||||
"actions": [
|
||||
{
|
||||
"mod_keys": "",
|
||||
"delay": 0.0,
|
||||
"keys": [
|
||||
"KEY_a_A",
|
||||
"KEY_b_B",
|
||||
"KEY_c_C",
|
||||
"KEY_d_D",
|
||||
"KEY_e_E",
|
||||
"KEY_f_F"
|
||||
]
|
||||
},
|
||||
{
|
||||
"mod_keys": "",
|
||||
"delay": 0.0,
|
||||
"keys": [
|
||||
"KEY_1_Exclamantion",
|
||||
"KEY_2_At",
|
||||
"KEY_3_Pound",
|
||||
"KEY_4_Dollar",
|
||||
"KEY_5_Percent",
|
||||
"KEY_6_Caret"
|
||||
]
|
||||
},
|
||||
{
|
||||
"mod_keys": "",
|
||||
"delay": 0.0,
|
||||
"keys": [
|
||||
"KEY_z_Z",
|
||||
"KEY_y_Y",
|
||||
"KEY_x_X",
|
||||
"KEY_w_W",
|
||||
"KEY_v_V",
|
||||
"KEY_u_U"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"macro_no": 2,
|
||||
"actions": [
|
||||
{
|
||||
"mod_keys": "",
|
||||
"delay": 0.0,
|
||||
"keys": [
|
||||
"KEY_1_Exclamantion",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"mod_keys": "",
|
||||
"delay": 0.0,
|
||||
"keys": [
|
||||
"KEY_a_A",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
#ifndef CONFIG_HANDLING_H_
|
||||
#define CONFIG_HANDLING_H_
|
||||
|
||||
/* config_handling.h */
|
||||
#include "../include/firmware_handling.h"
|
||||
|
||||
/* Read in a config file with the specified name. */
|
||||
f8_macroP *get_f8_macros(char *conf_name);
|
||||
|
||||
#endif /* CONFIG_HANDLING_H_ */
|
@ -0,0 +1,281 @@
|
||||
/* keycodes taken from https://usb.org/sites/default/files/hut1_22.pdf
|
||||
* See also:
|
||||
* https://github.com/benblazak/ergodox-firmware/blob/master/src/lib/usb/usage-page/keyboard.h
|
||||
*/
|
||||
|
||||
#ifndef DEFINES_H_
|
||||
#define DEFINES_H_
|
||||
|
||||
/* THESE ARE THE AVALIABLE KEYS FOR THE "MOD_KEYS" PARAMETER */
|
||||
#define MODKEY_NONE 0x00
|
||||
#define MODKEY_LCTR 0x01
|
||||
#define MODKEY_LSHI 0x02
|
||||
#define MODKEY_LALT 0x03
|
||||
#define MODKEY_LWIN 0x04
|
||||
#define MODKEY_RCTR 0x05
|
||||
#define MODKEY_RSHI 0x06
|
||||
#define MODKEY_RALT 0x07
|
||||
#define MODKEY_RWIN 0x08
|
||||
#define MODKEY_RWIN_RSHI 0x09
|
||||
#define MODKEY_RWIN_RCTR 0x0A
|
||||
#define MODKEY_RWIN_RALT 0x0B
|
||||
#define MODKEY_RWIN_RCTR_RSHI 0x0C
|
||||
#define MODKEY_RCTR_RALT 0x0D
|
||||
#define MODKEY_RCTR_RSHI 0x0E
|
||||
#define MODKEY_RALT_RSHI 0x0F
|
||||
#define MODKEY_RALT_RCTR_RSHI 0x10
|
||||
|
||||
/* THESE ARE THE AVAIRABLE KEYS FOR THE "KEYS" PARAMETER */
|
||||
#define KEY_NONE 0x00
|
||||
#define KEY_ErrorRollOver 0x01
|
||||
#define KEY_POSTFail 0x02
|
||||
#define KEY_ErrorUndefined 0x03
|
||||
#define KEY_a_A 0x04
|
||||
#define KEY_b_B 0x05
|
||||
#define KEY_c_C 0x06
|
||||
#define KEY_d_D 0x07
|
||||
#define KEY_e_E 0x08
|
||||
#define KEY_f_F 0x09
|
||||
#define KEY_g_G 0x0A
|
||||
#define KEY_h_H 0x0B
|
||||
#define KEY_i_I 0x0C
|
||||
#define KEY_j_J 0x0D
|
||||
#define KEY_k_K 0x0E
|
||||
#define KEY_l_L 0x0F
|
||||
#define KEY_m_M 0x10
|
||||
#define KEY_n_N 0x11
|
||||
#define KEY_o_O 0x12
|
||||
#define KEY_p_P 0x13
|
||||
#define KEY_q_Q 0x14
|
||||
#define KEY_r_R 0x15
|
||||
#define KEY_s_S 0x16
|
||||
#define KEY_t_T 0x17
|
||||
#define KEY_u_U 0x18
|
||||
#define KEY_v_V 0x19
|
||||
#define KEY_w_W 0x1A
|
||||
#define KEY_x_X 0x1B
|
||||
#define KEY_y_Y 0x1C
|
||||
#define KEY_z_Z 0x1D
|
||||
#define KEY_1_Exclamation 0x1E
|
||||
#define KEY_2_At 0x1F
|
||||
#define KEY_3_Pound 0x20
|
||||
#define KEY_4_Dollar 0x21
|
||||
#define KEY_5_Percent 0x22
|
||||
#define KEY_6_Caret 0x23
|
||||
#define KEY_7_Ampersand 0x24
|
||||
#define KEY_8_Asterisk 0x25
|
||||
#define KEY_9_LeftParenthesis 0x26
|
||||
#define KEY_0_RightParenthesis 0x27
|
||||
#define KEY_ReturnEnter 0x28
|
||||
#define KEY_Escape 0x29
|
||||
#define KEY_DeleteBackspace 0x2A
|
||||
#define KEY_Tab 0x2B
|
||||
#define KEY_Spacebar 0x2C
|
||||
#define KEY_Dash_Underscore 0x2D
|
||||
#define KEY_Equal_Plus 0x2E
|
||||
#define KEY_LeftBracket_LeftBrace 0x2F
|
||||
#define KEY_RightBracket_RightBrace 0x30
|
||||
#define KEY_Backslash_Pipe 0x31
|
||||
#define KEY_NonUS_Pound_Tilde 0x32
|
||||
#define KEY_Semicolon_Colon 0x33
|
||||
#define KEY_SingleQuote_DoubleQuote 0x34
|
||||
#define KEY_GraveAccent_Tilde 0x35
|
||||
#define KEY_Comma_LessThan 0x36
|
||||
#define KEY_Period_GreaterThan 0x37
|
||||
#define KEY_Slash_Question 0x38
|
||||
#define KEY_CapsLock 0x39
|
||||
#define KEY_F1 0x3A
|
||||
#define KEY_F2 0x3B
|
||||
#define KEY_F3 0x3C
|
||||
#define KEY_F4 0x3D
|
||||
#define KEY_F5 0x3E
|
||||
#define KEY_F6 0x3F
|
||||
#define KEY_F7 0x40
|
||||
#define KEY_F8 0x41
|
||||
#define KEY_F9 0x42
|
||||
#define KEY_F10 0x43
|
||||
#define KEY_F11 0x44
|
||||
#define KEY_F12 0x45
|
||||
#define KEY_PrintScreen 0x46
|
||||
#define KEY_ScrollLock 0x47
|
||||
#define KEY_Pause 0x48
|
||||
#define KEY_Insert 0x49
|
||||
#define KEY_Home 0x4A
|
||||
#define KEY_PageUp 0x4B
|
||||
#define KEY_DeleteForward 0x4C
|
||||
#define KEY_End 0x4D
|
||||
#define KEY_PageDown 0x4E
|
||||
#define KEY_RightArrow 0x4F
|
||||
#define KEY_LeftArrow 0x50
|
||||
#define KEY_DownArrow 0x51
|
||||
#define KEY_UpArrow 0x52
|
||||
#define KEYPAD_NumLock_Clear 0x53
|
||||
#define KEYPAD_Slash 0x54
|
||||
#define KEYPAD_Asterisk 0x55
|
||||
#define KEYPAD_Minus 0x56
|
||||
#define KEYPAD_Plus 0x57
|
||||
#define KEYPAD_ENTER 0x58
|
||||
#define KEYPAD_1_End 0x59
|
||||
#define KEYPAD_2_DownArrow 0x5A
|
||||
#define KEYPAD_3_PageDown 0x5B
|
||||
#define KEYPAD_4_LeftArrow 0x5C
|
||||
#define KEYPAD_5 0x5D
|
||||
#define KEYPAD_6_RightArrow 0x5E
|
||||
#define KEYPAD_7_Home 0x5F
|
||||
#define KEYPAD_8_UpArrow 0x60
|
||||
#define KEYPAD_9_PageUp 0x61
|
||||
#define KEYPAD_0_Insert 0x62
|
||||
#define KEYPAD_Period_Delete 0x63
|
||||
#define KEY_NonUS_Backslash_Pipe 0x64
|
||||
#define KEY_Application 0x65
|
||||
#define KEY_Power 0x66
|
||||
#define KEYPAD_Equal 0x67
|
||||
#define KEY_F13 0x68
|
||||
#define KEY_F14 0x69
|
||||
#define KEY_F15 0x6A
|
||||
#define KEY_F16 0x6B
|
||||
#define KEY_F17 0x6C
|
||||
#define KEY_F18 0x6D
|
||||
#define KEY_F19 0x6E
|
||||
#define KEY_F20 0x6F
|
||||
#define KEY_F21 0x70
|
||||
#define KEY_F22 0x71
|
||||
#define KEY_F23 0x72
|
||||
#define KEY_F24 0x73
|
||||
#define KEY_Execute 0x74
|
||||
#define KEY_Help 0x75
|
||||
#define KEY_Menu 0x76
|
||||
#define KEY_Select 0x77
|
||||
#define KEY_Stop 0x78
|
||||
#define KEY_Again 0x79
|
||||
#define KEY_Undo 0x7A
|
||||
#define KEY_Cut 0x7B
|
||||
#define KEY_Copy 0x7C
|
||||
#define KEY_Paste 0x7D
|
||||
#define KEY_Find 0x7E
|
||||
#define KEY_Mute 0x7F
|
||||
#define KEY_VolumeUp 0x80
|
||||
#define KEY_VolumeDown 0x81
|
||||
#define KEY_LockingCapsLock 0x82
|
||||
#define KEY_LockingNumLock 0x83
|
||||
#define KEY_LockingScrollLock 0x84
|
||||
#define KEYPAD_Comma 0x85
|
||||
#define KEYPAD_EqualSign 0x86
|
||||
#define KEY_International1 0x87
|
||||
#define KEY_International2 0x88
|
||||
#define KEY_International3 0x89
|
||||
#define KEY_International4 0x8A
|
||||
#define KEY_International5 0x8B
|
||||
#define KEY_International6 0x8C
|
||||
#define KEY_International7 0x8D
|
||||
#define KEY_International8 0x8E
|
||||
#define KEY_International9 0x8F
|
||||
#define KEY_LANG1 0x90
|
||||
#define KEY_LANG2 0x91
|
||||
#define KEY_LANG3 0x92
|
||||
#define KEY_LANG4 0x93
|
||||
#define KEY_LANG5 0x94
|
||||
#define KEY_LANG6 0x95
|
||||
#define KEY_LANG7 0x96
|
||||
#define KEY_LANG8 0x97
|
||||
#define KEY_LANG9 0x98
|
||||
#define KEY_AlternateErase 0x99
|
||||
#define KEY_SysReq_Attention 0x9A
|
||||
#define KEY_Cancel 0x9B
|
||||
#define KEY_Clear 0x9C
|
||||
#define KEY_Prior 0x9D
|
||||
#define KEY_Return 0x9E
|
||||
#define KEY_Separator 0x9F
|
||||
#define KEY_Out 0xA0
|
||||
#define KEY_Oper 0xA1
|
||||
#define KEY_Clear_Again 0xA2
|
||||
#define KEY_CrSel_Props 0xA3
|
||||
#define KEY_ExSel 0xA4
|
||||
// (Reserved) 0xA5..0xAF
|
||||
#define KEYPAD_00 0xB0
|
||||
#define KEYPAD_000 0xB1
|
||||
#define KEY_ThousandsSeparator 0xB2
|
||||
#define KEY_DecimalSeparator 0xB3
|
||||
#define KEY_CurrencyUnit 0xB4
|
||||
#define KEY_CurrencySubunit 0xB5
|
||||
#define KEYPAD_LeftParenthesis 0xB6
|
||||
#define KEYPAD_RightParenthesis 0xB7
|
||||
#define KEYPAD_LeftBrace 0xB8
|
||||
#define KEYPAD_RightBrace 0xB9
|
||||
#define KEYPAD_Tab 0xBA
|
||||
#define KEYPAD_Backspace 0xBB
|
||||
#define KEYPAD_A 0xBC
|
||||
#define KEYPAD_B 0xBD
|
||||
#define KEYPAD_C 0xBE
|
||||
#define KEYPAD_D 0xBF
|
||||
#define KEYPAD_E 0xC0
|
||||
#define KEYPAD_F 0xC1
|
||||
#define KEYPAD_XOR 0xC2
|
||||
#define KEYPAD_Caret 0xC3
|
||||
#define KEYPAD_Percent 0xC4
|
||||
#define KEYPAD_LessThan 0xC5
|
||||
#define KEYPAD_GreaterThan 0xC6
|
||||
#define KEYPAD_Ampersand 0xC7
|
||||
#define KEYPAD_AmpersandAmpersand 0xC8
|
||||
#define KEYPAD_Pipe 0xC9
|
||||
#define KEYPAD_PipePipe 0xCA
|
||||
#define KEYPAD_Colon 0xCB
|
||||
#define KEYPAD_Pound 0xCC
|
||||
#define KEYPAD_Space 0xCD
|
||||
#define KEYPAD_At 0xCE
|
||||
#define KEYPAD_Exclamation 0xCF
|
||||
#define KEYPAD_MemoryStore 0xD0
|
||||
#define KEYPAD_MemoryRecall 0xD1
|
||||
#define KEYPAD_MemoryClear 0xD2
|
||||
#define KEYPAD_MemoryAdd 0xD3
|
||||
#define KEYPAD_MemorySubtract 0xD4
|
||||
#define KEYPAD_MemoryMultiply 0xD5
|
||||
#define KEYPAD_MemoryDivide 0xD6
|
||||
#define KEYPAD_PlusMinus 0xD7
|
||||
#define KEYPAD_Clear 0xD8
|
||||
#define KEYPAD_ClearEntry 0xD9
|
||||
#define KEYPAD_Binary 0xDA
|
||||
#define KEYPAD_Octal 0xDB
|
||||
#define KEYPAD_Decimal 0xDC
|
||||
#define KEYPAD_Hexadecimal 0xDD
|
||||
// (Reserved) 0xDE..0xDF
|
||||
#define KEY_LeftControl 0xE0
|
||||
#define KEY_LeftShift 0xE1
|
||||
#define KEY_LeftAlt 0xE2
|
||||
#define KEY_LeftGUI 0xE3
|
||||
#define KEY_RightControl 0xE4
|
||||
#define KEY_RightShift 0xE5
|
||||
#define KEY_RightAlt 0xE6
|
||||
#define KEY_RightGUI 0xE7
|
||||
|
||||
/**** DEFINES FOR FIRMWARE ****/
|
||||
/* Defines for key offsets */
|
||||
#define F8_KEY1 0x00005189
|
||||
#define F8_KEY2 0x00005181
|
||||
#define F8_KEY3 0x00005179
|
||||
#define F8_KEY4 0x00005149
|
||||
#define F8_KEY5 0x0000518A
|
||||
#define F8_KEY6 0x00005182
|
||||
#define F8_KEY7 0x0000517A
|
||||
#define F8_KEY8 0x0000514A
|
||||
/* Defines for key program code */
|
||||
#define F8_PROG1 0xD7
|
||||
#define F8_PROG2 0xD8
|
||||
#define F8_PROG3 0xD9
|
||||
#define F8_PROG4 0xDA
|
||||
#define F8_PROG5 0xDB
|
||||
#define F8_PROG6 0xDC
|
||||
#define F8_PROG7 0xDD
|
||||
#define F8_PROG8 0xDE
|
||||
|
||||
/* Define for prog 1-8 offset */
|
||||
#define PROG1_OFFSET 0x0000539C
|
||||
#define PROG2_OFFSET 0x000056BC
|
||||
#define PROG3_OFFSET 0x000059DC
|
||||
#define PROG4_OFFSET 0x00005CFC
|
||||
#define PROG5_OFFSET 0x0000601C
|
||||
#define PROG6_OFFSET 0x0000633C
|
||||
#define PROG7_OFFSET 0x0000665C
|
||||
#define PROG8_OFFSET 0x0000697C
|
||||
|
||||
#endif /* DEFINES_H_ */
|
@ -1,85 +1,59 @@
|
||||
#ifndef FIRMWARE_HANDLING_H_
|
||||
#define FIRMWARE_HANDLING_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Max prog_actions per key_prog */
|
||||
/* Max f8_macro_actions per f8_macro */
|
||||
#define MAX_ACTION 100
|
||||
|
||||
/* Defines for key offsets */
|
||||
#define F8_KEY1 0x00005189
|
||||
#define F8_KEY2 0x00005181
|
||||
#define F8_KEY3 0x00005179
|
||||
#define F8_KEY4 0x00005149
|
||||
#define F8_KEY5 0x0000518A
|
||||
#define F8_KEY6 0x00005182
|
||||
#define F8_KEY7 0x0000517A
|
||||
#define F8_KEY8 0x0000514A
|
||||
|
||||
/* Defines for key program code */
|
||||
#define F8_PROG1 0xD7
|
||||
#define F8_PROG2 0xD8
|
||||
#define F8_PROG3 0xD9
|
||||
#define F8_PROG4 0xDA
|
||||
#define F8_PROG5 0xDB
|
||||
#define F8_PROG6 0xDC
|
||||
#define F8_PROG7 0xDD
|
||||
#define F8_PROG8 0xDE
|
||||
|
||||
/* Define for prog1-8 offset */
|
||||
#define PROG1_OFFSET 0x0000539C
|
||||
#define PROG2_OFFSET 0x000056BC
|
||||
#define PROG3_OFFSET 0x000059DC
|
||||
#define PROG4_OFFSET 0x00005CFC
|
||||
#define PROG5_OFFSET 0x0000601C
|
||||
#define PROG6_OFFSET 0x0000633C
|
||||
#define PROG7_OFFSET 0x0000665C
|
||||
#define PROG8_OFFSET 0x0000697C
|
||||
|
||||
typedef struct f_bffr_t* f_bffrP;
|
||||
struct f_bffr_t
|
||||
{
|
||||
/**** STRUCTS ****/
|
||||
typedef struct f_bffr_t *f_bffrP;
|
||||
struct f_bffr_t {
|
||||
char *buffer;
|
||||
int size;
|
||||
int size;
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
* A single macro action
|
||||
* First value is the modifiers to be hold while executing the other actions (see keycodes.h)
|
||||
* Second value is the delay between the keypresse ranging from 0.0 seconds to 3.0 seconds
|
||||
* The remaining values are the keycodes to be pressed
|
||||
* First value is the modifiers to be hold while executing the other actions
|
||||
* (see keycodes.h) Second value is the delay between the keypresse ranging from
|
||||
* 0.0 seconds to 3.0 seconds The remaining values are the keycodes to be
|
||||
* pressed
|
||||
*/
|
||||
typedef struct prog_action* prog_actionP;
|
||||
struct prog_action
|
||||
{
|
||||
uint8_t k_modifier;
|
||||
uint8_t k_delay;
|
||||
uint8_t k_action1;
|
||||
uint8_t k_action2;
|
||||
uint8_t k_action3;
|
||||
uint8_t k_action4;
|
||||
uint8_t k_action5;
|
||||
uint8_t k_action6;
|
||||
typedef struct f8_macro_action *f8_macro_actionP;
|
||||
struct f8_macro_action {
|
||||
uint8_t modifier;
|
||||
uint8_t delay;
|
||||
uint8_t action1;
|
||||
uint8_t action2;
|
||||
uint8_t action3;
|
||||
uint8_t action4;
|
||||
uint8_t action5;
|
||||
uint8_t action6;
|
||||
};
|
||||
|
||||
/*
|
||||
* A single macro program consisting of the offset and up to MAX_ACTION (100) actions
|
||||
/*
|
||||
* A single macro program consisting of the offset and up to MAX_ACTION (100)
|
||||
* actions
|
||||
*/
|
||||
typedef struct key_prog* key_progP;
|
||||
struct key_prog
|
||||
{
|
||||
int prog_offset;
|
||||
prog_actionP prog_actions[MAX_ACTION];
|
||||
typedef struct f8_macro *f8_macroP;
|
||||
struct f8_macro {
|
||||
int offset;
|
||||
f8_macro_actionP actions[MAX_ACTION];
|
||||
};
|
||||
|
||||
/*
|
||||
* set the value "value" to the specified key "key" inside the buffer "firmware_buffer"
|
||||
* Key has to be the offset of the key to be altered.
|
||||
* Value has to be a keycode
|
||||
/*
|
||||
* set the value "value" to the specified key "key" inside the buffer
|
||||
* "firmware_buffer" Key has to be the offset of the key to be altered. Value
|
||||
* has to be a keycode
|
||||
*/
|
||||
void set_key_value(char *firmware_buffer, int key, int value);
|
||||
void set_key_value(char *firmware_buffer, int key, int value);
|
||||
|
||||
void set_program(f_bffrP p_fb, key_progP kp);
|
||||
void set_program(f_bffrP p_fb, f8_macroP kp);
|
||||
|
||||
/* reads in the firmware file into a buffer */
|
||||
f_bffrP get_firmware_buffer(char *filename);
|
||||
f_bffrP get_firmware_buffer(char *filename);
|
||||
|
||||
void write_firmware_buffer(char *filename, f_bffrP p_fb);
|
||||
void write_firmware_buffer(char *filename, f_bffrP p_fb);
|
||||
|
||||
#endif /* FIRMWARE_HANDLING_H_ */
|
||||
|
@ -1,233 +0,0 @@
|
||||
/* keycodes taken from https://usb.org/sites/default/files/hut1_22.pdf
|
||||
* See also: https://github.com/benblazak/ergodox-firmware/blob/master/src/lib/usb/usage-page/keyboard.h
|
||||
* */
|
||||
|
||||
#define KEY_ErrorRollOver 0x01
|
||||
#define KEY_POSTFail 0x02
|
||||
#define KEY_ErrorUndefined 0x03
|
||||
#define KEY_a_A 0x04
|
||||
#define KEY_b_B 0x05
|
||||
#define KEY_c_C 0x06
|
||||
#define KEY_d_D 0x07
|
||||
#define KEY_e_E 0x08
|
||||
#define KEY_f_F 0x09
|
||||
#define KEY_g_G 0x0A
|
||||
#define KEY_h_H 0x0B
|
||||
#define KEY_i_I 0x0C
|
||||
#define KEY_j_J 0x0D
|
||||
#define KEY_k_K 0x0E
|
||||
#define KEY_l_L 0x0F
|
||||
#define KEY_m_M 0x10
|
||||
#define KEY_n_N 0x11
|
||||
#define KEY_o_O 0x12
|
||||
#define KEY_p_P 0x13
|
||||
#define KEY_q_Q 0x14
|
||||
#define KEY_r_R 0x15
|
||||
#define KEY_s_S 0x16
|
||||
#define KEY_t_T 0x17
|
||||
#define KEY_u_U 0x18
|
||||
#define KEY_v_V 0x19
|
||||
#define KEY_w_W 0x1A
|
||||
#define KEY_x_X 0x1B
|
||||
#define KEY_y_Y 0x1C
|
||||
#define KEY_z_Z 0x1D
|
||||
#define KEY_1_Exclamation 0x1E
|
||||
#define KEY_2_At 0x1F
|
||||
#define KEY_3_Pound 0x20
|
||||
#define KEY_4_Dollar 0x21
|
||||
#define KEY_5_Percent 0x22
|
||||
#define KEY_6_Caret 0x23
|
||||
#define KEY_7_Ampersand 0x24
|
||||
#define KEY_8_Asterisk 0x25
|
||||
#define KEY_9_LeftParenthesis 0x26
|
||||
#define KEY_0_RightParenthesis 0x27
|
||||
#define KEY_ReturnEnter 0x28
|
||||
#define KEY_Escape 0x29
|
||||
#define KEY_DeleteBackspace 0x2A
|
||||
#define KEY_Tab 0x2B
|
||||
#define KEY_Spacebar 0x2C
|
||||
#define KEY_Dash_Underscore 0x2D
|
||||
#define KEY_Equal_Plus 0x2E
|
||||
#define KEY_LeftBracket_LeftBrace 0x2F
|
||||
#define KEY_RightBracket_RightBrace 0x30
|
||||
#define KEY_Backslash_Pipe 0x31
|
||||
#define KEY_NonUS_Pound_Tilde 0x32
|
||||
#define KEY_Semicolon_Colon 0x33
|
||||
#define KEY_SingleQuote_DoubleQuote 0x34
|
||||
#define KEY_GraveAccent_Tilde 0x35
|
||||
#define KEY_Comma_LessThan 0x36
|
||||
#define KEY_Period_GreaterThan 0x37
|
||||
#define KEY_Slash_Question 0x38
|
||||
#define KEY_CapsLock 0x39
|
||||
#define KEY_F1 0x3A
|
||||
#define KEY_F2 0x3B
|
||||
#define KEY_F3 0x3C
|
||||
#define KEY_F4 0x3D
|
||||
#define KEY_F5 0x3E
|
||||
#define KEY_F6 0x3F
|
||||
#define KEY_F7 0x40
|
||||
#define KEY_F8 0x41
|
||||
#define KEY_F9 0x42
|
||||
#define KEY_F10 0x43
|
||||
#define KEY_F11 0x44
|
||||
#define KEY_F12 0x45
|
||||
#define KEY_PrintScreen 0x46
|
||||
#define KEY_ScrollLock 0x47
|
||||
#define KEY_Pause 0x48
|
||||
#define KEY_Insert 0x49
|
||||
#define KEY_Home 0x4A
|
||||
#define KEY_PageUp 0x4B
|
||||
#define KEY_DeleteForward 0x4C
|
||||
#define KEY_End 0x4D
|
||||
#define KEY_PageDown 0x4E
|
||||
#define KEY_RightArrow 0x4F
|
||||
#define KEY_LeftArrow 0x50
|
||||
#define KEY_DownArrow 0x51
|
||||
#define KEY_UpArrow 0x52
|
||||
|
||||
#define KEYPAD_NumLock_Clear 0x53
|
||||
#define KEYPAD_Slash 0x54
|
||||
#define KEYPAD_Asterisk 0x55
|
||||
#define KEYPAD_Minus 0x56
|
||||
#define KEYPAD_Plus 0x57
|
||||
#define KEYPAD_ENTER 0x58
|
||||
#define KEYPAD_1_End 0x59
|
||||
#define KEYPAD_2_DownArrow 0x5A
|
||||
#define KEYPAD_3_PageDown 0x5B
|
||||
#define KEYPAD_4_LeftArrow 0x5C
|
||||
#define KEYPAD_5 0x5D
|
||||
#define KEYPAD_6_RightArrow 0x5E
|
||||
#define KEYPAD_7_Home 0x5F
|
||||
#define KEYPAD_8_UpArrow 0x60
|
||||
#define KEYPAD_9_PageUp 0x61
|
||||
#define KEYPAD_0_Insert 0x62
|
||||
#define KEYPAD_Period_Delete 0x63
|
||||
|
||||
#define KEY_NonUS_Backslash_Pipe 0x64
|
||||
#define KEY_Application 0x65
|
||||
#define KEY_Power 0x66
|
||||
|
||||
#define KEYPAD_Equal 0x67
|
||||
|
||||
#define KEY_F13 0x68
|
||||
#define KEY_F14 0x69
|
||||
#define KEY_F15 0x6A
|
||||
#define KEY_F16 0x6B
|
||||
#define KEY_F17 0x6C
|
||||
#define KEY_F18 0x6D
|
||||
#define KEY_F19 0x6E
|
||||
#define KEY_F20 0x6F
|
||||
#define KEY_F21 0x70
|
||||
#define KEY_F22 0x71
|
||||
#define KEY_F23 0x72
|
||||
#define KEY_F24 0x73
|
||||
#define KEY_Execute 0x74
|
||||
#define KEY_Help 0x75
|
||||
#define KEY_Menu 0x76
|
||||
#define KEY_Select 0x77
|
||||
#define KEY_Stop 0x78
|
||||
#define KEY_Again 0x79
|
||||
#define KEY_Undo 0x7A
|
||||
#define KEY_Cut 0x7B
|
||||
#define KEY_Copy 0x7C
|
||||
#define KEY_Paste 0x7D
|
||||
#define KEY_Find 0x7E
|
||||
#define KEY_Mute 0x7F
|
||||
#define KEY_VolumeUp 0x80
|
||||
#define KEY_VolumeDown 0x81
|
||||
#define KEY_LockingCapsLock 0x82
|
||||
#define KEY_LockingNumLock 0x83
|
||||
#define KEY_LockingScrollLock 0x84
|
||||
|
||||
#define KEYPAD_Comma 0x85
|
||||
#define KEYPAD_EqualSign 0x86
|
||||
|
||||
#define KEY_International1 0x87
|
||||
#define KEY_International2 0x88
|
||||
#define KEY_International3 0x89
|
||||
#define KEY_International4 0x8A
|
||||
#define KEY_International5 0x8B
|
||||
#define KEY_International6 0x8C
|
||||
#define KEY_International7 0x8D
|
||||
#define KEY_International8 0x8E
|
||||
#define KEY_International9 0x8F
|
||||
#define KEY_LANG1 0x90
|
||||
#define KEY_LANG2 0x91
|
||||
#define KEY_LANG3 0x92
|
||||
#define KEY_LANG4 0x93
|
||||
#define KEY_LANG5 0x94
|
||||
#define KEY_LANG6 0x95
|
||||
#define KEY_LANG7 0x96
|
||||
#define KEY_LANG8 0x97
|
||||
#define KEY_LANG9 0x98
|
||||
#define KEY_AlternateErase 0x99
|
||||
#define KEY_SysReq_Attention 0x9A
|
||||
#define KEY_Cancel 0x9B
|
||||
#define KEY_Clear 0x9C
|
||||
#define KEY_Prior 0x9D
|
||||
#define KEY_Return 0x9E
|
||||
#define KEY_Separator 0x9F
|
||||
#define KEY_Out 0xA0
|
||||
#define KEY_Oper 0xA1
|
||||
#define KEY_Clear_Again 0xA2
|
||||
#define KEY_CrSel_Props 0xA3
|
||||
#define KEY_ExSel 0xA4
|
||||
// (Reserved) 0xA5..0xAF
|
||||
#define KEYPAD_00 0xB0
|
||||
#define KEYPAD_000 0xB1
|
||||
|
||||
#define KEY_ThousandsSeparator 0xB2
|
||||
#define KEY_DecimalSeparator 0xB3
|
||||
#define KEY_CurrencyUnit 0xB4
|
||||
#define KEY_CurrencySubunit 0xB5
|
||||
|
||||
#define KEYPAD_LeftParenthesis 0xB6
|
||||
#define KEYPAD_RightParenthesis 0xB7
|
||||
#define KEYPAD_LeftBrace 0xB8
|
||||
#define KEYPAD_RightBrace 0xB9
|
||||
|
||||
#define KEYPAD_Tab 0xBA
|
||||
#define KEYPAD_Backspace 0xBB
|
||||
#define KEYPAD_A 0xBC
|
||||
#define KEYPAD_B 0xBD
|
||||
#define KEYPAD_C 0xBE
|
||||
#define KEYPAD_D 0xBF
|
||||
#define KEYPAD_E 0xC0
|
||||
#define KEYPAD_F 0xC1
|
||||
#define KEYPAD_XOR 0xC2
|
||||
#define KEYPAD_Caret 0xC3
|
||||
#define KEYPAD_Percent 0xC4
|
||||
#define KEYPAD_LessThan 0xC5
|
||||
#define KEYPAD_GreaterThan 0xC6
|
||||
#define KEYPAD_Ampersand 0xC7
|
||||
#define KEYPAD_AmpersandAmpersand 0xC8
|
||||
#define KEYPAD_Pipe 0xC9
|
||||
#define KEYPAD_PipePipe 0xCA
|
||||
#define KEYPAD_Colon 0xCB
|
||||
#define KEYPAD_Pound 0xCC
|
||||
#define KEYPAD_Space 0xCD
|
||||
#define KEYPAD_At 0xCE
|
||||
#define KEYPAD_Exclamation 0xCF
|
||||
#define KEYPAD_MemoryStore 0xD0
|
||||
#define KEYPAD_MemoryRecall 0xD1
|
||||
#define KEYPAD_MemoryClear 0xD2
|
||||
#define KEYPAD_MemoryAdd 0xD3
|
||||
#define KEYPAD_MemorySubtract 0xD4
|
||||
#define KEYPAD_MemoryMultiply 0xD5
|
||||
#define KEYPAD_MemoryDivide 0xD6
|
||||
#define KEYPAD_PlusMinus 0xD7
|
||||
#define KEYPAD_Clear 0xD8
|
||||
#define KEYPAD_ClearEntry 0xD9
|
||||
#define KEYPAD_Binary 0xDA
|
||||
#define KEYPAD_Octal 0xDB
|
||||
#define KEYPAD_Decimal 0xDC
|
||||
#define KEYPAD_Hexadecimal 0xDD
|
||||
// (Reserved) 0xDE..0xDF
|
||||
#define KEY_LeftControl 0xE0
|
||||
#define KEY_LeftShift 0xE1
|
||||
#define KEY_LeftAlt 0xE2
|
||||
#define KEY_LeftGUI 0xE3
|
||||
#define KEY_RightControl 0xE4
|
||||
#define KEY_RightShift 0xE5
|
||||
#define KEY_RightAlt 0xE6
|
||||
#define KEY_RightGUI 0xE7
|
@ -0,0 +1,17 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef KEYCODE_CONV_H_
|
||||
#define KEYCODE_CONV_H_
|
||||
|
||||
typedef struct keyCode keyCode;
|
||||
struct keyCode {
|
||||
uint8_t key_code;
|
||||
const char *key_name;
|
||||
};
|
||||
|
||||
#define KEYCODE(KC) \
|
||||
{ KC, #KC }
|
||||
|
||||
uint8_t get_keycode_by_name(char *key_name);
|
||||
|
||||
#endif /* KEYCODE_CONV_H_ */
|
@ -0,0 +1,188 @@
|
||||
#include "../include/config_handling.h"
|
||||
|
||||
#include "../include/defines.h"
|
||||
#include "../include/keycodes_conv.h"
|
||||
|
||||
#include <cjson/cJSON.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* define declarations */
|
||||
#define JO_MACROS "macros"
|
||||
#define JO_MACRO_NO "macro_no"
|
||||
#define JO_ACTIONS "actions"
|
||||
#define JO_MOD_KEYS "mod_keys"
|
||||
#define JO_DELAY "delay"
|
||||
#define JO_KEYS "keys"
|
||||
|
||||
enum MacroNumber {
|
||||
MACRO1 = 1,
|
||||
MACRO2,
|
||||
MACRO3,
|
||||
MACRO4,
|
||||
MACRO5,
|
||||
MACRO6,
|
||||
MACRO7,
|
||||
MACRO8
|
||||
};
|
||||
|
||||
/* method declarations */
|
||||
char *read_in_config(const char *conf_name);
|
||||
void set_action(const cJSON *action, f8_macro_actionP pma);
|
||||
uint8_t get_key_from_json(cJSON *key);
|
||||
|
||||
f8_macroP *
|
||||
get_f8_macros(char *conf_name) {
|
||||
|
||||
/* reserve space for up to 8 macros */
|
||||
f8_macroP *return_macros = malloc(sizeof(return_macros) * 8);
|
||||
|
||||
for (int i = 0; i < sizeof(return_macros); i++) {
|
||||
f8_macroP pm = calloc(1, sizeof(*pm));
|
||||
return_macros[i] = pm;
|
||||
}
|
||||
|
||||
cJSON *macros = NULL;
|
||||
const cJSON *macro = NULL;
|
||||
|
||||
/* pmarse the read in config file */
|
||||
char *conf = read_in_config(conf_name);
|
||||
cJSON *config_json = cJSON_Parse(conf);
|
||||
free(conf);
|
||||
|
||||
if (config_json == NULL) {
|
||||
const char *error_ptr = cJSON_GetErrorPtr();
|
||||
if (error_ptr != NULL) {
|
||||
fprintf(stderr, "Error before: %s\n", error_ptr);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* READ IN VALUES */
|
||||
int i = 0;
|
||||
macros = cJSON_GetObjectItemCaseSensitive(config_json, JO_MACROS);
|
||||
cJSON_ArrayForEach(macro, macros) {
|
||||
|
||||
/* create new macro-pointer */
|
||||
f8_macroP pm = return_macros[i++];
|
||||
|
||||
/* Get the macro number from the JSON and set the offest */
|
||||
cJSON *macro_no = cJSON_GetObjectItemCaseSensitive(macro, JO_MACRO_NO);
|
||||
switch ((int)cJSON_GetNumberValue(macro_no)) {
|
||||
case MACRO1:
|
||||
return_macros[MACRO1 - 1] = pm;
|
||||
pm->offset = PROG1_OFFSET;
|
||||
break;
|
||||
case MACRO2:
|
||||
return_macros[MACRO2 - 1] = pm;
|
||||
pm->offset = PROG2_OFFSET;
|
||||
break;
|
||||
case MACRO3:
|
||||
return_macros[MACRO3 - 1] = pm;
|
||||
pm->offset = PROG3_OFFSET;
|
||||
break;
|
||||
case MACRO4:
|
||||
return_macros[MACRO4 - 1] = pm;
|
||||
pm->offset = PROG4_OFFSET;
|
||||
break;
|
||||
case MACRO5:
|
||||
return_macros[MACRO5 - 1] = pm;
|
||||
pm->offset = PROG5_OFFSET;
|
||||
break;
|
||||
case MACRO6:
|
||||
return_macros[MACRO6 - 1] = pm;
|
||||
pm->offset = PROG6_OFFSET;
|
||||
break;
|
||||
case MACRO7:
|
||||
return_macros[MACRO7 - 1] = pm;
|
||||
pm->offset = PROG7_OFFSET;
|
||||
break;
|
||||
case MACRO8:
|
||||
return_macros[MACRO8 - 1] = pm;
|
||||
pm->offset = PROG8_OFFSET;
|
||||
break;
|
||||
}
|
||||
|
||||
printf("For Macro %d the values are\r\n",
|
||||
(int)cJSON_GetNumberValue(macro_no));
|
||||
|
||||
/* Move through all the actions in the current macro and set the values
|
||||
*/
|
||||
cJSON *action = NULL;
|
||||
cJSON *actions = cJSON_GetObjectItemCaseSensitive(macro, JO_ACTIONS);
|
||||
|
||||
int j = 0;
|
||||
cJSON_ArrayForEach(action, actions) {
|
||||
|
||||
printf(" >> Action %d\r\n", j);
|
||||
f8_macro_actionP pma = calloc(1, sizeof(*pma));
|
||||
|
||||
set_action(action, pma);
|
||||
/* append the new action to the macro */
|
||||
pm->actions[j++] = pma;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON_Delete(config_json);
|
||||
return return_macros;
|
||||
}
|
||||
|
||||
void
|
||||
set_action(const cJSON *action, f8_macro_actionP pma) {
|
||||
|
||||
cJSON *mod_keys = cJSON_GetObjectItemCaseSensitive(action, JO_MOD_KEYS);
|
||||
cJSON *delay = cJSON_GetObjectItemCaseSensitive(action, JO_DELAY);
|
||||
cJSON *keys = cJSON_GetObjectItemCaseSensitive(action, JO_KEYS);
|
||||
|
||||
pma->modifier = get_key_from_json(mod_keys);
|
||||
|
||||
printf(" >> Delay: %.2f\r\n", cJSON_GetNumberValue(delay));
|
||||
pma->delay = 0x00; // TODO: Set actual value from JSON
|
||||
|
||||
pma->action1 = get_key_from_json(cJSON_GetArrayItem(keys, 0));
|
||||
pma->action2 = get_key_from_json(cJSON_GetArrayItem(keys, 1));
|
||||
pma->action3 = get_key_from_json(cJSON_GetArrayItem(keys, 2));
|
||||
pma->action4 = get_key_from_json(cJSON_GetArrayItem(keys, 3));
|
||||
pma->action5 = get_key_from_json(cJSON_GetArrayItem(keys, 4));
|
||||
pma->action6 = get_key_from_json(cJSON_GetArrayItem(keys, 5));
|
||||
}
|
||||
|
||||
/* returns the key-code from the given string. If no keycode is matched or the
|
||||
* string is empty keycode 0x00 will be supplied */
|
||||
uint8_t
|
||||
get_key_from_json(cJSON *key) {
|
||||
uint8_t key_val = 0x00; /* default the key value to zero */
|
||||
|
||||
if (strcmp(cJSON_GetStringValue(key), "") != 0) {
|
||||
key_val = get_keycode_by_name(cJSON_GetStringValue(key));
|
||||
}
|
||||
|
||||
printf(" >> Got keyvalue 0x%02x for key \"%s\"\r\n", key_val,
|
||||
cJSON_GetStringValue(key));
|
||||
|
||||
return key_val;
|
||||
}
|
||||
|
||||
char *
|
||||
read_in_config(const char *conf_name) {
|
||||
|
||||
FILE *fp = fopen(conf_name, "r");
|
||||
if (!fp) {
|
||||
perror("Error while reading conf file");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
struct stat sb;
|
||||
if (stat(conf_name, &sb) == -1) {
|
||||
perror("Error while reading config file metadata.\r\nExiting.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
char *config = malloc(sb.st_size);
|
||||
fread(config, sb.st_size, 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
return config;
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
#include "../include/keycodes_conv.h"
|
||||
|
||||
#include "../include/defines.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
const keyCode keycodes[] = {
|
||||
|
||||
KEYCODE(KEY_NONE),
|
||||
KEYCODE(KEY_ErrorRollOver),
|
||||
KEYCODE(KEY_POSTFail),
|
||||
KEYCODE(KEY_ErrorUndefined),
|
||||
KEYCODE(KEY_a_A),
|
||||
KEYCODE(KEY_b_B),
|
||||
KEYCODE(KEY_c_C),
|
||||
KEYCODE(KEY_d_D),
|
||||
KEYCODE(KEY_e_E),
|
||||
KEYCODE(KEY_f_F),
|
||||
KEYCODE(KEY_g_G),
|
||||
KEYCODE(KEY_h_H),
|
||||
KEYCODE(KEY_i_I),
|
||||
KEYCODE(KEY_j_J),
|
||||
KEYCODE(KEY_k_K),
|
||||
KEYCODE(KEY_l_L),
|
||||
KEYCODE(KEY_m_M),
|
||||
KEYCODE(KEY_n_N),
|
||||
KEYCODE(KEY_o_O),
|
||||
KEYCODE(KEY_p_P),
|
||||
KEYCODE(KEY_q_Q),
|
||||
KEYCODE(KEY_r_R),
|
||||
KEYCODE(KEY_s_S),
|
||||
KEYCODE(KEY_t_T),
|
||||
KEYCODE(KEY_u_U),
|
||||
KEYCODE(KEY_v_V),
|
||||
KEYCODE(KEY_w_W),
|
||||
KEYCODE(KEY_x_X),
|
||||
KEYCODE(KEY_y_Y),
|
||||
KEYCODE(KEY_z_Z),
|
||||
KEYCODE(KEY_1_Exclamation),
|
||||
KEYCODE(KEY_2_At),
|
||||
KEYCODE(KEY_3_Pound),
|
||||
KEYCODE(KEY_4_Dollar),
|
||||
KEYCODE(KEY_5_Percent),
|
||||
KEYCODE(KEY_6_Caret),
|
||||
KEYCODE(KEY_7_Ampersand),
|
||||
KEYCODE(KEY_8_Asterisk),
|
||||
KEYCODE(KEY_9_LeftParenthesis),
|
||||
KEYCODE(KEY_0_RightParenthesis),
|
||||
KEYCODE(KEY_ReturnEnter),
|
||||
KEYCODE(KEY_Escape),
|
||||
KEYCODE(KEY_DeleteBackspace),
|
||||
KEYCODE(KEY_Tab),
|
||||
KEYCODE(KEY_Spacebar),
|
||||
KEYCODE(KEY_Dash_Underscore),
|
||||
KEYCODE(KEY_Equal_Plus),
|
||||
KEYCODE(KEY_LeftBracket_LeftBrace),
|
||||
KEYCODE(KEY_RightBracket_RightBrace),
|
||||
KEYCODE(KEY_Backslash_Pipe),
|
||||
KEYCODE(KEY_NonUS_Pound_Tilde),
|
||||
KEYCODE(KEY_Semicolon_Colon),
|
||||
KEYCODE(KEY_SingleQuote_DoubleQuote),
|
||||
KEYCODE(KEY_GraveAccent_Tilde),
|
||||
KEYCODE(KEY_Comma_LessThan),
|
||||
KEYCODE(KEY_Period_GreaterThan),
|
||||
KEYCODE(KEY_Slash_Question),
|
||||
KEYCODE(KEY_CapsLock),
|
||||
KEYCODE(KEY_F1),
|
||||
KEYCODE(KEY_F2),
|
||||
KEYCODE(KEY_F3),
|
||||
KEYCODE(KEY_F4),
|
||||
KEYCODE(KEY_F5),
|
||||
KEYCODE(KEY_F6),
|
||||
KEYCODE(KEY_F7),
|
||||
KEYCODE(KEY_F8),
|
||||
KEYCODE(KEY_F9),
|
||||
KEYCODE(KEY_F10),
|
||||
KEYCODE(KEY_F11),
|
||||
KEYCODE(KEY_F12),
|
||||
KEYCODE(KEY_PrintScreen),
|
||||
KEYCODE(KEY_ScrollLock),
|
||||
KEYCODE(KEY_Pause),
|
||||
KEYCODE(KEY_Insert),
|
||||
KEYCODE(KEY_Home),
|
||||
KEYCODE(KEY_PageUp),
|
||||
KEYCODE(KEY_DeleteForward),
|
||||
KEYCODE(KEY_End),
|
||||
KEYCODE(KEY_PageDown),
|
||||
KEYCODE(KEY_RightArrow),
|
||||
KEYCODE(KEY_LeftArrow),
|
||||
KEYCODE(KEY_DownArrow),
|
||||
KEYCODE(KEY_UpArrow),
|
||||
KEYCODE(KEYPAD_NumLock_Clear),
|
||||
KEYCODE(KEYPAD_Slash),
|
||||
KEYCODE(KEYPAD_Asterisk),
|
||||
KEYCODE(KEYPAD_Minus),
|
||||
KEYCODE(KEYPAD_Plus),
|
||||
KEYCODE(KEYPAD_ENTER),
|
||||
KEYCODE(KEYPAD_1_End),
|
||||
KEYCODE(KEYPAD_2_DownArrow),
|
||||
KEYCODE(KEYPAD_3_PageDown),
|
||||
KEYCODE(KEYPAD_4_LeftArrow),
|
||||
KEYCODE(KEYPAD_5),
|
||||
KEYCODE(KEYPAD_6_RightArrow),
|
||||
KEYCODE(KEYPAD_7_Home),
|
||||
KEYCODE(KEYPAD_8_UpArrow),
|
||||
KEYCODE(KEYPAD_9_PageUp),
|
||||
KEYCODE(KEYPAD_0_Insert),
|
||||
KEYCODE(KEYPAD_Period_Delete),
|
||||
KEYCODE(KEY_NonUS_Backslash_Pipe),
|
||||
KEYCODE(KEY_Application),
|
||||
KEYCODE(KEY_Power),
|
||||
KEYCODE(KEYPAD_Equal),
|
||||
KEYCODE(KEY_F13),
|
||||
KEYCODE(KEY_F14),
|
||||
KEYCODE(KEY_F15),
|
||||
KEYCODE(KEY_F16),
|
||||
KEYCODE(KEY_F17),
|
||||
KEYCODE(KEY_F18),
|
||||
KEYCODE(KEY_F19),
|
||||
KEYCODE(KEY_F20),
|
||||
KEYCODE(KEY_F21),
|
||||
KEYCODE(KEY_F22),
|
||||
KEYCODE(KEY_F23),
|
||||
KEYCODE(KEY_F24),
|
||||
KEYCODE(KEY_Execute),
|
||||
KEYCODE(KEY_Help),
|
||||
KEYCODE(KEY_Menu),
|
||||
KEYCODE(KEY_Select),
|
||||
KEYCODE(KEY_Stop),
|
||||
KEYCODE(KEY_Again),
|
||||
KEYCODE(KEY_Undo),
|
||||
KEYCODE(KEY_Cut),
|
||||
KEYCODE(KEY_Copy),
|
||||
KEYCODE(KEY_Paste),
|
||||
KEYCODE(KEY_Find),
|
||||
KEYCODE(KEY_Mute),
|
||||
KEYCODE(KEY_VolumeUp),
|
||||
KEYCODE(KEY_VolumeDown),
|
||||
KEYCODE(KEY_LockingCapsLock),
|
||||
KEYCODE(KEY_LockingNumLock),
|
||||
KEYCODE(KEY_LockingScrollLock),
|
||||
KEYCODE(KEYPAD_Comma),
|
||||
KEYCODE(KEYPAD_EqualSign),
|
||||
KEYCODE(KEY_International1),
|
||||
KEYCODE(KEY_International2),
|
||||
KEYCODE(KEY_International3),
|
||||
KEYCODE(KEY_International4),
|
||||
KEYCODE(KEY_International5),
|
||||
KEYCODE(KEY_International6),
|
||||
KEYCODE(KEY_International7),
|
||||
KEYCODE(KEY_International8),
|
||||
KEYCODE(KEY_International9),
|
||||
KEYCODE(KEY_LANG1),
|
||||
KEYCODE(KEY_LANG2),
|
||||
KEYCODE(KEY_LANG3),
|
||||
KEYCODE(KEY_LANG4),
|
||||
KEYCODE(KEY_LANG5),
|
||||
KEYCODE(KEY_LANG6),
|
||||
KEYCODE(KEY_LANG7),
|
||||
KEYCODE(KEY_LANG8),
|
||||
KEYCODE(KEY_LANG9),
|
||||
KEYCODE(KEY_AlternateErase),
|
||||
KEYCODE(KEY_SysReq_Attention),
|
||||
KEYCODE(KEY_Cancel),
|
||||
KEYCODE(KEY_Clear),
|
||||
KEYCODE(KEY_Prior),
|
||||
KEYCODE(KEY_Return),
|
||||
KEYCODE(KEY_Separator),
|
||||
KEYCODE(KEY_Out),
|
||||
KEYCODE(KEY_Oper),
|
||||
KEYCODE(KEY_Clear_Again),
|
||||
KEYCODE(KEY_CrSel_Props),
|
||||
KEYCODE(KEY_ExSel),
|
||||
KEYCODE(KEYPAD_00),
|
||||
KEYCODE(KEYPAD_000),
|
||||
KEYCODE(KEY_ThousandsSeparator),
|
||||
KEYCODE(KEY_DecimalSeparator),
|
||||
KEYCODE(KEY_CurrencyUnit),
|
||||
KEYCODE(KEY_CurrencySubunit),
|
||||
KEYCODE(KEYPAD_LeftParenthesis),
|
||||
KEYCODE(KEYPAD_RightParenthesis),
|
||||
KEYCODE(KEYPAD_LeftBrace),
|
||||
KEYCODE(KEYPAD_RightBrace),
|
||||
KEYCODE(KEYPAD_Tab),
|
||||
KEYCODE(KEYPAD_Backspace),
|
||||
KEYCODE(KEYPAD_A),
|
||||
KEYCODE(KEYPAD_B),
|
||||
KEYCODE(KEYPAD_C),
|
||||
KEYCODE(KEYPAD_D),
|
||||
KEYCODE(KEYPAD_E),
|
||||
KEYCODE(KEYPAD_F),
|
||||
KEYCODE(KEYPAD_XOR),
|
||||
KEYCODE(KEYPAD_Caret),
|
||||
KEYCODE(KEYPAD_Percent),
|
||||
KEYCODE(KEYPAD_LessThan),
|
||||
KEYCODE(KEYPAD_GreaterThan),
|
||||
KEYCODE(KEYPAD_Ampersand),
|
||||
KEYCODE(KEYPAD_AmpersandAmpersand),
|
||||
KEYCODE(KEYPAD_Pipe),
|
||||
KEYCODE(KEYPAD_PipePipe),
|
||||
KEYCODE(KEYPAD_Colon),
|
||||
KEYCODE(KEYPAD_Pound),
|
||||
KEYCODE(KEYPAD_Space),
|
||||
KEYCODE(KEYPAD_At),
|
||||
KEYCODE(KEYPAD_Exclamation),
|
||||
KEYCODE(KEYPAD_MemoryStore),
|
||||
KEYCODE(KEYPAD_MemoryRecall),
|
||||
KEYCODE(KEYPAD_MemoryClear),
|
||||
KEYCODE(KEYPAD_MemoryAdd),
|
||||
KEYCODE(KEYPAD_MemorySubtract),
|
||||
KEYCODE(KEYPAD_MemoryMultiply),
|
||||
KEYCODE(KEYPAD_MemoryDivide),
|
||||
KEYCODE(KEYPAD_PlusMinus),
|
||||
KEYCODE(KEYPAD_Clear),
|
||||
KEYCODE(KEYPAD_ClearEntry),
|
||||
KEYCODE(KEYPAD_Binary),
|
||||
KEYCODE(KEYPAD_Octal),
|
||||
KEYCODE(KEYPAD_Decimal),
|
||||
KEYCODE(KEYPAD_Hexadecimal),
|
||||
KEYCODE(KEY_LeftControl),
|
||||
KEYCODE(KEY_LeftShift),
|
||||
KEYCODE(KEY_LeftAlt),
|
||||
KEYCODE(KEY_LeftGUI),
|
||||
KEYCODE(KEY_RightControl),
|
||||
KEYCODE(KEY_RightShift),
|
||||
KEYCODE(KEY_RightAlt),
|
||||
KEYCODE(KEY_RightGUI),
|
||||
|
||||
/* SPECIAL KEYCODES FOR THE MODIFIFER KEY */
|
||||
KEYCODE(MODKEY_NONE),
|
||||
KEYCODE(MODKEY_LCTR),
|
||||
KEYCODE(MODKEY_LSHI),
|
||||
KEYCODE(MODKEY_LALT),
|
||||
KEYCODE(MODKEY_LWIN),
|
||||
KEYCODE(MODKEY_RCTR),
|
||||
KEYCODE(MODKEY_RSHI),
|
||||
KEYCODE(MODKEY_RALT),
|
||||
KEYCODE(MODKEY_RWIN),
|
||||
KEYCODE(MODKEY_RWIN_RSHI),
|
||||
KEYCODE(MODKEY_RWIN_RCTR),
|
||||
KEYCODE(MODKEY_RWIN_RALT),
|
||||
KEYCODE(MODKEY_RWIN_RCTR_RSHI),
|
||||
KEYCODE(MODKEY_RCTR_RALT),
|
||||
KEYCODE(MODKEY_RCTR_RSHI),
|
||||
KEYCODE(MODKEY_RALT_RSHI),
|
||||
KEYCODE(MODKEY_RALT_RCTR_RSHI),
|
||||
};
|
||||
|
||||
uint8_t
|
||||
get_keycode_by_name(char *key_name) {
|
||||
uint8_t keycode = 0x00;
|
||||
|
||||
for (int i = 0; i < (sizeof(keycodes) / sizeof(keycodes[0])); i++) {
|
||||
if (strcmp(keycodes[i].key_name, key_name) == 0) {
|
||||
keycode = keycodes[i].key_code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return keycode;
|
||||
}
|
Loading…
Reference in New Issue