summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ergodox_ez')
-rw-r--r--keyboards/ergodox_ez/config.h10
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.c2
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.h4
-rw-r--r--keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk2
-rw-r--r--keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h3
-rw-r--r--keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c123
-rw-r--r--keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md7
-rw-r--r--keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk5
-rw-r--r--keyboards/ergodox_ez/keymaps/stamm/config.h40
-rw-r--r--keyboards/ergodox_ez/keymaps/stamm/keymap.c308
-rw-r--r--keyboards/ergodox_ez/keymaps/stamm/readme.md117
-rw-r--r--keyboards/ergodox_ez/keymaps/stamm/rules.mk8
-rw-r--r--keyboards/ergodox_ez/matrix.c333
-rw-r--r--keyboards/ergodox_ez/rules.mk20
14 files changed, 737 insertions, 245 deletions
diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h
index 8ef600b089..eb0f2066da 100644
--- a/keyboards/ergodox_ez/config.h
+++ b/keyboards/ergodox_ez/config.h
@@ -32,6 +32,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS_PER_SIDE (MATRIX_ROWS / 2)
#define MATRIX_COLS 6
+#define COL_EXPANDED { true, true, true, true, true, true, true, false, false, false, false, false, false, false }
+#define MATRIX_ONBOARD_ROW_PINS { 0, 0, 0, 0, 0, 0, 0, B0, B1, B2, B3, D2, D3, C6 }
+#define MATRIX_ONBOARD_COL_PINS { F0, F1, F4, F5, F6, F7 }
+#define DIODE_DIRECTION COL2ROW
+#define EXPANDER_COL_REGISTER GPIOB
+#define EXPANDER_ROW_REGISTER GPIOA
+#define MATRIX_EXPANDER_COL_PINS { 5, 4, 3, 2, 1, 0 }
+#define MATRIX_EXPANDER_ROW_PINS { 0, 1, 2, 3, 4, 5, 6 }
+
+
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c
index d313f7d5d9..6c0b74ec46 100644
--- a/keyboards/ergodox_ez/ergodox_ez.c
+++ b/keyboards/ergodox_ez/ergodox_ez.c
@@ -1,4 +1,4 @@
-#include QMK_KEYBOARD_H
+#include "ergodox_ez.h"
extern inline void ergodox_board_led_on(void);
extern inline void ergodox_right_led_1_on(void);
diff --git a/keyboards/ergodox_ez/ergodox_ez.h b/keyboards/ergodox_ez/ergodox_ez.h
index 88a0a2ee9f..a8b02a96bd 100644
--- a/keyboards/ergodox_ez/ergodox_ez.h
+++ b/keyboards/ergodox_ez/ergodox_ez.h
@@ -4,10 +4,6 @@
#include <stdint.h>
#include <stdbool.h>
#include "i2c_master.h"
-#include <util/delay.h>
-
-#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
-#define CPU_16MHz 0x00
// I2C aliases and register addresses (see "mcp23018.md")
#define I2C_ADDR 0b0100000
diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk b/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk
index aa13f98bd6..2eda18ce4f 100644
--- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk
+++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk
@@ -1,7 +1,7 @@
# Set any rules.mk overrides for your specific keymap here.
# See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file
-LINK_TIME_OPTIMIZATION_ENABLE = yes
+LTO_ENABLE = yes
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
TAP_DANCE_ENABLE = yes
MOUSEKEY_ENABLE = yes # Mouse keys(+4700b).
diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h b/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h
index 6d69b00112..06c50e0a96 100644
--- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h
+++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h
@@ -18,6 +18,9 @@
#undef MOUSEKEY_WHEEL_INTERVAL
#define MOUSEKEY_WHEEL_INTERVAL 50
+#undef MK_COMBINED
+#define MK_COMBINED
+
// /* Temporarily defining a tapping term that is ridiculous to see if i can tell if lt is working. */
// #undef TAPPING_TERM
// #define TAPPING_TERM 499
diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c b/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c
index c2960cfa16..e06d0b769f 100644
--- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c
+++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c
@@ -28,13 +28,17 @@
enum custom_keycodes {
RGB_SLD = EZ_SAFE_RANGE,
+ MS_WH_UP,
+ MS_WH_DOWN,
+ MS_WH_RIGHT,
+ MS_WH_LEFT,
};
// tapdance keycodes
enum td_keycodes {
CTRL_TO12,
SHIFT_TO13,
- ALT_TO11
+ ALT_TO11,
};
// define a type containing as many tapdance states as you need
@@ -59,6 +63,7 @@ void altto11_reset (qk_tap_dance_state_t *state, void *user_data);
void shiftto13_finished (qk_tap_dance_state_t *state, void *user_data);
void shiftto13_reset (qk_tap_dance_state_t *state, void *user_data);
+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ergodox_pretty(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
@@ -162,9 +167,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[10] = LAYOUT_ergodox_pretty(
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
- KC_TRANSPARENT, KC_NO, KC_LGUI, KC_MS_BTN2, KC_NO, KC_NO, KC_TRANSPARENT, MT(MOD_RCTL, KC_A), KC_NO, KC_NO, KC_MS_UP, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_NO, KC_LGUI, KC_MS_BTN2, KC_ACL2, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_MS_UP, KC_NO, KC_NO, KC_TRANSPARENT,
KC_TRANSPARENT, TD(SHIFT_TO13), TD(CTRL_TO12), TD(ALT_TO11), KC_MS_BTN1, KC_NO, KC_NO, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_NO, KC_TRANSPARENT,
- KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), KC_ACL0, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
KC_TRANSPARENT, KC_TRANSPARENT,
@@ -182,9 +187,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[12] = LAYOUT_ergodox_pretty(
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
- KC_TRANSPARENT, KC_NO, KC_LGUI, KC_HYPR, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_MS_WH_UP, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_NO, KC_LGUI, KC_HYPR, KC_ACL2, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_MS_WH_UP, KC_NO, KC_NO, KC_TRANSPARENT,
KC_TRANSPARENT, KC_LSHIFT, KC_LCTRL, KC_LALT, KC_NO, KC_NO, KC_NO, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_RIGHT, KC_NO, KC_TRANSPARENT,
- KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), MO(14), KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
KC_TRANSPARENT, KC_TRANSPARENT,
@@ -200,16 +205,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRANSPARENT, KC_TRANSPARENT,
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, TO(0)
),
+ [14] = LAYOUT_ergodox_pretty(
+ KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, MS_WH_UP, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, MS_WH_LEFT, MS_WH_DOWN, MS_WH_RIGHT, KC_NO, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_NO, KC_NO, KC_TRANSPARENT, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_TRANSPARENT,
+ KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT
+ ),
};
-
-/* Commenting out for debug purposes */
-// bool process_record_user(uint16_t keycode, keyrecord_t *record) {
-// switch (keycode) {
-// }
-// return true;
-// }
-
uint32_t layer_state_set_user(uint32_t state) {
uint8_t layer = biton32(state);
ergodox_board_led_off();
@@ -252,11 +259,31 @@ uint32_t layer_state_set_user(uint32_t state) {
// determine the tapdance state to return
int cur_dance (qk_tap_dance_state_t *state) {
if (state->count == 1) {
- if (state->interrupted || !state->pressed) { return SINGLE_TAP; }
+ if (state->interrupted && state->pressed && state->interrupting_keycode == KC_MS_BTN1) {return SINGLE_HOLD;}
+ if (state->interrupted && state->pressed && state->interrupting_keycode == 22273) {return SINGLE_HOLD;}
+ if (state->interrupted && state->pressed && state->interrupting_keycode == 22272) {return SINGLE_HOLD;}
+ if (state->interrupted && state->pressed && state->interrupting_keycode == KC_TAB) {return SINGLE_HOLD;}
+ else if (state->interrupted || !state->pressed) {
+ // if (state->interrupted) {
+ // print("interrupted\n");
+ // uprintf("Shift: %u\n", KC_LSHIFT);
+ // uprintf("Control: %u\n", KC_LCTRL);
+ // uprintf("%u\n",state->interrupting_keycode);
+ // }
+ return SINGLE_TAP;
+ }
else { return SINGLE_HOLD; }
}
else { return 2; } // any number higher than the maximum state value you return above
}
+// /* Backup in case previous code is hard to piece together. */
+// int cur_dance (qk_tap_dance_state_t *state) {
+// if (state->count == 1) {
+// if (state->interrupted || !state->pressed) { return SINGLE_TAP; }
+// else { return SINGLE_HOLD; }
+// }
+// else { return 2; } // any number higher than the maximum state value you return above
+// }
void ctrlto12_finished (qk_tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
@@ -265,7 +292,14 @@ void ctrlto12_finished (qk_tap_dance_state_t *state, void *user_data) {
layer_on(12);
break;
case SINGLE_HOLD:
+ if (state->interrupted && (state->interrupting_keycode == 22273 || state->interrupting_keycode == 43)) {
+ register_mods(MOD_BIT(KC_LCTRL));
+ break;
+ }
register_mods(MOD_BIT(KC_LCTRL)); // for a layer-tap key, use `layer_on(_MY_LAYER)` here
+ if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) {
+ register_code16(LCTL(KC_MS_BTN1));
+ }
break;
}
}
@@ -275,7 +309,14 @@ void ctrlto12_reset (qk_tap_dance_state_t *state, void *user_data) {
case SINGLE_TAP:
break;
case SINGLE_HOLD:
+ if (state->interrupted && (state->interrupting_keycode == 22273 || state->interrupting_keycode == 43) ) {
+ unregister_mods(MOD_BIT(KC_LCTRL));
+ break;
+ }
unregister_mods(MOD_BIT(KC_LCTRL)); // for a layer-tap key, use `layer_off(_MY_LAYER)` here
+ if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) {
+ unregister_code16(LCTL(KC_MS_BTN1));
+ }
break;
}
}
@@ -287,7 +328,14 @@ void shiftto13_finished (qk_tap_dance_state_t *state, void *user_data) {
layer_on(13);
break;
case SINGLE_HOLD:
+ if (state->interrupted && (state->interrupting_keycode == 22272 || state->interrupting_keycode == 43) ) {
+ register_mods(MOD_BIT(KC_LSHIFT));
+ break;
+ }
register_mods(MOD_BIT(KC_LSHIFT)); // for a layer-tap key, use `layer_on(_MY_LAYER)` here
+ if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) {
+ register_code16(LSFT(KC_MS_BTN1));
+ }
break;
}
}
@@ -297,7 +345,14 @@ void shiftto13_reset (qk_tap_dance_state_t *state, void *user_data) {
case SINGLE_TAP:
break;
case SINGLE_HOLD:
+ if (state->interrupted && (state->interrupting_keycode == 22272 || state->interrupting_keycode == 43) ) {
+ unregister_mods(MOD_BIT(KC_LSHIFT));
+ break;
+ }
unregister_mods(MOD_BIT(KC_LSHIFT)); // for a layer-tap key, use `layer_off(_MY_LAYER)` here
+ if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) {
+ unregister_code16(LSFT(KC_MS_BTN1));
+ }
break;
}
}
@@ -310,6 +365,9 @@ void altto11_finished (qk_tap_dance_state_t *state, void *user_data) {
break;
case SINGLE_HOLD:
register_mods(MOD_BIT(KC_LALT)); // for a layer-tap key, use `layer_on(_MY_LAYER)` here
+ if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) {
+ register_code16(LALT(KC_MS_BTN1));
+ }
break;
}
}
@@ -320,6 +378,9 @@ void altto11_reset (qk_tap_dance_state_t *state, void *user_data) {
break;
case SINGLE_HOLD:
unregister_mods(MOD_BIT(KC_LALT)); // for a layer-tap key, use `layer_off(_MY_LAYER)` here
+ if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) {
+ unregister_code16(LALT(KC_MS_BTN1));
+ }
break;
}
}
@@ -328,7 +389,7 @@ void altto11_reset (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_action_t tap_dance_actions[] = {
[CTRL_TO12] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctrlto12_finished, ctrlto12_reset),
[SHIFT_TO13] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftto13_finished, shiftto13_reset),
- [ALT_TO11] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altto11_finished, altto11_reset)
+ [ALT_TO11] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altto11_finished, altto11_reset),
};
/* Debugging functions */
@@ -342,10 +403,32 @@ void keyboard_post_init_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- // If console is enabled, it will print the matrix position and status of each key pressed
-// #ifdef CONSOLE_ENABLE
-// uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
-// #endif
- return true;
+ // If console is enabled, it will print the matrix position and status of each key pressed
+ // #ifdef CONSOLE_ENABLE
+ // uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
+ // #endif
+ switch (keycode) {
+ case MS_WH_DOWN:
+ if (record->event.pressed) {
+ SEND_STRING(SS_TAP(X_MS_WH_DOWN));
+ }
+ break;
+ case MS_WH_UP:
+ if (record->event.pressed) {
+ SEND_STRING(SS_TAP(X_MS_WH_UP));
+ }
+ break;
+ case MS_WH_LEFT:
+ if (record->event.pressed) {
+ SEND_STRING(SS_TAP(X_MS_WH_LEFT));
+ }
+ break;
+ case MS_WH_RIGHT:
+ if (record->event.pressed) {
+ SEND_STRING(SS_TAP(X_MS_WH_RIGHT));
+ }
+ break;
+ }
+ return true;
}
diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md b/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md
index 5570d9881c..ff3c8d142c 100644
--- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md
+++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md
@@ -1,7 +1,6 @@
# The nathanvercaemert ErgoDox EZ configuration
-Centered around the home row and the use of mouse keys, this configuration focuses
-on minimal finger movement. No key is more than one unit away from a finger on the home row.
+Centered around the home row and the use of mouse keys, this configuration focuses on minimal finger movement. No key is more than one unit away from the home row.
## Layers
@@ -20,7 +19,9 @@ on minimal finger movement. No key is more than one unit away from a finger on t
navigation layers.
* Navigation Layers
* From the Mouse Layer, taps to the left home row navigate to scroll keys, arrow keys, and page keys.
+* Notes on Acceleration
+ * Designated as "Slow" and "Fast" on the mouse layers (movement and scroll,) these keys can be held to allow for slow/precise or fast/efficient control.
Here is the image of my keymap:
-![Default](https://i.imgur.com/kXywQIq.png) \ No newline at end of file
+![Imgur Image](https://i.imgur.com/x6VgH9Z.png) \ No newline at end of file
diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk b/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk
index b41c275dd1..0dadd4371f 100644
--- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk
+++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk
@@ -1,10 +1,9 @@
# Set any rules.mk overrides for your specific keymap here.
# See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file
-LINK_TIME_OPTIMIZATION_ENABLE = yes
+LTO_ENABLE = yes
COMMAND_ENABLE = no
RGBLIGHT_ENABLE = no
TAP_DANCE_ENABLE=yes
-
-#Beginning debugging process for LT() and permissive hold
+# Debugging
CONSOLE_ENABLE = yes
diff --git a/keyboards/ergodox_ez/keymaps/stamm/config.h b/keyboards/ergodox_ez/keymaps/stamm/config.h
new file mode 100644
index 0000000000..e1db3d9002
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/stamm/config.h
@@ -0,0 +1,40 @@
+/* Copyright 2020 Rustam Zagirov
+ *
+ * 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/>.
+ */
+
+/*
+ Set any config.h overrides for your specific keymap here.
+ See config.h options at https://docs.qmk.fm/#/config_options?id=the-configh-file
+*/
+#pragma once
+
+#define ORYX_CONFIGURATOR
+#define LEADER_TIMEOUT 500
+#define LEADER_PER_KEY_TIMING
+
+#define TAPPING_TERM 200
+#define TAPPING_TERM_PER_KEY
+#define PERMISSIVE_HOLD
+/* #define PERMISSIVE_HOLD_PER_KEY */
+
+#define IGNORE_MOD_TAP_INTERRUPT
+#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY
+
+#define TAPPING_FORCE_HOLD
+#define TAPPING_FORCE_HOLD_PER_KEY
+
+/* #define RETRO_TAPPING */
+#undef LED_BRIGHTNESS_DEFAULT
+#define LED_BRIGHTNESS_DEFAULT (LED_BRIGHTNESS_LO)
diff --git a/keyboards/ergodox_ez/keymaps/stamm/keymap.c b/keyboards/ergodox_ez/keymaps/stamm/keymap.c
new file mode 100644
index 0000000000..e2d9964ba5
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/stamm/keymap.c
@@ -0,0 +1,308 @@
+/* Copyright 2020 Rustam Zagirov
+ *
+ * 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 "version.h"
+
+#define KC_MAC_UNDO LGUI(KC_Z)
+#define KC_MAC_CUT LGUI(KC_X)
+#define KC_MAC_COPY LGUI(KC_C)
+#define KC_MAC_PASTE LGUI(KC_V)
+#define KC_PC_UNDO LCTL(KC_Z)
+#define KC_PC_CUT LCTL(KC_X)
+#define KC_PC_COPY LCTL(KC_C)
+#define KC_PC_PASTE LCTL(KC_V)
+#define ES_LESS_MAC KC_GRAVE
+#define ES_GRTR_MAC LSFT(KC_GRAVE)
+#define ES_BSLS_MAC ALGR(KC_6)
+#define NO_PIPE_ALT KC_GRAVE
+#define NO_BSLS_ALT KC_EQUAL
+#define LSA_T(kc) MT(MOD_LSFT | MOD_LALT, kc)
+
+#define E_NUMBERS LT(_3_NUMBERS,KC_E)
+#define R_MOUSE LT(_4_MOUSE,KC_R)
+#define O_NUMBERS LT(_3_NUMBERS,KC_O)
+#define U_MOUSE LT(_4_MOUSE,KC_U)
+#define R_NUMBERS LT(_3_NUMBERS,KC_R)
+#define W_MOUSE LT(_4_MOUSE,KC_W)
+#define LEFT_NUMBERS LT(_3_NUMBERS, KC_LEFT)
+#define RIGHT_MOUSE LT(_4_MOUSE, KC_RIGHT)
+
+enum custom_keycodes {
+ RGB_SLD = EZ_SAFE_RANGE,
+ ALT_TAB,
+};
+
+bool is_alt_tab_active = false; // ADD this near the begining of keymap.c
+uint16_t alt_tab_timer = 0; // we will be using them soon.
+
+enum layers {
+ _0_BASE,
+ _1_BEAKL,
+ _2_WORKMAN,
+ _3_NUMBERS,
+ _4_MOUSE,
+};
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+[_0_BASE] = LAYOUT_ergodox(
+ KC_NONUS_BSLASH, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_AUDIO_MUTE,
+ KC_LEAD, KC_Q, KC_W, E_NUMBERS, R_MOUSE, KC_T, TG(_1_BEAKL),
+ LCTL(KC_B), LSFT_T(KC_A), LCTL_T(KC_S), LALT_T(KC_D), LGUI_T(KC_F), KC_G,
+ KC_BSLASH, KC_Z, KC_X, KC_C, KC_V, KC_B, TG(_2_WORKMAN),
+ ALT_TAB, XXXXXXX, XXXXXXX, LEFT_NUMBERS, RIGHT_MOUSE,
+ KC_AUDIO_VOL_DOWN, KC_AUDIO_VOL_UP,
+ XXXXXXX,
+ KC_ENTER, KC_TAB, KC_ESCAPE,
+ KC_CAPSLOCK, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_MINUS,
+ XXXXXXX, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRACKET,
+ KC_H, RGUI_T(KC_J), RALT_T(KC_K), RCTL_T(KC_L), RSFT_T(KC_SCOLON), KC_QUOTE,
+ KC_RBRACKET, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_EQUAL,
+ KC_DOWN, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX,
+ KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK,
+ XXXXXXX,
+ KC_ESCAPE, KC_BSPACE, KC_SPACE
+),
+[_1_BEAKL] = LAYOUT_ergodox(
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, KC_H, O_NUMBERS, U_MOUSE, KC_X, _______,
+ _______, LSFT_T(KC_Y), LCTL_T(KC_I), LALT_T(KC_E), LGUI_T(KC_A), KC_DOT,
+ _______, KC_J, KC_SLASH, KC_COMMA, KC_K, KC_QUOTE, _______,
+ _______, _______, _______, _______, _______,
+ _______, _______,
+ _______,
+ _______, _______, _______,
+
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, KC_G, KC_C, KC_R, KC_F, KC_Z, _______,
+ KC_D, RGUI_T(KC_S), RALT_T(KC_T), RCTL_T(KC_N), RSFT_T(KC_B), KC_SCOLON,
+ _______, KC_W, _______, KC_L, KC_P, KC_V, _______,
+ _______, _______, _______, _______, _______,
+ _______, _______,
+ _______,
+ _______, _______, _______
+),
+[_2_WORKMAN] = LAYOUT_ergodox(
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, KC_D, R_NUMBERS, W_MOUSE, KC_B, _______,
+ _______, _______, _______, LALT_T(KC_H), LGUI_T(KC_T), _______,
+ _______, _______, _______, KC_M, KC_C, KC_V, _______,
+ _______, _______, _______, _______, _______,
+ _______, _______,
+ _______,
+ _______, _______, _______,
+
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, KC_J, KC_F, KC_U, KC_P, KC_SCOLON, _______,
+ KC_Y, RGUI_T(KC_N), RALT_T(KC_E), RCTL_T(KC_O), RSFT_T(KC_I), _______,
+ _______, KC_K, KC_L, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______,
+ _______, _______,
+ _______,
+ _______, _______, _______
+),
+[_3_NUMBERS] = LAYOUT_ergodox(
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______,
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______,
+ RESET, _______, _______, _______, _______,
+ _______, _______,
+ _______,
+ _______, _______, _______,
+
+ _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ _______, _______, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
+ _______, KC_4, KC_5, KC_6, KC_PLUS, _______,
+ _______, _______, KC_1, KC_2, KC_3, KC_BSLASH, _______,
+ KC_0, KC_KP_DOT, _______, KC_EQUAL, _______,
+ _______, _______,
+ _______,
+ _______, _______, _______
+),
+[_4_MOUSE] = LAYOUT_ergodox(
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______,
+
+ RGB_HUI, RGB_HUD,
+ _______,
+ _______, _______, _______,
+
+ _______, _______, _______, _______, _______, _______, _______,
+ RGB_MOD, RGB_TOG, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, _______, _______,
+ RGB_SLD, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, _______, _______,
+ TOGGLE_LAYER_COLOR, _______, KC_MS_WH_UP, _______, KC_MS_WH_DOWN, _______, _______,
+ _______, _______, _______, _______, _______,
+
+ RGB_VAD, RGB_VAI,
+ _______,
+ _______, _______,
+),
+};
+
+
+/* bool suspended = false; */
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case RGB_SLD:
+ if (record->event.pressed) {
+ rgblight_mode(1);
+ }
+ return false;
+ case ALT_TAB:
+ if (record->event.pressed) {
+ if (!is_alt_tab_active) {
+ is_alt_tab_active = true;
+ register_code(KC_LGUI);
+ }
+ alt_tab_timer = timer_read();
+ register_code(KC_TAB);
+ } else {
+ unregister_code(KC_TAB);
+ }
+ break;
+ }
+ return true;
+}
+
+layer_state_t layer_state_set_user(layer_state_t state) {
+ ergodox_led_all_off();
+ switch (get_highest_layer(state)) {
+ case _1_BEAKL:
+ ergodox_right_led_1_on();
+ break;
+ case _2_WORKMAN:
+ ergodox_right_led_2_on();
+ break;
+ case _3_NUMBERS:
+ ergodox_right_led_3_on();
+ break;
+ case _4_MOUSE:
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ break;
+ /* case 6: */
+ /* ergodox_right_led_2_on(); */
+ /* ergodox_right_led_3_on(); */
+ /* break; */
+ /* case 7: */
+ /* ergodox_right_led_1_on(); */
+ /* ergodox_right_led_2_on(); */
+ /* ergodox_right_led_3_on(); */
+ /* break; */
+ default:
+ break;
+ }
+ return state;
+
+};
+
+
+uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ /* case SFT_T(KC_SPC): */
+ /* return TAPPING_TERM + 1250; */
+ case LT(_3_NUMBERS, KC_E):
+ return 200;
+ case LT(_4_MOUSE, KC_R):
+ return 200;
+ /* case LGUI_T(KC_F): */
+ /* return 50; */
+ default:
+ return TAPPING_TERM;
+ }
+}
+bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case LT(_3_NUMBERS, KC_E):
+ case LT(_4_MOUSE, KC_R):
+ case LSFT_T(KC_A):
+ case LCTL_T(KC_S):
+ case LALT_T(KC_D):
+ case LGUI_T(KC_F):
+ case RGUI_T(KC_J):
+ case RALT_T(KC_K):
+ case RCTL_T(KC_L):
+ case RSFT_T(KC_SCOLON):
+ case LEFT_NUMBERS:
+ case RIGHT_MOUSE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case LT(_3_NUMBERS, KC_E):
+ case LT(_4_MOUSE, KC_R):
+ case LSFT_T(KC_A):
+ case LCTL_T(KC_S):
+ case LALT_T(KC_D):
+ case LGUI_T(KC_F):
+ case RGUI_T(KC_J):
+ case RALT_T(KC_K):
+ case RCTL_T(KC_L):
+ case RSFT_T(KC_SCOLON):
+ case LEFT_NUMBERS:
+ case RIGHT_MOUSE:
+ return false;
+ default:
+ return true;
+ }
+}
+
+
+
+LEADER_EXTERNS();
+
+void matrix_scan_user(void) {
+ if (is_alt_tab_active) {
+ if (timer_elapsed(alt_tab_timer) > 1000) {
+ unregister_code(KC_LGUI);
+ is_alt_tab_active = false;
+ }
+ }
+ LEADER_DICTIONARY() {
+ leading = false;
+ leader_end();
+
+ SEQ_ONE_KEY(KC_F) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ SEQ_ONE_KEY(KC_S) {
+ SEND_STRING ("sudo -i\n");
+ }
+ SEQ_TWO_KEYS(KC_D, KC_D) {
+ SEND_STRING(SS_LGUI("ac"));
+ /* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
+ }
+ SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
+ SEND_STRING("https://start.duckduckgo.com\n");
+ }
+ SEQ_TWO_KEYS(KC_A, KC_S) {
+ register_code(KC_LGUI);
+ register_code(KC_S);
+ unregister_code(KC_S);
+ unregister_code(KC_LGUI);
+ }
+ }
+}
diff --git a/keyboards/ergodox_ez/keymaps/stamm/readme.md b/keyboards/ergodox_ez/keymaps/stamm/readme.md
new file mode 100644
index 0000000000..f2cdc7ea1a
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/stamm/readme.md
@@ -0,0 +1,117 @@
+# Stamm layouts for ergodox_ez
+
+5 layers:
+
+* QUERTY
+* BEAKL15
+* WORKMAN
+* Numbers
+* Mouse
+
+On home row there are hold dual keys:
+- shift, ctrl, alt, cmd — on the fingers on the left hand
+- cmd, alt, ctrl, shift — mirrored on the finger on the righ hand
+
+Top row behaves like shifter numbers row.
+Hold E switch to layer with numbers.
+Hold R switch to mouse controll layer.
+
+```
+ 0 Base
+╭────────┬─────┬─────┬─────┬─────┬─────┬─────╮ ╭─────┬─────┬─────┬─────┬─────┬─────┬────────╮
+│ ` │ ! │ @ │ # │ $ │ % │Mute │ │Capsl│ ^ │ & │ * │ ( │ ) │ - │
+├────────┼─────┼─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┼─────┼────────┤
+│ Lead │ Q │ W │E|LT3│R|LT4│ T │ TG1 │ │ │ Y │ U │ I │ O │ P │ [ │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│Ctrl + B│A | ⇧│S | ⌃│D | ⌥│F | ⌘│ G ├─────┤ ├─────┤ H │J | ⌘│K | ⌥│L | ⌃│; | ⇧│ ' │
+├────────┼─────┼─────┼─────┼─────┼─────┤ TG2 │ │ ] ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ \ │ Z │ X │ C │ V │ B │ │ │ │ N │ M │ , │ . │ / │ = │
+╰──┬─────┼─────┼─────┼─────┼─────┼─────┴─────╯ ╰─────┴─────┼─────┼─────┼─────┼─────┼─────┬──╯
+ │⎇ + T│ │ │←|LT3│→|LT4│ │ ↓ │ ↑ │ │ │ │
+ ╰─────┴─────┴─────┴─────┴─────╯ ╭─────┬─────╮ ╭─────┬─────╮ ╰─────┴─────┴─────┴─────┴─────╯
+ │Vol- │Vol+ │ │Play │Next │
+ ╭─────┼─────┼─────┤ ├─────┼─────┼─────╮
+ │ │ │ │ │ │ │ │
+ │Enter│ Tab ├─────┤ ├─────┤Bspac│ ⎵ │
+ │ │ │ Esc │ │ Esc │ │ │
+ ╰─────┴─────┴─────╯ ╰─────┴─────┴─────╯
+
+ 1 Beakl
+╭────────┬─────┬─────┬─────┬─────┬─────┬─────╮ ╭─────┬─────┬─────┬─────┬─────┬─────┬────────╮
+│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
+├────────┼─────┼─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ H │O|LT3│U|LT4│ X │ │ │ │ G │ C │ R │ F │ Z │ │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │Y | ⇧│I | ⌃│E | ⌥│A | ⌘│ . ├─────┤ ├─────┤ D │S | ⌘│T | ⌥│N | ⌃│B | ⇧│ ; │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ J │ / │ , │ K │ ' │ │ │ │ W │ │ L │ P │ V │ │
+╰──┬─────┼─────┼─────┼─────┼─────┼─────┴─────╯ ╰─────┴─────┼─────┼─────┼─────┼─────┼─────┬──╯
+ │ │ │ │ │ │ │ │ │ │ │ │
+ ╰─────┴─────┴─────┴─────┴─────╯ ╭─────┬─────╮ ╭─────┬─────╮ ╰─────┴─────┴─────┴─────┴─────╯
+ │ │ │ │ │ │
+ ╭─────┼─────┼─────┤ ├─────┼─────┼─────╮
+ │ │ │ │ │ │ │ │
+ │ │ ├─────┤ ├─────┤ │ │
+ │ │ │ │ │ │ │ │
+ ╰─────┴─────┴─────╯ ╰─────┴─────┴─────╯
+
+ 2 Workman
+╭────────┬─────┬─────┬─────┬─────┬─────┬─────╮ ╭─────┬─────┬─────┬─────┬─────┬─────┬────────╮
+│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
+├────────┼─────┼─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ D │R|LT3│W|LT4│ B │ │ │ │ J │ F │ U │ P │ ; │ │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │H | ⌥│T | ⌘│ ├─────┤ ├─────┤ Y │N | ⌘│E | ⌥│O | ⌃│I | ⇧│ │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │ M │ C │ V │ │ │ │ K │ L │ │ │ │ │
+╰──┬─────┼─────┼─────┼─────┼─────┼─────┴─────╯ ╰─────┴─────┼─────┼─────┼─────┼─────┼─────┬──╯
+ │ │ │ │ │ │ │ │ │ │ │ │
+ ╰─────┴─────┴─────┴─────┴─────╯ ╭─────┬─────╮ ╭─────┬─────╮ ╰─────┴─────┴─────┴─────┴─────╯
+ │ │ │ │ │ │
+ ╭─────┼─────┼─────┤ ├─────┼─────┼─────╮
+ │ │ │ │ │ │ │ │
+ │ │ ├─────┤ ├─────┤ │ │
+ │ │ │ │ │ │ │ │
+ ╰─────┴─────┴─────╯ ╰─────┴─────┴─────╯
+
+ 3 Numbers
+╭────────┬─────┬─────┬─────┬─────┬─────┬─────╮ ╭─────┬─────┬─────┬─────┬─────┬─────┬────────╮
+│ │ F1 │ F2 │ F3 │ F4 │ F5 │ │ │ │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │
+├────────┼─────┼─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │ │ │ │ │ │ │ │ 7 │ 8 │ 9 │ * │ F12 │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │ │ │ ├─────┤ ├─────┤ │ 4 │ 5 │ 6 │ + │ │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │ │ │ │ │ │ │ │ 1 │ 2 │ 3 │ \ │ │
+╰──┬─────┼─────┼─────┼─────┼─────┼─────┴─────╯ ╰─────┴─────┼─────┼─────┼─────┼─────┼─────┬──╯
+ │Reset│ │ │ │ │ │ 0 │ . │ │ = │ │
+ ╰─────┴─────┴─────┴─────┴─────╯ ╭─────┬─────╮ ╭─────┬─────╮ ╰─────┴─────┴─────┴─────┴─────╯
+ │ │ │ │ │ │
+ ╭─────┼─────┼─────┤ ├─────┼─────┼─────╮
+ │ │ │ │ │ │ │ │
+ │ │ ├─────┤ ├─────┤ │ │
+ │ │ │ │ │ │ │ │
+ ╰─────┴─────┴─────╯ ╰─────┴─────┴─────╯
+
+ 4 Mouse
+╭────────┬─────┬─────┬─────┬─────┬─────┬─────╮ ╭─────┬─────┬─────┬─────┬─────┬─────┬────────╮
+│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
+├────────┼─────┼─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │ │ │ │ │ │RgbMo│RgbTo│MsBtn│MsUp │MsBtn│ │ │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │ ├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │ │ │ ├─────┤ ├─────┤RgbSl│MsLef│MsDow│MsRig│ │ │
+├────────┼─────┼─────┼─────┼─────┼─────┤ │ │Toggl├─────┼─────┼─────┼─────┼─────┼────────┤
+│ │ │ │ │ │ │ │ │ │ │MsWhU│ │MsWhD│ │ │
+╰──┬─────┼─────┼─────┼─────┼─────┼─────┴─────╯ ╰─────┴─────┼─────┼─────┼─────┼─────┼─────┬──╯
+ │ │ │ │ │ │ │ │ │ │ │ │
+ ╰─────┴─────┴─────┴─────┴─────╯ ╭─────┬─────╮ ╭─────┬─────╮ ╰─────┴─────┴─────┴─────┴─────╯
+ │RgbHu│RgbHu│ │RgbVa│RgbVa│
+ ╭─────┼─────┼─────┤ ├─────┼─────┼─────╮
+ │ │ │ │ │ │ │ │
+ │ │ ├─────┤ ├─────┤ │ 75 │
+ │ │ │ │ │ │ │ │
+ ╰─────┴─────┴─────╯ ╰─────┴─────┴─────╯
+
+```
+
+Copyright &copy; 2020 Rustam Zagirov. Released under [GPL-2.0](/LICENSE).
diff --git a/keyboards/ergodox_ez/keymaps/stamm/rules.mk b/keyboards/ergodox_ez/keymaps/stamm/rules.mk
new file mode 100644
index 0000000000..619224bef4
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/stamm/rules.mk
@@ -0,0 +1,8 @@
+# Set any rules.mk overrides for your specific keymap here.
+# See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file
+LTO_ENABLE = yes
+COMMAND_ENABLE = no
+LEADER_ENABLE = yes
+RGBLIGHT_ENABLE = yes
+
+TAP_DANCE_ENABLE = no
diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c
index 28dc37a099..cfa76c1c39 100644
--- a/keyboards/ergodox_ez/matrix.c
+++ b/keyboards/ergodox_ez/matrix.c
@@ -30,7 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "matrix.h"
#include "debounce.h"
-#include QMK_KEYBOARD_H
+#include "ergodox_ez.h"
+
/*
* This constant define not debouncing time in msecs, assuming eager_pr.
@@ -45,8 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* matrix state(1:on, 0:off) */
-static matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
-static matrix_row_t matrix[MATRIX_ROWS]; // debounced values
+extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
+extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
static matrix_row_t read_cols(uint8_t row);
static void init_cols(void);
@@ -54,132 +55,62 @@ static void unselect_rows(void);
static void select_row(uint8_t row);
static uint8_t mcp23018_reset_loop;
-// static uint16_t mcp23018_reset_loop;
-
-__attribute__((weak)) void matrix_init_user(void) {}
-
-__attribute__((weak)) void matrix_scan_user(void) {}
-
-__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }
-inline uint8_t matrix_rows(void) { return MATRIX_ROWS; }
+void matrix_init_custom(void) {
+ // initialize row and col
-inline uint8_t matrix_cols(void) { return MATRIX_COLS; }
+ mcp23018_status = init_mcp23018();
-void matrix_init(void) {
- // initialize row and col
-
- mcp23018_status = init_mcp23018();
-
- unselect_rows();
- init_cols();
-
- // initialize matrix state: all keys off
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- raw_matrix[i] = 0;
- }
-
- debounce_init(MATRIX_ROWS);
- matrix_init_quantum();
-}
-
-void matrix_power_up(void) {
- mcp23018_status = init_mcp23018();
-
- unselect_rows();
- init_cols();
-
- // initialize matrix state: all keys off
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- }
+ unselect_rows();
+ init_cols();
}
// Reads and stores a row, returning
// whether a change occurred.
static inline bool store_raw_matrix_row(uint8_t index) {
- matrix_row_t temp = read_cols(index);
- if (raw_matrix[index] != temp) {
- raw_matrix[index] = temp;
- return true;
- }
- return false;
+ matrix_row_t temp = read_cols(index);
+ if (raw_matrix[index] != temp) {
+ raw_matrix[index] = temp;
+ return true;
+ }
+ return false;
}
-uint8_t matrix_scan(void) {
- if (mcp23018_status) { // if there was an error
- if (++mcp23018_reset_loop == 0) {
- // if (++mcp23018_reset_loop >= 1300) {
- // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans
- // this will be approx bit more frequent than once per second
- print("trying to reset mcp23018\n");
- mcp23018_status = init_mcp23018();
- if (mcp23018_status) {
- print("left side not responding\n");
- } else {
- print("left side attached\n");
- ergodox_blink_all_leds();
+bool matrix_scan_custom(matrix_row_t current_matrix[]) {
+ if (mcp23018_status) { // if there was an error
+ if (++mcp23018_reset_loop == 0) {
+ print("trying to reset mcp23018\n");
+ mcp23018_status = init_mcp23018();
+ if (mcp23018_status) {
+ print("left side not responding\n");
+ } else {
+ print("left side attached\n");
+ ergodox_blink_all_leds();
#ifdef RGB_MATRIX_ENABLE
- rgb_matrix_init(); // re-init driver on reconnect
+ rgb_matrix_init(); // re-init driver on reconnect
#endif
- }
+ }
+ }
}
- }
#ifdef LEFT_LEDS
- mcp23018_status = ergodox_left_leds_update();
+ mcp23018_status = ergodox_left_leds_update();
#endif // LEFT_LEDS
- bool changed = false;
- for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) {
- // select rows from left and right hands
- uint8_t left_index = i;
- uint8_t right_index = i + MATRIX_ROWS_PER_SIDE;
- select_row(left_index);
- select_row(right_index);
-
- // we don't need a 30us delay anymore, because selecting a
- // left-hand row requires more than 30us for i2c.
-
- changed |= store_raw_matrix_row(left_index);
- changed |= store_raw_matrix_row(right_index);
-
- unselect_rows();
- }
-
- debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
- matrix_scan_quantum();
-
- return 1;
-}
-
-bool matrix_is_modified(void) // deprecated and evidently not called.
-{
- return true;
-}
-
-inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 << col)); }
-
-inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
-
-void matrix_print(void) {
- print("\nr/c 0123456789ABCDEF\n");
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- phex(row);
- print(": ");
- pbin_reverse16(matrix_get_row(row));
- print("\n");
- }
-}
+ bool changed = false;
+ for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) {
+ // select rows from left and right hands
+ uint8_t left_index = i;
+ uint8_t right_index = i + MATRIX_ROWS_PER_SIDE;
+ select_row(left_index);
+ select_row(right_index);
+
+ changed |= store_raw_matrix_row(left_index);
+ changed |= store_raw_matrix_row(right_index);
+
+ unselect_rows();
+ }
-uint8_t matrix_key_count(void) {
- uint8_t count = 0;
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- count += bitpop16(matrix[i]);
- }
- return count;
+ return changed;
}
/* Column pin configuration
@@ -193,42 +124,43 @@ uint8_t matrix_key_count(void) {
* pin: B5 B4 B3 B2 B1 B0
*/
static void init_cols(void) {
- // init on mcp23018
- // not needed, already done as part of init_mcp23018()
-
- // init on teensy
- // Input with pull-up(DDR:0, PORT:1)
- DDRF &= ~(1 << 7 | 1 << 6 | 1 << 5 | 1 << 4 | 1 << 1 | 1 << 0);
- PORTF |= (1 << 7 | 1 << 6 | 1 << 5 | 1 << 4 | 1 << 1 | 1 << 0);
+ // init on mcp23018
+ // not needed, already done as part of init_mcp23018()
+
+ // init on teensy
+ setPinInputHigh(F0);
+ setPinInputHigh(F1);
+ setPinInputHigh(F4);
+ setPinInputHigh(F5);
+ setPinInputHigh(F6);
+ setPinInputHigh(F7);
}
static matrix_row_t read_cols(uint8_t row) {
- if (row < 7) {
- if (mcp23018_status) { // if there was an error
- return 0;
+ if (row < 7) {
+ if (mcp23018_status) { // if there was an error
+ return 0;
+ } else {
+ uint8_t data = 0;
+ // reading GPIOB (column port) since in mcp23018's sequential mode
+ // it is addressed directly after writing to GPIOA in select_row()
+ mcp23018_status = i2c_start(I2C_ADDR_READ, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_read_nack(ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status < 0) goto out;
+ data = ~((uint8_t)mcp23018_status);
+ mcp23018_status = I2C_STATUS_SUCCESS;
+ out:
+ i2c_stop();
+ return data;
+ }
} else {
- uint8_t data = 0;
- // reading GPIOB (column port) since in mcp23018's sequential mode
- // it is addressed directly after writing to GPIOA in select_row()
- mcp23018_status = i2c_start(I2C_ADDR_READ, ERGODOX_EZ_I2C_TIMEOUT);
- if (mcp23018_status) goto out;
- mcp23018_status = i2c_read_nack(ERGODOX_EZ_I2C_TIMEOUT);
- if (mcp23018_status < 0) goto out;
- data = ~((uint8_t)mcp23018_status);
- mcp23018_status = I2C_STATUS_SUCCESS;
- out:
- i2c_stop();
- return data;
- }
- } else {
- /* read from teensy
- * bitmask is 0b11110011, but we want those all
- * in the lower six bits.
- * we'll return 1s for the top two, but that's harmless.
- */
+ /* read from teensy
+ * bitmask is 0b11110011, but we want those all
+ * in the lower six bits.
+ * we'll return 1s for the top two, but that's harmless.
+ */
- return ~((PINF & 0x03) | ((PINF & 0xF0) >> 2));
- }
+ return ~((PINF & 0x03) | ((PINF & 0xF0) >> 2));
+ }
}
/* Row pin configuration
@@ -242,69 +174,64 @@ static matrix_row_t read_cols(uint8_t row) {
* pin: A0 A1 A2 A3 A4 A5 A6
*/
static void unselect_rows(void) {
- // no need to unselect on mcp23018, because the select step sets all
- // the other row bits high, and it's not changing to a different
- // direction
-
- // unselect on teensy
- // Hi-Z(DDR:0, PORT:0) to unselect
- DDRB &= ~(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3);
- PORTB &= ~(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3);
- DDRD &= ~(1 << 2 | 1 << 3);
- PORTD &= ~(1 << 2 | 1 << 3);
- DDRC &= ~(1 << 6);
- PORTC &= ~(1 << 6);
+ // no need to unselect on mcp23018, because the select step sets all
+ // the other row bits high, and it's not changing to a different
+ // direction
+
+ // unselect on teensy
+ setPinInput(B0);
+ setPinInput(B1);
+ setPinInput(B2);
+ setPinInput(B3);
+ setPinInput(D2);
+ setPinInput(D3);
+ setPinInput(C6);
}
static void select_row(uint8_t row) {
- if (row < 7) {
- // select on mcp23018
- if (mcp23018_status) { // if there was an error
- // do nothing
+ if (row < 7) {
+ // select on mcp23018
+ if (!mcp23018_status) {
+ // set active row low : 0
+ // set other rows hi-Z : 1
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPIOA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(0xFF & ~(1 << row), ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
+ out:
+ i2c_stop();
+ }
} else {
- // set active row low : 0
- // set other rows hi-Z : 1
- mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT);
- if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(GPIOA, ERGODOX_EZ_I2C_TIMEOUT);
- if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(0xFF & ~(1 << row), ERGODOX_EZ_I2C_TIMEOUT);
- if (mcp23018_status) goto out;
- out:
- i2c_stop();
- }
- } else {
- // select on teensy
- // Output low(DDR:1, PORT:0) to select
- switch (row) {
- case 7:
- DDRB |= (1 << 0);
- PORTB &= ~(1 << 0);
- break;
- case 8:
- DDRB |= (1 << 1);
- PORTB &= ~(1 << 1);
- break;
- case 9:
- DDRB |= (1 << 2);
- PORTB &= ~(1 << 2);
- break;
- case 10:
- DDRB |= (1 << 3);
- PORTB &= ~(1 << 3);
- break;
- case 11:
- DDRD |= (1 << 2);
- PORTD &= ~(1 << 2);
- break;
- case 12:
- DDRD |= (1 << 3);
- PORTD &= ~(1 << 3);
- break;
- case 13:
- DDRC |= (1 << 6);
- PORTC &= ~(1 << 6);
- break;
+ // select on teensy
+ // Output low(DDR:1, PORT:0) to select
+ switch (row) {
+ case 7:
+ setPinOutput(B0);
+ writePinLow(B0);
+ break;
+ case 8:
+ setPinOutput(B1);
+ writePinLow(B1);
+ break;
+ case 9:
+ setPinOutput(B2);
+ writePinLow(B2);
+ break;
+ case 10:
+ setPinOutput(B3);
+ writePinLow(B3);
+ break;
+ case 11:
+ setPinOutput(D2);
+ writePinLow(D2);
+ break;
+ case 12:
+ setPinOutput(D3);
+ writePinLow(D3);
+ break;
+ case 13:
+ setPinOutput(C6);
+ writePinLow(C6);
+ break;
+ }
}
- }
}
diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk
index 579e4f59de..9ad4eaa186 100644
--- a/keyboards/ergodox_ez/rules.mk
+++ b/keyboards/ergodox_ez/rules.mk
@@ -19,20 +19,20 @@ BOOTLOADER = halfkay
# Build Options
# comment out to disable the options.
#
-BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
-MOUSEKEY_ENABLE = yes # Mouse keys
-EXTRAKEY_ENABLE = yes # Audio control and System control
-CONSOLE_ENABLE = no # Console for debug
-COMMAND_ENABLE = yes # Commands for debug and configuration
-CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDox EZ
-NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-UNICODE_ENABLE = yes # Unicode
-SWAP_HANDS_ENABLE= yes # Allow swapping hands of keyboard
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = no # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+CUSTOM_MATRIX = lite # Custom matrix file for the ErgoDox EZ
+NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+UNICODE_ENABLE = yes # Unicode
+SWAP_HANDS_ENABLE= yes # Allow swapping hands of keyboard
SLEEP_LED_ENABLE = no
API_SYSEX_ENABLE = no
RGBLIGHT_ENABLE = yes
-RGB_MATRIX_ENABLE = no # enable later
+RGB_MATRIX_ENABLE = no # enable later
DEBOUNCE_TYPE = eager_pr
# project specific files