diff options
author | Gergely Peidl <gergely@peidl.net> | 2020-01-02 21:03:47 +0100 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2020-01-02 12:03:47 -0800 |
commit | 2406c04d89a8a289b131c43759beca593cc9520c (patch) | |
tree | b205e3c05da7a11f730b6791d4293c89ed6dc78e /keyboards | |
parent | 156d319604b398dbc3d2290cd9e277dd19da8b96 (diff) | |
download | qmk_firmware-2406c04d89a8a289b131c43759beca593cc9520c.tar.gz |
[Keymap] Personal keymap for Let's Split keyboard. (#7702)
* Add Initial layout configuration.
* Set arduino pro micro's built in RX LED as Numlock
* Enable Autoshift feautre.
* Remove DVORAK layout.
* Add Numpad, update default layer.
* Update AutoShift timeout.
* Beautify ASCII Art.
* Update keymap.
* Add Initial verison of RGB lighting.
* Add Tap dance, hungarian letters.
.Xmodmap example: https://github.com/geripgeri/dotfiles/commit/09f058753dd10e4ff8ab2aac7274b5600c466392
* Update RGB to use only noeeprom functions.
* Change default rgb led color.
* Add `pragma once`.
* Emojis added.
* Add tap dance for hungarian letters, multimedia control, slash/backslash.
* Remove audio related code.
* Add Gaming layer.
* Remove unnecessary code, update copyright.
* Add readme.md
* Implement code review suggestions.
* Implement code review suggestions #2
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/lets_split/keymaps/geripgeri/config.h | 37 | ||||
-rw-r--r-- | keyboards/lets_split/keymaps/geripgeri/keymap.c | 368 | ||||
-rw-r--r-- | keyboards/lets_split/keymaps/geripgeri/readme.md | 3 | ||||
-rw-r--r-- | keyboards/lets_split/keymaps/geripgeri/rules.mk | 5 |
4 files changed, 413 insertions, 0 deletions
diff --git a/keyboards/lets_split/keymaps/geripgeri/config.h b/keyboards/lets_split/keymaps/geripgeri/config.h new file mode 100644 index 000000000..6e71ea2b9 --- /dev/null +++ b/keyboards/lets_split/keymaps/geripgeri/config.h @@ -0,0 +1,37 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert +Copyright 2019 Gergely Peidl + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#define AUTO_SHIFT_TIMEOUT 200 +#define NO_AUTO_SHIFT_NUMERIC + +// RGB lighting +#define RGBLIGHT_SLEEP +#undef RGBLED_NUM +#define RGBLED_NUM 32 + +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_STATIC_GRADIENT + +#define TAPPING_TERM 200 diff --git a/keyboards/lets_split/keymaps/geripgeri/keymap.c b/keyboards/lets_split/keymaps/geripgeri/keymap.c new file mode 100644 index 000000000..b268fb90c --- /dev/null +++ b/keyboards/lets_split/keymaps/geripgeri/keymap.c @@ -0,0 +1,368 @@ +#include QMK_KEYBOARD_H + +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _NUMPAD, + _GAMING, + _ADJUST +}; + +enum custom_keycodes { + NUMPAD = SAFE_RANGE, + SLIGHTLY, + SMILE, + JOY, + RELAXED, + HEART, + SAD, + CRY, + NETRURAL, + SCREAM, + THUMBSUP +}; + +enum td_extra_keys { + U, + O, + NEXTPREV, + SLASH +}; + +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, //send two single taps + TRIPLE_TAP = 6, + TRIPLE_HOLD = 7 +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +int cur_dance (qk_tap_dance_state_t *state); + +void u_finished (qk_tap_dance_state_t *state, void *user_data); +void o_finished (qk_tap_dance_state_t *state, void *user_data); + +uint8_t rgb_mode = RGBLIGHT_MODE_BREATHING + 1; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Qwerty + * ,-----------------------------------------. ,-----------------------------------------. + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | - | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Esc | A | S | D | F | G | | H | J | K | L | ; | ' | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | ALT |Numpad| GUI |Lower | Space| | Bksp |Raise | Left | Down | Up |Right | + * `-----------------------------------------' `-----------------------------------------' + */ +[_QWERTY] = LAYOUT_ortho_4x12( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINUS, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, TD(SLASH), KC_ENT, + KC_LCTL, KC_LALT, MO(_NUMPAD), KC_LGUI, LOWER, KC_SPC, KC_BSPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Lower + * ,-----------------------------------------. ,-----------------------------------------. + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | = | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | :) | :D | :'D | :$ | <3 | | | Home | Pgup | | { | } | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | :( | :'( | :| | :O | +1 | | | End |Pgdown| | [ | ] |PrntSc| + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | |Insert| | Del | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------' `-----------------------------------------' + */ +[_LOWER] = LAYOUT_ortho_4x12( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_EQL, + SLIGHTLY, SMILE, JOY, RELAXED, HEART, _______, KC_HOME, KC_PGUP, _______, KC_LCBR, KC_RCBR, KC_PIPE, + SAD, CRY, NETRURAL, SCREAM, THUMBSUP, _______, KC_END, KC_PGDOWN,_______, KC_LBRC, KC_RBRC, KC_PSCREEN, + _______, _______, _______, _______, _______, KC_INSERT, KC_DEL, _______, TD(NEXTPREV), KC_VOLD, KC_VOLU, KC_MPLY +), + +/* Raise + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * `-----------------------------------------' `-----------------------------------------' + */ +[_RAISE] = LAYOUT_ortho_4x12( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------. ,-----------------------------------------. + * | Reset|EEPRST| | EE | | | | | UE | IE | OE | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | AE | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | TGLAS| | | | | | | | | | | |GAMING| + * `-----------------------------------------' `-----------------------------------------' + */ +[_ADJUST] = LAYOUT_ortho_4x12( + RESET, EEP_RST, _______, RALT(KC_SCLN), _______, _______, _______, TD(U), RALT(KC_Z), TD(O), _______, _______, + _______, RALT(KC_QUOT), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_ASTG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(_GAMING) +), + +/* Numpad + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | 7 | 8 | 9 | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | 4 | 5 | 6 | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | VAI | SAI | HUI | | | | | 3 | 2 | 1 | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | |RGBMOD|RGBTGL| | Calc | 0 | + | | | | + * `-----------------------------------------' `-----------------------------------------' + */ +[_NUMPAD] = LAYOUT_ortho_4x12( + _______, _______, _______, _______, _______, _______, KC_7, KC_8, KC_9, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_4, KC_5, KC_6, _______, _______, _______, + RGB_VAI, RGB_SAI, RGB_HUI, _______, _______, _______, KC_1, KC_2, KC_3, _______, _______, _______, + _______, _______, _______, _______, RGB_MOD, RGB_TOG, KC_CALC, KC_0, KC_PPLS, _______, _______, _______ +), + +/* Gaming + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | RAISE| | | | LOWER| | | | | + * `-----------------------------------------' `-----------------------------------------' + */ +[_GAMING] = LAYOUT_ortho_4x12( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, RAISE, _______, _______, LOWER, _______, _______, _______, _______ +)}; + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + case RGB_VAI: + if(record->event.pressed) { + rgblight_increase_val_noeeprom(); + } + break; + case RGB_VAD: + if(record->event.pressed) { + rgblight_decrease_val_noeeprom(); + } + break; + case RGB_SAI: + if(record->event.pressed) { + rgblight_increase_sat_noeeprom(); + } + break; + case RGB_SAD: + if(record->event.pressed) { + rgblight_decrease_sat_noeeprom(); + } + break; + case RGB_HUI: + if(record->event.pressed) { + rgblight_increase_hue_noeeprom(); + } + break; + case RGB_HUD: + if(record->event.pressed) { + rgblight_decrease_hue_noeeprom(); + } + break; + case RGB_TOG: + if(record->event.pressed) { + rgblight_toggle_noeeprom(); + } + break; + case RGB_MOD: + if(record->event.pressed) { + rgblight_step_noeeprom(); + rgb_mode = rgblight_get_mode(); + } + break; + case RGB_RMOD: + if(record->event.pressed) { + rgblight_step_reverse_noeeprom(); + rgb_mode = rgblight_get_mode(); + } + break; + + case SLIGHTLY: + if(record->event.pressed) { + SEND_STRING(":slightly_smiling_face:"); + } + break; + case SMILE: + if(record->event.pressed) { + SEND_STRING(":smile:"); + } + break; + case JOY: + if(record->event.pressed) { + SEND_STRING(":joy:"); + } + break; + case RELAXED: + if(record->event.pressed) { + SEND_STRING(":relaxed:"); + } + break; + case HEART: + if(record->event.pressed) { + SEND_STRING(":heart:"); + } + break; + case SAD: + if(record->event.pressed) { + SEND_STRING(":white_frowning_face:"); + } + break; + case CRY: + if(record->event.pressed) { + SEND_STRING(":cry:"); + } + break; + case NETRURAL: + if(record->event.pressed) { + SEND_STRING(":neutral_face:"); + } + break; + case SCREAM: + if(record->event.pressed) { + SEND_STRING(":scream:"); + } + break; + case THUMBSUP: + if(record->event.pressed) { + SEND_STRING(":+1:"); + } + break; + default: + return true; + } + return false; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + writePin(B0, !(state & (1UL << (_NUMPAD)))); + + switch(biton32(state)) { + case _RAISE: + rgblight_setrgb_at(255, 255, 255, RGBLED_NUM / 2); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + break; + case _LOWER: + rgblight_setrgb_at(255, 255, 255, RGBLED_NUM / 2 - 1); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + break; + case _NUMPAD: + rgblight_setrgb_at(0,255,0, 0); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + break; + case _GAMING: + rgb_mode = RGBLIGHT_MODE_RAINBOW_SWIRL + 5; + autoshift_disable(); + break; + default: + rgb_mode = RGBLIGHT_MODE_BREATHING + 1; + rgblight_mode_noeeprom(rgb_mode); + autoshift_enable(); + break; + } + return state; +} + +void led_set_user(uint8_t usb_led) { + rgblight_sethsv_noeeprom(0, 255, 255); + rgblight_mode_noeeprom(rgb_mode); +} + +int cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return SINGLE_TAP; + //key has not been interrupted, but they key is still held. Means you want to send a 'HOLD'. + else return SINGLE_HOLD; + } + else if (state->count == 2) { + /* + * DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap + * action when hitting 'pp'. Suggested use case for this return value is when you want to send two + * keystrokes of the key, and not the 'double tap' action/macro. + */ + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + //Assumes no one is trying to type the same letter three times (at least not quickly). + //If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add + //an exception here to return a 'TRIPLE_SINGLE_TAP', and define that enum just like 'DOUBLE_SINGLE_TAP' + if (state->count == 3) { + if (state->interrupted || !state->pressed) return TRIPLE_TAP; + else return TRIPLE_HOLD; + } + else return 8; //magic number. At some point this method will expand to work for more presses +} + +static tap utap_state = { + .is_press_action = true, + .state = 0 +}; + +static tap otap_state = { + .is_press_action = true, + .state = 0 +}; + +void u_finished (qk_tap_dance_state_t *state, void *user_data) { + utap_state.state = cur_dance(state); + switch(utap_state.state) { + case SINGLE_TAP: SEND_STRING(SS_RALT("]")); break; + case DOUBLE_TAP: SEND_STRING(SS_RALT("-")); break; + case TRIPLE_TAP: SEND_STRING(SS_RALT("\\")); break; + } +} + +void o_finished (qk_tap_dance_state_t *state, void *user_data) { + otap_state.state = cur_dance(state); + switch(otap_state.state) { + case SINGLE_TAP: SEND_STRING(SS_RALT("=")); break; + case DOUBLE_TAP: SEND_STRING(SS_RALT("0")); break; + case TRIPLE_TAP: SEND_STRING(SS_RALT("[")); break; + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [U] = ACTION_TAP_DANCE_FN(u_finished), + [O] = ACTION_TAP_DANCE_FN(o_finished), + [NEXTPREV] = ACTION_TAP_DANCE_DOUBLE(KC_MNXT, KC_MPRV), + [SLASH] = ACTION_TAP_DANCE_DOUBLE(KC_SLASH, KC_BSLS) + }; diff --git a/keyboards/lets_split/keymaps/geripgeri/readme.md b/keyboards/lets_split/keymaps/geripgeri/readme.md new file mode 100644 index 000000000..09f1bedee --- /dev/null +++ b/keyboards/lets_split/keymaps/geripgeri/readme.md @@ -0,0 +1,3 @@ +# Personal Layout + +[Layout](http://www.keyboard-layout-editor.com/#/gists/8eae83bfb830d847c94c7ff423bbdc84) diff --git a/keyboards/lets_split/keymaps/geripgeri/rules.mk b/keyboards/lets_split/keymaps/geripgeri/rules.mk new file mode 100644 index 000000000..5cefc0017 --- /dev/null +++ b/keyboards/lets_split/keymaps/geripgeri/rules.mk @@ -0,0 +1,5 @@ +AUTO_SHIFT_ENABLE = yes +AUTO_SHIFT_MODIFIERS = no +RGBLIGHT_ENABLE = yes +TAP_DANCE_ENABLE = yes + |