@@ -1,6 +1,12 @@ | |||
kll - keyboard layout language | |||
============================== | |||
[![https://travis-ci.org/kiibohd/kll](https://travis-ci.org/kiibohd/kll.svg?branch=master)](https://travis-ci.org/kiibohd/kll) | |||
[![Visit our IRC channel](https://kiwiirc.com/buttons/irc.freenode.net/input.club.png)](https://kiwiirc.com/client/irc.freenode.net/#input.club) | |||
## If you're trying to compile keyboard firmware, you want [THIS](https://github.com/kiibohd/controller/) | |||
KLL Compiler | |||
------------ | |||
@@ -31,11 +37,3 @@ Patches/Features/Backends | |||
------------------------- | |||
Completely welcome :D | |||
Spec Additions/Fixes | |||
-------------------- | |||
Contact HaaTa via IRC (#[email protected] or #deskthority). | |||
Or by email -> [email protected] | |||
@@ -1,9 +1,10 @@ | |||
#!/usr/bin/env python3 | |||
# KLL Compiler - Kiibohd Backend | |||
# | |||
# Backend code generator for the Kiibohd Controller firmware. | |||
# | |||
# Copyright (C) 2014-2015 by Jacob Alexander | |||
''' | |||
KLL Compiler - Kiibohd Backend | |||
Backend code generator for the Kiibohd Controller firmware. | |||
''' | |||
# Copyright (C) 2014-2016 by Jacob Alexander | |||
# | |||
# This file is free software: you can redistribute it and/or modify | |||
# it under the terms of the GNU General Public License as published by | |||
@@ -37,6 +38,11 @@ from kll_lib.hid_dict import * | |||
### Classes ### | |||
class Backend( BackendBase ): | |||
''' | |||
Kiibohd Code-Generation Backend | |||
Kiibohd specific code generation. | |||
''' | |||
# Default templates and output files | |||
templatePaths = ["templates/kiibohdKeymap.h", "templates/kiibohdDefs.h"] | |||
outputPaths = ["generatedKeymap.h", "kll_defs.h"] | |||
@@ -119,11 +125,14 @@ class Backend( BackendBase ): | |||
## Defines ## | |||
self.fill_dict['Defines'] = "" | |||
stateWordSize = "" | |||
# Iterate through defines and lookup the variables | |||
for define in variables.defines.keys(): | |||
if define in variables.overallVariables.keys(): | |||
self.fill_dict['Defines'] += "\n#define {0} {1}".format( variables.defines[ define ], variables.overallVariables[ define ].replace( '\n', ' \\\n' ) ) | |||
if define == "stateWordSize": | |||
stateWordSize = variables.overallVariables[ define ] | |||
else: | |||
print( "{0} '{1}' not defined...".format( WARNING, define ) ) | |||
@@ -144,6 +153,9 @@ class Backend( BackendBase ): | |||
self.fill_dict['CapabilitiesList'] += "};" | |||
self.fill_dict['CapabilitiesIndices'] += "} CapabilityIndex;" | |||
# Define for total number of capabilities | |||
self.fill_dict['Defines'] += "\n#define CapabilitiesNum_KLL {0}".format( len( capabilities.keys() ) ) | |||
## Results Macros ## | |||
self.fill_dict['ResultMacros'] = "" | |||
@@ -215,15 +227,21 @@ class Backend( BackendBase ): | |||
self.fill_dict['ResultMacroList'] += "\tDefine_RM( {0} ),\n".format( result ) | |||
self.fill_dict['ResultMacroList'] += "};" | |||
results_count = len( macros.resultsIndexSorted ) | |||
## Result Macro Record ## | |||
self.fill_dict['ResultMacroRecord'] = "ResultMacroRecord ResultMacroRecordList[ ResultMacroNum ];" | |||
# Define for total number of Result Macros | |||
self.fill_dict['Defines'] += "\n#define ResultMacroNum_KLL {0}".format( len( macros.resultsIndexSorted ) ) | |||
## Trigger Macros ## | |||
self.fill_dict['TriggerMacros'] = "" | |||
# Iterate through each of the trigger macros | |||
triggers_count = len( macros.triggersIndexSorted ); | |||
for trigger in range( 0, len( macros.triggersIndexSorted ) ): | |||
self.fill_dict['TriggerMacros'] += "Guide_TM( {0} ) = {{ ".format( trigger ) | |||
@@ -249,6 +267,13 @@ class Backend( BackendBase ): | |||
self.fill_dict['TriggerMacros'] += "0 };\n" | |||
self.fill_dict['TriggerMacros'] = self.fill_dict['TriggerMacros'][ :-1 ] # Remove last newline | |||
# check for too small stateWordSize | |||
if stateWordSize == "8" and (triggers_count > 255 or results_count > 255): | |||
print ("{0} Over 255 trigger or result macros, changing stateWordSize from {1} to 16.".format( WARNING, stateWordSize ) ) | |||
print( "Results count: ", results_count ) | |||
print( "Triggers count: ", triggers_count ) | |||
stateWordSize == "16" | |||
self.fill_dict['Defines'] = self.fill_dict['Defines'].replace("StateWordSize_define 8", "StateWordSize_define 16") | |||
## Trigger Macro List ## | |||
self.fill_dict['TriggerMacroList'] = "const TriggerMacro TriggerMacroList[] = {\n" | |||
@@ -263,6 +288,9 @@ class Backend( BackendBase ): | |||
## Trigger Macro Record ## | |||
self.fill_dict['TriggerMacroRecord'] = "TriggerMacroRecord TriggerMacroRecordList[ TriggerMacroNum ];" | |||
# Define for total number of Trigger Macros | |||
self.fill_dict['Defines'] += "\n#define TriggerMacroNum_KLL {0}".format( len( macros.triggersIndexSorted ) ) | |||
## Max Scan Code ## | |||
self.fill_dict['MaxScanCode'] = "#define MaxScanCode 0x{0:X}".format( macros.overallMaxScanCode ) | |||
@@ -354,6 +382,9 @@ class Backend( BackendBase ): | |||
self.fill_dict['LayerIndexList'] += '\tLayer_IN( layer{0}_scanMap, "{0}: {2}", 0x{1:02X} ),\n'.format( layer, firstScanCode, stackName ) | |||
self.fill_dict['LayerIndexList'] += "};" | |||
# Define for total number of Trigger Macros | |||
self.fill_dict['Defines'] += "\n#define LayerNum_KLL {0}".format( len( macros.triggerList ) ) | |||
## Layer State ## | |||
self.fill_dict['LayerState'] = "uint8_t LayerState[ LayerNum ];" |
@@ -0,0 +1,40 @@ | |||
Name = mouseTest; | |||
Version = 0.2; | |||
Author = "HaaTa (Jacob Alexander) 2016"; | |||
KLL = 0.3d; | |||
# Modified Date | |||
Date = 2016-03-21; | |||
# mouseOut | |||
# Arg1, button, 1-16 | |||
# Arg2, mouse x relative axis -32 767 to 32 767 | |||
# Arg3, mouse y relative axis -32 767 to 32 767 | |||
U"1" : mouseOut( 1, 0, 0 ); | |||
U"2" : mouseOut( 2, 0, 0 ); | |||
U"3" : mouseOut( 3, 0, 0 ); | |||
U"4" : mouseOut( 4, 0, 0 ); | |||
U"5" : mouseOut( 5, 0, 0 ); | |||
U"6" : mouseOut( 6, 0, 0 ); | |||
U"7" : mouseOut( 7, 0, 0 ); | |||
U"8" : mouseOut( 8, 0, 0 ); | |||
U"Z" : mouseOut( 9, 0, 0 ); | |||
U"X" : mouseOut( 10, 0, 0 ); | |||
U"C" : mouseOut( 11, 0, 0 ); | |||
U"V" : mouseOut( 12, 0, 0 ); | |||
U"B" : mouseOut( 13, 0, 0 ); | |||
U"N" : mouseOut( 14, 0, 0 ); | |||
U"M" : mouseOut( 15, 0, 0 ); | |||
U"Comma" : mouseOut( 16, 0, 0 ); | |||
U"Up" : mouseOut( 0, 0, 1 ); | |||
U"Down" : mouseOut( 0, 0, -1 ); | |||
U"Left" : mouseOut( 0, -1, 0 ); | |||
U"Right" : mouseOut( 0, 1, 0 ); | |||
U"W" : mouseOut( 0, 0, 5 ); | |||
U"S" : mouseOut( 0, 0, -5 ); | |||
U"A" : mouseOut( 0, -5, 0 ); | |||
U"D" : mouseOut( 0, 5, 0 ); | |||
@@ -0,0 +1,93 @@ | |||
Name = programmers dvorak default layer; | |||
Version = 0.1; | |||
Author = "HaaTa (Jacob Alexander) 2016"; | |||
KLL = 0.3d; | |||
# Modified Date | |||
Date = 2016-08-06; | |||
# This the default layer for programmers dvorak | |||
# http://www.kaufmann.no/roland/dvorak/ | |||
# | |||
# CAVEATS; | |||
# 1) Assumes US ANSI locale set on the host OS | |||
# 2) No AltGr layer (future enhancement, will require a different locale) | |||
# 3) Some shortcuts may not behave correctly | |||
# Shift Keys are masked in some situations | |||
# | |||
# USAGE: | |||
# This layer must be set on the defaultMap | |||
# programmers_dvorak_shift must be set as Layer1 (first PartialMap) | |||
# Attempt to force the host OS to use US ANSI | |||
# (Not guaranteed) | |||
keyboardLocale = 33; | |||
### Mapping ### | |||
# Top Row | |||
U"BackTick" : '$'; | |||
U"1" : '&'; | |||
U"2" : '['; | |||
U"3" : '{'; | |||
U"4" : '}'; | |||
U"5" : '('; | |||
U"6" : '='; | |||
U"7" : '*'; | |||
U"8" : ')'; | |||
U"9" : '+'; | |||
U"0" : ']'; | |||
U"-" : '!'; | |||
U"=" : '#'; | |||
# Top-Middle Row | |||
U"Q" : ';'; | |||
U"W" : ','; | |||
U"E" : '.'; | |||
U"R" : 'p'; | |||
U"T" : 'y'; | |||
U"Y" : 'f'; | |||
U"U" : 'g'; | |||
U"I" : 'c'; | |||
U"O" : 'r'; | |||
U"P" : 'l'; | |||
U"[" : '/'; | |||
U"]" : '@'; | |||
### / is in the same place | |||
# Middle Row | |||
### A is in the same place | |||
U"S" : 'o'; | |||
U"D" : 'e'; | |||
U"F" : 'u'; | |||
U"G" : 'i'; | |||
U"H" : 'd'; | |||
U"J" : 'h'; | |||
U"K" : 't'; | |||
U"L" : 'n'; | |||
U"Semicolon" : 's'; | |||
U"Quote" : '-'; | |||
# Bottom-Middle Row | |||
U"LShift" :+ U"Function1"; # Do not replace LShift, just trigger Function1 in addition to LShift | |||
### XXX Not sure what the square key is (-HaaTa) | |||
U"Z" : U"Quote"; # ' is hard to do using the single quote syntax | |||
U"X" : 'q'; | |||
U"C" : 'j'; | |||
U"V" : 'k'; | |||
U"B" : 'x'; | |||
### M is in the same place | |||
U"N" : 'b'; | |||
U"Comma" : 'w'; | |||
#U"Period" : 'v'; | |||
U"Slash" : 'z'; | |||
U"RShift" :+ U"Function1"; # Do not replace RShift, just trigger Function1 in addition to RShift | |||
# Bottom Row | |||
# N/A | |||
@@ -0,0 +1,48 @@ | |||
Name = programmers dvorak shift layer; | |||
Version = 0.1; | |||
Author = "HaaTa (Jacob Alexander) 2016"; | |||
KLL = 0.3d; | |||
# | |||
# NOTE: See programmers_dvorak_default.kll for more details on how to use this layout | |||
# It relies on the semantics of the US ANSI layout | |||
# | |||
# This file relies heavily on the blockKey capability for LShift (0xE1) and RShift (0xE5) | |||
# However, it is only used in the cases where it's necessary | |||
# | |||
# We also rely on "fall-through" to the previous layer | |||
# This means any normally shifted keys do not need to be redefined here | |||
# | |||
# Modified Date | |||
Date = 2016-08-06; | |||
### Mapping ### | |||
# Top Row | |||
U"BackTick" : '~'; | |||
U"1" : '%'; | |||
U"2" : U"7" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"3" : U"5" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"4" : U"3" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"5" : U"1" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"6" : U"9" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"7" : U"0" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"8" : U"2" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"9" : U"4" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"0" : U"6" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"-" : U"8" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
U"=" : U"Backtick" + blockKey( 0xE1 ) + blockKey( 0xE5 ); | |||
# Top-Middle Row | |||
U"]" : '^'; | |||
# Middle Row | |||
# N/A | |||
# Bottom-Middle Row | |||
# N/A | |||
# Bottom Row | |||
# N/A | |||