From 74c01654c771f120ab29ffabac833497a086eacf Mon Sep 17 00:00:00 2001 From: George Petri Date: Mon, 30 Mar 2020 00:14:43 +0300 Subject: Update keymap keebio/nyquist (#8602) * format code, add shift color * testing colors * todos, shift on right * changed colors * use rgh layers api * impl shift layer * replace xor with != * moved shift rbg * breathing animation, simplyfy layers * remove breating animation * use tt * minor cleanup * debounce eager, lto * shut down rbg when poweroff * update readme * readme.md fix * more readme.md fix * more readme.md fix --- .../keebio/nyquist/keymaps/georgepetri/config.h | 10 ++- .../keebio/nyquist/keymaps/georgepetri/keymap.c | 71 ++++++++++++++-------- .../keebio/nyquist/keymaps/georgepetri/readme.md | 12 ++-- .../keebio/nyquist/keymaps/georgepetri/rules.mk | 4 +- 4 files changed, 57 insertions(+), 40 deletions(-) (limited to 'keyboards/keebio') diff --git a/keyboards/keebio/nyquist/keymaps/georgepetri/config.h b/keyboards/keebio/nyquist/keymaps/georgepetri/config.h index bc7fed826d..d13d3294fd 100644 --- a/keyboards/keebio/nyquist/keymaps/georgepetri/config.h +++ b/keyboards/keebio/nyquist/keymaps/georgepetri/config.h @@ -17,11 +17,9 @@ along with this program. If not, see . #pragma once -// #define USE_I2C - -/* Select hand configuration */ -// #define MASTER_RIGHT -// #define EE_HANDS - #undef RGBLED_NUM #define RGBLED_NUM 12 +#define RGBLIGHT_LAYERS + +#define TAPPING_TOGGLE 2 +#define TAPPING_TERM 150 diff --git a/keyboards/keebio/nyquist/keymaps/georgepetri/keymap.c b/keyboards/keebio/nyquist/keymaps/georgepetri/keymap.c index 6b427e06d5..96ea4ff199 100644 --- a/keyboards/keebio/nyquist/keymaps/georgepetri/keymap.c +++ b/keyboards/keebio/nyquist/keymaps/georgepetri/keymap.c @@ -6,10 +6,6 @@ extern keymap_config_t keymap_config; #define _L 1 #define _R 2 -enum custom_keycodes { - QWERTY = SAFE_RANGE -}; - #define KC_TL LCTL(KC_PGUP) #define KC_TR LCTL(KC_PGDN) #define KC_TC LCTL(KC_W) @@ -26,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_ENT , //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ - KC_CAPS, KC_LCTL, KC_LGUI, KC_LALT, MO(_L) , KC_SPC , KC_SPC , TG(_R) , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT + KC_CAPS, KC_LCTL, KC_LGUI, KC_LALT, MO(_L) , KC_SPC , KC_RSFT, TT(_R) , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT //└────────┴────────┴────────┴────────┴────────┴────────┘ └────────┴────────┴────────┴────────┴────────┴────────┘ ), @@ -59,33 +55,54 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; +const rgblight_segment_t PROGMEM left[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 12, HSV_MAGENTA} +); + +const rgblight_segment_t PROGMEM right[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 12, HSV_RED} +); + +const rgblight_segment_t PROGMEM capslock[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 3, HSV_GOLD}, + {6, 3, HSV_GOLD} +); + +const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST(left, right, capslock); + void keyboard_post_init_user(void) { - rgblight_sethsv_noeeprom(HSV_BLUE); + rgblight_sethsv_noeeprom(HSV_SPRINGGREEN); + rgblight_layers = rgb_layers; } -void update_led(void) { - switch (biton32(layer_state)) { - case _BASE: - rgblight_sethsv_noeeprom(HSV_BLUE); - break; - case _L: - rgblight_sethsv_noeeprom(HSV_CORAL); - break; - case _R: - rgblight_sethsv_noeeprom(HSV_MAGENTA); - break; - } - if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { - rgblight_sethsv_range(HSV_WHITE,0,3); - rgblight_sethsv_range(HSV_WHITE,9,12); - } +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(0, layer_state_cmp(state, _L)); + rgblight_set_layer_state(1, layer_state_cmp(state, _R)); + return state; } -uint32_t layer_state_set_user(uint32_t state) { - update_led(); - return state; +void suspend_power_down_user(void) { + rgblight_disable(); } -void led_set_user(uint8_t usb_led) { - update_led(); +void suspend_wakeup_init_user(void) { + rgblight_enable(); +} + +bool is_shift_pressed = false; + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(2, is_shift_pressed != led_state.caps_lock); + return true; +} + +bool process_record_user(uint16_t keycode, keyrecord_t* record) { + switch (keycode) { + case KC_LSFT: + case KC_RSFT: + is_shift_pressed = record->event.pressed; + rgblight_set_layer_state(2, is_shift_pressed != host_keyboard_led_state().caps_lock); + default: + return true; + } } diff --git a/keyboards/keebio/nyquist/keymaps/georgepetri/readme.md b/keyboards/keebio/nyquist/keymaps/georgepetri/readme.md index a659905f8f..5d1855e933 100644 --- a/keyboards/keebio/nyquist/keymaps/georgepetri/readme.md +++ b/keyboards/keebio/nyquist/keymaps/georgepetri/readme.md @@ -1,7 +1,7 @@ # George Petri's Nyquist layout ``` -make keebio/nyquist/rev2:georgepetri +sudo make keebio/nyquist/rev2:georgepetri:dfu ``` Features a dedicated navigation layer on rise and current layer status on rgb underglow. @@ -15,9 +15,9 @@ Features a dedicated navigation layer on rise and current layer status on rgb un ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ │ ESC │ A │ S │ D │ F │ G │ │ H │ J │ K │ L │ SCLN│ QUOT │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ -│ LSFT│ Z │ X │ C │ V │ B │ │ N │ M │ COMM │ DOT │ SLSH│ ENT │ +│ LSFT│ Z │ X │ C │ V │ B │ │ N │ M │ COMM│ DOT │ SLSH│ ENT │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ -│ CAPS│ LCTL│ LGUI │ LALT │MO(_L)│ SPC │ │ SPC │MO(_R)│ LEFT │ DOWN│ UP │ RGHT │ +│ CAPS│ LCTL│ LGUI │ LALT │MO(_L)│ SPC │ │ RSFT│MO(_R)│ LEFT│ DOWN│ UP │ RGHT │ └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ ``` @@ -28,7 +28,7 @@ Features a dedicated navigation layer on rise and current layer status on rgb un ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ │ │ F11 │ F12 │ │ │ │ │ │ MINS│ EQL │ LBRC│ RBRC│ BSLS │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ -│ │ │ │ │ │ │ │ LEFT │ DOWN │ UP │ RGHT │ │ │ +│ │ │ │ │ │ │ │ LEFT│ DOWN│ UP │ RGHT│ │ │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ │ │ │ │ │ │ │ │ │ PGDN│ PGUP │ HOME│ END │ │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ @@ -43,9 +43,9 @@ Features a dedicated navigation layer on rise and current layer status on rgb un ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ │ │ TAB_L│ TAB_R│ TAB_C│ TAB_R│ │ │ │ TAB_L│ TAB_R│ TAB_C│ TAB_R│ │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ -│ │ LEFT │ DOWN │ UP │ RGHT │ │ │ LEFT │ DOWN │ UP │ RGHT │ │ │ +│ │ LEFT│ DOWN│ UP │ RGHT│ │ │ LEFT│ DOWN│ UP │ RGHT│ │ │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ -│ │ PGDN │ PGUP │ HOME│ END │ │ │ │ PGDN │ PGUP │ HOME│ END │ │ +│ │ PGDN│ PGUP│ HOME│ END │ │ │ │ PGDN│ PGUP│ HOME│ END │ │ ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ diff --git a/keyboards/keebio/nyquist/keymaps/georgepetri/rules.mk b/keyboards/keebio/nyquist/keymaps/georgepetri/rules.mk index 2e145d5a88..4010d90f03 100644 --- a/keyboards/keebio/nyquist/keymaps/georgepetri/rules.mk +++ b/keyboards/keebio/nyquist/keymaps/georgepetri/rules.mk @@ -1,3 +1,5 @@ -RGBLIGHT_ENABLE = yes MOUSEKEY_ENABLE = no COMMAND_ENABLE = no +RGBLIGHT_ENABLE = yes +LTO_ENABLE = yes +DEBOUNCE_TYPE = eager_pk -- cgit v1.2.3