~jojo/kyria-keymap

27cc241f021310c9f1822f48804eabba417db642 — JoJo 10 months ago 35b38e9
Workgirl, & set OLD_ONE from shell
3 files changed, 49 insertions(+), 117 deletions(-)

M config.h
M keymap.c
M rules.mk
M config.h => config.h +1 -8
@@ 16,8 16,8 @@

#pragma once

// FIXME: Just here until I've built the right half
#define MASTER_LEFT
// #define OLD_ONE false

#define TAPPING_TERM 350



@@ 28,13 28,6 @@
  #define OLED_DISPLAY_128X64
#endif

#ifdef RGBLIGHT_ENABLE
  #define RGBLIGHT_ANIMATIONS
  #define RGBLIGHT_HUE_STEP 8
  #define RGBLIGHT_SAT_STEP 8
  #define RGBLIGHT_VAL_STEP 8
#endif

// If you are using an Elite C rev3 on the slave side, uncomment the lines below:
// #define SPLIT_USB_DETECT
// #define NO_USB_STARTUP_CHECK

M keymap.c => keymap.c +45 -109
@@ 16,9 16,9 @@
#include QMK_KEYBOARD_H

enum layers {
    QWERTY = 0,
    WORKGIRL = 0,
    QWERTY,
    SYMB,
    EXT,
    FUNC,
    GAME
};


@@ 26,7 26,8 @@ enum layers {
#define KC_SUP KC_LGUI

enum tapdance {
    TD_MEDIA
    DMEDI,
    DLAYO
};

void dance_media(qk_tap_dance_state_t* state, void* user_data) {


@@ 38,130 39,65 @@ void dance_media(qk_tap_dance_state_t* state, void* user_data) {
    }
}

void dance_layout(qk_tap_dance_state_t* state, void* user_data) {
    switch (state->count) {
    case 1: layer_off(QWERTY); layer_off(GAME); break;
    case 2: layer_on(QWERTY); layer_off(GAME); break;
    case 3: layer_off(QWERTY); layer_on(GAME); break;
    default: {};
    }
}

qk_tap_dance_action_t tap_dance_actions[] = {
    [TD_MEDIA] = ACTION_TAP_DANCE_FN(dance_media),
    [DMEDI] = ACTION_TAP_DANCE_FN(dance_media),
    [DLAYO] = ACTION_TAP_DANCE_FN(dance_layout)
};

#define AGR ALGR
#define ___ _______

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
 * Base Layer: QWERTY
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * | Tab    |   Q  |   W  |   E  |   R  |   T  |                              |   Y  |   U  |   I  |   O  |   P  |  - _   |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * | >Ext   |   A  |   S  |  D   |   F  |   G  |                              |   H  |   J  |   K  |   L  | ;  : |  ' "   |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * | Super  |   Z  |   X  |   C  |   V  |   B  | Esc  | >Game|  | Del  | Bkspc|   N  |   M  | ,  < | . >  | /  ? |  \ |   |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        | Print| Ctrl | Alt  | Ctrl | Enter|  | Space| Shift| >Symb| >Func| Media|
 *                        |      | +Alt |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [WORKGIRL] = LAYOUT(
      KC_TAB,   KC_Q,     KC_D,     KC_R,     KC_W,     KC_B,                                                KC_J,     KC_F,     KC_U,     KC_P,     KC_SCLN,  KC_MINS,
      KC_ESC,   KC_A,     KC_S,     KC_H,     KC_T,     KC_G,                                                KC_Y,     KC_N,     KC_E,     KC_O,     KC_I,     KC_QUOT,
      KC_SUP,   KC_Z,     KC_X,     KC_M,     KC_C,     KC_V,     _______,  TD(DLAYO),   KC_DEL,   KC_BSPC,  KC_K,     KC_L,     KC_COMM,  KC_DOT,   KC_SLSH,  KC_BSLS,
                                    KC_PSCR,  C(KC_LALT),KC_LALT, KC_LCTL,  KC_ENT,      KC_SPC,   KC_LSFT,  MO(SYMB), MO(FUNC), TD(DMEDI)
    ),
    [QWERTY] = LAYOUT(
      KC_TAB,    KC_Q,   KC_W,   KC_E,    KC_R,      KC_T,                                         KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_MINS,
      MO(EXT),   KC_A,   KC_S,   KC_D,    KC_F,      KC_G,                                         KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,
      KC_SUP,    KC_Z,   KC_X,   KC_C,    KC_V,      KC_B,   KC_ESC,  TO(GAME),   KC_DEL, KC_BSPC, KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_BSLS,
                                 KC_PSCR, C(KC_LALT),KC_LALT,KC_LCTL, KC_ENT,     KC_SPC, KC_LSFT, MO(SYMB),MO(FUNC),TD(TD_MEDIA)
      _______,  KC_Q,     KC_W,     KC_E,     KC_R,     KC_T,                                                KC_Y,     KC_U,     KC_I,     KC_O,     KC_P,     KC_MINS,
      _______,  KC_A,     KC_S,     KC_D,     KC_F,     KC_G,                                                KC_H,     KC_J,     KC_K,     KC_L,     KC_SCLN,  KC_QUOT,
      _______,  KC_Z,     KC_X,     KC_C,     KC_V,     KC_B,     _______,  _______,     _______,  _______,  KC_N,     KC_M,     KC_COMM,  KC_DOT,   KC_SLSH,  KC_BSLS,
                                    _______,  _______,  _______,  _______,  _______,     _______,  _______,  _______,  _______,  _______
    ),
/*
 * Symbol & numpad layer
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * |        |  !   |  {   |  }   |  $   |  `   |                              |   &  |  7   |  8   |  9   |  =   |  +     |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * |        |  @   |  (   |  )   |  %   |  ~   |                              |   *  |  4   |  5   |  6   |  0   | Dead¨  |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * |        |  #   |  [   |  ]   |  ^   |  ¡   |      |      |  |      |      |  Spc |  1   |  2   |  3   |  ¿   | Dead´  |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [SYMB] = LAYOUT(
      _______, KC_EXLM, KC_LCBR, KC_RCBR, KC_DLR , KC_GRV       ,                                        KC_AMPR, KC_7   , KC_8   , KC_9, KC_EQL       , KC_PLUS,
      _______, KC_AT  , KC_LPRN, KC_RPRN, KC_PERC, KC_TILD      ,                                        KC_ASTR, KC_4   , KC_5   , KC_6, KC_0         , SAGR(KC_QUOT),
      _______, KC_HASH, KC_LBRC, KC_RBRC, KC_CIRC, SAGR(KC_EXLM), _______, _______,    _______, _______, KC_SPC , KC_1   , KC_2   , KC_3, ALGR(KC_QUES), ALGR(KC_QUOT),
                                 _______, _______, _______      , _______, _______,    _______, _______, _______, _______, _______
    ),
/*
 * Extra symbol & character layer
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * |        |      |      |      |      |      |                              |      |      |      |      |      |  å     |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * |        |      |      |      |      |      |                              |      |      |      |      |  ö   |  ä     |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * |        |      |      |      |      |      |      |      |  |      |      |      |      |      |      |      |        |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [EXT] = LAYOUT(
      _______, _______, _______, _______, _______, _______,                                     _______, _______, _______, _______, _______, ALGR(KC_W),
      _______, _______, _______, _______, _______, _______,                                     _______, _______, _______, _______, ALGR(KC_P), ALGR(KC_Q),
      _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
                                 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
      AGR(KC_W),KC_EXLM,  KC_LCBR,  KC_RCBR,  KC_DLR,   KC_GRV,                                              KC_AMPR,  KC_7,     KC_8,     KC_9,     KC_EQL,   KC_PLUS,
      AGR(KC_Q),KC_AT,    KC_LPRN,  KC_RPRN,  KC_PERC,  KC_TILD,                                             KC_ASTR,  KC_4,     KC_5,     KC_6,     KC_0,     SAGR(KC_QUOT),
      AGR(KC_P),KC_HASH,  KC_LBRC,  KC_RBRC,  KC_CIRC,  SAGR(KC_EXLM),___,  _______,     _______,  _______,  KC_SPC,   KC_1,     KC_2,     KC_3,     AGR(KC_QUES),AGR(KC_QUOT),
                                    _______,  _______,  _______,  _______,  _______,     _______,  _______,  _______,  _______,  _______
    ),
/*
 * Function layer
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * |        |      |      |      |      |      |                              |      | Home | Up   | End  | PgUp |        |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * |        |      |      |      |      |      |                              |      | Left | Down | Right| PgDn |        |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * | F1     |  F2  |  F3  |  F4  |  F5  | F6   |      |      |  |      |      |  F7  |  F8  |  F9  |  F10 |  F11 | F12    |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [FUNC] = LAYOUT(
      _______, _______, _______, _______, _______, _______,                                     _______, KC_HOME, KC_UP  , KC_END , KC_PGUP, _______,
      _______, _______, _______, _______, _______, _______,                                     _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______,
      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_HOME,  KC_UP,    KC_END,   KC_PGUP,  _______,
      _______,  _______,  _______,  _______,  _______,  _______,                                             _______,  KC_LEFT,  KC_DOWN,  KC_RGHT,  KC_PGDN,  _______,
      KC_F1,    KC_F2,    KC_F3,    KC_F4,    KC_F5,    KC_F6,    _______,  _______,     _______,  _______,  KC_F7,    KC_F8,    KC_F9,    KC_F10,   KC_F11,   KC_F12,
                                    _______,  _______,  _______,  _______,  _______,     _______,  _______,  _______,  _______,  _______
    ),
/*
 * Gaming layer
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * | Tab    | `    | Q    | W    | E    | R    |                              |      |      |      |      |      |        |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * | Ctrl   | Shift| A    | S    | D    | F    |                              |      |      |      |      |      |        |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * | 1      | 2    | Z    | X    | C    | V    | G    | >DEF |  |      |      |      |      |      |      |      |        |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        | Esc  | 3    | T    | Alt  | Space|  |      |      |      | +FUNC|      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [GAME] = LAYOUT(
      KC_TAB , KC_GRV , KC_Q, KC_W   , KC_E   , KC_R   ,                                           _______, _______ , _______, _______, _______, _______,
      KC_LCTL, KC_LSFT, KC_A, KC_S   , KC_D   , KC_F   ,                                           _______, _______ , _______, _______, _______, _______,
      KC_1   , KC_2   , KC_Z, KC_X   , KC_C   , KC_V   , KC_G   , TO(QWERTY),    _______, _______, _______, _______ , _______, _______, _______, _______,
                              KC_ESC , KC_3   , KC_T   , KC_LALT, KC_SPC    ,    _______, _______, _______, TG(FUNC), _______
      _______,  KC_1,     KC_Q,     KC_W,     KC_E,     KC_R,                                                _______,  KC_HOME,  KC_UP,    KC_END,   KC_PGUP,  _______,
      _______,  KC_LSFT,  KC_A,     KC_S,     KC_D,     KC_F,                                                _______,  KC_LEFT,  KC_DOWN,  KC_RGHT,  KC_PGDN,  _______,
      _______,  KC_LCTL,  KC_Z,     KC_X,     KC_C,     KC_V,     KC_T,     _______,     _______,  _______,  _______,  _______,  _______,  _______,  _______,  _______,
                                    KC_G,     KC_2,     KC_3,     KC_LALT,  KC_SPC ,     _______,  _______,  _______,  _______,  _______
    ),
};

void encoder_update_user(uint8_t index, bool clockwise) {
#ifdef MASTER_LEFT
    bool side_clockwise = index ? clockwise : !clockwise;
    bool side_clockwise = (index && OLD_ONE) ? clockwise : !clockwise;
#else
    bool side_clockwise = index ? !clockwise : clockwise;
#endif
    if (index == 0) { // Left hand, brightness
        if (side_clockwise) {
            tap_code(KC_BRIGHTNESS_UP);
        } else {
            tap_code(KC_BRIGHTNESS_DOWN);
        }
    } else if (index == 1) { // Right hand, volume
        if (side_clockwise) {
            tap_code(KC_VOLU);
        } else {
            tap_code(KC_VOLD);
        }
    if (index == 0) {
        if (side_clockwise) tap_code(KC_BRIGHTNESS_UP); else tap_code(KC_BRIGHTNESS_DOWN);
    } else {
        if (side_clockwise) tap_code(KC_VOLU); else tap_code(KC_VOLD);
    }
}

M rules.mk => rules.mk +3 -0
@@ 2,3 2,6 @@ OLED_DRIVER_ENABLE = no    # Enables the use of OLED displays
ENCODER_ENABLE = yes       # Enables the use of one or more encoders
RGBLIGHT_ENABLE = no       # Enable keyboard RGB underglow
TAP_DANCE_ENABLE = yes     # Tap once for X, double tap for Y

OLD_ONE=please_build_with_make_and_set_var_OLD_ONE
CFLAGS += -DOLD_ONE=$(OLD_ONE)