diff options
Diffstat (limited to 'layouts/community/ergodox/plums/keymap.c')
| -rw-r--r-- | layouts/community/ergodox/plums/keymap.c | 84 |
1 files changed, 5 insertions, 79 deletions
diff --git a/layouts/community/ergodox/plums/keymap.c b/layouts/community/ergodox/plums/keymap.c index c75ce0f97..dd273e579 100644 --- a/layouts/community/ergodox/plums/keymap.c +++ b/layouts/community/ergodox/plums/keymap.c | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | #include QMK_KEYBOARD_H | 1 | #include QMK_KEYBOARD_H |
| 2 | #include "debug.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | 2 | ||
| 5 | #define BASE 0 // default layer | 3 | #define BASE 0 // default layer |
| 6 | #define SYMB 1 // symbols | 4 | #define SYMB 1 // symbols |
| @@ -36,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 36 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, | 34 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, |
| 37 | KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G, | 35 | KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G, |
| 38 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, TG(SYMB), | 36 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, TG(SYMB), |
| 39 | F(0), KC_LCBR, KC_LPRN,KC_PIPE,KC_COLN, | 37 | KC_NO, KC_LCBR, KC_LPRN,KC_PIPE,KC_COLN, |
| 40 | LGUI(KC_LALT), KC_LALT, | 38 | LGUI(KC_LALT), KC_LALT, |
| 41 | KC_HOME, | 39 | KC_HOME, |
| 42 | KC_BSPC, KC_ESC, KC_END, | 40 | KC_BSPC, KC_ESC, KC_END, |
| @@ -45,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 45 | KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, | 43 | KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, |
| 46 | KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | 44 | KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, |
| 47 | TG(MDIA), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, | 45 | TG(MDIA), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, |
| 48 | KC_MINS, KC_EQL, KC_RPRN, KC_RCBR, F(1), | 46 | KC_MINS, KC_EQL, KC_RPRN, KC_RCBR, KC_NO, |
| 49 | KC_RALT, KC_MPLY, | 47 | KC_RALT, KC_MPLY, |
| 50 | KC_PGUP, | 48 | KC_PGUP, |
| 51 | KC_PGDN, KC_ENT, KC_SPC | 49 | KC_PGDN, KC_ENT, KC_SPC |
| @@ -135,85 +133,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 135 | ), | 133 | ), |
| 136 | }; | 134 | }; |
| 137 | 135 | ||
| 138 | const uint16_t PROGMEM fn_actions[] = { | ||
| 139 | [0] = ACTION_MACRO_TAP(0), // FN0 - Ctrl + a (For screen/tmux) | ||
| 140 | [1] = ACTION_MACRO_TAP(1) // FN1 - Ctrl + ` (For quake style console) | ||
| 141 | }; | ||
| 142 | |||
| 143 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is. | ||
| 144 | { | ||
| 145 | switch(id) { | ||
| 146 | case 0: | ||
| 147 | if (record->event.pressed) { | ||
| 148 | if (record->tap.count) { | ||
| 149 | if (record->tap.interrupted) { | ||
| 150 | record->tap.count = 0; | ||
| 151 | // hold press action | ||
| 152 | register_code(KC_LCTL); | ||
| 153 | } else { | ||
| 154 | // tap press action | ||
| 155 | return MACRO( D(LCTL), T(A), U(LCTL), END ); | ||
| 156 | } | ||
| 157 | } else { | ||
| 158 | // hold press action | ||
| 159 | register_code(KC_LCTL); | ||
| 160 | } | ||
| 161 | } else { | ||
| 162 | if (record->tap.count) { | ||
| 163 | // tap release action | ||
| 164 | } else { | ||
| 165 | // hold release action | ||
| 166 | unregister_code(KC_LCTL); | ||
| 167 | } | ||
| 168 | record->tap.count = 0; | ||
| 169 | } | ||
| 170 | break; | ||
| 171 | case 1: | ||
| 172 | if (record->event.pressed) { | ||
| 173 | if (record->tap.count) { | ||
| 174 | if (record->tap.interrupted) { | ||
| 175 | record->tap.count = 0; | ||
| 176 | // hold press action | ||
| 177 | register_code(KC_RCTL); | ||
| 178 | } else { | ||
| 179 | // tap press action | ||
| 180 | return MACRO( DOWN(KC_RCTL), TYPE(KC_GRV), UP(KC_RCTL), END ); | ||
| 181 | } | ||
| 182 | } else { | ||
| 183 | // hold press action | ||
| 184 | register_code(KC_RCTL); | ||
| 185 | } | ||
| 186 | } else { | ||
| 187 | if (record->tap.count) { | ||
| 188 | // tap release action | ||
| 189 | } else { | ||
| 190 | // hold release action | ||
| 191 | unregister_code(KC_RCTL); | ||
| 192 | } | ||
| 193 | record->tap.count = 0; | ||
| 194 | } | ||
| 195 | break; | ||
| 196 | } | ||
| 197 | return MACRO_NONE; | ||
| 198 | }; | ||
| 199 | |||
| 200 | |||
| 201 | |||
| 202 | // Runs just one time when the keyboard initializes. | ||
| 203 | void matrix_init_user(void) { | ||
| 204 | |||
| 205 | }; | ||
| 206 | |||
| 207 | // Runs constantly in the background, in a loop. | 136 | // Runs constantly in the background, in a loop. |
| 208 | void matrix_scan_user(void) { | 137 | void matrix_scan_user(void) { |
| 209 | |||
| 210 | uint8_t layer = biton32(layer_state); | ||
| 211 | |||
| 212 | ergodox_board_led_off(); | 138 | ergodox_board_led_off(); |
| 213 | ergodox_right_led_1_off(); | 139 | ergodox_right_led_1_off(); |
| 214 | ergodox_right_led_2_off(); | 140 | ergodox_right_led_2_off(); |
| 215 | ergodox_right_led_3_off(); | 141 | ergodox_right_led_3_off(); |
| 216 | switch (layer) { | 142 | |
| 143 | switch (get_highest_layer(layer_state)) { | ||
| 217 | // TODO: Make this relevant to the ErgoDox EZ. | 144 | // TODO: Make this relevant to the ErgoDox EZ. |
| 218 | case 1: | 145 | case 1: |
| 219 | ergodox_right_led_1_on(); | 146 | ergodox_right_led_1_on(); |
| @@ -225,5 +152,4 @@ void matrix_scan_user(void) { | |||
| 225 | // none | 152 | // none |
| 226 | break; | 153 | break; |
| 227 | } | 154 | } |
| 228 | 155 | } | |
| 229 | }; | ||
