diff options
author | Ivan Smirnov <isgsmirnov@gmail.com> | 2019-11-08 19:17:21 -0800 |
---|---|---|
committer | James Young <18669334+noroadsleft@users.noreply.github.com> | 2019-11-08 19:17:21 -0800 |
commit | 2b30776dd0f6dc6571fb741113bc71cea578b971 (patch) | |
tree | 9ad71df7d21d7bc75c42ad85d9bcbff136ec06b5 /keyboards/keebio | |
parent | 5414ff709f2ab6f47b722a70aa2c4d18bed7c458 (diff) | |
download | qmk_firmware-2b30776dd0f6dc6571fb741113bc71cea578b971.tar.gz |
[Keymap] Add issmirnov {user, ergodox, levinson} files. (#7239)
* Add issmirnov {user, ergodox, levinson} files.
There are enough interesting QMK tricks in these layouts that it seems
worth it to share with the broader community. Big thanks to Drashna for
inspiration, as well as all the wonderful creators of QMK documentation.
Some highlights:
- Common layout shared between levinson and ergodox_ez
- TAP_TOG macro for fast layer switching
- Autogenerated keymaps ascii art with git hooks
I will do my best to do periodic rolls here, but the source of truth
will always be https://github.com/issmirnov/qmk-keebs
* Incorporate review feedback.
- Remove CLEAR_EEPROM in favor of built in EEP_RST
- Remove custom handlers for audio on bootup and shutdown
- Remove plethora of unneeded includes
- Remove deprecated and dupliated config options
HUGE thanks to drashna for the review!
* Apply suggestions from code review
Huge thanks to drashna@ for a very thorough review and the very useful suggestions.
Co-Authored-By: Drashna Jaelre <drashna@live.com>
* Remove unclear optimization
This was an artifact from some other keymap I saw.
Diffstat (limited to 'keyboards/keebio')
11 files changed, 340 insertions, 0 deletions
diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/README.md b/keyboards/keebio/levinson/keymaps/issmirnov/README.md new file mode 100644 index 000000000..1e03e58e7 --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/README.md @@ -0,0 +1,15 @@ +# Levinson + +## Colors + +- https://github.com/qmk/qmk_firmware/blob/master/docs/feature_rgblight.md + - main docs. +- https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h + - list of colors +- https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight.h + - list of functions for RGB manipulation + +## Troubleshooting + +- When in doubt, flash both sides of the keyboard. For some reason that helps with LEDs and reponsiveness. + - `cd qmk_firmware && make keebio/levinson/rev2:issmirnov:dfu-split-right` diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/asci-keymap.txt b/keyboards/keebio/levinson/keymaps/issmirnov/asci-keymap.txt new file mode 100644 index 000000000..aa5bd08b3 --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/asci-keymap.txt @@ -0,0 +1,55 @@ + Qwerty +,-----------------------------------. ,-----------------------------------. +| Esc | Q | W | E | R | T | | Y | U | I | O | P |⌘ + d| +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| Tab | A | S | D | F | G | | H | J | K | L |TapTo|Mo(Na| +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +|⇧(1) | Z | X | C | V | B | | N | M | . |Comma|Tg(Nu| ' | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +|Ctrl | ⌘⇧ | Alt | Mod | ⌫ | Spc | |Enter| Tab | ↑ | ↓ | ← | → | +`-----------------------------------' ------------------------------------' + + Symb +,-----------------------------------. ,-----------------------------------. +| | - | @ | { | } | ` | | * | ! | | | % | + | Esc | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | ^ | _ | ( | ) | $ | | # | = | : | ; |TapTo| " | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | < | > | [ | ] | ~ | | & | ? | / | \ |Tg(Nu| ' | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | | | | | | | | | Esc | : | % | 🔒 | +`-----------------------------------' ------------------------------------' + + Nump +,-----------------------------------. ,-----------------------------------. +| | No | No |Lgui(| | | | , | 7 | 8 | 9 | |Reset| +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | |Lgui(|Lgui(|Lgui(| | | 0 | 4 | 5 | 6 |To(Sy| | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | | | |Audio|Audio| | . | 1 | 2 | 3 |To(Qw| | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | | | | | | | | | | |To(Ov| | +`-----------------------------------' ------------------------------------' + + Overwatch +,-----------------------------------. ,-----------------------------------. +| Tab | Q | W | E | R | T | |To(0)| | | | |Clear| +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +|Ctrl | A | S | D | F | P | |RgbMo|RgbMo|RgbVa|RgbVa| |RgbTo| +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +|Lshif| Z | X | C | V |Grave| |RgbMo|RgbMo|RgbMo|RgbMo|RgbMo|RgbMo| +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +|Ctrl | F9 |Pscre| H | R | ⎵ | |RgbHu|RgbHu|RgbSa|RgbSa|RgbMo|RgbMo| +`-----------------------------------' ------------------------------------' + + Navi +,-----------------------------------. ,-----------------------------------. +| | | | ↑ | | | | | | | | | | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | | ← | ↓ | → | | | |Ctrl | | | | | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | | | | | | | | | | | | | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| | | | | |⌘ + d| | Mod | ⌘⇧ | | | | | +`-----------------------------------' ------------------------------------' + diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/build.sh b/keyboards/keebio/levinson/keymaps/issmirnov/build.sh new file mode 100755 index 000000000..d01308391 --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +make keebio/levinson/rev2:issmirnov diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/config.h b/keyboards/keebio/levinson/keymaps/issmirnov/config.h new file mode 100644 index 000000000..89c2f5ebe --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/config.h @@ -0,0 +1,34 @@ +#pragma once + +// Use serial comms for split keyboard +// DO NOT enable USE_IDC - board will not respond. +#define USE_SERIAL +//#define USE_I2C + +#ifdef RGBLIGHT_ENABLE + // Enable animations. +5500 bytes + #define RGBLIGHT_ANIMATIONS + + // Map my custom number of LED's + #undef RGBLED_NUM + #define RGBLED_NUM 16 + #define RGBLIGHT_LED_MAP { 0, 1, 2, 3, 4, 5, 6, 7, 15, 14, 13, 12, 11, 10, 9, 8 } // When changed, BE SURE to flash EEPROM on both halves and clear it. + + // DO NOT USE RGBLED_SPLIT - the slave board will stop responding. + + // Turn off RGB when computer sleeps + #define RGBLIGHT_SLEEP + + // custom colors + #define RGB_CLEAR 0x00, 0x00, 0x00 + + // MOD indicators + #define SHFT_LED1 7 + #define GUI_LED1 8 +#endif + +#ifdef AUDIO_ENABLE + #define QMK_SPEAKER C6 + #define C6_AUDIO + #define NO_MUSIC_MODE // Save 2000 bytes +#endif diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/keymap.c b/keyboards/keebio/levinson/keymaps/issmirnov/keymap.c new file mode 100644 index 000000000..0023b8424 --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/keymap.c @@ -0,0 +1,124 @@ +#include "tap_tog.h" + +#ifdef AUDIO_ENABLE + #include "audio.h" + #include "sounds.h" +#endif + + +#ifdef RGBLIGHT_ENABLE + #include "rgb.h" +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Run `./qmk show levinson` from parent dir to see this layer. +[_QWERTY] = LAYOUT_ortho_4x12_wrapper( +KC_ESC , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________ , APPS , +KC_TAB , _________________QWERTY_L2_________________, _________________QWERTY_R2_________________ , MO(_NAVI) , +OSMSFT , _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ , KC_QUOTE , +KC_LCTL , MODSFT , KC_LALT , KC_LGUI , KC_BSPACE , KC_SPC , KC_ENTER , KC_TAB , KC_UP , KC_DOWN , KC_LEFT , KC_RGHT +), // Note: visualizer expects this closing parens to be right at the start of the line. + +// Run `./qmk show levinson` from parent dir to see this layer. +[_SYMB] = LAYOUT_ortho_4x12_wrapper( +_______ , _________________SYMB_L1___________________, _________________SYMB_R1___________________ , KC_ESC , +_______ , _________________SYMB_L2___________________, _________________SYMB_R2___________________ , KC_DQT , +_______ , _________________SYMB_L3___________________, _________________SYMB_R3___________________ , KC_QUOTE , +_______ , ___________________BLANK___________________, _______ , _______ , KC_ESC , KC_COLN , KC_PERC , LOCK +), // Note: visualizer expects this closing parens to be right at the start of the line. + +// Run `./qmk show levinson` from parent dir to see this layer. +[_NUMP] = LAYOUT_ortho_4x12_wrapper( +_______ , _________________NUMP_L1___________________ , _________________NUMP_R1___________________ , RESET , +_______ , _________________NUMP_L2___________________ , _________________NUMP_R2___________________ , _______ , +_______ , _________________NUMP_L3___________________ , _________________NUMP_R3___________________ , _______ , +_______ , ___________________BLANK___________________ , _______ , _______ , _______ , _______ , TO(_OVERWATCH) , _______ +), // Note: visualizer expects this closing parens to be right at the start of the line. + +// Run `./qmk show levinson` from parent dir to see this layer. +[_OVERWATCH] = LAYOUT_ortho_4x12_wrapper( +______________OVERWATCH_L1_________________ , TO(0) , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , EEP_RST , +______________OVERWATCH_L2_________________ , RGB_MODE_FORWARD , RGB_MODE_REVERSE , RGB_VAI , RGB_VAD , XXXXXXX , RGB_TOG , +______________OVERWATCH_L3_________________ , RGB_MODE_PLAIN , RGB_MODE_BREATHE , RGB_MODE_RAINBOW , RGB_MODE_SWIRL , RGB_MODE_SNAKE , RGB_MODE_XMAS , +______________OVERWATCH_L4_________________ , KC_SPACE, RGB_HUI , RGB_HUD , RGB_SAI , RGB_SAD , RGB_MODE_RGBTEST , RGB_MODE_GRADIENT +), // Note: visualizer expects this closing parens to be right at the start of the line. + +// Run `./qmk show levinson` from parent dir to see this layer. +[_NAVI] = LAYOUT_ortho_4x12_wrapper( +XXXXXXX , _________________NAVI_L1___________________ , _________________NAVI_R1___________________ , XXXXXXX , +XXXXXXX , _________________NAVI_L2___________________ , _________________NAVI_R2___________________ , XXXXXXX , +XXXXXXX , _________________NAVI_L3___________________ , _________________NAVI_R3___________________ , XXXXXXX , +XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , APPS , KC_LGUI , MODSFT , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +), // Note: visualizer expects this closing parens to be right at the start of the line. + +}; + +// called by QMK during key processing before the actual key event is handled. Useful for macros. +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LOCK: + if (record->event.pressed) { + rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL); + } + return true; // Let QMK send the press/release events + break; + + case TAP_TOG_LAYER: + process_tap_tog(_SYMB,record); + return false; + break; + default: + tap_tog_count = 0; // reset counter. + tap_tog_layer_other_key_pressed = true; // always set this to true, TAP_TOG_LAYER handlers will handle interpreting this + break; + } + return true; +} + + +// Runs constantly in the background, in a loop every 100ms or so. +// Best used for LED status output triggered when user isn't actively typing. +void matrix_scan_user(void) { + #ifdef RGBLIGHT_ENABLE + matrix_scan_rgb(); + #endif // RGBLIGHT_ENABLE +} + +// only runs when when the layer is changed, good for updating LED's and clearing sticky state +// RGB modes: https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight.h +uint32_t layer_state_set_user(uint32_t state) { + #ifdef RGBLIGHT_ENABLE + layer_state_set_rgb(state); + #endif + uint8_t layer = biton32(state); + combo_enable(); // by default, enable combos. + switch (layer) { + case 0: + break; + case 1: + clear_mods(); + break; + case 2: + clear_mods(); + break; + case _OVERWATCH: + clear_mods(); + combo_disable(); // We don't want combos in overwatch + #ifdef AUDIO_ENABLE + // PLAY_SONG(song_overwatch); + #endif + break; + default: + break; + } + return state; +}; + +// Runs boot tasks for keyboard. +// Plays a welcome song and clears RGB state. +void matrix_init_user(void) { + #ifdef RGBLIGHT_ENABLE + keyboard_post_init_rgb(); + #endif +} diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/push.sh b/keyboards/keebio/levinson/keymaps/issmirnov/push.sh new file mode 100755 index 000000000..58eb115f8 --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/push.sh @@ -0,0 +1,2 @@ +#!/bin/bash +make keebio/levinson/rev2:issmirnov:dfu-split-left diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/rgb.c b/keyboards/keebio/levinson/keymaps/issmirnov/rgb.c new file mode 100644 index 000000000..de3a5342c --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/rgb.c @@ -0,0 +1,61 @@ +#include "rgb.h" + +// TODO gate this debugging header +#include <print.h> + +// Wired up in layer_state_set_user in keymap.c +layer_state_t layer_state_set_rgb(layer_state_t state) { + switch (get_highest_layer(state)) { + case _QWERTY: + rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_sethsv_noeeprom(RGB_CLEAR); + break; + case _SYMB: + rgblight_sethsv_noeeprom_red(); + break; + case _NUMP: + rgblight_sethsv_noeeprom_green(); + break; + case _OVERWATCH: + rgblight_sethsv_noeeprom_blue(); + // TODO set up animated rainbow swirl with overwatch colors. + // rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL); + // rgblight_effect_breathing(&animation_status); + // rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + break; + case _NAVI: + rgblight_sethsv_noeeprom(HSV_AZURE); + break; + default: // for any other layers, or the default layer + break; + } + return state; +} + + +void keyboard_post_init_rgb(void) { + rgblight_enable(); + rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_setrgb(RGB_CLEAR); + uprintf("Reset RGB colors"); +} + +void matrix_scan_rgb(void) { + set_rgb_indicators(get_mods(), get_oneshot_mods()); +} + +void set_rgb_indicators(uint8_t this_mod, uint8_t this_osm) { + if (biton32(layer_state) == _QWERTY) { + if ((this_mod | this_osm) & MOD_MASK_SHIFT) { + rgblight_setrgb_gold_at(SHFT_LED1); + } else { + rgblight_setrgb_at(RGB_CLEAR, SHFT_LED1); + } + + if ((this_mod | this_osm) & MOD_MASK_GUI) { + rgblight_setrgb_purple_at(GUI_LED1); + } else { + rgblight_setrgb_at(RGB_CLEAR, GUI_LED1); + } + } +} diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/rgb.h b/keyboards/keebio/levinson/keymaps/issmirnov/rgb.h new file mode 100644 index 000000000..254d3cbac --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/rgb.h @@ -0,0 +1,15 @@ +#pragma once +#include "quantum.h" +#include "issmirnov.h" + +// Welcome animation when keyboard boots +void keyboard_post_init_rgb(void); + +// If rgb enabled, set underglow for layer +uint32_t layer_state_set_rgb(uint32_t state); + +// Enhance matrix scan code. Note: keep this light, since it runs every 100ms +void matrix_scan_rgb(void); + +// Light up SHIFT and GUI indicator when pressed. +void set_rgb_indicators(uint8_t this_mod, uint8_t this_osm); diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/rules.mk b/keyboards/keebio/levinson/keymaps/issmirnov/rules.mk new file mode 100644 index 000000000..6cbed2f77 --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/rules.mk @@ -0,0 +1,14 @@ +# Enable RGB underglow +# https://beta.docs.qmk.fm/features/feature_rgblight +RGBLIGHT_ENABLE = yes # +5500 bytes +ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) + # Include my fancy rgb functions source here + SRC += rgb.c +endif + +# Disable backlight, since I use RGB underglow. +# https://beta.docs.qmk.fm/features/feature_backlight +BACKLIGHT_ENABLE = no + +# Control piezo speaker on C6 +AUDIO_ENABLE = yes # +4000 bytes diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/sounds.h b/keyboards/keebio/levinson/keymaps/issmirnov/sounds.h new file mode 100644 index 000000000..dac9d276c --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/sounds.h @@ -0,0 +1,9 @@ +// ................................................................ Audio Sounds +#pragma once +#ifdef AUDIO_ENABLE +// Songs come from quantum/audio/song_list.h +float song_startup [][2] = SONG(STARTUP_SOUND); +float song_goodbye [][2] = SONG(GOODBYE_SOUND); +float song_overwatch[][2] = SONG(OVERWATCH_THEME); +#undef AUDIO_VOICES +#endif diff --git a/keyboards/keebio/levinson/keymaps/issmirnov/template.txt b/keyboards/keebio/levinson/keymaps/issmirnov/template.txt new file mode 100644 index 000000000..8787cee7b --- /dev/null +++ b/keyboards/keebio/levinson/keymaps/issmirnov/template.txt @@ -0,0 +1,9 @@ +,-----------------------------------. ,-----------------------------------. +| 0 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 10 | 11 | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| 12 | 13 | 14 | 15 | 16 | 17 | | 18 | 19 | 20 | 21 | 22 | 23 | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| 24 | 25 | 26 | 27 | 28 | 29 | | 30 | 31 | 32 | 33 | 34 | 35 | +|-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----| +| 36 | 37 | 38 | 39 | 40 | 41 | | 42 | 43 | 44 | 45 | 46 | 47 | +`-----------------------------------' ------------------------------------' |