~ruther/qmk_firmware

ea2505901e39715bbca8245b7ea767eb56f630dc — jonavin 3 years ago 633ef14
[Keymap] Jonavin new obe keymap (#14657)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Jonavin <=>
A keyboards/mechwild/obe/keymaps/jonavin/config.h => keyboards/mechwild/obe/keymaps/jonavin/config.h +39 -0
@@ 0,0 1,39 @@
/* Copyright 2021 Jonavin Eng
 *
 * 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 TAPPING_TOGGLE 2
// TT set to two taps

/*  Handle GRAVESC combo keys */
#define GRAVE_ESC_ALT_OVERRIDE
    //Always send Escape if Alt is pressed
#define GRAVE_ESC_CTRL_OVERRIDE
    //Always send Escape if Control is pressed

#define TAPPING_TERM 180

#ifdef RGBLIGHT_ENABLE
    // Redefine number of LED
    #ifdef RGBLED_NUM
        #undef RGBLED_NUM
    #endif // DEBUG
    #define RGBLED_NUM 20

    #define RGBLIGHT_LAYERS
    #define RGBLIGHT_SLEEP
#endif // RGBLIGHT_ENABLE

A keyboards/mechwild/obe/keymaps/jonavin/keymap.c => keyboards/mechwild/obe/keymaps/jonavin/keymap.c +114 -0
@@ 0,0 1,114 @@
/* Copyright 2021 Kyle McCreery
 *
 * 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/>.
 */

#include QMK_KEYBOARD_H
#include "jonavin.h"

#ifdef RGBLIGHT_ENABLE
    // Custom RGB Colours
    #define RGB_OBE_BOW 0x00, 0xE4, 0xFF // colour for matching keycaps
#endif // RGBLIGHT_ENABLE

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Base */
    [_BASE] = LAYOUT(
    KC_MUTE, KC_GESC, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSLS, KC_DEL,
    KC_PGUP, KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC, KC_BSPC,
    KC_PGDN, TT(_RAISE), KC_A, KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,          KC_ENT,
        KC_LSFTCAPSWIN,KC_Z,   KC_X,    KC_C,    KC_V,    KC_B, LT(_LOWER,KC_B), KC_N, KC_M,  KC_COMM, KC_DOT,  KC_SLSH, KC_UP,   KC_RSFT,
             KC_LCTL, KC_LGUI, KC_LALT,          KC_SPC,  MO(_FN1),  LT(_RAISE,KC_SPC),       KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
    ),
    [_FN1] = LAYOUT(
    KC_NO,   KC_ESC,  KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_TRNS, KC_INS,
    KC_HOME, KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_PSCR, KC_SLCK, KC_PAUS, KC_NO,   KC_NO,   KC_NO,   RESET,
    KC_END,  KC_CAPS, KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,            KC_TRNS,
             KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_TRNS, KC_NLCK, KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_PGUP, KC_TRNS,
             KC_TRNS,KC_WINLCK,KC_TRNS,          KC_TRNS, KC_TRNS,          KC_TRNS,          KC_NO,   KC_NO,   KC_HOME, KC_PGDN, KC_END
    ),
    [_LOWER] = LAYOUT(
    KC_NO,   KC_TILD, KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   RGB_VAD, RGB_VAI, KC_TRNS, KC_DEL,
    RGB_HUI, KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO, EMO_TEARS, EMO_SAD, KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   RGB_TOG,
    RGB_HUD, KC_NO,   KC_NO,   EMO_SHRUG,KC_NO,  KC_NO,   KC_NO,   KC_NO,   EMO_JOY, KC_NO,   KC_NO,   KC_NO,   KC_NO,            KC_TRNS,
             KC_NO,   KC_NO,   KC_NO,   EMO_CONFUSE,KC_NO,KC_NO,KC_TRNS,EMO_NERVOUS,KC_NO,   KC_NO,   KC_NO,   KC_NO,   RGB_MOD, KC_TRNS,
             KC_TRNS, KC_APP,  KC_TRNS,          KC_BSPC, KC_TRNS,          KC_TRNS,          KC_TRNS, KC_TRNS, RGB_SPD, RGB_RMOD, RGB_SPI
    ),
    [_RAISE] = LAYOUT(
    KC_NO,   KC_TILD,  KC_NO,  KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_P7,   KC_P8,   KC_P9,   KC_P0,   KC_PMNS, KC_PPLS, KC_PSLS, KC_DEL,
    KC_NO,   KC_NO,    KC_HOME,KC_UP,   KC_END,  KC_PGUP, KC_NO,   KC_TAB,  KC_P4,   KC_P5,   KC_P6,   KC_NO,   KC_NO,   KC_NO,   KC_PEQL,
    KC_NO,  TT(_RAISE),KC_LEFT,KC_DOWN, KC_RGHT, KC_PGDN, KC_NO,   KC_NO,   KC_P1,   KC_P2,   KC_P3,   KC_NO,   KC_PAST,          KC_PENT,
             KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_NO,   KC_TRNS, KC_P0,   KC_00,   KC_NO,   KC_PDOT, KC_PSLS, CT_PGUP, KC_TRNS,
             KC_TRNS, KC_TRNS, KC_TRNS,          KC_TRNS, KC_TRNS,          KC_TRNS,          KC_TRNS, KC_TRNS, CT_HOME, CT_PGDN, CT_END
    )
};

#ifdef RGBLIGHT_ENABLE

    enum custom_rgblight_layers
    {
        _rgbWINLOCK,
        _rgbFN,
        _rgbLOWER,
        _rgbRAISE
    };

    // Optional RGB Light Mapping Zones {LED Posiiton, Number of LEDs, Colour}
    const rgblight_segment_t PROGMEM _rgb_winlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
        {1, 3, HSV_RED},
        {15, 3, HSV_RED}
    );
    const rgblight_segment_t PROGMEM _rgb_fn_layer[] = RGBLIGHT_LAYER_SEGMENTS(
        {6, 6, HSV_PURPLE}
    );
    // Light LEDs 9 & 10 in cyan when keyboard layer 1 is active
    const rgblight_segment_t PROGMEM _rgb_lower_layer[] = RGBLIGHT_LAYER_SEGMENTS(
        {4, 10, HSV_YELLOW}
    );

    const rgblight_segment_t PROGMEM _rgb_raise_layer[] = RGBLIGHT_LAYER_SEGMENTS(
        {3, 5, HSV_GREEN},
        {10, 5, HSV_GREEN}
    );

    const rgblight_segment_t* const PROGMEM _rgb_layers[] = RGBLIGHT_LAYERS_LIST(
        _rgb_winlock_layer,
        _rgb_fn_layer,
        _rgb_lower_layer,
        _rgb_raise_layer
    );

    bool led_update_user(led_t led_state) {
        rgblight_set_layer_state(_rgbWINLOCK, keymap_config.no_gui);
        return true;
    }

    layer_state_t layer_state_set_user(layer_state_t state) {
        rgblight_set_layer_state(_rgbFN, layer_state_cmp(state, _FN1));
        rgblight_set_layer_state(_rgbLOWER, layer_state_cmp(state, _LOWER));
        rgblight_set_layer_state(_rgbRAISE, layer_state_cmp(state, _RAISE));
        return state;
    }
#endif // RGBLIGHT_ENABLE

void keyboard_post_init_keymap(void) {
    // keyboard_post_init_user() moved to userspace
    #ifdef RGBLIGHT_ENABLE
        rgblight_enable_noeeprom();
        rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
        rgblight_setrgb(RGB_OBE_BOW); // Default startup colour
        rgblight_layers = _rgb_layers;
    #endif
}


A keyboards/mechwild/obe/keymaps/jonavin/readme.md => keyboards/mechwild/obe/keymaps/jonavin/readme.md +46 -0
@@ 0,0 1,46 @@
# Jonavin's MechWild Orange Boy Ergo keymap

-->  This keymap makes user of user/jonavin userspace 

Features
  - Split spacebars, Split Backspace
  - RGB Winlock indicator (requires LED stripto be installed)
  - RGB Layer indicators: FN/MO1 - Purple; LOWER/MO2 - Yellow; RAISE/MO3/NumPad - Green
  - quick demo https://youtu.be/gR1awbsouLk

- Add PrtScr, Scroll Lock, Break, NumLock to Fn layer
- Implement Win key lock using Fn+Win 
- Layer 2 (LOWER) when right B is held -- for emoticons
- Layer 2 RGB functions
- Layer 3 (RAISE) mod on Caps Lock with double-tap to switch to this layer, double tap to switch back
    - provides arrows on WASD and additional nav keys + right hand numpad with 00; an be used for Alt Code entry
    - left spacebar Backspace
- add double tap of Left Shift to toggle Caps Lock


rules.mk OPTIONS - Active features from userspace
--------------------------------------------------

STARTUP_NUMLOCK_ON = yes
- turns on NUMLOCK by default

ENCODER_DEFAULTACTIONS_ENABLE = yes
- Enables default encoder funtions
    - holding Left shift, change layers
    - holding right shift, Navigate page up/down
    - holding Left Ctrl, navigate prev/next word
    - holding Left Alt, change media prev/next track
    - default is change volume
  
TD_LSFT_CAPSLOCK_ENABLE = yes
    - This will enable double tap on Left Shift to toggle CAPSLOCK when using KC_LSFTCAPS

IDLE_TIMEOUT_ENABLE = yes
    - Enables Timer functionality; for RGB idle timeouts that can be changed dynamically

EMOTICON_ENABLE
    - adds EMO_ keycodes for text emojis
    
## All layers diagram
![image](https://user-images.githubusercontent.com/71780717/135770721-ab263532-f645-4903-99cb-749549944e15.png)


A keyboards/mechwild/obe/keymaps/jonavin/rules.mk => keyboards/mechwild/obe/keymaps/jonavin/rules.mk +11 -0
@@ 0,0 1,11 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
RGBLIGHT_ENABLE = yes

MOUSEKEY_ENABLE = no
TAP_DANCE_ENABLE = yes

TD_LSFT_CAPSLOCK_ENABLE = yes
STARTUP_NUMLOCK_ON = yes
ENCODER_DEFAULTACTIONS_ENABLE = yes
EMOTICON_ENABLE = yes

M users/jonavin/jonavin.c => users/jonavin/jonavin.c +30 -2
@@ 256,7 256,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
                break;
            }
        }
        return true;
        return false;
    }
#endif // ENCODER_ENABLE



@@ 266,7 266,7 @@ __attribute__ ((weak))  bool process_record_keymap(uint16_t keycode, keyrecord_t

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    if (!process_record_keymap(keycode, record)) { return false; }
     switch (keycode) {
    switch (keycode) {
    case KC_00:
        if (record->event.pressed) {
            // when keycode KC_00 is pressed


@@ 298,6 298,34 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
        } else  unregister_code16(keycode);
        break;
#endif // RGB_MATRIX_ENABLE

#ifdef EMOTICON_ENABLE
    case EMO_SHRUG:
        if (record->event.pressed)  SEND_STRING("`\\_(\"/)_/`");
            else unregister_code16(keycode);
        break;
    case EMO_CONFUSE:
        if (record->event.pressed)  SEND_STRING("(*_*)");
            else unregister_code16(keycode);
        break;
    case EMO_TEARS:
        if (record->event.pressed)  SEND_STRING("(T_T)");
            else unregister_code16(keycode);
        break;
    case EMO_NERVOUS:
        if (record->event.pressed)  SEND_STRING("(~_~;)");
            else unregister_code16(keycode);
        break;
    case EMO_JOY:
        if (record->event.pressed)  SEND_STRING("(^o^)");
            else unregister_code16(keycode);
        break;
    case EMO_SAD:
        if (record->event.pressed)  SEND_STRING(":'-(");
            else unregister_code16(keycode);
        break;
    #endif // EMOTICON_ENABLE

    default:
        if (record->event.pressed) {
            #ifdef RGB_MATRIX_ENABLE

M users/jonavin/jonavin.h => users/jonavin/jonavin.h +12 -2
@@ 38,13 38,23 @@ enum custom_user_keycodes {
  RGB_TOD,      // Timeout idle time down
  RGB_NITE,     // Turns off all rgb but allow rgb indicators to work

  EMO_SHRUG,    // `\_("/)_/`
  EMO_CONFUSE,  // (*_*)
  EMO_SAD,      // :'-(
  EMO_NERVOUS,  // (~_~;)
  EMO_JOY,      // (^o^)
  EMO_TEARS,    // (T_T)

  NEW_SAFE_RANGE  // new safe range for keymap level custom keycodes
};

#define KC_CAD	LALT(LCTL(KC_DEL))
#define KC_CAD  LALT(LCTL(KC_DEL))
#define KC_AF4	LALT(KC_F4)
#define KC_TASK	LCTL(LSFT(KC_ESC))

#define CT_PGUP RCTL(KC_PGUP)
#define CT_PGDN RCTL(KC_PGDN)
#define CT_HOME RCTL(KC_HOME)
#define CT_END  RCTL(KC_END)

#ifdef TD_LSFT_CAPSLOCK_ENABLE
    // Tap Dance Definitions

M users/jonavin/readme.md => users/jonavin/readme.md +67 -39
@@ 14,62 14,90 @@ You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

LAYERS:
    0 = _BASE
    1 = _FN1
    2 = _LOWER
    3 = _RAISE
- 0 = _BASE
- 1 = _FN1
- 2 = _LOWER
- 3 = _RAISE

KEYCODES:
    KC_CAD          Ctrl-Alt-Del	  
    KC_AF4	        Alt-F4
    KC_TASK	        Windows Task Manager (Ctrl-Shift-Esc) 
    LSFT_CAPSLOCK   When LSFT_CAPSLOCK_ENABLE is defined, hold for Shift double tap for CAPSLOCK; otherwise, just Shift
    KC_00           double zero "00"
    KC_WINLCK       toggles LGui/Win key lock
    RGB_TOI         Increase Timeout idle time threshold
    RGB_TOD         Decrease Timeout idle time threshold
- KC_CAD          Ctrl-Alt-Del	  
- KC_AF4	      Alt-F4
- KC_TASK	      Windows Task Manager (Ctrl-Shift-Esc) 
- LSFT_CAPSLOCK   When LSFT_CAPSLOCK_ENABLE is defined, hold for Shift double tap for CAPSLOCK; otherwise, just Shift
- KC_00           double zero "00"
- KC_WINLCK       toggles LGui/Win key lock
- RGB_TOI         Increase Timeout idle time threshold
- RGB_TOD         Decrease Timeout idle time threshold
- CT_PGUP         Ctrl-PgUp
- CT_PGDN         Ctrl-PgDn
- CT_HOME         Ctrl-HOme
- CT_END          Ctrl-End
- 
 When EMOTICON_ENABLE = yes
-   EMO_SHRUG       `\_("/)_/`
-   EMO_CONFUSE     (*_*)
-   EMD_TEARS       (T_T)
-   EMO_NERVOUS     (~_~;)
-   EMO_JOY         (^o^)


AVAILABLE ENCODER ACTIONS:
- void encoder_action_volume(bool clockwise);
- void encoder_action_mediatrack(bool clockwise);
- void encoder_action_navword(bool clockwise);
- void encoder_action_navpage(bool clockwise);
- 
- uint8_t get_selected_layer(void);
- void encoder_action_layerchange(bool clockwise);
- 
- void encoder_action_rgb_speed(bool clockwise);
- void encoder_action_rgb_hue(bool clockwise);
- void encoder_action_rgb_saturation(bool clockwise);
- void encoder_action_rgb_brightness(bool clockwise);
- void encoder_action_rgb_mode(bool clockwise);


ENABLE FEATURES your keymap rules.mk
---------------------------------------

STARTUP_NUMLOCK_ON = yes
    turns on NUMLOCK by default
- turns on NUMLOCK by default

ENCODER_DEFAULTACTIONS_ENABLE = yes
    Enabled default encoder funtions
    When enabled, use this in the keymap for an additional encoder processing 
        bool encoder_update_keymap(uint8_t index, bool clockwise)
  
    OPTION: set ENCODER_DEFAULTACTIONS_INDEX to the encoder number if the encoder is not index 0
- Enabled default encoder funtions
- When enabled, use this in the keymap for an additional encoder processing 
-   bool encoder_update_keymap(uint8_t index, bool clockwise)
  
OPTION: set ENCODER_DEFAULTACTIONS_INDEX to the encoder number if the encoder is not index 0

TD_LSFT_CAPSLOCK_ENABLE = yes
    This will enable double tap on Left Shift to toggle CAPSLOCK
        KC_LSFTCAPS to bind to left Shift to enable feature
        KC_LSFTCAPSWIN does the same thing but will not turn on CAPS when Win Lkey is disabled
- This will enable double tap on Left Shift to toggle CAPSLOCK
-   KC_LSFTCAPS to bind to left Shift to enable feature
-   KC_LSFTCAPSWIN does the same thing but will not turn on CAPS when Win Lkey is disabled

IDLE_TIMEOUT_ENABLE = yes
    Enables Timer functionality; for RGB idle timeouts that can be changed dynamically
    When enabled, use this in the keymap for an additional matrix processing     
        void matrix_scan_keymap(void)
    
    Functions:
        u16int_t get_timeout_threshold(void)            // returns the current timeout threshold
        void timeout_update_threshold(bool increase)    // change threshold: true = increase, false = decrease     
        void timeout_reset_timer(void)                  // resets timer (put in process_record_user if you override it)
        void timeout_tick_timer(void)                   // registers time ticks (put in maxtrix_scan_user if you override it)
- Enables Timer functionality; for RGB idle timeouts that can be changed dynamically
- When enabled, use this in the keymap for an additional matrix processing:  void matrix_scan_keymap(void)

- Functions:
-   u16int_t get_timeout_threshold(void)            // returns the current timeout threshold
-   void timeout_update_threshold(bool increase)    // change threshold: true = increase, false = decrease     
-   void timeout_reset_timer(void)                  // resets timer (put in process_record_user if you override it)
-   void timeout_tick_timer(void)                   // registers time ticks (put in maxtrix_scan_user if you override it)

Other Functions:
    - activate_numlock(bool turn_on)                    // true = turn on NUM LOCK, false = off 
- activate_numlock(bool turn_on)                    // true = turn on NUM LOCK, false = off 

KEYMAP LEVEL ADDITIONAL PROCESSING FUNCTIONS
    bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
    void keyboard_post_init_keymap(void)
- bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
- void keyboard_post_init_keymap(void)

LIST OF COMPATIBLE KEYMAPS
    - gmmk/pro/ansi
    - keebio/quefrency/rev3
    - mechwild/mercutio
    - mechwild/murphpad
    - mechwild/OBE (*)
    - nopunin10did/kastenwagen (*)
- gmmk/pro/ansi
- keebio/quefrency/rev3
- mechwild/mercutio
- mechwild/murphpad
- mechwild/OBE
- nopunin10did/kastenwagen (*)

    (*) coming soon

M users/jonavin/rules.mk => users/jonavin/rules.mk +3 -0
@@ 14,3 14,6 @@ endif
ifeq ($(strip $(COLEMAK_LAYER_ENABLE)), yes)
    OPT_DEFS += -DCOLEMAK_LAYER_ENABLE
endif
ifeq ($(strip $(EMOTICON_ENABLE)), yes)
    OPT_DEFS += -DEMOTICON_ENABLE
endif