[Keymap] Add dhertz' kanu layout (#11346)

* Add dhertz' kanu layout

* Fix delete button

* Add weak user layer change
This commit is contained in:
Dan Hertz 2021-01-12 17:53:15 -08:00 committed by GitHub
parent 1eaad6dd65
commit c81e07fef5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 4 deletions

View file

@ -35,7 +35,8 @@ bool led_update_kb(led_t led_state) {
return true; return true;
} }
layer_state_t layer_state_set_kb(layer_state_t state) { __attribute__((weak))
layer_state_t layer_state_set_user(layer_state_t state) {
// if on layer 1, turn on D2 LED, otherwise off. // if on layer 1, turn on D2 LED, otherwise off.
writePin(D2, get_highest_layer(state) == 1); writePin(D2, get_highest_layer(state) == 1);
// if on layer 2, turn on D1 LED, otherwise off. // if on layer 2, turn on D1 LED, otherwise off.
@ -43,4 +44,4 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
// if on layer 3, turn on D0 LED, otherwise off. // if on layer 3, turn on D0 LED, otherwise off.
writePin(D0, get_highest_layer(state) == 3); writePin(D0, get_highest_layer(state) == 3);
return state; return state;
} }

View file

@ -48,6 +48,21 @@
{ k61, k62, k63, KC_NO, KC_NO, KC_NO, k65, KC_NO, KC_NO, k66, k67, k68, k69, k70, k71 }, \ { k61, k62, k63, KC_NO, KC_NO, KC_NO, k65, KC_NO, KC_NO, k66, k67, k68, k69, k70, k71 }, \
} }
#define LAYOUT_65_iso_blocker( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12, k13, k66, \
k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26, k27, k29, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k40, k41, k42, k43, k45, \
k46, k47, k48, k49, k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k60, \
k61, k62, k63, k65, k67, k68, k69, k70, k71 \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12, k13, KC_NO }, \
{ k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26, k27, KC_NO, k29 }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k40, k41, k42, k43, k45 }, \
{ k46, k47, k48, k49, k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k60 }, \
{ k61, k62, k63, KC_NO, KC_NO, KC_NO, k65, KC_NO, KC_NO, k66, k67, k68, k69, k70, k71 }, \
}
#define LAYOUT_65_ansi_blocker( \ #define LAYOUT_65_ansi_blocker( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12, k13, k66, \ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12, k13, k66, \
k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \ k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \

View file

@ -0,0 +1,62 @@
#include QMK_KEYBOARD_H
#include "dhertz.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,---------------------------------------------------------------.
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Backsp|Del|
* |---------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Enter|Hom|
* |------------------------------------------------------` |---|
* |SrCtl | A| S| D| F| G| H| J| K| L| ;| '| \| |End|
* |---------------------------------------------------------------|
* |Shif| #| Z| X| C| V| B| N| M| ,| .| /|Shift |Up |PgD|
* |---------------------------------------------------------------|
* |NcCtl| Alt| CTab| LyrSpc | CGv| Alt|Lef|Dow|Rig|
* `---------------------------------------------------------------'
*/
[0] = LAYOUT_65_iso_blocker(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_HOME,
SRCH_CTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_END,
KC_LSFT, HSH_TLD, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,
NC_CTL, KC_LALT, CMD_TAB_CMD, LYR_SPC, CMD_GRV_CMD, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT
),
/* Layer 1: Special
* ,---------------------------------------------------------------.
* | §| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |Iso|
* |---------------------------------------------------------------|
* | | | | | | | | | | | | | | | |
* |------------------------------------------------------` |---|
* | | | | | | | | | |CSL| | | `| | |
* |---------------------------------------------------------------|
* | | `| | |CAC| | | | | | | | |PgU| |
* |---------------------------------------------------------------|
* | | | | | | |Hom|PgD|End|
* `---------------------------------------------------------------'
*/
[1] = LAYOUT_65_iso_blocker(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, ISO_COUNTRY_CODE,
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, CMD_SFT_L, KC_TRNS, KC_TRNS, KC_NUBS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_NUBS, KC_TRNS, KC_TRNS, CMD_ALT_C, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDOWN, KC_END
),
};
void keyboard_post_init_user(void) {
rgblight_enable_noeeprom();
rgblight_sethsv_teal();
}
layer_state_t layer_state_set_keymap(layer_state_t state) {
switch (get_highest_layer(state)) {
case 1:
rgblight_sethsv_noeeprom_magenta();
break;
default: // for any other layers, or the default layer
rgblight_sethsv_noeeprom_teal();
break;
}
return state;
}

View file

@ -21,4 +21,4 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output AUDIO_ENABLE = no # Audio output
LAYOUTS = 65_ansi_blocker 65_iso_blocker_split_bs LAYOUTS = 65_ansi_blocker 65_iso_blocker_split_bs 65_iso_blocker

View file

@ -91,7 +91,7 @@ void mod_or_mod_with_macro(keyrecord_t *record, uint16_t kc_mod, char* macro) {
// Runs state check and changes underglow color and animation // Runs state check and changes underglow color and animation
// on layer change, no matter where the change was initiated // on layer change, no matter where the change was initiated
// Then runs keymap's layer change check // Then runs keymap's layer change check
uint32_t layer_state_set_user (uint32_t state) { layer_state_t layer_state_set_user (layer_state_t state) {
return layer_state_set_keymap (state); return layer_state_set_keymap (state);
} }