1
0
Fork 0
This commit is contained in:
cbbrowne 2016-10-13 13:05:33 -04:00
commit f74c560be8
7 changed files with 523 additions and 7 deletions

View file

@ -38,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_H,
CTL_T(KC_GRV),KC_NUBS,KC_NO, KC_NO, KC_LALT,
KC_PSCREEN, KC_PSCREEN,
TO(PROG, ON_PRESS),
TO(PROG),
KC_SPC, MO(NAVI), KC_LGUI,
// right hand
KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_BSPC,
@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
KC_RALT,KC_LBRC,KC_RBRC,KC_NO, CTL_T(KC_QUOT),
MT(0x5, KC_NO), MT(0x5, KC_NO),
TO(PROG, ON_PRESS),
TO(PROG),
KC_RGUI, MO(PROG), KC_SPC
),
@ -81,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
TO(NAVI, ON_PRESS),
TO(NAVI),
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_NO, KC_PSLS, KC_PAST, KC_PMNS, KC_EQUAL,
@ -90,7 +90,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PENT, KC_TRNS,
KC_P0, KC_P0, KC_PDOT, KC_PENT, KC_TRNS,
KC_TRNS, KC_TRNS,
TO(NAVI, ON_PRESS),
TO(NAVI),
KC_TRNS, KC_TRNS, KC_TRNS
),
@ -123,7 +123,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS,
TO(BASE, ON_PRESS),
TO(BASE),
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,
@ -132,7 +132,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLD, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
TO(BASE, ON_PRESS),
TO(BASE),
KC_TRNS, KC_TRNS, KC_TRNS
),
};

View file

@ -0,0 +1,7 @@
## v0.3
*2016-10-11*
### Starting point
* The starting point of this keymap. A beginner layout, and a couple placeholders.

View file

@ -0,0 +1,9 @@
CONSOLE_ENABLE = no # for debugging
SLEEP_LED_ENABLE = no # no led blinking while sleeping
NKRO_ENABLE = yes # disable for windows
TAP_DANCE_ENABLE = yes # tap-tap-tap
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View file

@ -0,0 +1,65 @@
pvinis' keymap
==============
This is a getting-used-to keymap for the [ErgoDox EZ][ez]. It's very much a work in progress.
[ez]: https://ergodox-ez.com/
## Table of Contents
* [Todo](#todo)
* [Layouts](#layouts)
- [Base layer](#base-layer)
- [Beginner layer](#beginner-layer)
- [QWERTY layer](#qwerty-layer)
- [CARPALX layer](#carpalx-layer)
- [System Control layer](#system-control-layer)
- [Template layers](#template-layers)
* [Building](#building)
# Todo
- [ ] Generate images from keymap
- [ ] Implement algernon's heatmap
- [ ] Implement `KC_POP`
# Layouts
## Base layer
This is the base layer that contains the common buttons of all keymaps. Right now, it has the top left button as a `flash` button when it's tapped 4 times, and the two thumb islands. The islands contain the `space` and `enter` keys on the right, the `backspace` and `shift` on the left, and all the 1x1 keys are just layer switches.
Every time I connect the keyboard, I press the `BEGIN` layer switch, and then start typing.
Recently, I added a few application "shortcuts", that basically call `ctrl`+`alt`+`cmd`+`<key>`, and `<key>` is `S` for Slack, `X` for Xcode, `M` for Messenger. Using [Hammerspoon][hammerspoon], I show/hide the application.
[hammerspoon]: http://www.hammerspoon.org/
## Beginner layer
This is a basic keymap I use right now until I'm comfortable typing on the Ergodox. Currently uses a QWERTY layout, and the `([{}])` on the middle keys. Not a perfect layout, and its going to go away at some point, but for now thats my daily driver.
## QWERTY layer
This is basically the same as the `BEGIN` layer, but it might go away. I'm not using it, but I should have a QWERTY layout on the keyboard, in case someone else wants to try it out, or if I completely forget how keyboards work! At some point, this and the `BEGIN` layer will become one.
## CARPALX layer
This is here as a placeholder. I want to transition to [Carpalx QGMLWY][carpalx] or [White][white] at some point. They both look very interesting and more comfortable to type on, but after I'm confident with typing on the Ergodox.
[carpalx]: http://mkweb.bcgsc.ca/carpalx/?full_optimization
[white]: https://github.com/mw8/white_keyboard_layout
## System Control layer
This one is a layer that, in time, will have controls like mouse movement, volume up/down, mute, sleep, restart, shutdown, etc.
## Template layers
I have two commented out layers that are just templates, so I can easily create a new layer.
# Building
```
$ git clone https://github.com/jackhumbert/qmk_firmware.git
$ cd qmk_firmware/keyboards/ergodox/keymaps/pvinis
$ make
```

View file

@ -0,0 +1,430 @@
// pvinis' ergodox keymap
#include "ergodox.h"
#include "mousekey.h"
// easier name for left ctrl-alt-gui
#define ALLM(kc) LCAG(kc)
// layers
enum {
BASE = 0,
BEGIN,
QWERTY,
CARPALX,
SYSCTL,
};
// extra keys
enum {
NONE = 0,
// mouse
MS_UL, // up left
MS_UR, // up right
MS_DL, // down left
MS_DR, // down right
// tap dance
TD_FLSH, // flash keyboard
};
// application selection
// this is sending ctrl-alt-gui-<key>, and this is picked up by hammerspoon
#define AP_SLCK ALLM(KC_S)
#define AP_XCOD ALLM(KC_X)
#define AP_MSGR ALLM(KC_M)
// keymaps
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* BASE
* the base of the keyboard.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* |4x FLASH| | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* |BEGIN |QWERTY| |SYSCTL| |
* ,------|------|------| |------+--------+------.
* | | |CARPAL| |Slack | | |
* |Backsp|LShift|------| |------| Enter |Space |
* | | |SYSCTL| |Msngr | | |
* `--------------------' `----------------------'
*/
[BASE] = KEYMAP(
TD(TD_FLSH) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,TG(BEGIN) ,TG(QWERTY)
,TG(CARPALX)
,KC_BSPC ,KC_LSFT ,TG(SYSCTL)
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,TG(SYSCTL) ,KC_NO
,AP_SLCK
,AP_MSGR ,KC_ENT ,KC_SPC
),
/* BEGIN
* a beginner's keymap i currently use.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | 1 | 2 | 3 | 4 | 5 | 6 | | 6 | 7 | 8 | 9 | 0 | - | = |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* |Esc/Ctrl| A | S | D | F | G |------| |------| H | J | K | L | ; | Enter |
* |--------+------+------+------+------+------| ( | | ) |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | ` | Cmd | | Cmd | | | | | ' | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+--------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `----------------------'
*/
[BEGIN] = KEYMAP(
KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_6
,KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,CTL_T(KC_ESC) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_LPRN
,KC_TRNS ,KC_GRV ,KC_LGUI ,KC_LEFT ,KC_RIGHT
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS ,KC_EQL
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,KC_ENT
,KC_RPRN ,KC_N ,KC_M ,KC_COMM ,KC_DOT ,KC_SLSH ,KC_RSFT
,KC_UP ,KC_DOWN ,KC_TRNS ,KC_QUOT ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* QWERTY
* the default qwerty keymap. not really used, but i'll keep it here for now.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | Q | W | E | R | T | | | | Y | U | I | O | P | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | A | S | D | F | G |------| |------| H | J | K | L | ; | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | Z | X | C | V | B | | | | N | M | , | . | / | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+--------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `----------------------'
*/
[QWERTY] = KEYMAP(
KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_TRNS
,KC_TRNS ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_TRNS
,KC_TRNS ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_TRNS ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_TRNS
,KC_TRNS ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_TRNS
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,KC_TRNS
,KC_TRNS ,KC_N ,KC_M ,KC_COMM ,KC_DOT ,KC_SLSH ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* CARPALX
* the keymap i would like to transition to.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | 1 | 2 | 3 | 4 | 5 | | | RIGHT| 6 | 7 | 8 | 9 | 0 | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | Q | G | M | L | W | | | L1 | Y | F | U | B | ; | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | D | S | T | N | R |------| |------| I | A | E | O | H | |
* |--------+------+------+------+------+------| | | Meh |------+------+------+------+------+--------|
* | | Z | X | C | V | J | | | | K | P | , | . | / | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | Up | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[CARPALX] = KEYMAP(
KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_TRNS
,KC_TRNS ,KC_Q ,KC_G ,KC_M ,KC_L ,KC_W ,KC_TRNS
,KC_TRNS ,KC_D ,KC_S ,KC_T ,KC_N ,KC_R
,KC_TRNS ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_J ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_TRNS
,KC_TRNS ,KC_Y ,KC_F ,KC_U ,KC_B ,KC_SCLN ,KC_TRNS
,KC_I ,KC_A ,KC_E ,KC_O ,KC_H ,KC_TRNS
,KC_TRNS ,KC_K ,KC_P ,KC_COMM ,KC_DOT ,KC_SLSH ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* SYSCTL
* a keymap to control my system.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | Mute |VolDn |VolUp | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | |MsUpL | MsUp |MsUpR | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------| |MsLeft| MsDn |MsRght| | Lock |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | |MsDnL | MsDn | | | Sleep |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | Power|
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | |MidClk|
* ,------|------|------| |------+------+------.
* | | | | | |Left |Right |
* | | |------| |------| Click| Click|
* | | | | | | | |
* `--------------------' `--------------------'
*/
[SYSCTL] = KEYMAP(
KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO
,KC_NO
,KC_NO ,KC_NO ,KC_NO
/*,KC_POP*/,KC_NO ,KC_NO ,KC_NO ,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_NO
/*,KC_PTRN*/,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LCTL(LSFT(KC_PWR))
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_SLEP
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR
,KC_NO ,KC_NO
,KC_NO
,KC_NO ,KC_NO ,KC_NO
),
/* TEMPLATE
* keymap template with transparent and non-transparent keys
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+--------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `----------------------'
*/
/*
[TEMPLATE] = KEYMAP(
KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
[TEMPLATE] = KEYMAP(
KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO
,KC_NO
,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO
,KC_NO
,KC_NO ,KC_NO ,KC_NO
),
*/
};
// keyboard initialization
void matrix_init_user() {
ergodox_led_all_on();
for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) {
ergodox_led_all_set(i);
wait_ms(5);
}
wait_ms(1000);
for (int i = LED_BRIGHTNESS_LO; i > 0; i--) {
ergodox_led_all_set(i);
wait_ms(10);
}
ergodox_led_all_off();
}
// extra keys
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch (id) {
// mouse
case MS_UL:
if (record->event.pressed) {
mousekey_on(KC_MS_UP);
mousekey_on(KC_MS_LEFT);
} else {
mousekey_off(KC_MS_UP);
mousekey_off(KC_MS_LEFT);
}
break;
case MS_UR:
if (record->event.pressed) {
mousekey_on(KC_MS_UP);
mousekey_on(KC_MS_RIGHT);
} else {
mousekey_off(KC_MS_UP);
mousekey_off(KC_MS_RIGHT);
}
break;
case MS_DL:
if (record->event.pressed) {
mousekey_on(KC_MS_DOWN);
mousekey_on(KC_MS_LEFT);
} else {
mousekey_off(KC_MS_DOWN);
mousekey_off(KC_MS_LEFT);
}
break;
case MS_DR:
if (record->event.pressed) {
mousekey_on(KC_MS_DOWN);
mousekey_on(KC_MS_RIGHT);
} else {
mousekey_off(KC_MS_DOWN);
mousekey_off(KC_MS_RIGHT);
}
break;
}
return MACRO_NONE;
}
// tap dances
// flash keyboard on 4x tap, with leds
void flash_each_tap(qk_tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1:
ergodox_right_led_3_on();
break;
case 2:
ergodox_right_led_2_on();
break;
case 3:
ergodox_right_led_1_on();
break;
case 4:
ergodox_right_led_3_off();
wait_ms(50);
ergodox_right_led_2_off();
wait_ms(50);
ergodox_right_led_1_off();
break;
}
}
void flash_dance_finished(qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 4) {
reset_keyboard();
reset_tap_dance(state);
}
}
void flash_dance_reset(qk_tap_dance_state_t *state, void *user_data) {
ergodox_right_led_1_off();
wait_ms(50);
ergodox_right_led_2_off();
wait_ms(50);
ergodox_right_led_3_off();
}
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED( flash_each_tap, flash_dance_finished, flash_dance_reset ),
};

View file

@ -296,7 +296,10 @@ enum quantum_keycodes {
// ON_PRESS = 1
// ON_RELEASE = 2
// Unless you have a good reason not to do so, prefer ON_PRESS (1) as your default.
#define TO(layer, when) (layer | QK_TO | (when << 0x4))
// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own
// keycode modeled after the old version, kept below for this.
/* #define TO(layer, when) (layer | QK_TO | (when << 0x4)) */
#define TO(layer) (layer | QK_TO | (ON_PRESS << 0x4))
// Momentary switch layer - 256 layer max
#define MO(layer) (layer | QK_MOMENTARY)

View file

@ -379,6 +379,8 @@ Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` -
`TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack.
`TO(layer)` - Goes to a layer. This code is special, because it lets you go either up or down the stack -- just goes directly to the layer you want. So while other codes only let you go _up_ the stack (from layer 0 to layer 3, for example), `TO(2)` is going to get you to layer 2, no matter where you activate it from -- even if you're currently on layer 5. This gets activated on keydown (as soon as the key is pressed).
### Fun with modifier keys