geekhack
geekhack Community => Keyboards => Topic started by: apanzerj on Tue, 25 April 2017, 00:27:07
-
Is there a good intro article or something that goes over the very basics? I'm just trying to get layer switching working. I can't seem to switch layers back after going forward. IE: I can get to layer 1 but then I can't get back.
I'm using a USB-to-USB converter.
#include "keymap_common.h"
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
KEYMAP_ALL(
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
ESC, FN1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP,
GRV, FN1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN,
TAB, Q, 0, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO,
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY,
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE,
LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT
),
KEYMAP_ALL(
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
ESC, F1, FN0, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP,
GRV, 1, FN0, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN,
TAB, Q, W, 1, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO,
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY,
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE,
LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT
),
};
const action_t PROGMEM fn_actions[] = {
ACTION_LAYER_TOGGLE(0),
ACTION_LAYER_TOGGLE(1)
};
-
toggle means switch to
what you are looking for is ACTION_LAYER_MOMENTARY,
which changes to lvl2 while holding down and when released you get back.
-
By the look of your code, everything should work as intended.
I don't know if it matters much, but your second line should read like this:
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
You're missing PROGMEM.
-
I didn't want to do the momentary, I wanted to actually switch to that layer.
I'll add PROGMEM in there and report back.
-
i used
http://qmk.sized.io/
it makes it a bit easier
your tg(whatever layer) button should also be your trns button to go back to your previous layer
-
your tg(whatever layer) button should also be your trns button to go back to your previous layer
I don't get what you just said there. What does tg mean? If one of my FN keys is set to toggle layer 1 then you can't use trns because that would just still do toggle layer 1, right?
-
Change this array:
const action_t PROGMEM fn_actions[] = {
ACTION_LAYER_TOGGLE(0),
ACTION_LAYER_TOGGLE(1)
};
to:
static const action_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_TOGGLE(1),
[1] = ACTION_LAYER_TOGGLE(0)
};
-
TOGGLE just turns on/off specific layer.
So you will have to useTOGGLE(1) to turn off layer 1 if you activated it with TOGGLE(1).
these may help.
https://github.com/tmk/tmk_core/blob/master/doc/keymap.md
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap