diff options
author | Øyvind Wilhelmsen <46304257+oeywil@users.noreply.github.com> | 2019-04-17 20:07:19 +0200 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-04-17 11:07:19 -0700 |
commit | f05927a2f0d688f8c4e9496ba995c454511b1a97 (patch) | |
tree | 5a8a3248183cd8c4313f377881d89e0af26b687b /keyboards/planck | |
parent | 4cd3afc7e95f8ae58b13be544310c44e1dd5a775 (diff) |
[Keymap] Update to oeywil's keymap (#5614)
* Switched to grid, added leader key and space cadet shift
* renamed layer, removed sound
* fixed comment
* added comment
* Added tap dance
* Added comments
* removed useless sound
* removed useless comments
* removed useless cases
* changed to register_code16 function
* renamed variables
* fixed typo
* fixed indentation
Diffstat (limited to 'keyboards/planck')
-rw-r--r-- | keyboards/planck/keymaps/oeywil/.gitignore | 2 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oeywil/config.h | 13 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oeywil/keymap.c | 462 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oeywil/no_keycodes.h | 28 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oeywil/readme.md | 7 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oeywil/rules.mk | 14 |
6 files changed, 373 insertions, 153 deletions
diff --git a/keyboards/planck/keymaps/oeywil/.gitignore b/keyboards/planck/keymaps/oeywil/.gitignore index a7fbec4747..03b2b46668 100644 --- a/keyboards/planck/keymaps/oeywil/.gitignore +++ b/keyboards/planck/keymaps/oeywil/.gitignore @@ -1 +1 @@ -secret.h +secrets.h diff --git a/keyboards/planck/keymaps/oeywil/config.h b/keyboards/planck/keymaps/oeywil/config.h index 215ea9f75c..09b22e193e 100644 --- a/keyboards/planck/keymaps/oeywil/config.h +++ b/keyboards/planck/keymaps/oeywil/config.h @@ -1,7 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "config_common.h" +#pragma once #ifdef AUDIO_ENABLE #define STARTUP_SONG SONG(PLANCK_SOUND) @@ -32,7 +29,9 @@ /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ //#define MIDI_TONE_KEYCODE_OCTAVES 2 -// Most tactile encoders have detents every 4 stages -#define ENCODER_RESOLUTION 4 +// Leader Key +#define LEADER_TIMEOUT 250 +#define LEADER_PER_KEY_TIMING -#endif +// Tap dance +#define TAPPING_TERM 200 diff --git a/keyboards/planck/keymaps/oeywil/keymap.c b/keyboards/planck/keymaps/oeywil/keymap.c index f718c8f6a7..59e76cab12 100644 --- a/keyboards/planck/keymaps/oeywil/keymap.c +++ b/keyboards/planck/keymaps/oeywil/keymap.c @@ -1,112 +1,139 @@ #include QMK_KEYBOARD_H -#include "secret.h" +#include "no_keycodes.h" +#if __has_include("secrets.h") +# include "secrets.h" +#else +# define mail_str "" +# define pwd_str "" +#endif + +// layer definitions enum planck_layers { _DEFAULT, _LOWER, _RAISE, - _FUNCTION, _GAME, - _GAMERAISE + _GLOW }; -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) -#define FUNCTION MO(_FUNCTION) -#define GAMER MO(_GAMERAISE) - -#define NO_OE KC_SCLN -#define NO_AE KC_QUOT -#define NO_AA KC_LBRC -#define NO_EXCL LSFT(KC_1) -#define NO_QEST LSFT(KC_MINS) -#define NO_APOS KC_BSLS -#define NO_QUOT LSFT(KC_2) -#define NO_UMLA KC_RBRC -#define NO_HASH LSFT(KC_3) -#define NO_FSLS LSFT(KC_7) -#define NO_LPAR LSFT(KC_8) -#define NO_RPAR LSFT(KC_9) -#define NO_ALFA ALGR(KC_2) -#define NO_AMPE LSFT(KC_6) -#define NO_USDO ALGR(KC_4) -#define NO_PERC LSFT(KC_5) -#define NO_BSLS KC_EQL -#define NO_ASTE LSFT(KC_BSLS) -#define NO_LBRA ALGR(KC_7) -#define NO_RBRA ALGR(KC_0) -#define NO_LBRC ALGR(KC_8) -#define NO_RBRC ALGR(KC_9) -#define NO_ANBR KC_NUBS -#define NO_DASH KC_SLSH -#define NO_PLUS KC_MINS -#define NO_EQUA LSFT(KC_0) - -#define TSKMGR LCTL(LSFT(KC_ESC)) -#define STEAM LSFT(KC_F7) -#define WKILL LALT(KC_F4) -#define BWORD LCTL(KC_LEFT) -#define FWORD LCTL(KC_RIGHT) - -float onsong[][2] = SONG(MARIO_MUSHROOM); -float offsong[][2] = SONG(PLOVER_GOODBYE_SOUND); - -enum custom_keycodes { - PWD = SAFE_RANGE, - MAIL, - GAMEON, - GAMEOFF -}; +// sounds +#ifdef AUDIO_ENABLE + float gamesong[][2] = SONG(MARIO_MUSHROOM); + float defsong[][2] = SONG(PLOVER_GOODBYE_SOUND); + float failed[][2] = SONG(TERMINAL_SOUND); +#endif -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case PWD: - if (record->event.pressed) { - SEND_STRING(pwd_str); - } - break; - case MAIL: - if (record->event.pressed) { - SEND_STRING(mail_str); - } - break; - case GAMEON: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(onsong); - #endif - layer_on(_GAME); - } - break; - case GAMEOFF: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(offsong); - #endif - layer_off(_GAME); - } - break; +// leader key +bool leader_succeed; +bool leader_layer_game; +bool leader_layer_def; +LEADER_EXTERNS(); + +void matrix_scan_user(void) { + LEADER_DICTIONARY() { + leader_succeed = leading = false; + leader_layer_game = false; + leader_layer_def = false; + + SEQ_TWO_KEYS(KC_P, KC_P) { + SEND_STRING(pwd_str); + leader_succeed = true; + } + SEQ_TWO_KEYS(KC_P, KC_M) { + SEND_STRING(mail_str); + leader_succeed = true; + } + SEQ_TWO_KEYS(KC_B, KC_B) { + SEND_STRING("build"SS_TAP(X_ENTER)); + leader_succeed = true; + } + SEQ_TWO_KEYS(KC_B, KC_F) { + SEND_STRING("flash"SS_TAP(X_ENTER)); + reset_keyboard(); + leader_succeed = true; + } + SEQ_TWO_KEYS(KC_L, KC_G) { + layer_on(_GAME); + leader_layer_game = true; + } + SEQ_TWO_KEYS(KC_L, KC_D) { + layer_off(_GAME); + leader_layer_def = true; + } + leader_end(); } - return true; +} + +void leader_end(void) { + if (leader_succeed) { + // do nothing + } else if (leader_layer_game) { + #ifdef AUDIO_ENABLE + PLAY_SONG(gamesong); + #endif + } else if (leader_layer_def) { + #ifdef AUDIO_ENABLE + PLAY_SONG(defsong); + #endif + } else { + #ifdef AUDIO_ENABLE + PLAY_SONG(failed); + #endif + } +} + +// tap dance definitions +typedef struct { + bool is_press_action; + int state; +} tap; + +enum { + SINGLE_TAP = 1, + SINGLE_HOLD = 2, + DOUBLE_TAP = 3, + DOUBLE_HOLD = 4, + DOUBLE_SINGLE_TAP = 5, + TRIPLE_TAP = 6, + TRIPLE_HOLD = 7 }; +enum { + TD_LSFT = 0, + TD_LCTL, + TD_RSFT, + TD_RCTL +}; + +int cur_dance (qk_tap_dance_state_t *state); +void lsft_finished (qk_tap_dance_state_t *state, void *user_data); +void lsft_reset (qk_tap_dance_state_t *state, void *user_data); +void rsft_finished (qk_tap_dance_state_t *state, void *user_data); +void rsft_reset (qk_tap_dance_state_t *state, void *user_data); +void lctl_finished (qk_tap_dance_state_t *state, void *user_data); +void lctl_reset (qk_tap_dance_state_t *state, void *user_data); +void rctl_finished (qk_tap_dance_state_t *state, void *user_data); +void rctl_reset (qk_tap_dance_state_t *state, void *user_data); + +// layer declarations const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Default * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | BkSp | + * | Tab | Q | W | E | R | T | Y | U | I | O | Å | BkSp | * |------+------+------+------+------+-------------+------+------+------+------+------| * | Esc | A | S | D | F | G | H | J | K | L | Ø | Æ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | Å | Shift| + * | Shift| Z | X | C | V | B | N | M | P | , | . | Shift| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | Win | Alt | Lower| Space | Enter | Raise| AltGr| Game | Fn | + * | Ctrl | Lead | Win | Alt | Lower| Space| Enter| Raise| AltGr| App | Lead | Ctrl | * `-----------------------------------------------------------------------------------' */ [_DEFAULT] = LAYOUT_planck_grid( - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - KC_GESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, NO_OE, NO_AE, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, NO_AA, KC_RSFT, - KC_LCTL, KC_LGUI, KC_LALT, LOWER, KC_NO, KC_SPC, KC_NO, KC_ENT, RAISE, KC_RALT, GAMEON, FUNCTION + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, NO_AA, KC_BSPC, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, NO_OE, NO_AE, + TD(TD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_P, KC_COMM, KC_DOT, TD(TD_RSFT), + TD(TD_LCTL), KC_LEAD, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, KC_ENT, MO(_RAISE), KC_ALGR, KC_APP, KC_LEAD, TD(TD_RCTL) ), /* Lower * ,-----------------------------------------------------------------------------------. @@ -116,81 +143,250 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Home | | End | | | | | F1 | F2 | F3 | Shift| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | Win | Alt | Lower| Space | Enter | | | | | + * | Ctrl | | Win | Alt | Lower| M_PP |M_Next| | | Mute | VolD | VolUp| * `-----------------------------------------------------------------------------------' */ [_LOWER] = LAYOUT_planck_grid( - KC_TRNS, BWORD, KC_UP, FWORD, KC_PGUP, KC_NO, KC_NO, KC_NO, KC_F7, KC_F8, KC_F9, KC_DEL, - KC_BSPC, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN, KC_NO, KC_NO, KC_NO, KC_F4, KC_F5, KC_F6, KC_NO, - KC_TRNS, KC_HOME, KC_NO, KC_END, KC_NO, KC_NO, KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO + KC_TRNS, LCTL(KC_LEFT), KC_UP, LCTL(KC_RIGHT), KC_PGUP, KC_NO, KC_NO, KC_NO, KC_F7, KC_F8, KC_F9, KC_DEL, + KC_BSPC, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN, KC_NO, KC_NO, KC_NO, KC_F4, KC_F5, KC_F6, KC_NO, + KC_TRNS, KC_HOME, KC_NO, KC_END, KC_NO, KC_NO, KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_TRNS, + KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MNXT, KC_NO, KC_NO, KC_MUTE, KC_VOLD, KC_VOLU ), /* Raise * ,-----------------------------------------------------------------------------------. - * | Tab | ! | ? | ' | " | ¨ | | / | 7 | 8 | 9 | Ins | + * | Tab | ! | ? | # | * | | | = | / | 7 | 8 | 9 | Ins | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | BkSp | @ | & | # | $ | % | <> | \ | 4 | 5 | 6 | * | + * | BkSp | @ | & | $ | % | ~ | + | \ | 4 | 5 | 6 | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| ( | ) | { | } | [ | ] | 0 | 1 | 2 | 3 | Shift| + * | Shift| ' | " | ¨ | | | - | 0 | 1 | 2 | 3 | Shift| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | Win | Alt | | Space | Enter | Raise| - | + | = | + * | Ctrl | | Win | Alt | | Space| Enter| Raise| AltGr| | | | * `-----------------------------------------------------------------------------------' */ [_RAISE] = LAYOUT_planck_grid( - KC_TRNS, NO_EXCL, NO_QEST, NO_APOS, NO_QUOT, NO_UMLA, KC_NO, NO_FSLS, KC_7, KC_8, KC_9, KC_INS, - KC_BSPC, NO_ALFA, NO_AMPE, NO_HASH, NO_USDO, NO_PERC, NO_ANBR, NO_BSLS, KC_4, KC_5, KC_6, NO_ASTE, - KC_TRNS, NO_LPAR, NO_RPAR, NO_LBRA, NO_RBRA, NO_LBRC, NO_RBRC, KC_0, KC_1, KC_2, KC_3, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, NO_DASH, NO_PLUS, NO_EQUA - ), - /* Function - * ,-----------------------------------------------------------------------------------. - * | | | | | |TskMgr| | | | | Pwd | Vol+ | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Reset| | | | | | | | Wkill| | | Vol- | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Mail | | | | VolM | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | Play/Pause | Next | | | | | - * `-----------------------------------------------------------------------------------' - */ - [_FUNCTION] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, TSKMGR, KC_NO, KC_NO, KC_NO, KC_NO, PWD, KC_VOLU, - RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, WKILL, KC_NO, KC_NO, KC_VOLD, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, MAIL, KC_NO, KC_NO, KC_NO, KC_MUTE, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MPLY, KC_NO, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO + KC_TRNS, NO_EXCL, NO_QEST, NO_HASH, NO_ASTE, NO_PIPE, NO_EQUA, NO_FSLS, KC_7, KC_8, KC_9, KC_INS, + KC_BSPC, NO_ALFA, NO_AMPE, NO_USDO, NO_PERC, NO_TILD, NO_PLUS, NO_BSLS, KC_4, KC_5, KC_6, KC_NO, + KC_TRNS, NO_APOS, NO_QUOT, NO_UMLA, KC_NO, KC_NO, NO_DASH, KC_0, KC_1, KC_2, KC_3, KC_TRNS, + KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO ), /* Game * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | BkSp | + * | Tab | Q | W | E | R | T | Y | U | I | O | | BkSp | * |------+------+------+------+------+-------------+------+------+------+------+------| * | Esc | A | S | D | F | G | H | J | K | L | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | | | | | + * | Shift| Z | X | C | V | B | N | M | P | , | . | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | | Alt | Raise| Space | Enter | | | | | + * | Ctrl | Lead | | Alt | Lower| Space| Enter| Lower| | | Lead | | * `-----------------------------------------------------------------------------------' */ [_GAME] = LAYOUT_planck_grid( - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_NO, KC_NO, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, - KC_LCTL, KC_NO, KC_LALT, GAMER, KC_NO, KC_SPC, KC_NO, KC_ENT, KC_NO, KC_NO, KC_NO, KC_NO + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_BSPC, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_NO, KC_NO, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_P, KC_COMM, KC_DOT, KC_NO, + KC_LCTL, KC_LEAD, KC_NO, KC_LALT, MO(_GLOW), KC_SPC, KC_ENT, MO(_GLOW), KC_NO, KC_NO, KC_LEAD, KC_NO ), - /* Game raise + /* Game lower * ,-----------------------------------------------------------------------------------. - * | Tab | 1 | 2 | 3 | 4 | 5 | | | | | | Vol+ | + * | Tab | 1 | 2 | 3 | | | | | | | | Steam| * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | F1 | F2 | F3 | F4 | F5 | | | | | | Vol- | + * | Esc | 4 | 5 | 6 | | | | | | | | F12 | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| | | | | | | | | | | VolM | + * | Shift| 7 | 8 | 9 | 0 | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | | Alt | | Space | Enter | | | Def | Steam| + * | Ctrl | | | Alt | | PlyPa| Next | | | Mute | VolD | VolUp| * `-----------------------------------------------------------------------------------' */ - [_GAMERAISE] = LAYOUT_planck_grid( - KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLU, - KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MUTE, - KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_NO, GAMEOFF, STEAM + [_GLOW] = LAYOUT_planck_grid( + KC_TRNS, KC_1, KC_2, KC_3, KC_PPLS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_F7), + KC_TRNS, KC_4, KC_5, KC_6, KC_PMNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F12, + KC_TRNS, KC_7, KC_8, KC_9, KC_0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MNXT, KC_NO, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU ) }; + +// tap dance declarations +int cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } + else if (state->count == 2) { + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + if (state->count == 3) { + if (state->interrupted || !state->pressed) return TRIPLE_TAP; + else return TRIPLE_HOLD; + } + else return 8; +} + +static tap xtap_state = { + .is_press_action = true, + .state = 0 +}; + +void lsft_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: + register_code16(LSFT(KC_8)); + break; + case SINGLE_HOLD: + register_code(KC_LSFT); + break; + case DOUBLE_TAP: + register_code(KC_NUBS); + break; + case DOUBLE_SINGLE_TAP: + register_code(KC_NUBS); + break; + } +} + +void lsft_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: + unregister_code16(LSFT(KC_8)); + break; + case SINGLE_HOLD: + unregister_code(KC_LSFT); + break; + case DOUBLE_TAP: + unregister_code(KC_NUBS); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_NUBS); + break; + } + xtap_state.state = 0; +} + +void rsft_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: + register_code16(LSFT(KC_9)); + break; + case SINGLE_HOLD: + register_code(KC_RSFT); + break; + case DOUBLE_TAP: + register_code16(LSFT(KC_NUBS)); + break; + case DOUBLE_SINGLE_TAP: + register_code16(LSFT(KC_NUBS)); + break; + } +} + +void rsft_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: + unregister_code16(LSFT(KC_9)); + break; + case SINGLE_HOLD: + unregister_code(KC_RSFT); + break; + case DOUBLE_TAP: + unregister_code16(LSFT(KC_NUBS)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code16(LSFT(KC_NUBS)); + break; + } + xtap_state.state = 0; +} + +void lctl_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: + register_mods(MOD_BIT(KC_ALGR)); + register_code(KC_7); + break; + case SINGLE_HOLD: + register_code(KC_LCTL); + break; + case DOUBLE_TAP: + register_mods(MOD_BIT(KC_ALGR)); + register_code(KC_8); + break; + case DOUBLE_SINGLE_TAP: + register_mods(MOD_BIT(KC_ALGR)); + register_code(KC_8); +break; + } +} + +void lctl_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: + unregister_code(KC_7); + unregister_mods(MOD_BIT(KC_ALGR)); + break; + case SINGLE_HOLD: + unregister_code(KC_LCTL); + break; + case DOUBLE_TAP: + unregister_code(KC_8); + unregister_mods(MOD_BIT(KC_ALGR)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_8); + unregister_mods(MOD_BIT(KC_ALGR)); +break; + } + xtap_state.state = 0; +} + +void rctl_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: + register_mods(MOD_BIT(KC_ALGR)); + register_code(KC_0); + break; + case SINGLE_HOLD: + register_code(KC_RCTL); + break; + case DOUBLE_TAP: + register_mods(MOD_BIT(KC_ALGR)); + register_code(KC_9); + break; + case DOUBLE_SINGLE_TAP: + register_mods(MOD_BIT(KC_ALGR)); + register_code(KC_9); + break; + } +} + +void rctl_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: + unregister_code(KC_0); + unregister_mods(MOD_BIT(KC_ALGR)); + break; + case SINGLE_HOLD: + unregister_code(KC_RCTL); + break; + case DOUBLE_TAP: + unregister_code(KC_9); + unregister_mods(MOD_BIT(KC_ALGR)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_9); + unregister_mods(MOD_BIT(KC_ALGR)); + break; + } + xtap_state.state = 0; +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_LSFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lsft_finished, lsft_reset), + [TD_RSFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rsft_finished, rsft_reset), + [TD_LCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lctl_finished, lctl_reset), + [TD_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rctl_finished, rctl_reset), +}; diff --git a/keyboards/planck/keymaps/oeywil/no_keycodes.h b/keyboards/planck/keymaps/oeywil/no_keycodes.h new file mode 100644 index 0000000000..c412c35d81 --- /dev/null +++ b/keyboards/planck/keymaps/oeywil/no_keycodes.h @@ -0,0 +1,28 @@ +// øæå +#define NO_OE KC_SCLN +#define NO_AE KC_QUOT +#define NO_AA KC_LBRC +// rename +#define NO_ANBR KC_NUBS +#define NO_APOS KC_BSLS +#define NO_BSLS KC_EQL +#define NO_DASH KC_SLSH +#define NO_PLUS KC_MINS +#define NO_UMLA KC_RBRC +#define NO_PIPE KC_GRV +// shifted +#define NO_EXCL LSFT(KC_1) +#define NO_QUOT LSFT(KC_2) +#define NO_HASH LSFT(KC_3) +#define NO_PERC LSFT(KC_5) +#define NO_AMPE LSFT(KC_6) +#define NO_FSLS LSFT(KC_7) +#define NO_LPAR LSFT(KC_8) +#define NO_RPAR LSFT(KC_9) +#define NO_EQUA LSFT(KC_0) +#define NO_QEST LSFT(KC_MINS) +#define NO_ASTE LSFT(KC_BSLS) +// altgr +#define NO_ALFA ALGR(KC_2) +#define NO_USDO ALGR(KC_4) +#define NO_TILD ALGR(KC_RBRC) diff --git a/keyboards/planck/keymaps/oeywil/readme.md b/keyboards/planck/keymaps/oeywil/readme.md index e9e061be3a..5587b4b913 100644 --- a/keyboards/planck/keymaps/oeywil/readme.md +++ b/keyboards/planck/keymaps/oeywil/readme.md @@ -1,9 +1,4 @@ About ------ -A simple Norwegian Layout. - -Layout -------- - -![Layout](https://i.imgur.com/GQ4iM6B.png "Keyboard Layout") +A simple Norwegian grid layout using Leader Key, Space Cadet Shift and audio. diff --git a/keyboards/planck/keymaps/oeywil/rules.mk b/keyboards/planck/keymaps/oeywil/rules.mk index a0373a4d4e..23b2611735 100644 --- a/keyboards/planck/keymaps/oeywil/rules.mk +++ b/keyboards/planck/keymaps/oeywil/rules.mk @@ -1,9 +1,11 @@ SRC += muse.c # Build Options -AUDIO_ENABLE = yes -CONSOLE_ENABLE = no -EXTRAKEY_ENABLE = yes -NKRO_ENABLE = yes - -DEFAULT_FOLDER = planck/rev6 +NKRO_ENABLE = yes +EXTRAKEY_ENABLE = yes +LEADER_ENABLE = yes +TAP_DANCE_ENABLE = yes +AUDIO_ENABLE = yes +COMMAND_ENABLE = no +CONSOLE_ENABLE = no +MOUSEKEY_ENABLE = no |