From dacc54fa1a6c6e05972519007621ab7717be63e1 Mon Sep 17 00:00:00 2001 From: Ben Blazak Date: Tue, 16 Oct 2012 16:48:54 -0700 Subject: [PATCH] layout/qwerty -> layout/qwerty-kinesis-mod - NOT TESTED YET. still need to do that - also, got an idea for layer masking... possible future changes: - i'd like to make the layer matrices just '_kb_layout_values', and '_kb_layout_functions'. - i'd like to make layer masks implemented with a special function 'kbfun_layermask_transparent' or something similar. a function that looks up what would have been pressed if that layer wasn't active. they could be chainable, i.e. a lookup for such a function could end up calling the same function (if two layermasks were active on top of on another), which would then call a real key. these wouldn't be allowed on the base layer, of course... and then, all i'd have to do to keep track of layers would be keep a variable length array (or not... maybe an array of length 10 or something) of which layer is active... :) - i'd like to have a thing (this isn't a very complete thought yet) where keypresses are looked up first in the EEPROM, to see if there's a definition there. if there isn't (which should usually be the case) then the standard definition for that key from the matrices would be used. this would allow macros (and redefinitions) without reflashing. this would also be convenient, once the mechanism was implemented, for assigning keys multiple decomposable actions... dunno exactly how it'll work out yet though. layer stuff comes first. --- build-scripts/gen-layout.py | 54 ++++--- .../layout/{qwerty.c => qwerty-kinesis-mod.c} | 132 +++++++++--------- .../layout/{qwerty.h => qwerty-kinesis-mod.h} | 0 src/lib/key-functions/public/numpad.c | 10 +- src/makefile-options | 5 +- 5 files changed, 107 insertions(+), 94 deletions(-) rename src/keyboard/ergodox/layout/{qwerty.c => qwerty-kinesis-mod.c} (69%) rename src/keyboard/ergodox/layout/{qwerty.h => qwerty-kinesis-mod.h} (100%) diff --git a/build-scripts/gen-layout.py b/build-scripts/gen-layout.py index 56adcf6..fec5225 100755 --- a/build-scripts/gen-layout.py +++ b/build-scripts/gen-layout.py @@ -1,4 +1,18 @@ #! /usr/bin/env python3 +# ----------------------------------------------------------------------------- +# Copyright (c) 2012 Ben Blazak +# Released under The MIT License (MIT) (see "license.md") +# Project located at +# ----------------------------------------------------------------------------- + +""" +Generate a depiction of the layout (in html + svg) + +Depends on: +- the UI info file (in JSON) +""" + +# ----------------------------------------------------------------------------- import argparse import json @@ -76,7 +90,7 @@ def main(): for (name, (code, press, release)) \ in zip(info.matrix_positions, layout): replace = '' - if press == '&kbfun_jump_to_bootloader': + if press == 'kbfun_jump_to_bootloader': replace = '[btldr]' elif re.search(r'layer', press): replace = '[layer]' @@ -98,9 +112,9 @@ def main(): # ----------------------------------------------------------------------------- keycode_to_string = { - 0x01: "ErrorRollOver", + 0x01: "Error", # ErrorRollOver 0x02: "POSTFail", - 0x03: "ErrorUndefined", + 0x03: "Error", # ErrorUndefined 0x04: "a A", 0x05: "b B", 0x06: "c C", @@ -154,7 +168,7 @@ keycode_to_string = { 0x36: ", <", 0x37: ". >", 0x38: "/ ?", - 0x39: "CapsLock", + 0x39: "Caps", 0x3A: "F1", 0x3B: "F2", 0x3C: "F3", @@ -181,12 +195,12 @@ keycode_to_string = { 0x51: "\u2193", # down arrow 0x52: "\u2191", # up arrow - 0x53: "NumLock Clear", + 0x53: "Num", 0x54: "/", 0x55: "*", 0x56: "-", 0x57: "+", - 0x58: "Enter(kp)", + 0x58: "Enter", 0x59: "1 End", 0x5A: "2 \u2193", # down arrow 0x5B: "3 Pg\u2193", # down arrow @@ -200,7 +214,7 @@ keycode_to_string = { 0x63: ". Del", 0x64: "\ |", - 0x65: "Application", + 0x65: "App", 0x66: "Power", 0x67: "=", @@ -229,8 +243,8 @@ keycode_to_string = { 0x7D: "Paste", 0x7E: "Find", 0x7F: "Mute", - 0x80: "VolumeUp", - 0x81: "VolumeDown", + 0x80: "VolUp", + 0x81: "VolDown", 0x82: "LockingCapsLock", 0x83: "LockingNumLock", 0x84: "LockingScrollLock", @@ -238,15 +252,15 @@ keycode_to_string = { 0x85: ",", 0x86: "=", - 0x87: "International1", - 0x88: "International2", - 0x89: "International3", - 0x8A: "International4", - 0x8B: "International5", - 0x8C: "International6", - 0x8D: "International7", - 0x8E: "International8", - 0x8F: "International9", + 0x87: "Int1", + 0x88: "Int2", + 0x89: "Int3", + 0x8A: "Int4", + 0x8B: "Int5", + 0x8C: "Int6", + 0x8D: "Int7", + 0x8E: "Int8", + 0x8F: "Int9", 0x90: "LANG1", 0x91: "LANG2", 0x92: "LANG3", @@ -274,7 +288,7 @@ keycode_to_string = { 0xB2: "Thousands_Sep", 0xB3: "Decimal_Sep", - 0xB4: "Currency_Unit", + 0xB4: "$", 0xB5: "Currency_Subunit", 0xB6: "(", @@ -316,7 +330,7 @@ keycode_to_string = { 0xD9: "ClearEntry", 0xDA: "Binary", 0xDB: "Octal", - 0xDC: "Decimal", + 0xDC: ".", 0xDD: "Hexadecimal", 0xE0: "L-Ctrl", diff --git a/src/keyboard/ergodox/layout/qwerty.c b/src/keyboard/ergodox/layout/qwerty-kinesis-mod.c similarity index 69% rename from src/keyboard/ergodox/layout/qwerty.c rename to src/keyboard/ergodox/layout/qwerty-kinesis-mod.c index 9159428..bb419f2 100644 --- a/src/keyboard/ergodox/layout/qwerty.c +++ b/src/keyboard/ergodox/layout/qwerty-kinesis-mod.c @@ -1,7 +1,5 @@ /* ---------------------------------------------------------------------------- - * ergoDOX layout : QWERTY - * - * TODO: This is a temporary version. It will be replaced later. + * ergoDOX layout : QWERTY (modified from the Kinesis layout) * ---------------------------------------------------------------------------- * Copyright (c) 2012 Ben Blazak * Released under The MIT License (MIT) (see "license.md") @@ -47,20 +45,20 @@ const uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { // unused 0, // left hand - _grave, _1, _2, _3, _4, _5, _equal, -_bracketL, _Q, _W, _E, _R, _T, _esc, - _tab, _A, _S, _D, _F, _G, - _shiftL, _Z, _X, _C, _V, _B, 1, - _guiL, _arrowL, _arrowU, _arrowD, _arrowR, - _bs, 0, - _del, 0, _ctrlL, - _end, _home, _altL, + _equal, _1, _2, _3, _4, _5, _esc, + _tab, _Q, _W, _E, _R, _T, 1, +_capsLock, _A, _S, _D, _F, _G, + _shiftL, _Z, _X, _C, _V, _B, 1, + _guiL, _grave, _backslash, _arrowL, _arrowR, + _bs, 0, + _del, 0, _ctrlL, + _end, _home, _altL, // right hand - _backslash, _6, _7, _8, _9, _0, _dash, - _bracketL, _Y, _U, _I, _O, _P, _bracketR, - _H, _J, _K, _L, _semicolon, _quote, - 1, _N, _M, _comma, _period, _slash, _shiftR, - _arrowL, _arrowD, _arrowU, _arrowR, _guiR, + 2, _6, _7, _8, _9, _0, _dash, + _bracketL, _Y, _U, _I, _O, _P, _bracketR, + _H, _J, _K, _L, _semicolon, _quote, + 1, _N, _M, _comma, _period, _slash, _shiftR, + _arrowL, _arrowD, _arrowU, _arrowR, _guiR, 0, _space, _ctrlR, 0, _enter, _altR, _pageU, _pageD ), @@ -69,45 +67,45 @@ _ctrlR, 0, _enter, // unused 0, // left hand --1, _F1, _F2, _F3, _F4, _F5, _F11, - 0, _braceL_kp, _braceR_kp, _bracketL, _bracketR, 0, _esc, - 0, _semicolon, _slash, _dash, 0, _colon_kp, - 2, 0, 0, 0, 0, 0, 0, - 0, _arrowL, _arrowU, _arrowD, _arrowR, - _bs, 0, - _del, 0, _ctrlL, - _end, _home, _altL, + _equal, _F1, _F2, _F3, _F4, _F5, _F11, + _tab, _braceL_kp, _braceR_kp, _bracketL, _bracketR, 0, 1, +_capsLock, _semicolon, _slash, _dash, _0_kp, _colon_kp, + _shiftL, _6_kp, _7_kp, _8_kp, _9_kp, _add_kp, 0, + _guiL, _grave, _backslash, _arrowL, _arrowR, + _bs, 0, + _del, 0, _ctrlL, + _end, _home, _altL, // right hand - _F12, _F6, _F7, _F8, _F9, _F10, 0, - 2, 0, _dash, _lt_kp, _gt_kp, _currencyUnit, 0, - _backslash, 0, _parenL_kp, _parenR_kp, _equal, 0, - 0, _mul_kp, 0, 0, 0, 0, 0, - _arrowL, _arrowD, _arrowU, _arrowR, 0, - 0, _space, -_ctrlR, 0, _enter, - _altR, _pageU, _pageD ), + _F12, _F6, _F7, _F8, _F9, _F10, _dash, +_bracketL, 0, _dash, _lt_kp, _gt_kp,_currencyUnit,_bracketR, + _backslash, _1_kp,_parenL_kp,_parenR_kp, _equal_kp, _quote, + 0, _mul_kp, _2_kp, _3_kp, _4_kp, _5_kp, _shiftR, + _arrowL, _arrowD, _arrowU, _arrowR, _guiR, + 0, _space, +_ctrlR, 0, _enter, + _altR, _pageU, _pageD ), // -------------------------------------------------------------------- KB_MATRIX_LAYER( // layout: layer 2: numpad // unused 0, // left hand -0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, - 0, 0, - 0, 0, 0, - 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, +0, _insert, 0, 0, 0, + 0, 0, + 0, 0, 0, + 0, 0, 0, // right hand - 0, 0, _7_kp, _8_kp, _9_kp, _div_kp, 0, - 0, 0, _4_kp, _5_kp, _6_kp, _mul_kp, 0, - 0, _1_kp, _2_kp, _3_kp, _sub_kp, 0, - 0, 0, _0_kp, _period, 0, _add_kp, 0, - 0, 0, 0, 0, 0, - 0, 0, -0, 0, 0, -0, 0, 0 ) +2, 0, 2, _equal_kp, _div_kp, _mul_kp, 0, +0, 0, _7_kp, _8_kp, _9_kp, _sub_kp, 0, + 0, _4_kp, _5_kp, _6_kp, _add_kp, 0, +0, 0, _1_kp, _2_kp, _3_kp, _enter_kp, 0, + 0, 0, _dec_kp, _enter_kp, 0, + 0, _0_kp, +0, 0, 0, +0, 0, 0 ), // -------------------------------------------------------------------- }; @@ -120,7 +118,7 @@ const void_funptr_t PROGMEM _kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { NULL, // left hand f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, -f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, +f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_l_inc, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_2kcap,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_l_inc, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, @@ -128,7 +126,7 @@ f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel, NULL,f_prrel, f_prrel,f_prrel,f_prrel, // right hand - f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, + f_np_to,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_l_inc,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_2kcap, @@ -141,19 +139,19 @@ f_prrel,f_prrel,f_prrel ), // unused NULL, // left hand -f_btldr,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, +f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL,f_l_dec, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, -f_np_on,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL, +f_2kcap,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel, NULL, f_prrel, NULL,f_prrel, f_prrel,f_prrel,f_prrel, // right hand f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, - f_np_to,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, + f_prrel, NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, - NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, + NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_2kcap, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL,f_prrel, f_prrel, NULL,f_prrel, @@ -172,14 +170,14 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, // right hand - NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, + f_np_to, NULL,f_np_to,f_prrel,f_prrel,f_prrel, NULL, NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, + NULL, NULL,f_prrel,f_prrel, NULL, + NULL,f_prrel, NULL, NULL, NULL, - NULL, NULL, NULL ) + NULL, NULL, NULL ), // -------------------------------------------------------------------- }; @@ -192,7 +190,7 @@ const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS] = NULL, // left hand f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, -f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, +f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_2kcap,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_l_dec, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, @@ -200,7 +198,7 @@ f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel, NULL,f_prrel, f_prrel,f_prrel,f_prrel, // right hand - f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, + NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_l_dec,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_2kcap, @@ -214,18 +212,18 @@ f_prrel,f_prrel,f_prrel ), NULL, // left hand NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, -f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, +f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL, NULL, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, -f_np_of,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL, +f_2kcap,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel, NULL, f_prrel, NULL,f_prrel, f_prrel,f_prrel,f_prrel, // right hand f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, - NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, + f_prrel, NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, - NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, + NULL,f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,f_2kcap, f_prrel,f_prrel,f_prrel,f_prrel,f_prrel, NULL,f_prrel, f_prrel, NULL,f_prrel, @@ -244,12 +242,12 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, // right hand - NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, + NULL, NULL, NULL,f_prrel,f_prrel,f_prrel, NULL, NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, NULL, NULL,f_prrel,f_prrel,f_prrel,f_prrel, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, + NULL, NULL,f_prrel,f_prrel, NULL, + NULL,f_prrel, NULL, NULL, NULL, NULL, NULL, NULL ), // -------------------------------------------------------------------- diff --git a/src/keyboard/ergodox/layout/qwerty.h b/src/keyboard/ergodox/layout/qwerty-kinesis-mod.h similarity index 100% rename from src/keyboard/ergodox/layout/qwerty.h rename to src/keyboard/ergodox/layout/qwerty-kinesis-mod.h diff --git a/src/lib/key-functions/public/numpad.c b/src/lib/key-functions/public/numpad.c index c497940..63a60cd 100644 --- a/src/lib/key-functions/public/numpad.c +++ b/src/lib/key-functions/public/numpad.c @@ -55,20 +55,20 @@ static bool _layer_mask[KB_ROWS][KB_COLUMNS] = // left hand 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // right hand - 0, 0, 1, 1, 1, 1, 0, + 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, - 0, 0, + 0, 0, 1, 1, 0, + 0, 1, 0, 0, 0, 0, 0, 0 ); diff --git a/src/makefile-options b/src/makefile-options index faaa4ec..ab08efa 100644 --- a/src/makefile-options +++ b/src/makefile-options @@ -9,8 +9,9 @@ TARGET := firmware # the name we want for our program binary KEYBOARD := ergodox # keyboard model; see "src/keyboard" for what's available -LAYOUT := qwerty # keyboard layout; see "src/keyboard/*/layout" for what's - # available +LAYOUT := qwerty-kinesis-mod # keyboard layout + # see "src/keyboard/*/layout" for what's + # available LED_BRIGHTNESS := 0.5 # a multiplier, with 1 being the max DEBOUNCE_TIME := 5 # in ms; see keyswitch spec for necessary value; 5ms should