diff options
| author | Yet Another Developer <50936645+yet-another-developer@users.noreply.github.com> | 2019-10-21 02:07:57 +0800 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-10-20 11:07:56 -0700 |
| commit | 3d53ea439c277e49cd4149a6caea727304f41ace (patch) | |
| tree | 1d782a97be651ff911342cbec19cdb18ceeeda62 /users/yet-another-developer/yet-another-developer.c | |
| parent | f64d9b06215bb08d7f77aeba126c0804fffd0064 (diff) | |
| download | qmk_firmware-3d53ea439c277e49cd4149a6caea727304f41ace.tar.gz qmk_firmware-3d53ea439c277e49cd4149a6caea727304f41ace.zip | |
[Keymap] Ergodash keymap for yet-another-developer (#7046)
* Initialize ergodash rev 1 keymap
./util/new_keymap.sh ergodash/rev1 yet-another-developer
* Add user space configurations referenced from drashna
* Start community layout for ergodash in ortho_5x14
* Remove unused layers
* Add userspace layers
* Add Userspace gitignore
Hide Secrets
* Remove userspace unused drashna features
* Scrap default keymap and follow drashna's template
* Add code referenced from kuchosauronad0
* Make sure that the author is named Developer
* Replace middle keys del and bksp with curly brace
* Reduce ONESHOT_TIMEOUT from 3sec to 2sec
* Remove adjust key AG_SWAP
* Disable UNICODEMAP_ENABLE, remove code causing build fail
* Increase TAPPING_TERM to 240
Reason: Because Space is also LOWER, space sometimes not registering.
PS: I dont want to #define RETRO_TAPPING yet
* Update KC_MAKE to use :flash
* Remove TAP_ONCE, use tap_code
Signed-off-by: Developer <anotherdeveloper@icloud.com>
* Remove redundant code implementation of keyboard_post_init_user
https://github.com/qmk/qmk_firmware/pull/7046
users/yet-another-developer/leader.c
```
static bool has_ran_yet;
if (!has_ran_yet) {
has_ran_yet = true;
startup_user();
```
Comment for lines +11 – +14
@drashna: Not needed anymore. You can use keyboard_post_init_user now.
Signed-off-by: Developer <anotherdeveloper@icloud.com>
Diffstat (limited to 'users/yet-another-developer/yet-another-developer.c')
| -rw-r--r-- | users/yet-another-developer/yet-another-developer.c | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/users/yet-another-developer/yet-another-developer.c b/users/yet-another-developer/yet-another-developer.c new file mode 100644 index 000000000..b729c0621 --- /dev/null +++ b/users/yet-another-developer/yet-another-developer.c | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | #include "quantum.h" | ||
| 2 | #include "yet-another-developer.h" | ||
| 3 | |||
| 4 | userspace_config_t userspace_config; | ||
| 5 | |||
| 6 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) | ||
| 7 | #define YAD_UNICODE_MODE UC_WIN | ||
| 8 | #else | ||
| 9 | // set to 2 for UC_WIN, set to 4 for UC_WINC | ||
| 10 | #define YAD_UNICODE_MODE 2 | ||
| 11 | #endif | ||
| 12 | |||
| 13 | |||
| 14 | bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) { | ||
| 15 | static uint16_t this_timer; | ||
| 16 | if (pressed) { | ||
| 17 | this_timer = timer_read(); | ||
| 18 | } else { | ||
| 19 | if (timer_elapsed(this_timer) < TAPPING_TERM) { | ||
| 20 | tap_code(code); | ||
| 21 | } else { | ||
| 22 | register_code(mod_code); | ||
| 23 | tap_code(code); | ||
| 24 | unregister_code(mod_code); | ||
| 25 | } | ||
| 26 | } | ||
| 27 | return false; | ||
| 28 | } | ||
| 29 | |||
| 30 | bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) { | ||
| 31 | if (pressed) { | ||
| 32 | this_timer = timer_read(); | ||
| 33 | } else { | ||
| 34 | if (timer_elapsed(this_timer) < TAPPING_TERM) { | ||
| 35 | tap_code(code); | ||
| 36 | } else { | ||
| 37 | register_code(mod_code); | ||
| 38 | tap_code(code); | ||
| 39 | unregister_code(mod_code); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | return false; | ||
| 43 | } | ||
| 44 | |||
| 45 | // Add reconfigurable functions here, for keymap customization | ||
| 46 | // This allows for a global, userspace functions, and continued | ||
| 47 | // customization of the keymap. Use _keymap instead of _user | ||
| 48 | // functions in the keymaps | ||
| 49 | __attribute__ ((weak)) | ||
| 50 | void matrix_init_keymap(void) {} | ||
| 51 | |||
| 52 | // Call user matrix init, set default RGB colors and then | ||
| 53 | // call the keymap's init function | ||
| 54 | void matrix_init_user(void) { | ||
| 55 | userspace_config.raw = eeconfig_read_user(); | ||
| 56 | |||
| 57 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) | ||
| 58 | set_unicode_input_mode(YAD_UNICODE_MODE); | ||
| 59 | get_unicode_input_mode(); | ||
| 60 | #endif //UNICODE_ENABLE | ||
| 61 | |||
| 62 | matrix_init_keymap(); | ||
| 63 | } | ||
| 64 | |||
| 65 | __attribute__((weak)) | ||
| 66 | void keyboard_post_init_keymap(void) {} | ||
| 67 | |||
| 68 | void keyboard_post_init_user(void) { | ||
| 69 | #ifdef RGBLIGHT_ENABLE | ||
| 70 | keyboard_post_init_rgb(); | ||
| 71 | #endif | ||
| 72 | keyboard_post_init_keymap(); | ||
| 73 | } | ||
| 74 | |||
| 75 | __attribute__((weak)) | ||
| 76 | void suspend_power_down_keymap(void) {} | ||
| 77 | |||
| 78 | void suspend_power_down_user(void) { | ||
| 79 | suspend_power_down_keymap(); | ||
| 80 | } | ||
| 81 | |||
| 82 | __attribute__((weak)) | ||
| 83 | void suspend_wakeup_init_keymap(void) {} | ||
| 84 | |||
| 85 | void suspend_wakeup_init_user(void) { | ||
| 86 | suspend_wakeup_init_keymap(); | ||
| 87 | } | ||
| 88 | |||
| 89 | __attribute__((weak)) | ||
| 90 | void matrix_scan_keymap(void) {} | ||
| 91 | |||
| 92 | __attribute__ ((weak)) | ||
| 93 | void matrix_scan_user(void){ | ||
| 94 | |||
| 95 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. | ||
| 96 | // run_diablo_macro_check(); | ||
| 97 | #endif // TAP_DANCE_ENABLE | ||
| 98 | |||
| 99 | #ifdef RGBLIGHT_ENABLE | ||
| 100 | matrix_scan_rgb(); | ||
| 101 | #endif // RGBLIGHT_ENABLE | ||
| 102 | |||
| 103 | matrix_scan_keymap(); | ||
| 104 | } | ||
| 105 | |||
| 106 | __attribute__((weak)) | ||
| 107 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 108 | return state; | ||
| 109 | } | ||
| 110 | |||
| 111 | // on layer change, no matter where the change was initiated | ||
| 112 | // Then runs keymap's layer change check | ||
| 113 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 114 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
| 115 | #ifdef RGBLIGHT_ENABLE | ||
| 116 | state = layer_state_set_rgb(state); | ||
| 117 | #endif // RGBLIGHT_ENABLE | ||
| 118 | return layer_state_set_keymap(state); | ||
| 119 | } | ||
| 120 | |||
| 121 | __attribute__((weak)) | ||
| 122 | layer_state_t default_layer_state_set_keymap(layer_state_t state) { | ||
| 123 | return state; | ||
| 124 | } | ||
| 125 | |||
| 126 | // Runs state check and changes underglow color and animation | ||
| 127 | layer_state_t default_layer_state_set_user(layer_state_t state) { | ||
| 128 | state = default_layer_state_set_keymap(state); | ||
| 129 | #if 0 | ||
| 130 | #ifdef RGBLIGHT_ENABLE | ||
| 131 | state = default_layer_state_set_rgb(state); | ||
| 132 | #endif // RGBLIGHT_ENABLE | ||
| 133 | #endif | ||
| 134 | return state; | ||
| 135 | } | ||
| 136 | |||
| 137 | __attribute__ ((weak)) | ||
| 138 | void led_set_keymap(uint8_t usb_led) {} | ||
| 139 | |||
| 140 | // Any custom LED code goes here. | ||
| 141 | // So far, I only have keyboard specific code, | ||
| 142 | // So nothing goes here. | ||
| 143 | void led_set_user(uint8_t usb_led) { | ||
| 144 | led_set_keymap(usb_led); | ||
| 145 | } | ||
| 146 | |||
| 147 | __attribute__ ((weak)) | ||
| 148 | void eeconfig_init_keymap(void) {} | ||
| 149 | |||
| 150 | void eeconfig_init_user(void) { | ||
| 151 | userspace_config.raw = 0; | ||
| 152 | userspace_config.rgb_layer_change = true; | ||
| 153 | eeconfig_update_user(userspace_config.raw); | ||
| 154 | #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) | ||
| 155 | set_unicode_input_mode(YAD_UNICODE_MODE); | ||
| 156 | get_unicode_input_mode(); | ||
| 157 | #else | ||
| 158 | eeprom_update_byte(EECONFIG_UNICODEMODE, YAD_UNICODE_MODE); | ||
| 159 | #endif | ||
| 160 | } | ||
