diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-08-29 10:42:15 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-08-29 13:42:15 -0400 |
| commit | e4bbe057f2620ee24c3a78cb758cdfa7c4bd7abf (patch) | |
| tree | 7bba9941bd9e1058d3105d2df312cb0006e56eba /users/drashna | |
| parent | 661ca4440cc42f3b60697e98985c44b0571ccfc1 (diff) | |
| download | qmk_firmware-e4bbe057f2620ee24c3a78cb758cdfa7c4bd7abf.tar.gz qmk_firmware-e4bbe057f2620ee24c3a78cb758cdfa7c4bd7abf.zip | |
Yet another update to drashna keymaps and userspace (#3787)
* Make tap function inline
* Use better makefile keyboard detection
* Remove Copy-Paste macro
* Add F11/F12 to Iris
* Minor tweaks to userspace config
* Set audio clicky randomness to 1.5
* Set NO_DEBUG to only be set if console is not enabled
* Move NO_MUSIC_MODE to userspace config.h
* Reduce Ergodox Debounce
* Add Planck Light config
* Use OSM for ortho 4x12
* Music Mode changes for planck light
* Cleanup do to shutdown user and other fixes in Master
* Add and use 'shutdown_user' fzunction
* Remove global NO_MUSIC_MODE define
* Add NO_MUSIC_MODE to individual keymaps
* Change layer colors
* Remove NO_PRINT and NO_DEBUG from userspace config.h
Since these are automatically disabled if the console isn't enabled.
* Remove backlight code if backlight isn't enabled
* Remove Twinkle from Ergodox
* Disable RGB twinkling and enable PSM
* Clean up RGB matrix code
* Clean up planck light indicators
* Clean up tap code
* Rules cleanup for ortho 4x12
* Fix up userspace template
* Revert "Clean up tap code"
This reverts commit 09f64d6d67aa021c3b5ac86a9a739a5ca2b9c1ec.
* Organize includes
* userspace cleanup
* Fix modifier spelling error
* Fix userspace rules
* Disable Permissive Hold again
* Minor clean up
* Fix Tap stuff
* Viterbi Updates for file size
Diffstat (limited to 'users/drashna')
| -rw-r--r-- | users/drashna/config.h | 16 | ||||
| -rw-r--r-- | users/drashna/drashna.c | 75 | ||||
| -rw-r--r-- | users/drashna/drashna.h | 22 | ||||
| -rw-r--r-- | users/drashna/rgb_stuff.c | 6 | ||||
| -rw-r--r-- | users/drashna/rgb_stuff.h | 1 | ||||
| -rw-r--r-- | users/drashna/template.c | 97 | ||||
| -rw-r--r-- | users/drashna/template.h | 4 |
7 files changed, 124 insertions, 97 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h index 87050fbcc..dd6875ceb 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h | |||
| @@ -11,8 +11,10 @@ | |||
| 11 | SONG(OVERWATCH_THEME) \ | 11 | SONG(OVERWATCH_THEME) \ |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | #define AUDIO_CLICKY_FREQ_RANDOMNESS 1.0f | 14 | #define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f |
| 15 | 15 | // #ifdef RGBLIGHT_ENABLE | |
| 16 | // #define NO_MUSIC_MODE | ||
| 17 | // #endif //RGBLIGHT_ENABLE | ||
| 16 | #endif | 18 | #endif |
| 17 | 19 | ||
| 18 | #ifdef RGBLIGHT_ENABLE | 20 | #ifdef RGBLIGHT_ENABLE |
| @@ -40,8 +42,8 @@ | |||
| 40 | // and when this option isn't enabled, z rapidly followed by x | 42 | // and when this option isn't enabled, z rapidly followed by x |
| 41 | // actually sends Ctrl-x. That's bad.) | 43 | // actually sends Ctrl-x. That's bad.) |
| 42 | #define IGNORE_MOD_TAP_INTERRUPT | 44 | #define IGNORE_MOD_TAP_INTERRUPT |
| 43 | #undef PERMISSIVE_HOLD | 45 | #undef PERMISSIVE_HOLD |
| 44 | #undef PREVENT_STUCK_MODIFIERS | 46 | #define PREVENT_STUCK_MODIFIERS |
| 45 | // #define TAPPING_FORCE_HOLD | 47 | // #define TAPPING_FORCE_HOLD |
| 46 | //#define RETRO_TAPPING | 48 | //#define RETRO_TAPPING |
| 47 | 49 | ||
| @@ -59,12 +61,6 @@ | |||
| 59 | 61 | ||
| 60 | // Disable action_get_macro and fn_actions, since we don't use these | 62 | // Disable action_get_macro and fn_actions, since we don't use these |
| 61 | // and it saves on space in the firmware. | 63 | // and it saves on space in the firmware. |
| 62 | #ifndef NO_DEBUG | ||
| 63 | #define NO_DEBUG | ||
| 64 | #endif // !NO_DEBUG | ||
| 65 | #if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE) | ||
| 66 | #define NO_PRINT | ||
| 67 | #endif // !NO_PRINT | ||
| 68 | #define NO_ACTION_MACRO | 64 | #define NO_ACTION_MACRO |
| 69 | #define NO_ACTION_FUNCTION | 65 | #define NO_ACTION_FUNCTION |
| 70 | 66 | ||
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index f72902f0b..20df2f4de 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -16,16 +16,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "drashna.h" | 18 | #include "drashna.h" |
| 19 | #include "version.h" | ||
| 20 | #include "eeprom.h" | ||
| 21 | #include "tap_dances.h" | 19 | #include "tap_dances.h" |
| 22 | #include "rgb_stuff.h" | 20 | #include "rgb_stuff.h" |
| 23 | 21 | ||
| 24 | |||
| 25 | float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); | ||
| 26 | float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); | ||
| 27 | |||
| 28 | static uint16_t copy_paste_timer; | ||
| 29 | userspace_config_t userspace_config; | 22 | userspace_config_t userspace_config; |
| 30 | 23 | ||
| 31 | // Helper Functions | 24 | // Helper Functions |
| @@ -35,8 +28,14 @@ userspace_config_t userspace_config; | |||
| 35 | // the same thing, but with differring text sent. | 28 | // the same thing, but with differring text sent. |
| 36 | bool send_game_macro(const char *str, keyrecord_t *record, bool override) { | 29 | bool send_game_macro(const char *str, keyrecord_t *record, bool override) { |
| 37 | if (!record->event.pressed || override) { | 30 | if (!record->event.pressed || override) { |
| 31 | uint16_t keycode; | ||
| 32 | if (userspace_config.is_overwatch) { | ||
| 33 | keycode = KC_BSPC; | ||
| 34 | } else { | ||
| 35 | keycode = KC_ENTER; | ||
| 36 | } | ||
| 38 | clear_keyboard(); | 37 | clear_keyboard(); |
| 39 | tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); | 38 | tap(keycode); |
| 40 | wait_ms(50); | 39 | wait_ms(50); |
| 41 | send_string_with_delay(str, MACRO_TIMER); | 40 | send_string_with_delay(str, MACRO_TIMER); |
| 42 | wait_ms(50); | 41 | wait_ms(50); |
| @@ -46,8 +45,6 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { | |||
| 46 | return false; | 45 | return false; |
| 47 | } | 46 | } |
| 48 | 47 | ||
| 49 | void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; | ||
| 50 | |||
| 51 | bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { | 48 | bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) { |
| 52 | static uint16_t this_timer; | 49 | static uint16_t this_timer; |
| 53 | if(pressed) { | 50 | if(pressed) { |
| @@ -94,6 +91,9 @@ __attribute__ ((weak)) | |||
| 94 | void startup_keymap(void) {} | 91 | void startup_keymap(void) {} |
| 95 | 92 | ||
| 96 | __attribute__ ((weak)) | 93 | __attribute__ ((weak)) |
| 94 | void shutdown_keymap(void) {} | ||
| 95 | |||
| 96 | __attribute__ ((weak)) | ||
| 97 | void suspend_power_down_keymap(void) {} | 97 | void suspend_power_down_keymap(void) {} |
| 98 | 98 | ||
| 99 | __attribute__ ((weak)) | 99 | __attribute__ ((weak)) |
| @@ -127,6 +127,7 @@ __attribute__ ((weak)) | |||
| 127 | void led_set_keymap(uint8_t usb_led) {} | 127 | void led_set_keymap(uint8_t usb_led) {} |
| 128 | 128 | ||
| 129 | 129 | ||
| 130 | |||
| 130 | // Call user matrix init, set default RGB colors and then | 131 | // Call user matrix init, set default RGB colors and then |
| 131 | // call the keymap's init function | 132 | // call the keymap's init function |
| 132 | void matrix_init_user(void) { | 133 | void matrix_init_user(void) { |
| @@ -158,6 +159,24 @@ void startup_user (void) { | |||
| 158 | startup_keymap(); | 159 | startup_keymap(); |
| 159 | } | 160 | } |
| 160 | 161 | ||
| 162 | void shutdown_user (void) { | ||
| 163 | #ifdef RGBLIGHT_ENABLE | ||
| 164 | rgblight_enable_noeeprom(); | ||
| 165 | rgblight_mode_noeeprom(1); | ||
| 166 | rgblight_setrgb_red(); | ||
| 167 | #endif // RGBLIGHT_ENABLE | ||
| 168 | #ifdef RGB_MATRIX_ENABLE | ||
| 169 | rgb_led led; | ||
| 170 | for (int i = 0; i < DRIVER_LED_TOTAL; i++) { | ||
| 171 | led = g_rgb_leds[i]; | ||
| 172 | if (led.matrix_co.raw < 0xFF) { | ||
| 173 | rgb_matrix_set_color( i, 0xFF, 0x00, 0x00 ); | ||
| 174 | } | ||
| 175 | } | ||
| 176 | #endif //RGB_MATRIX_ENABLE | ||
| 177 | shutdown_keymap(); | ||
| 178 | } | ||
| 179 | |||
| 161 | void suspend_power_down_user(void) | 180 | void suspend_power_down_user(void) |
| 162 | { | 181 | { |
| 163 | suspend_power_down_keymap(); | 182 | suspend_power_down_keymap(); |
| @@ -246,20 +265,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 246 | return false; | 265 | return false; |
| 247 | break; | 266 | break; |
| 248 | 267 | ||
| 249 | |||
| 250 | case KC_RESET: // Custom RESET code that sets RGBLights to RED | ||
| 251 | if (!record->event.pressed) { | ||
| 252 | #ifdef RGBLIGHT_ENABLE | ||
| 253 | rgblight_enable_noeeprom(); | ||
| 254 | rgblight_mode_noeeprom(1); | ||
| 255 | rgblight_setrgb_red(); | ||
| 256 | #endif // RGBLIGHT_ENABLE | ||
| 257 | reset_keyboard(); | ||
| 258 | } | ||
| 259 | return false; | ||
| 260 | break; | ||
| 261 | |||
| 262 | |||
| 263 | case EPRM: // Resets EEPROM | 268 | case EPRM: // Resets EEPROM |
| 264 | if (record->event.pressed) { | 269 | if (record->event.pressed) { |
| 265 | eeconfig_init(); | 270 | eeconfig_init(); |
| @@ -333,28 +338,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 333 | return false; break; | 338 | return false; break; |
| 334 | 339 | ||
| 335 | 340 | ||
| 336 | case KC_CCCV: // One key copy/paste | ||
| 337 | if(record->event.pressed){ | ||
| 338 | copy_paste_timer = timer_read(); | ||
| 339 | } else { | ||
| 340 | if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy | ||
| 341 | register_code(KC_LCTL); | ||
| 342 | tap(KC_C); | ||
| 343 | unregister_code(KC_LCTL); | ||
| 344 | #ifdef AUDIO_ENABLE | ||
| 345 | PLAY_SONG(tone_copy); | ||
| 346 | #endif | ||
| 347 | } else { // Tap, paste | ||
| 348 | register_code(KC_LCTL); | ||
| 349 | tap(KC_V); | ||
| 350 | unregister_code(KC_LCTL); | ||
| 351 | #ifdef AUDIO_ENABLE | ||
| 352 | PLAY_SONG(tone_paste); | ||
| 353 | #endif | ||
| 354 | } | ||
| 355 | } | ||
| 356 | return false; | ||
| 357 | break; | ||
| 358 | case CLICKY_TOGGLE: | 341 | case CLICKY_TOGGLE: |
| 359 | #ifdef AUDIO_CLICKY | 342 | #ifdef AUDIO_CLICKY |
| 360 | userspace_config.clicky_enable = clicky_enable; | 343 | userspace_config.clicky_enable = clicky_enable; |
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 3efef5704..dd0d1c0d7 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h | |||
| @@ -15,11 +15,13 @@ You should have received a copy of the GNU General Public License | |||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #ifndef USERSPACE | 18 | #pragma once |
| 19 | #define USERSPACE | ||
| 20 | #include "quantum.h" | 19 | #include "quantum.h" |
| 21 | 20 | #include "version.h" | |
| 22 | 21 | #include "eeprom.h" | |
| 22 | #ifdef RGB_MATRIX_ENABLE | ||
| 23 | #include "rgb_matrix.h" | ||
| 24 | #endif | ||
| 23 | // Define layer names | 25 | // Define layer names |
| 24 | enum userspace_layers { | 26 | enum userspace_layers { |
| 25 | _QWERTY = 0, | 27 | _QWERTY = 0, |
| @@ -53,7 +55,7 @@ extern bool clicky_enable; | |||
| 53 | void rgblight_sethsv_default_helper(uint8_t index); | 55 | void rgblight_sethsv_default_helper(uint8_t index); |
| 54 | #endif // RGBLIGHT_ENABLE | 56 | #endif // RGBLIGHT_ENABLE |
| 55 | 57 | ||
| 56 | void tap(uint16_t keycode); | 58 | inline void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; |
| 57 | bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); | 59 | bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); |
| 58 | bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); | 60 | bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); |
| 59 | 61 | ||
| @@ -90,7 +92,6 @@ enum userspace_custom_keycodes { | |||
| 90 | KC_C9, | 92 | KC_C9, |
| 91 | KC_GGEZ, | 93 | KC_GGEZ, |
| 92 | KC_MAKE, // Run keyboard's customized make command | 94 | KC_MAKE, // Run keyboard's customized make command |
| 93 | KC_RESET, // Resets keyboard, with red underglow | ||
| 94 | KC_RGB_T, // Toggles RGB Layer Indication mode | 95 | KC_RGB_T, // Toggles RGB Layer Indication mode |
| 95 | KC_SECRET_1, // test1 | 96 | KC_SECRET_1, // test1 |
| 96 | KC_SECRET_2, // test2 | 97 | KC_SECRET_2, // test2 |
| @@ -123,6 +124,7 @@ enum userspace_custom_keycodes { | |||
| 123 | #define COLEMAK KC_COLEMAK | 124 | #define COLEMAK KC_COLEMAK |
| 124 | #define WORKMAN KC_WORKMAN | 125 | #define WORKMAN KC_WORKMAN |
| 125 | 126 | ||
| 127 | #define KC_RESET RESET | ||
| 126 | #define KC_RST KC_RESET | 128 | #define KC_RST KC_RESET |
| 127 | 129 | ||
| 128 | #ifdef SWAP_HANDS_ENABLE | 130 | #ifdef SWAP_HANDS_ENABLE |
| @@ -131,6 +133,11 @@ enum userspace_custom_keycodes { | |||
| 131 | #define KC_C1R3 KC_BSPC | 133 | #define KC_C1R3 KC_BSPC |
| 132 | #endif // SWAP_HANDS_ENABLE | 134 | #endif // SWAP_HANDS_ENABLE |
| 133 | 135 | ||
| 136 | #define BK_LWER LT(_LOWER, KC_BSPC) | ||
| 137 | #define SP_LWER LT(_LOWER, KC_SPC) | ||
| 138 | #define DL_RAIS LT(_RAISE, KC_DEL) | ||
| 139 | #define ET_RAIS LT(_RAISE, KC_ENTER) | ||
| 140 | |||
| 134 | // OSM keycodes, to keep things clean and easy to change | 141 | // OSM keycodes, to keep things clean and easy to change |
| 135 | #define KC_MLSF OSM(MOD_LSFT) | 142 | #define KC_MLSF OSM(MOD_LSFT) |
| 136 | #define KC_MRSF OSM(MOD_RSFT) | 143 | #define KC_MRSF OSM(MOD_RSFT) |
| @@ -325,7 +332,7 @@ enum { | |||
| 325 | 332 | ||
| 326 | 333 | ||
| 327 | #define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG | 334 | #define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG |
| 328 | #define _________________ADJUST_L2_________________ _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM | 335 | #define _________________ADJUST_L2_________________ MU_TOG , CK_TOGG, AU_ON, AU_OFF, AG_NORM |
| 329 | #define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T | 336 | #define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T |
| 330 | 337 | ||
| 331 | #define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 | 338 | #define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 |
| @@ -350,4 +357,3 @@ enum { | |||
| 350 | LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) | 357 | LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) |
| 351 | 358 | ||
| 352 | 359 | ||
| 353 | #endif // !USERSPACE | ||
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index f2a9a47a9..03c55b132 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c | |||
| @@ -267,7 +267,7 @@ void matrix_init_rgb(void) { | |||
| 267 | case _COLEMAK: | 267 | case _COLEMAK: |
| 268 | rgblight_sethsv_noeeprom_magenta(); break; | 268 | rgblight_sethsv_noeeprom_magenta(); break; |
| 269 | case _DVORAK: | 269 | case _DVORAK: |
| 270 | rgblight_sethsv_noeeprom_green(); break; | 270 | rgblight_sethsv_noeeprom_springgreen(); break; |
| 271 | case _WORKMAN: | 271 | case _WORKMAN: |
| 272 | rgblight_sethsv_noeeprom_goldenrod(); break; | 272 | rgblight_sethsv_noeeprom_goldenrod(); break; |
| 273 | default: | 273 | default: |
| @@ -313,7 +313,7 @@ uint32_t layer_state_set_rgb(uint32_t state) { | |||
| 313 | rgblight_mode_noeeprom(5); | 313 | rgblight_mode_noeeprom(5); |
| 314 | break; | 314 | break; |
| 315 | case _LOWER: | 315 | case _LOWER: |
| 316 | rgblight_sethsv_noeeprom_orange(); | 316 | rgblight_sethsv_noeeprom_green(); |
| 317 | rgblight_mode_noeeprom(5); | 317 | rgblight_mode_noeeprom(5); |
| 318 | break; | 318 | break; |
| 319 | case _ADJUST: | 319 | case _ADJUST: |
| @@ -325,7 +325,7 @@ uint32_t layer_state_set_rgb(uint32_t state) { | |||
| 325 | case _COLEMAK: | 325 | case _COLEMAK: |
| 326 | rgblight_sethsv_noeeprom_magenta(); break; | 326 | rgblight_sethsv_noeeprom_magenta(); break; |
| 327 | case _DVORAK: | 327 | case _DVORAK: |
| 328 | rgblight_sethsv_noeeprom_green(); break; | 328 | rgblight_sethsv_noeeprom_springgreen(); break; |
| 329 | case _WORKMAN: | 329 | case _WORKMAN: |
| 330 | rgblight_sethsv_noeeprom_goldenrod(); break; | 330 | rgblight_sethsv_noeeprom_goldenrod(); break; |
| 331 | default: | 331 | default: |
diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 6426ea266..50c75c8c3 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h | |||
| @@ -13,4 +13,3 @@ void matrix_init_rgb(void); | |||
| 13 | void matrix_scan_rgb(void); | 13 | void matrix_scan_rgb(void); |
| 14 | uint32_t layer_state_set_rgb(uint32_t state); | 14 | uint32_t layer_state_set_rgb(uint32_t state); |
| 15 | 15 | ||
| 16 | |||
diff --git a/users/drashna/template.c b/users/drashna/template.c index 20dbb96d7..e6b50c961 100644 --- a/users/drashna/template.c +++ b/users/drashna/template.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "drashna.h" | 1 | #include "template.h" |
| 2 | #include "quantum.h" | 2 | |
| 3 | #include "action.h" | ||
| 4 | #include "version.h" | ||
| 5 | 3 | ||
| 6 | // Add reconfigurable functions here, for keymap customization | 4 | // Add reconfigurable functions here, for keymap customization |
| 7 | // This allows for a global, userspace functions, and continued | 5 | // This allows for a global, userspace functions, and continued |
| @@ -10,25 +8,15 @@ | |||
| 10 | __attribute__ ((weak)) | 8 | __attribute__ ((weak)) |
| 11 | void matrix_init_keymap(void) {} | 9 | void matrix_init_keymap(void) {} |
| 12 | 10 | ||
| 13 | __attribute__ ((weak)) | ||
| 14 | void matrix_scan_keymap(void) {} | ||
| 15 | |||
| 16 | __attribute__ ((weak)) | ||
| 17 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 18 | return true; | ||
| 19 | } | ||
| 20 | __attribute__ ((weak)) | ||
| 21 | uint32_t layer_state_set_keymap (uint32_t state) { | ||
| 22 | return state; | ||
| 23 | } | ||
| 24 | __attribute__ ((weak)) | ||
| 25 | void led_set_keymap(uint8_t usb_led) {} | ||
| 26 | |||
| 27 | // Call user matrix init, then call the keymap's init function | 11 | // Call user matrix init, then call the keymap's init function |
| 28 | void matrix_init_user(void) { | 12 | void matrix_init_user(void) { |
| 29 | matrix_init_keymap(); | 13 | matrix_init_keymap(); |
| 30 | } | 14 | } |
| 31 | 15 | ||
| 16 | |||
| 17 | __attribute__ ((weak)) | ||
| 18 | void matrix_scan_keymap(void) {} | ||
| 19 | |||
| 32 | // No global matrix scan code, so just run keymap's matix | 20 | // No global matrix scan code, so just run keymap's matix |
| 33 | // scan function | 21 | // scan function |
| 34 | void matrix_scan_user(void) { | 22 | void matrix_scan_user(void) { |
| @@ -36,11 +24,16 @@ void matrix_scan_user(void) { | |||
| 36 | } | 24 | } |
| 37 | 25 | ||
| 38 | 26 | ||
| 27 | __attribute__ ((weak)) | ||
| 28 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 29 | return true; | ||
| 30 | } | ||
| 31 | |||
| 39 | // Defines actions tor my global custom keycodes. Defined in drashna.h file | 32 | // Defines actions tor my global custom keycodes. Defined in drashna.h file |
| 40 | // Then runs the _keymap's recod handier if not processed here, | 33 | // Then runs the _keymap's recod handier if not processed here, |
| 41 | // And use "NEWPLACEHOLDER" for new safe range | 34 | // And use "NEWPLACEHOLDER" for new safe range |
| 42 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 35 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 43 | 36 | ||
| 44 | switch (keycode) { | 37 | switch (keycode) { |
| 45 | case KC_MAKE: | 38 | case KC_MAKE: |
| 46 | if (!record->event.pressed) { | 39 | if (!record->event.pressed) { |
| @@ -56,12 +49,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 56 | } | 49 | } |
| 57 | return false; | 50 | return false; |
| 58 | break; | 51 | break; |
| 59 | case KC_RESET: | 52 | |
| 60 | if (!record->event.pressed) { | ||
| 61 | reset_keyboard(); | ||
| 62 | } | ||
| 63 | return false; | ||
| 64 | break; | ||
| 65 | case EPRM: | 53 | case EPRM: |
| 66 | if (record->event.pressed) { | 54 | if (record->event.pressed) { |
| 67 | eeconfig_init(); | 55 | eeconfig_init(); |
| @@ -78,13 +66,66 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 78 | return process_record_keymap(keycode, record); | 66 | return process_record_keymap(keycode, record); |
| 79 | } | 67 | } |
| 80 | 68 | ||
| 81 | // Runs state check and changes underglow color and animation | 69 | |
| 82 | // on layer change, no matter where the change was initiated | 70 | __attribute__ ((weak)) |
| 83 | // Then runs keymap's layer change check | 71 | uint32_t layer_state_set_keymap (uint32_t state) { |
| 72 | return state; | ||
| 73 | } | ||
| 74 | |||
| 84 | uint32_t layer_state_set_user (uint32_t state) { | 75 | uint32_t layer_state_set_user (uint32_t state) { |
| 85 | return layer_state_set_keymap (state); | 76 | return layer_state_set_keymap (state); |
| 86 | } | 77 | } |
| 87 | 78 | ||
| 79 | |||
| 80 | |||
| 81 | __attribute__ ((weak)) | ||
| 82 | void led_set_keymap(uint8_t usb_led) {} | ||
| 83 | |||
| 88 | void led_set_user(uint8_t usb_led) { | 84 | void led_set_user(uint8_t usb_led) { |
| 89 | led_set_keymap(usb_led); | 85 | led_set_keymap(usb_led); |
| 90 | } | 86 | } |
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | __attribute__ ((weak)) | ||
| 91 | void suspend_power_down_keymap(void) {} | ||
| 92 | |||
| 93 | void suspend_power_down_user(void) | ||
| 94 | { | ||
| 95 | suspend_power_down_keymap(); | ||
| 96 | } | ||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | __attribute__ ((weak)) | ||
| 101 | void suspend_wakeup_init_keymap(void) {} | ||
| 102 | |||
| 103 | void suspend_wakeup_init_user(void) | ||
| 104 | { | ||
| 105 | suspend_wakeup_init_keymap(); | ||
| 106 | #ifdef KEYBOARD_ergodox_ez | ||
| 107 | wait_ms(10); | ||
| 108 | #endif | ||
| 109 | } | ||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | __attribute__ ((weak)) | ||
| 114 | void startup_keymap(void) {} | ||
| 115 | |||
| 116 | void startup_user (void) { | ||
| 117 | #ifdef RGBLIGHT_ENABLE | ||
| 118 | matrix_init_rgb(); | ||
| 119 | #endif //RGBLIGHT_ENABLE | ||
| 120 | startup_keymap(); | ||
| 121 | } | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | __attribute__ ((weak)) | ||
| 126 | void shutdown_keymap(void) {} | ||
| 127 | |||
| 128 | void shutdown_user (void) { | ||
| 129 | shutdown_keymap(); | ||
| 130 | } | ||
| 131 | |||
diff --git a/users/drashna/template.h b/users/drashna/template.h index d1251462b..5b3a93de5 100644 --- a/users/drashna/template.h +++ b/users/drashna/template.h | |||
| @@ -2,8 +2,10 @@ | |||
| 2 | #define USERSPACE | 2 | #define USERSPACE |
| 3 | 3 | ||
| 4 | #include "quantum.h" | 4 | #include "quantum.h" |
| 5 | #include "version.h" | ||
| 6 | #include "eeprom.h" | ||
| 5 | 7 | ||
| 6 | // Define layer names | 8 | // Define layer names |
| 7 | #define BASE 0 | 9 | #define BASE 0 |
| 8 | 10 | ||
| 9 | enum custom_keycodes { | 11 | enum custom_keycodes { |
