diff --git a/src/keyboard/ergodox/layout/qwerty-kinesis-mod.c b/src/keyboard/ergodox/layout/qwerty-kinesis-mod.c index cceeb43..62eef33 100644 --- a/src/keyboard/ergodox/layout/qwerty-kinesis-mod.c +++ b/src/keyboard/ergodox/layout/qwerty-kinesis-mod.c @@ -35,11 +35,11 @@ _capsLock, _A, _S, _D, _F, _G, _del, 0, _ctrlL, _end, _home, _altL, // right hand - 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, + 3, _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 ), @@ -106,7 +106,7 @@ _ctrlR, 0, _enter, 0, 0, 0, 0, 0, 0, // right hand -2, 0, 2, _equal_kp, _div_kp, _mul_kp, 0, +3, 0, 3, _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, diff --git a/src/lib/key-functions/public/basic.c b/src/lib/key-functions/public/basic.c index c0836b0..9dcb2c2 100644 --- a/src/lib/key-functions/public/basic.c +++ b/src/lib/key-functions/public/basic.c @@ -67,7 +67,7 @@ void kbfun_toggle(void) { void kbfun_transparent(void) { LAYER_OFFSET++; LAYER = main_layers_peek(LAYER_OFFSET); - main_layers_pressed[row][col] = LAYER; + main_layers_pressed[ROW][COL] = LAYER; main_exec_key(); } diff --git a/src/lib/key-functions/public/special.c b/src/lib/key-functions/public/special.c index ce1013a..6527bda 100644 --- a/src/lib/key-functions/public/special.c +++ b/src/lib/key-functions/public/special.c @@ -88,9 +88,9 @@ void kbfun_2_keys_capslock_press_release(void) { static uint8_t numpad_layer_id; static inline void numpad_toggle_numlock(void) { - _kbfun_press_release(true, KEYPAD_NumLock_Clear); + _kbfun_press_release(true, KEY_LockingNumLock); usb_keyboard_send(); - _kbfun_press_release(false, KEYPAD_NumLock_Clear); + _kbfun_press_release(false, KEY_LockingNumLock); usb_keyboard_send(); } diff --git a/src/main.c b/src/main.c index c0c1086..ac8cdc4 100644 --- a/src/main.c +++ b/src/main.c @@ -165,20 +165,18 @@ void main_exec_key(void) { * Implemented as a fixed size stack. * ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- + struct layers { uint8_t layer; uint8_t id; }; -struct layers_info { - uint8_t head; - bool ids_in_use[MAX_ACTIVE_LAYERS]; -}; -static struct layers layers[MAX_ACTIVE_LAYERS]; -static struct layers_info layers_info = { - // .head = 0, // default - .ids_in_use = {true}, // id 0 = true; id's 1..max = false -}; +// ---------------------------------------------------------------------------- + +struct layers layers[MAX_ACTIVE_LAYERS]; +uint8_t layers_head = 0; +uint8_t layers_ids_in_use[MAX_ACTIVE_LAYERS] = {true}; /* * peek() @@ -191,10 +189,10 @@ static struct layers_info layers_info = { * - failure: 0 (default) (out of bounds) */ uint8_t main_layers_peek(uint8_t offset) { - if (offset > layers_info.head) // uint8_t, so they're both >0 - return 0; // default + if (offset <= layers_head) + return layers[layers_head - offset].layer; - return layers[layers_info.head - offset].layer; + return 0; // default, or error } /* @@ -208,25 +206,18 @@ uint8_t main_layers_peek(uint8_t offset) { * - failure: 0 (the stack was already full) */ uint8_t main_layers_push(uint8_t layer) { - if (layers_info.head == MAX_ACTIVE_LAYERS) - return 0; // error - - layers_info.head++; - + // look for an available id for (uint8_t id=1; id