Archived
1
0

Adding Lock and Latch symbolic names (e.g. Function)

- Like Function, these are not valid USB codes, but can be used to easily refer a particular key (no possible with exact name)

U"Lock1"  : layerLock( 1 );
U"Latch1" : layerLatch( 1 );
This commit is contained in:
Jacob Alexander 2015-09-20 14:45:42 -07:00
parent 8120771175
commit cf5bba7039
5 changed files with 151 additions and 18 deletions

14
kll.py
View File

@ -182,9 +182,10 @@ capabilities_dict = Capabilities()
def make_scanCode( token ): def make_scanCode( token ):
scanCode = int( token[1:], 0 ) scanCode = int( token[1:], 0 )
# Check size, to make sure it's valid # Check size, to make sure it's valid
if scanCode > 0xFF: # XXX Add better check that takes symbolic names into account (i.e. U"Latch5")
print ( "{0} ScanCode value {1} is larger than 255".format( ERROR, scanCode ) ) #if scanCode > 0xFF:
raise # print ( "{0} ScanCode value {1} is larger than 255".format( ERROR, scanCode ) )
# raise
return scanCode return scanCode
def make_hidCode( type, token ): def make_hidCode( type, token ):
@ -214,9 +215,10 @@ def make_hidCode( type, token ):
hidCode = int( token, 0 ) hidCode = int( token, 0 )
# Check size if a USB Code, to make sure it's valid # Check size if a USB Code, to make sure it's valid
if type == 'USBCode' and hidCode > 0xFF: # XXX Add better check that takes symbolic names into account (i.e. U"Latch5")
print ( "{0} USBCode value {1} is larger than 255".format( ERROR, hidCode ) ) #if type == 'USBCode' and hidCode > 0xFF:
raise # print ( "{0} USBCode value {1} is larger than 255".format( ERROR, hidCode ) )
# raise
# Return a tuple, identifying which type it is # Return a tuple, identifying which type it is
if type == 'USBCode': if type == 'USBCode':

View File

@ -262,6 +262,39 @@ hid_lookup_dictionary = dict([
( ('USB', 0xFD), 'KEY_FUN14' ), ( ('USB', 0xFD), 'KEY_FUN14' ),
( ('USB', 0xFE), 'KEY_FUN15' ), ( ('USB', 0xFE), 'KEY_FUN15' ),
( ('USB', 0xFF), 'KEY_FUN16' ), ( ('USB', 0xFF), 'KEY_FUN16' ),
# ('USB', 0x100) to ('USB', 0x11F) for function key placeholders, not valid usb codes (must use a translation .kll file before firmware compilation)
( ('USB', 0x100), 'KEY_LCK1' ),
( ('USB', 0x101), 'KEY_LCK2' ),
( ('USB', 0x102), 'KEY_LCK3' ),
( ('USB', 0x103), 'KEY_LCK4' ),
( ('USB', 0x104), 'KEY_LCK5' ),
( ('USB', 0x105), 'KEY_LCK6' ),
( ('USB', 0x106), 'KEY_LCK7' ),
( ('USB', 0x107), 'KEY_LCK8' ),
( ('USB', 0x108), 'KEY_LCK9' ),
( ('USB', 0x109), 'KEY_LCK10' ),
( ('USB', 0x10A), 'KEY_LCK11' ),
( ('USB', 0x10B), 'KEY_LCK12' ),
( ('USB', 0x10C), 'KEY_LCK13' ),
( ('USB', 0x10D), 'KEY_LCK14' ),
( ('USB', 0x10E), 'KEY_LCK15' ),
( ('USB', 0x10F), 'KEY_LCK16' ),
( ('USB', 0x110), 'KEY_LAT1' ),
( ('USB', 0x111), 'KEY_LAT2' ),
( ('USB', 0x112), 'KEY_LAT3' ),
( ('USB', 0x113), 'KEY_LAT4' ),
( ('USB', 0x114), 'KEY_LAT5' ),
( ('USB', 0x115), 'KEY_LAT6' ),
( ('USB', 0x116), 'KEY_LAT7' ),
( ('USB', 0x117), 'KEY_LAT8' ),
( ('USB', 0x118), 'KEY_LAT9' ),
( ('USB', 0x119), 'KEY_LAT10' ),
( ('USB', 0x11A), 'KEY_LAT11' ),
( ('USB', 0x11B), 'KEY_LAT12' ),
( ('USB', 0x11C), 'KEY_LAT13' ),
( ('USB', 0x11D), 'KEY_LAT14' ),
( ('USB', 0x11E), 'KEY_LAT15' ),
( ('USB', 0x11F), 'KEY_LAT16' ),
# USB HID Consumer Control Codes # USB HID Consumer Control Codes
# List of Consumer Codes - USB HID 1.12v2 # List of Consumer Codes - USB HID 1.12v2
@ -975,6 +1008,7 @@ kll_hid_lookup_dictionary['USBCode'] = dict([
( 'RALT', ('USB', 0xE6) ), ( 'RIGHT ALT', ('USB', 0xE6) ), ( 'RIGHT ALTERNATE', ('USB', 0xE6) ), ( 'RALT', ('USB', 0xE6) ), ( 'RIGHT ALT', ('USB', 0xE6) ), ( 'RIGHT ALTERNATE', ('USB', 0xE6) ),
( 'RGUI', ('USB', 0xE7) ), ( 'RIGHT GUI', ('USB', 0xE7) ), ( 'RIGHT SUPER', ('USB', 0xE7) ), ( 'RIGHT WINDOWS', ('USB', 0xE7) ), ( 'RIGHT WIN', ('USB', 0xE7) ), ( 'RGUI', ('USB', 0xE7) ), ( 'RIGHT GUI', ('USB', 0xE7) ), ( 'RIGHT SUPER', ('USB', 0xE7) ), ( 'RIGHT WINDOWS', ('USB', 0xE7) ), ( 'RIGHT WIN', ('USB', 0xE7) ),
# Special Function Shift/Lock/Latch symbolic names (not part of the USB HID spec)
( 'FUN1', ('USB', 0xF0) ), ( 'FUNCTION1', ('USB', 0xF0) ), ( 'FUN', ('USB', 0xF0) ), ( 'FUN1', ('USB', 0xF0) ), ( 'FUNCTION1', ('USB', 0xF0) ), ( 'FUN', ('USB', 0xF0) ),
( 'FUN2', ('USB', 0xF1) ), ( 'FUNCTION2', ('USB', 0xF1) ), ( 'FUN2', ('USB', 0xF1) ), ( 'FUNCTION2', ('USB', 0xF1) ),
( 'FUN3', ('USB', 0xF2) ), ( 'FUNCTION3', ('USB', 0xF2) ), ( 'FUN3', ('USB', 0xF2) ), ( 'FUNCTION3', ('USB', 0xF2) ),
@ -991,6 +1025,38 @@ kll_hid_lookup_dictionary['USBCode'] = dict([
( 'FUN14', ('USB', 0xFD) ), ( 'FUNCTION14', ('USB', 0xFD) ), ( 'FUN14', ('USB', 0xFD) ), ( 'FUNCTION14', ('USB', 0xFD) ),
( 'FUN15', ('USB', 0xFE) ), ( 'FUNCTION15', ('USB', 0xFE) ), ( 'FUN15', ('USB', 0xFE) ), ( 'FUNCTION15', ('USB', 0xFE) ),
( 'FUN16', ('USB', 0xFF) ), ( 'FUNCTION16', ('USB', 0xFF) ), ( 'FUN16', ('USB', 0xFF) ), ( 'FUNCTION16', ('USB', 0xFF) ),
( 'LCK1', ('USB', 0x100) ), ( 'LOCK1', ('USB', 0x100) ), ( 'LCK', ('USB', 0x100) ),
( 'LCK2', ('USB', 0x101) ), ( 'LOCK2', ('USB', 0x101) ),
( 'LCK3', ('USB', 0x102) ), ( 'LOCK3', ('USB', 0x102) ),
( 'LCK4', ('USB', 0x103) ), ( 'LOCK4', ('USB', 0x103) ),
( 'LCK5', ('USB', 0x104) ), ( 'LOCK5', ('USB', 0x104) ),
( 'LCK6', ('USB', 0x105) ), ( 'LOCK6', ('USB', 0x105) ),
( 'LCK7', ('USB', 0x106) ), ( 'LOCK7', ('USB', 0x106) ),
( 'LCK8', ('USB', 0x107) ), ( 'LOCK8', ('USB', 0x107) ),
( 'LCK9', ('USB', 0x108) ), ( 'LOCK9', ('USB', 0x108) ),
( 'LCK10', ('USB', 0x109) ), ( 'LOCK10', ('USB', 0x109) ),
( 'LCK11', ('USB', 0x10A) ), ( 'LOCK11', ('USB', 0x10A) ),
( 'LCK12', ('USB', 0x10B) ), ( 'LOCK12', ('USB', 0x10B) ),
( 'LCK13', ('USB', 0x10C) ), ( 'LOCK13', ('USB', 0x10C) ),
( 'LCK14', ('USB', 0x10D) ), ( 'LOCK14', ('USB', 0x10D) ),
( 'LCK15', ('USB', 0x10E) ), ( 'LOCK15', ('USB', 0x10E) ),
( 'LCK16', ('USB', 0x10F) ), ( 'LOCK16', ('USB', 0x10F) ),
( 'LAT1', ('USB', 0x110) ), ( 'LATCH1', ('USB', 0x110) ), ( 'LAT', ('USB', 0x110) ),
( 'LAT2', ('USB', 0x111) ), ( 'LATCH2', ('USB', 0x111) ),
( 'LAT3', ('USB', 0x112) ), ( 'LATCH3', ('USB', 0x112) ),
( 'LAT4', ('USB', 0x113) ), ( 'LATCH4', ('USB', 0x113) ),
( 'LAT5', ('USB', 0x114) ), ( 'LATCH5', ('USB', 0x114) ),
( 'LAT6', ('USB', 0x115) ), ( 'LATCH6', ('USB', 0x115) ),
( 'LAT7', ('USB', 0x116) ), ( 'LATCH7', ('USB', 0x116) ),
( 'LAT8', ('USB', 0x117) ), ( 'LATCH8', ('USB', 0x117) ),
( 'LAT9', ('USB', 0x118) ), ( 'LATCH9', ('USB', 0x118) ),
( 'LAT10', ('USB', 0x119) ), ( 'LATCH10', ('USB', 0x119) ),
( 'LAT11', ('USB', 0x11A) ), ( 'LATCH11', ('USB', 0x11A) ),
( 'LAT12', ('USB', 0x11B) ), ( 'LATCH12', ('USB', 0x11B) ),
( 'LAT13', ('USB', 0x11C) ), ( 'LATCH13', ('USB', 0x11C) ),
( 'LAT14', ('USB', 0x11D) ), ( 'LATCH14', ('USB', 0x11D) ),
( 'LAT15', ('USB', 0x11E) ), ( 'LATCH15', ('USB', 0x11E) ),
( 'LAT16', ('USB', 0x11F) ), ( 'LATCH16', ('USB', 0x11F) ),
]) ])

View File

@ -1,10 +1,10 @@
Name = lcdFuncMap; Name = lcdFuncMap;
Version = 0.1; Version = 0.2;
Author = "HaaTa (Jacob Alexander) 2015"; Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3c; KLL = 0.3c;
# Modified Date # Modified Date
Date = 2015-08-17; Date = 2015-09-20;
# Maps each Function key incrementally to each layer # Maps each Function key incrementally to each layer
# Unused layers and functions are ignored # Unused layers and functions are ignored
@ -26,6 +26,40 @@ U"Function14" : layerShift( 14 ) + LCDLayerDisplay();
U"Function15" : layerShift( 15 ) + LCDLayerDisplay(); U"Function15" : layerShift( 15 ) + LCDLayerDisplay();
U"Function16" : layerShift( 16 ) + LCDLayerDisplay(); U"Function16" : layerShift( 16 ) + LCDLayerDisplay();
U"Lock1" : layerLock( 1 ) + LCDLayerDisplay();
U"Lock2" : layerLock( 2 ) + LCDLayerDisplay();
U"Lock3" : layerLock( 3 ) + LCDLayerDisplay();
U"Lock4" : layerLock( 4 ) + LCDLayerDisplay();
U"Lock5" : layerLock( 5 ) + LCDLayerDisplay();
U"Lock6" : layerLock( 6 ) + LCDLayerDisplay();
U"Lock7" : layerLock( 7 ) + LCDLayerDisplay();
U"Lock8" : layerLock( 8 ) + LCDLayerDisplay();
U"Lock9" : layerLock( 9 ) + LCDLayerDisplay();
U"Lock10" : layerLock( 10 ) + LCDLayerDisplay();
U"Lock11" : layerLock( 11 ) + LCDLayerDisplay();
U"Lock12" : layerLock( 12 ) + LCDLayerDisplay();
U"Lock13" : layerLock( 13 ) + LCDLayerDisplay();
U"Lock14" : layerLock( 14 ) + LCDLayerDisplay();
U"Lock15" : layerLock( 15 ) + LCDLayerDisplay();
U"Lock16" : layerLock( 16 ) + LCDLayerDisplay();
U"Latch1" : layerLatch( 1 ) + LCDLayerDisplay();
U"Latch2" : layerLatch( 2 ) + LCDLayerDisplay();
U"Latch3" : layerLatch( 3 ) + LCDLayerDisplay();
U"Latch4" : layerLatch( 4 ) + LCDLayerDisplay();
U"Latch5" : layerLatch( 5 ) + LCDLayerDisplay();
U"Latch6" : layerLatch( 6 ) + LCDLayerDisplay();
U"Latch7" : layerLatch( 7 ) + LCDLayerDisplay();
U"Latch8" : layerLatch( 8 ) + LCDLayerDisplay();
U"Latch9" : layerLatch( 9 ) + LCDLayerDisplay();
U"Latch10" : layerLatch( 10 ) + LCDLayerDisplay();
U"Latch11" : layerLatch( 11 ) + LCDLayerDisplay();
U"Latch12" : layerLatch( 12 ) + LCDLayerDisplay();
U"Latch13" : layerLatch( 13 ) + LCDLayerDisplay();
U"Latch14" : layerLatch( 14 ) + LCDLayerDisplay();
U"Latch15" : layerLatch( 15 ) + LCDLayerDisplay();
U"Latch16" : layerLatch( 16 ) + LCDLayerDisplay();
# Colours assigned to each of the LCD numbers # Colours assigned to each of the LCD numbers
# The "top of stack" layer is the colour used # The "top of stack" layer is the colour used

View File

@ -1,10 +1,10 @@
Name = mdergo1Overlay; Name = mdergo1Overlay;
Version = 0.1; Version = 0.2;
Author = "HaaTa (Jacob Alexander) 2015"; Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3c; KLL = 0.3c;
# Modified Date # Modified Date
Date = 2015-08-21; Date = 2015-09-20;
# Make default layout more like the original ErgoDox default layout # Make default layout more like the original ErgoDox default layout
# https://keyboard-configurator.massdrop.com/ext/ergodox/ # https://keyboard-configurator.massdrop.com/ext/ergodox/
@ -13,13 +13,10 @@ Date = 2015-08-21;
# But, the DefaultMap can start to duplicate keys without any issues # But, the DefaultMap can start to duplicate keys without any issues
# Top Row - Right # Top Row - Right
# XXX Currently there are no "convenience" Function symbolic names for layerLock U"Function6" : U"Lock2";
# This means the LCDLayerDisplay has to be applied here
# Adding more symbolic names is possible, but it's not super straight-forward
U"Function6" : layerLock( 2 ) + LCDLayerDisplay(); # Lock layer 2, and LCD update
# Top-Middle Row - Left # Top-Middle Row - Left
U"Function1" : layerLock( 1 ) + LCDLayerDisplay(); # Lock layer 1, and LCD update U"Function1" : U"Lock1";
# Bottom-Middle Row - Left # Bottom-Middle Row - Left
U"Function2" : U"Function1"; # Set Function2 to be layer shift 1 U"Function2" : U"Function1"; # Set Function2 to be layer shift 1

View File

@ -1,10 +1,10 @@
Name = stdFuncMap; Name = stdFuncMap;
Version = 0.1; Version = 0.2;
Author = "HaaTa (Jacob Alexander) 2014"; Author = "HaaTa (Jacob Alexander) 2014-2015";
KLL = 0.3; KLL = 0.3;
# Modified Date # Modified Date
Date = 2014-09-14; Date = 2015-09-20;
# Maps each Function key incrementally to each layer # Maps each Function key incrementally to each layer
# Unused layers and functions are ignored # Unused layers and functions are ignored
@ -26,3 +26,37 @@ U"Function14" : layerShift( 14 );
U"Function15" : layerShift( 15 ); U"Function15" : layerShift( 15 );
U"Function16" : layerShift( 16 ); U"Function16" : layerShift( 16 );
U"Lock1" : layerLock( 1 );
U"Lock2" : layerLock( 2 );
U"Lock3" : layerLock( 3 );
U"Lock4" : layerLock( 4 );
U"Lock5" : layerLock( 5 );
U"Lock6" : layerLock( 6 );
U"Lock7" : layerLock( 7 );
U"Lock8" : layerLock( 8 );
U"Lock9" : layerLock( 9 );
U"Lock10" : layerLock( 10 );
U"Lock11" : layerLock( 11 );
U"Lock12" : layerLock( 12 );
U"Lock13" : layerLock( 13 );
U"Lock14" : layerLock( 14 );
U"Lock15" : layerLock( 15 );
U"Lock16" : layerLock( 16 );
U"Latch1" : layerLatch( 1 );
U"Latch2" : layerLatch( 2 );
U"Latch3" : layerLatch( 3 );
U"Latch4" : layerLatch( 4 );
U"Latch5" : layerLatch( 5 );
U"Latch6" : layerLatch( 6 );
U"Latch7" : layerLatch( 7 );
U"Latch8" : layerLatch( 8 );
U"Latch9" : layerLatch( 9 );
U"Latch10" : layerLatch( 10 );
U"Latch11" : layerLatch( 11 );
U"Latch12" : layerLatch( 12 );
U"Latch13" : layerLatch( 13 );
U"Latch14" : layerLatch( 14 );
U"Latch15" : layerLatch( 15 );
U"Latch16" : layerLatch( 16 );