From de29da973a3171d55834a1401b72772726d5a354 Mon Sep 17 00:00:00 2001 From: Stick <8531041+nstickney@users.noreply.github.com> Date: Thu, 6 Jun 2019 16:00:52 -0400 Subject: [Keymap] update @nstickney's keymaps (#6076) * [Keymap] iris@nstickney: improve RGB init Perfecting the rgb backlight initialization with a delay for each color; also start and stop the animation at the "default layer" color. * [Keymap] iris,ergodox@nstickney fix FN on SYMB The function key was not operational on the SYMB and SYSH layers due to other keycodes being mapped over MO() on those layers. The offending keycodes have been moved to other keys. * [Keymap] add @nstickney's userspace Pulled common code out to a userspace directory for my iris and ergodox keymaps. * [Keymap] iris@nstickney add image to README Added an image from keyboard-layout-editor.com to meet the README standard. * iris@nstickney hue values now `uint8_t` (#6050) --- keyboards/keebio/iris/keymaps/nstickney/keymap.c | 92 ++++-------------------- 1 file changed, 13 insertions(+), 79 deletions(-) (limited to 'keyboards/keebio/iris/keymaps/nstickney/keymap.c') diff --git a/keyboards/keebio/iris/keymaps/nstickney/keymap.c b/keyboards/keebio/iris/keymaps/nstickney/keymap.c index 6091399858..16b2d0de33 100644 --- a/keyboards/keebio/iris/keymaps/nstickney/keymap.c +++ b/keyboards/keebio/iris/keymaps/nstickney/keymap.c @@ -1,66 +1,4 @@ -#include QMK_KEYBOARD_H - -extern keymap_config_t keymap_config; - -// Layers -#define BASE 0 // Base layer -#define SYMB 1 // Symbols -#define SYSH 2 // Symbols, shifted -#define NUMP 4 // Numpad -#define FCTN 8 // Functions - -// Tap Dancing -void dance_lock (qk_tap_dance_state_t *state, void *user_data) { - switch (state->count){ - case 1: // Press once for LGUI - tap_code(KC_LGUI); - break; - case 2: // Press twice for NUMLOCK - tap_code(KC_NLCK); - break; - case 3: // Press thrice for CAPSLOCK - tap_code(KC_CAPS); - break; - case 4: // Press four times for SCROLLOCK - tap_code(KC_SLCK); - break; - default: - break; - } -}; - -void dance_layer (qk_tap_dance_state_t *state, void *user_data) { - switch (state -> count) { - case 1: // Press once for MENU - tap_code(KC_APP); - break; - case 2: // Press twice for NUMPAD - layer_invert(NUMP); - break; - case 3: // Press thrice for SYMBOLS - layer_invert(SYMB); - break; - case 4: // Press four times for SYMBOLS, SHIFTED - layer_invert(SYSH); - break; - default: - break; - } -}; - -enum tap_dances {LOCKS = 0, LAYERS = 1}; -qk_tap_dance_action_t tap_dance_actions[] = { - [LOCKS] = ACTION_TAP_DANCE_FN(dance_lock), - [LAYERS] = ACTION_TAP_DANCE_FN(dance_layer) -}; - -// Make layering more clear -#define CC_ESC LCTL_T(KC_ESC) -#define CC_QUOT RCTL_T(KC_QUOT) -#define AC_SLSH LALT_T(KC_SLSH) -#define AC_EQL RALT_T(KC_EQL) -#define FC_BSLS LT(FCTN, KC_BSLS) -#define FC_MINS LT(FCTN, KC_MINS) +#include "nstickney.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -88,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┐ ┌──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤ _______, UC(0x00E6),UC(0x00E8),UC(0x00A9),UC(0x00EA),UC(0x00EB),_______, _______, UC(0x00F1),UC(0x00FD),UC(0x00E7),UC(0x00F4),UC(0x00BF),_______, // └──────────┴──────────┴──────────┴────┬─────┴────┬─────┴────┬─────┴────┬─────┘ └────┬─────┴────┬─────┴────┬─────┴────┬─────┴──────────┴──────────┴──────────┘ - UC(0x00BF),UC(0x00AC),_______, _______, UC(0x00B1),UC(0x00D7) + UC(0x00BF),_______, UC(0x00AC), UC(0x00B1),_______, UC(0x00D7) // └──────────┴──────────┴──────────┘ └──────────┴──────────┴──────────┘ ), @@ -102,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┐ ┌──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤ _______, UC(0x00C6),UC(0x00C8),UC(0x00A2),UC(0x00CA),UC(0x00CB),_______, _______, UC(0x00D1),UC(0x00DD),UC(0x00C7),UC(0x00D4),UC(0x203D),_______, // └──────────┴──────────┴──────────┴────┬─────┴────┬─────┴────┬─────┴────┬─────┘ └────┬─────┴────┬─────┴────┬─────┴────┬─────┴──────────┴──────────┴──────────┘ - UC(0x203D),UC(0x00A6),_______, _______, UC(0x00AA),UC(0x00F7) + UC(0x203D),_______, UC(0x00A6), UC(0x00AA),_______, UC(0x00F7) // └──────────┴──────────┴──────────┘ └──────────┴──────────┴──────────┘ ), @@ -138,8 +76,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Initialize rgblight void keyboard_post_init_user(void) { rgblight_enable_noeeprom(); - for (int i = 360; i > 0; i--) { - rgblight_sethsv_noeeprom(i, 255, 255); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + layer_state_set_user(layer_state); + uint16_t user_hue = rgblight_get_hue(); + for (uint16_t i = 0; i < 256; ++i) { + rgblight_sethsv_noeeprom( (i + user_hue) % 256, 255, 255); + wait_ms(5); } layer_state_set_user(layer_state); }; @@ -147,19 +89,11 @@ void keyboard_post_init_user(void) { // Turn on RGB underglow according to active layer uint32_t layer_state_set_user(uint32_t state) { switch (biton32(state)) { - case FCTN: - rgblight_sethsv_noeeprom(136, 255, 255); - break; - case NUMP: - rgblight_sethsv_noeeprom(228, 255, 255); - break; + case FCTN: rgblight_sethsv_noeeprom(96, 255, 255); break; + case NUMP: rgblight_sethsv_noeeprom(162, 255, 255); break; case SYMB: - case SYSH: - rgblight_sethsv_noeeprom(320, 255, 255); - break; - default: // for any other layers, or the default layer - rgblight_sethsv_noeeprom(19, 255, 255); - break; + case SYSH: rgblight_sethsv_noeeprom(227, 255, 255); break; + default: rgblight_sethsv_noeeprom(13, 255, 255); break; } return state; }; -- cgit v1.2.3