~ruther/qmk_firmware

6a045e93f7f0240cacaf35a3f84102ec85920ec3 — Khang 3 years ago c05d3eb
[Keymap] Add keebio/iris keymap (#14688)

Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/keebio/iris/keymaps/khang/colors.h => keyboards/keebio/iris/keymaps/khang/colors.h +67 -0
@@ 0,0 1,67 @@
/* Copyright 2021 Nguyen Vu Khang <brew4k@gmail.com>
  * 
  * 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 MINIMAL_BASEx(hue,sat) \
    rgblight_sethsv_range(hue, sat, 0, 0, 12); \
    rgblight_sethsv_range(hue, sat, 100, 5, 7)

#define MINIMAL_BASE(hue, sat) \
    {0, 12, hue, sat, 0}, \
    {5, 2, hue, sat, 100}

#define MINIMAL(hue, sat) \
    {0, 12, hue, sat, 0}, \
    {3, 1, hue, sat, 100}, \
    {8, 1, hue, sat, 100}

const int yellow = 30;
const int green = 99;
const int red = 252;
const int base_sat = 120;

const rgblight_segment_t PROGMEM _BL_rgblayer[] = RGBLIGHT_LAYER_SEGMENTS(
    MINIMAL_BASE(yellow,250)
);
const rgblight_segment_t PROGMEM _FN_rgblayer[] = RGBLIGHT_LAYER_SEGMENTS(
    MINIMAL(green,255)
);
const rgblight_segment_t PROGMEM _SL_rgblayer[] = RGBLIGHT_LAYER_SEGMENTS(
    MINIMAL(red,255)
);

const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
    _BL_rgblayer,
    _FN_rgblayer,
    _SL_rgblayer
);

void keyboard_post_init_user(void) {
    MINIMAL_BASEx(yellow,200);
    rgblight_layers = my_rgb_layers;
}

layer_state_t default_layer_state_set_user(layer_state_t state) {
    rgblight_set_layer_state(0, layer_state_cmp(state, _BL));
    return state;
}

layer_state_t layer_state_set_user(layer_state_t state) {
    rgblight_set_layer_state(1, layer_state_cmp(state, _FN));
    rgblight_set_layer_state(2, layer_state_cmp(state, _SL));
    return state;
}

A keyboards/keebio/iris/keymaps/khang/config.h => keyboards/keebio/iris/keymaps/khang/config.h +33 -0
@@ 0,0 1,33 @@
/* Copyright 2021 Nguyen Vu Khang <brew4k@gmail.com>
  * 
  * 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 EE_HANDS
#define RGBLIGHT_LAYERS
#define RGBLIGHT_MAX_LAYERS 5
#undef RGBLIGHT_ANIMATIONS
#undef RGBLIGHT_EFFECT_ALTERNATING
#undef RGBLIGHT_EFFECT_BREATHING
#undef RGBLIGHT_EFFECT_CHRISTMAS
#undef RGBLIGHT_EFFECT_KNIGHT
#undef RGBLIGHT_EFFECT_RAINBOW_MOOD
#undef RGBLIGHT_EFFECT_RAINBOW_SWIRL
#undef RGBLIGHT_EFFECT_RGB_TEST
#undef RGBLIGHT_EFFECT_SNAKE
#undef RGBLIGHT_EFFECT_STATIC_GRADIENT
#undef RGBLIGHT_EFFECT_TWINKLE
#undef MOUSEKEY_ENABLE

A keyboards/keebio/iris/keymaps/khang/extrakeys.h => keyboards/keebio/iris/keymaps/khang/extrakeys.h +81 -0
@@ 0,0 1,81 @@
/* Copyright 2021 Nguyen Vu Khang <brew4k@gmail.com>
  * 
  * 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

enum my_keycodes {
    ______ = SAFE_RANGE,
    HYPR1, HYPR2, HYPR3, HYPR4, HYPR5, HYPR6, HYPR7, HYPR8, HYPR9, HYPR0,
    HYPRL,
    HYPRM,
    HYPRP,
    HYPRQ,
    HYPRS,
    HYPRT,
    KC_STAB
};

#undef _______
#define ______ KC_NO

#define HYPR1 HYPR(KC_1)
#define HYPR2 HYPR(KC_2)
#define HYPR3 HYPR(KC_3)
#define HYPR4 HYPR(KC_4)
#define HYPR5 HYPR(KC_5)
#define HYPR6 HYPR(KC_6)
#define HYPR7 HYPR(KC_7)
#define HYPR8 HYPR(KC_8)
#define HYPR9 HYPR(KC_9)
#define HYPR0 HYPR(KC_0)

#define HYPRL HYPR(KC_L)
#define HYPRM HYPR(KC_M)
#define HYPRP HYPR(KC_P)
#define HYPRQ HYPR(KC_Q)
#define HYPRS HYPR(KC_S)
#define HYPRT HYPR(KC_T)

#define KC_STAB LSFT(KC_TAB)

uint8_t mod_state;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    mod_state = get_mods();
    switch (keycode) {
        case KC_BSPC: {
            static bool delkey_registered;
            if (record->event.pressed) { // on key-down of Backspace
                if (mod_state & MOD_MASK_CTRL) {
                    // Ctrl + Backspace -> Forward Delete
                    del_mods(MOD_MASK_CTRL);
                    register_code(KC_DEL);
                    delkey_registered = true;
                    set_mods(mod_state);
                    return false;
                }
            } else { // on release of Backspace
                if (delkey_registered) {
                    unregister_code(KC_DEL);
                    delkey_registered = false;
                    return false;
                }
            }
            return true;
        };
        break;
    }
    return true;
};

A keyboards/keebio/iris/keymaps/khang/keymap.c => keyboards/keebio/iris/keymaps/khang/keymap.c +71 -0
@@ 0,0 1,71 @@
#include QMK_KEYBOARD_H

enum keyboard_layers {
    _BL = 0,
    _FN,
    _SL,
    _BF,
    _UP
};

#include "colors.h"
#include "extrakeys.h"

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

    [_BL] = LAYOUT(
    //┌────────┬────────┬────────┬────────┬────────┬────────┐                    ┌────────┬────────┬────────┬────────┬────────┬────────┐
        KC_GRV ,  KC_1  ,  KC_2  ,  KC_3  ,  KC_4  ,  KC_5  ,                       KC_6  ,  KC_7  ,  KC_8  ,  KC_9  ,  KC_0  ,KC_BSPC ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
        KC_TAB ,  KC_Q  ,  KC_W  ,  KC_E  ,  KC_R  ,  KC_T  ,                       KC_Y  ,  KC_U  ,  KC_I  ,  KC_O  ,  KC_P  ,KC_BSLS ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
        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_MINS ,   KC_PLUS ,  KC_N  ,  KC_M  ,KC_COMM , KC_DOT ,KC_SLSH ,MO(_FN) ,
    //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘  └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
                                      KC_LGUI ,KC_LCTL , KC_ENT ,             KC_SPC ,MO(_UP) ,KC_RALT
                                  // └────────┴────────┴────────┘           └────────┴────────┴────────┘
    ),

    [_UP] = LAYOUT(
    //┌────────┬────────┬────────┬────────┬────────┬────────┐                    ┌────────┬────────┬────────┬────────┬────────┬────────┐
       KC_TILD ,KC_EXLM , KC_AT  ,KC_HASH , KC_DLR ,KC_PERC ,                      ______ , ______ , ______ ,KC_MINS , KC_EQL , KC_NO  ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
        ______ , ______ , ______ , ______ , ______ , ______ ,                      ______ , ______ , ______ ,KC_LBRC ,KC_RBRC , ______ ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
        ______ , ______ , ______ , ______ , ______ , ______ ,                     KC_LEFT ,KC_DOWN , KC_UP  ,KC_RGHT , ______ , ______ ,
    //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐  ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
       KC_LSFT , ______ , ______ , ______ , ______ , ______ , ______ ,    ______ , ______ , ______ , ______ , ______ , ______ , ______ ,
    //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘  └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
                                      KC_LGUI ,KC_LCTL , ______ ,             ______ , KC_NO  , ______
                                  // └────────┴────────┴────────┘           └────────┴────────┴────────┘
    ),

    [_FN] = LAYOUT(
    //┌────────┬────────┬────────┬────────┬────────┬────────┐                    ┌────────┬────────┬────────┬────────┬────────┬────────┐
        ______ , KC_F1  , KC_F2  , KC_F3  , KC_F4  , KC_F5  ,                      KC_F6  , KC_F7  , KC_F8  , KC_F9  , KC_F10 , KC_F11 ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
       KC_STAB , ______ , ______ , ______ , ______ , HYPRT  ,                      ______ , ______ , ______ , ______ , ______ , KC_F12 ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
        ______ , ______ , HYPRS  , ______ , ______ , ______ ,                      ______ , ______ ,KC_BRID ,KC_BRIU , ______ , ______ ,
    //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐  ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
       MO(_SL) , ______ , ______ , ______ , ______ , ______ , ______ ,    ______ , ______ , HYPRM  ,KC_VOLD ,KC_VOLU , ______ , KC_NO  ,
    //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘  └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
                                       ______ , ______ , ______ ,            KC_MPLY ,KC_MPRV ,KC_MNXT
                                  // └────────┴────────┴────────┘           └────────┴────────┴────────┘
    ),

    [_SL] = LAYOUT(
    //┌────────┬────────┬────────┬────────┬────────┬────────┐                    ┌────────┬────────┬────────┬────────┬────────┬────────┐
        ______ , HYPR1  , HYPR2  , HYPR3  , HYPR4  , HYPR5  ,                      HYPR6  , HYPR7  , HYPR8  , HYPR9  , HYPR0  , ______ ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
        ______ , HYPRQ  , ______ , ______ , ______ , ______ ,                      ______ , ______ , ______ , ______ , HYPRP  , ______ ,
    //├────────┼────────┼────────┼────────┼────────┼────────┤                    ├────────┼────────┼────────┼────────┼────────┼────────┤
        ______ , ______ , ______ , ______ , ______ , ______ ,                      ______ , ______ , ______ ,HYPRL   , ______ , ______ ,
    //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐  ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
        KC_NO  , ______ , ______ , ______ , ______ , ______ , ______ ,    ______ , ______ , ______ , ______ , ______ , ______ , KC_NO  ,
    //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘  └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
                                       ______ , ______ , ______ ,             RESET  , ______ , ______
                                  // └────────┴────────┴────────┘           └────────┴────────┴────────┘
    )
};

A keyboards/keebio/iris/keymaps/khang/readme.md => keyboards/keebio/iris/keymaps/khang/readme.md +7 -0
@@ 0,0 1,7 @@
# Khang's Iris Keymap

- QWERTY at heart
- Space on right thumb
- Enter on left thumb
- Right-Shift as Fn
- Minimal (disabled everything unused to save space)

A keyboards/keebio/iris/keymaps/khang/rules.mk => keyboards/keebio/iris/keymaps/khang/rules.mk +3 -0
@@ 0,0 1,3 @@
ENCODER_ENABLE = no
MOUSEKEY_ENABLE = no
RGBLIGHT_ENABLE = yes