summaryrefslogtreecommitdiff
path: root/layouts/community/ergodox/mpiechotka
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/community/ergodox/mpiechotka')
-rw-r--r--layouts/community/ergodox/mpiechotka/keymap.c127
1 files changed, 57 insertions, 70 deletions
diff --git a/layouts/community/ergodox/mpiechotka/keymap.c b/layouts/community/ergodox/mpiechotka/keymap.c
index 6a89e38a32..a83725519b 100644
--- a/layouts/community/ergodox/mpiechotka/keymap.c
+++ b/layouts/community/ergodox/mpiechotka/keymap.c
@@ -1,21 +1,20 @@
#include QMK_KEYBOARD_H
-#include "debug.h"
-#include "action_layer.h"
+
#include "keymap_colemak.h"
-enum {
+enum layer_names {
BASE = 0,
BASE_CM,
SYMB,
MACR
};
-enum {
- LWIN = 1,
- PC1,
- PC2,
- PC3,
- PC4
+enum custom_keycodes {
+ LWIN = SAFE_RANGE,
+ KC_PC1,
+ KC_PC2,
+ KC_PC3,
+ KC_PC4
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -50,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_EQL,
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
- KC_LALT, F(LWIN),
+ KC_LALT, LWIN,
KC_HOME,
SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END),
// right hand
@@ -94,7 +93,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D,
KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, KC_EQL,
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
- KC_LALT, F(LWIN),
+ KC_LALT, LWIN,
KC_HOME,
SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END),
// right hand
@@ -174,7 +173,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MACR] = LAYOUT_ergodox(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, DF(BASE), DF(BASE_CM), KC_NO, KC_NO, KC_NO, KC_NO,
- KC_NO, F(PC1), F(PC2), F(PC3), F(PC4), KC_NO,
+ KC_NO, KC_PC1, KC_PC2, KC_PC3, KC_PC4, 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_TRNS,KC_TRNS,
@@ -192,72 +191,60 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
-const uint16_t PROGMEM fn_actions[] = {
- [LWIN] = ACTION_MACRO(LWIN),
- [PC1] = ACTION_MACRO(PC1),
- [PC2] = ACTION_MACRO(PC2),
- [PC3] = ACTION_MACRO(PC3),
- [PC4] = ACTION_MACRO(PC4)
-};
-
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
-{
- switch(id) {
- case 0:
- if (record->event.pressed) {
- register_code(KC_RSFT);
- } else {
- unregister_code(KC_RSFT);
- }
- break;
- case LWIN:
- if (record->event.pressed) {
- register_code(KC_RSFT);
- unregister_code(KC_RSFT);
- register_code(KC_LGUI);
- } else {
- unregister_code(KC_LGUI);
- }
- break;
- case PC1:
- if (!record->event.pressed) {
- return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(1), W(50), T(ENT), END);
- }
- break;
- case PC2:
- if (!record->event.pressed) {
- return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(2), W(50), T(ENT), END);
- }
- break;
- case PC3:
- if (!record->event.pressed) {
- return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(3), W(50), T(ENT), END);
- }
- break;
- case PC4:
- if (!record->event.pressed) {
- return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(4), W(50), T(ENT), END);
- }
- break;
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case LWIN:
+ if (record->event.pressed) {
+ tap_code(KC_RSFT);
+ register_code(KC_LGUI);
+ } else {
+ unregister_code(KC_LGUI);
+ }
+ return false;
+ case KC_PC1:
+ if (record->event.pressed) {
+ tap_code_delay(KC_SLCK, 50);
+ wait_ms(50);
+ tap_code_delay(KC_1, 50);
+ tap_code(KC_ENT);
+ }
+ return false;
+ case KC_PC2:
+ if (record->event.pressed) {
+ tap_code_delay(KC_SLCK, 50);
+ wait_ms(50);
+ tap_code_delay(KC_2, 50);
+ tap_code(KC_ENT);
+ }
+ return false;
+ case KC_PC3:
+ if (record->event.pressed) {
+ tap_code_delay(KC_SLCK, 50);
+ wait_ms(50);
+ tap_code_delay(KC_3, 50);
+ tap_code(KC_ENT);
+ }
+ return false;
+ case KC_PC4:
+ if (record->event.pressed) {
+ tap_code_delay(KC_SLCK, 50);
+ wait_ms(50);
+ tap_code_delay(KC_4, 50);
+ tap_code(KC_ENT);
+ }
+ return false;
}
- return MACRO_NONE;
+ return true;
}
-// Runs just one time when the keyboard initializes.
-void matrix_init_user(void) {
-
-};
-
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
-
- uint8_t layer = biton32(layer_state);
-
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
- switch (layer) {
+
+ switch (get_highest_layer(layer_state)) {
// TODO: Make this relevant to the ErgoDox EZ.
case SYMB:
ergodox_right_led_1_on();
@@ -269,4 +256,4 @@ void matrix_scan_user(void) {
// none
break;
}
-};
+}