geekhack

geekhack Projects => Making Stuff Together! => Topic started by: OfTheWild on Wed, 27 July 2016, 15:22:46

Title: TMK keymap question about ACTION_LAYER_TAP_KEY feature?
Post by: OfTheWild on Wed, 27 July 2016, 15:22:46
I'm trying to get my keymap built (still having issues compiling on win10 but thats another issues) and i'm reading matt3o's tutorial and wondered if theres a way to setup the "Fn" key to opperate the numlock function layer via the TAP feature? I'm not sure if that makes sense so i'll describe what i want:

HOLD Fn key = F0 layer keymap
TAP Fn key = num lock=on
...able to use numpad overlay with "789uiojklm." like on a realforce
TAP Fn key again to turn numlock=off

example code from Hasu using ESC key input on TAP, Fn key on hold:
Code: [Select]
const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),
  [1] = ACTION_LAYER_TAP_KEY(1, KC_ESC),
  [2] = ACTION_LAYER_TOGGLE(2)
};

Is this doable/Been done? Is this stupid?
Title: Re: TMK keymap question about ACTION_LAYER_TAP_KEY feature?
Post by: suicidal_orange on Wed, 27 July 2016, 15:51:03
Sounds perfectly reasonable to me, but you don't actually want it to be number lock as you need to swap the keys from those letters to numbers - it will be like another FN.  Something like this where layer 3 has the numbers mapped?

Code: [Select]
const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),
  [1] = ACTION_LAYER_TAP_KEY(1, ACTION_LAYER_TOGGLE(3),
  [2] = ACTION_LAYER_TOGGLE(2)
};

You'll need to set numberlock elsewhere if you want/need real numberpad keycodes, if you don't need them you can just use the top row number codes and not worry about real number lock :)
Title: Re: TMK keymap question about ACTION_LAYER_TAP_KEY feature?
Post by: OfTheWild on Wed, 27 July 2016, 16:24:02
ok so yeah then just on layer3 function i'd just map the tenkey layout from what realforce does when the numlock key is toggled? Makes sense. Thanks, i will try that (and try to get winavr working for compiling this into a hex file)