Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update keymap and config #1

Merged
merged 5 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions keyboards/planck/keymaps/adamtabrams/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
// Mouse Configs
#define MK_3_SPEED
#define MK_MOMENTARY_ACCEL
#define MK_C_OFFSET_1 6
#define MK_C_OFFSET_UNMOD 16
#define MK_C_OFFSET_2 26
#define MK_C_OFFSET_1 4
#define MK_C_OFFSET_UNMOD 14
#define MK_C_OFFSET_2 28
// for MK_W lower is faster
#define MK_W_INTERVAL_UNMOD 80

// Tap-Hold Configs
#define TAPPING_TERM 180
#define TAPPING_TERM 155
// #define TAPPING_TERM 165
#define PERMISSIVE_HOLD
#define HOLD_ON_OTHER_KEY_PRESS
#define HOLD_ON_OTHER_KEY_PRESS_PER_KEY
#define QUICK_TAP_TERM 0
#define QUICK_TAP_TERM 120
#define QUICK_TAP_TERM_PER_KEY
113 changes: 93 additions & 20 deletions keyboards/planck/keymaps/adamtabrams/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/

#include QMK_KEYBOARD_H
#include "muse.h"


enum planck_layers {
_QWERTY,
Expand Down Expand Up @@ -133,14 +131,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* ## Arrows

| | |A(->) | | |A(<-) | | P_Up | P_Up |C(->) | | |
| | | |A(->) | |A(<-) | | P_Up | P_Up |C(->) | | |
| | | |P_Down| | | Left | Down | Up |Right |C(<-) | |
| | | | |P_Down|A(<-) | | | | | | |
| | | | | | | | \\/ | | | |Normal|
*/

[_ARROWS] = LAYOUT_planck_grid(
_______, _______, ALTRGHT, _______, _______, ALTLEFT, _______, KC_PGUP, KC_PGUP, CTLRGHT, _______, _______,
_______, _______, _______, ALTRGHT, _______, ALTLEFT, _______, KC_PGUP, KC_PGUP, CTLRGHT, _______, _______,
_______, _______, _______, KC_PGDN, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, CTLLEFT, _______,
_______, _______, _______, _______, KC_PGDN, ALTLEFT, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NORMAL
Expand Down Expand Up @@ -208,7 +206,96 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

bool is_left_mod(uint16_t keycode) {
switch (keycode) {
case ALT__A:
case GUI__S:
case SFT__D:
case CTL__F:
case GUI__R:
case SFT__S:
case CTL__T:
return true;
}
return false;
}

bool is_right_mod(uint16_t keycode) {
switch (keycode) {
case ALTSCLN:
case GUI__L:
case SFT__K:
case CTL__J:
case ALT__O:
case GUI__I:
case SFT__E:
case CTL__N:
return true;
}
return false;
}

bool is_left_key(int row) {
return row < 4 || row == 7;
}

bool is_right_key(int row) {
return row > 2;
}

void tap_mods(int num_mods, uint16_t *mods, int *counts) {
clear_mods();
for (int i = 0; i < num_mods; i++) {
if (counts[i] == 0) {
tap_code16(mods[i]);
}
}
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static int l_mods = 0;
static int r_mods = 0;
static int counts[4];
static uint16_t mods[4];
bool is_l_mod = is_left_mod(keycode);
bool is_r_mod = is_right_mod(keycode);

if (l_mods > 0) {
// opposite key
if (is_right_key(record->event.key.row)) {
return true;
}
// sameside non-mod
if (!is_l_mod && record->event.pressed) {
tap_mods(l_mods, mods, counts);
return true;
}
} else if (r_mods > 0) {
// opposite key
if (is_left_key(record->event.key.row)) {
return true;
}
// sameside non-mod
if (!is_r_mod && record->event.pressed) {
tap_mods(r_mods, mods, counts);
return true;
}
}

// sameside mod
if (is_l_mod || is_r_mod) {
if (record->event.pressed) {
counts[l_mods + r_mods] = record->tap.count;
mods[l_mods + r_mods] = keycode;
l_mods += is_l_mod;
r_mods += is_r_mod;
} else {
l_mods -= is_l_mod;
r_mods -= is_r_mod;
}
return true;
}

switch (keycode) {
case QWERTY:
set_single_persistent_default_layer(_QWERTY);
Expand All @@ -226,6 +313,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_clear();
return false;
}

return true;
}

Expand All @@ -234,21 +322,6 @@ uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
case SHFTESC:
case NUMSPAC:
case SFTENTR:
case ALT__A:
case ALTSCLN:
case ALT__O:
case GUI__S:
case GUI__L:
case GUI__R:
case GUI__I:
case SFT__D:
case SFT__K:
case SFT__S:
case SFT__E:
case CTL__F:
case CTL__J:
case CTL__T:
case CTL__N:
return 0;
default:
return QUICK_TAP_TERM;
Expand All @@ -274,6 +347,6 @@ bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
case CTL__N:
return false;
default:
return false;
return true;
}
}
2 changes: 1 addition & 1 deletion keyboards/planck/keymaps/adamtabrams/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

|------|------|------|------|------|------|------|------|------|------|------|------|
|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|
| | |A(->) | | |A(<-) | | P_Up | P_Up |C(->) | | |
| | | |A(->) | |A(<-) | | P_Up | P_Up |C(->) | | |
| | | |P_Down| | | Left | Down | Up |Right |C(<-) | |
| | | | |P_Down|A(<-) | | | | | | |
| | | | | | | | \\/ | | | |Normal|
Expand Down
1 change: 0 additions & 1 deletion keyboards/planck/keymaps/adamtabrams/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SRC += muse.c
LTO_ENABLE = yes

MOUSEKEY_ENABLE = yes
Expand Down