diff options
| author | Joshua T <replicaJunction@users.noreply.github.com> | 2018-08-15 17:38:41 -0500 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-08-15 15:38:41 -0700 |
| commit | c19d949b72844120fff5159bc7e637ada4dd2579 (patch) | |
| tree | 834d410b135352015a887d6f5fc94feefd96b726 /users/replicaJunction/replicaJunction.c | |
| parent | 632287535c83e6607de97a5998713def61dc01bc (diff) | |
| download | qmk_firmware-c19d949b72844120fff5159bc7e637ada4dd2579.tar.gz qmk_firmware-c19d949b72844120fff5159bc7e637ada4dd2579.zip | |
Keymap: Revamp replicaJunction keymaps (#3589)
* Revamp replicaJunction keymaps
Updates both the replicaJunction Ergodox and Atreus keymaps and moves
most of the logic into a new user directory.
* Cleanup as requested in #3589
* Slightly increased TAPPING_TERM
* Fixed typo in #pragma once
* Fix TAPPING_TERM redefined in config.h
* Add include of replicaJunction.h
Due to the tap dance references, without this include, I was getting
compiler errors about both internal QMK items like
`qk_tap_dance_state_t` and constants defined in my replicaJunction.h
file like TD_LAYER_TOGGLE.
Also remove some commented-out code that defined an enum which has since
moved to replicaJunction.h.
Diffstat (limited to 'users/replicaJunction/replicaJunction.c')
| -rw-r--r-- | users/replicaJunction/replicaJunction.c | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/users/replicaJunction/replicaJunction.c b/users/replicaJunction/replicaJunction.c new file mode 100644 index 000000000..f0bc59d25 --- /dev/null +++ b/users/replicaJunction/replicaJunction.c | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | #include "replicaJunction.h" | ||
| 2 | #include "version.h" | ||
| 3 | |||
| 4 | #ifdef TAP_DANCE_ENABLE | ||
| 5 | void dance_layer(qk_tap_dance_state_t *state, void *user_data) | ||
| 6 | { | ||
| 7 | uint8_t layer = biton32(layer_state); | ||
| 8 | |||
| 9 | if (state->count >= 5) | ||
| 10 | { | ||
| 11 | // 5 or more taps resets the keyboard | ||
| 12 | reset_keyboard(); | ||
| 13 | } | ||
| 14 | #ifdef L_QWERTY | ||
| 15 | else if (state->count == 3) | ||
| 16 | { | ||
| 17 | // Triple tap changes to QWERTY layer | ||
| 18 | if (layer == L_QWERTY) | ||
| 19 | { | ||
| 20 | layer_off(L_QWERTY); | ||
| 21 | } | ||
| 22 | else | ||
| 23 | { | ||
| 24 | layer_on(L_QWERTY); | ||
| 25 | } | ||
| 26 | } | ||
| 27 | #endif | ||
| 28 | #ifdef L_NUM | ||
| 29 | else if (state->count == 2) | ||
| 30 | { | ||
| 31 | // Double tap toggles Number layer | ||
| 32 | if (layer == L_NUM) | ||
| 33 | { | ||
| 34 | layer_off(L_NUM); | ||
| 35 | } | ||
| 36 | else | ||
| 37 | { | ||
| 38 | layer_on(L_NUM); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | #endif | ||
| 42 | else | ||
| 43 | { | ||
| 44 | // Single tap sends Escape, and also turns off layers | ||
| 45 | // That's mostly in case I get stuck and forget where I am | ||
| 46 | #ifdef L_NUM | ||
| 47 | layer_off(L_NUM); | ||
| 48 | #endif | ||
| 49 | #ifdef L_EXTEND | ||
| 50 | layer_off(L_EXTEND); | ||
| 51 | #endif | ||
| 52 | #ifdef L_SYMBOL | ||
| 53 | layer_off(L_SYMBOL); | ||
| 54 | #endif | ||
| 55 | #ifdef L_QWERTY | ||
| 56 | layer_off(L_QWERTY); | ||
| 57 | #endif | ||
| 58 | register_code(KC_ESC); | ||
| 59 | unregister_code(KC_ESC); | ||
| 60 | } | ||
| 61 | }; | ||
| 62 | |||
| 63 | // Tap Dance Definitions | ||
| 64 | // Note - this needs to come AFTER the function is declared | ||
| 65 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 66 | [TD_LAYER_TOGGLE] = ACTION_TAP_DANCE_FN(dance_layer) | ||
| 67 | }; | ||
| 68 | |||
| 69 | #endif // TAP_DANCE_ENABLE | ||
| 70 | |||
| 71 | // These functions can be overridden in individual keymap files. | ||
| 72 | // This allows a user function to be shared for all my keyboards, while each | ||
| 73 | // keyboard can also have a keyboard-specific section. | ||
| 74 | |||
| 75 | // Note that keymaps don't need to override these if there's nothing to | ||
| 76 | // override them with. | ||
| 77 | __attribute__ ((weak)) | ||
| 78 | void matrix_init_keymap(void) {} | ||
| 79 | |||
| 80 | __attribute__ ((weak)) | ||
| 81 | void matrix_scan_keymap(void) {} | ||
| 82 | |||
| 83 | __attribute__ ((weak)) | ||
| 84 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 85 | return true; | ||
| 86 | }; | ||
| 87 | |||
| 88 | // Runs just one time when the keyboard initializes. | ||
| 89 | void matrix_init_user(void) { | ||
| 90 | #ifdef UNICODEMAP_ENABLE | ||
| 91 | // Set Unicode input to use WinCompose | ||
| 92 | // https://github.com/samhocevar/wincompose | ||
| 93 | set_unicode_input_mode(UC_WINC); | ||
| 94 | #endif // UNICODEMAP_ENABLE | ||
| 95 | |||
| 96 | matrix_init_keymap(); | ||
| 97 | }; | ||
| 98 | |||
| 99 | // Runs constantly in the background, in a loop. | ||
| 100 | void matrix_scan_user(void) { | ||
| 101 | matrix_scan_keymap(); | ||
| 102 | } | ||
| 103 | |||
| 104 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 105 | if (record->event.pressed) | ||
| 106 | return true; | ||
| 107 | |||
| 108 | switch(keycode) | ||
| 109 | { | ||
| 110 | case RJ_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader | ||
| 111 | SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP | ||
| 112 | #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) | ||
| 113 | ":dfu" | ||
| 114 | #elif defined(BOOTLOADER_HALFKAY) | ||
| 115 | ":teensy" | ||
| 116 | #elif defined(BOOTLOADER_CATERINA) | ||
| 117 | ":avrdude" | ||
| 118 | #endif // bootloader options | ||
| 119 | //SS_TAP(X_ENTER) | ||
| 120 | ); | ||
| 121 | return false; | ||
| 122 | case RJ_QMKV: | ||
| 123 | SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
| 124 | return false; | ||
| 125 | case RJ_EQ: | ||
| 126 | SEND_STRING("=="); | ||
| 127 | return false; | ||
| 128 | case RJ_NEQ: | ||
| 129 | SEND_STRING("!="); | ||
| 130 | return false; | ||
| 131 | case RJ_GEQ: | ||
| 132 | SEND_STRING(">="); | ||
| 133 | return false; | ||
| 134 | case RJ_LEQ: | ||
| 135 | SEND_STRING("<="); | ||
| 136 | return false; | ||
| 137 | case RJ_GEQR: | ||
| 138 | SEND_STRING("=>"); | ||
| 139 | return false; | ||
| 140 | case RJ_DUND: | ||
| 141 | SEND_STRING("$_"); | ||
| 142 | return false; | ||
| 143 | case RJ_SELS: | ||
| 144 | SEND_STRING("select *"); | ||
| 145 | return false; | ||
| 146 | } | ||
| 147 | |||
| 148 | return process_record_keymap(keycode, record); | ||
| 149 | }; | ||
