]> git.donarmstrong.com Git - kiibohd-kll.git/commitdiff
Adding Lock and Latch symbolic names (e.g. Function)
authorJacob Alexander <haata@kiibohd.com>
Sun, 20 Sep 2015 21:45:42 +0000 (14:45 -0700)
committerJacob Alexander <haata@kiibohd.com>
Sun, 20 Sep 2015 21:45:42 +0000 (14:45 -0700)
- 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 );

kll.py
kll_lib/hid_dict.py
layouts/lcdFuncMap.kll
layouts/mdergo1Overlay.kll
layouts/stdFuncMap.kll

diff --git a/kll.py b/kll.py
index accbca6cfcf1fad94003121cc3979d8b841db888..e9ea19b6d26b4647f0829d6c63173610995240c6 100755 (executable)
--- a/kll.py
+++ b/kll.py
@@ -182,9 +182,10 @@ capabilities_dict = Capabilities()
 def make_scanCode( token ):
        scanCode = int( token[1:], 0 )
        # Check size, to make sure it's valid
-       if scanCode > 0xFF:
-               print ( "{0} ScanCode value {1} is larger than 255".format( ERROR, scanCode ) )
-               raise
+       # XXX Add better check that takes symbolic names into account (i.e. U"Latch5")
+       #if scanCode > 0xFF:
+       #       print ( "{0} ScanCode value {1} is larger than 255".format( ERROR, scanCode ) )
+       #       raise
        return scanCode
 
 def make_hidCode( type, token ):
@@ -214,9 +215,10 @@ def make_hidCode( type, token ):
                        hidCode = int( token, 0 )
 
        # Check size if a USB Code, to make sure it's valid
-       if type == 'USBCode' and hidCode > 0xFF:
-               print ( "{0} USBCode value {1} is larger than 255".format( ERROR, hidCode ) )
-               raise
+       # XXX Add better check that takes symbolic names into account (i.e. U"Latch5")
+       #if type == 'USBCode' and hidCode > 0xFF:
+       #       print ( "{0} USBCode value {1} is larger than 255".format( ERROR, hidCode ) )
+       #       raise
 
        # Return a tuple, identifying which type it is
        if type == 'USBCode':
index f244509349073e35c32c16394a95938e9120d5fa..a0bfc5b3baa736422d4c3de1375cc9c1589e9b69 100644 (file)
@@ -262,6 +262,39 @@ hid_lookup_dictionary = dict([
        ( ('USB', 0xFD), 'KEY_FUN14' ),
        ( ('USB', 0xFE), 'KEY_FUN15' ),
        ( ('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
 # 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) ),
        ( '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) ),
        ( 'FUN2', ('USB', 0xF1) ), ( 'FUNCTION2', ('USB', 0xF1) ),
        ( 'FUN3', ('USB', 0xF2) ), ( 'FUNCTION3', ('USB', 0xF2) ),
@@ -991,6 +1025,38 @@ kll_hid_lookup_dictionary['USBCode'] = dict([
        ( 'FUN14', ('USB', 0xFD) ), ( 'FUNCTION14', ('USB', 0xFD) ),
        ( 'FUN15', ('USB', 0xFE) ), ( 'FUNCTION15', ('USB', 0xFE) ),
        ( '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) ),
 ])
 
 
index 95f450fe13221f13fcc27386a0a11a35d0009308..b9d979cebd7817ed1d6cb4dadb4be5650289c5f9 100644 (file)
@@ -1,10 +1,10 @@
 Name = lcdFuncMap;
-Version = 0.1;
+Version = 0.2;
 Author = "HaaTa (Jacob Alexander) 2015";
 KLL = 0.3c;
 
 # Modified Date
-Date = 2015-08-17;
+Date = 2015-09-20;
 
 # Maps each Function key incrementally to each layer
 # Unused layers and functions are ignored
@@ -26,6 +26,40 @@ U"Function14" : layerShift( 14 ) + LCDLayerDisplay();
 U"Function15" : layerShift( 15 ) + 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
 # The "top of stack" layer is the colour used
index 5115476af5dd1a0a0bbd0e730466f83cf652d07d..3b6a8b5c8209b5a585cd3c5f3afde49342f39941 100644 (file)
@@ -1,10 +1,10 @@
 Name = mdergo1Overlay;
-Version = 0.1;
+Version = 0.2;
 Author = "HaaTa (Jacob Alexander) 2015";
 KLL = 0.3c;
 
 # Modified Date
-Date = 2015-08-21;
+Date = 2015-09-20;
 
 # Make default layout more like the original ErgoDox default layout
 # 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
 
 # Top Row - Right
-# XXX Currently there are no "convenience" Function symbolic names for layerLock
-#     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
+U"Function6" : U"Lock2";
 
 # Top-Middle Row - Left
-U"Function1" : layerLock( 1 ) + LCDLayerDisplay(); # Lock layer 1, and LCD update
+U"Function1" : U"Lock1";
 
 # Bottom-Middle Row - Left
 U"Function2" : U"Function1"; # Set Function2 to be layer shift 1
index 2f174faf6b49f7318b824dbb8cb463e96a4902e6..7d1e6c863b571a84949e8af2cd5f4674ce03e06c 100644 (file)
@@ -1,10 +1,10 @@
 Name = stdFuncMap;
-Version = 0.1;
-Author = "HaaTa (Jacob Alexander) 2014";
+Version = 0.2;
+Author = "HaaTa (Jacob Alexander) 2014-2015";
 KLL = 0.3;
 
 # Modified Date
-Date = 2014-09-14;
+Date = 2015-09-20;
 
 # Maps each Function key incrementally to each layer
 # Unused layers and functions are ignored
@@ -26,3 +26,37 @@ U"Function14" : layerShift( 14 );
 U"Function15" : layerShift( 15 );
 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 );
+