You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
8.1 KiB

[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
[Keymap] Drashna's Feature madness (#6128) * Fix my Tap Dance issues after I broke them * Cleanup and organization of userspace documentation As well as some additional cleanup of functions due to review of documentation. * Enable Tapdance on Glow and remove more animations * Revert to Eager PR debouncing * Add better check for startup animation * Move where RGB Matrix defines are listed * Limit RGB Matrix max val * Update keyboard for Iris Rev 3 conflicts * Enable encoder support on planck ez * Remove is_master check from corne\'s OLED code * Overhaul OLED screens for my Corne * One last removal * Show RGB valu On both sides * Updates for OLED display info * Fix compile issues for rgb config * Disabled Space Cadet for all drashna keymaps * Fix OLED Screen configs * Minor OLED Tweaks * Revert some Iris changes * Fix song include * Handle MAKE macro for the Corne boards better * Add super hacky-hack for eeconfig initialization * Add audio support for Fractal since Elite Cs support it * Add defines for keycode steps * Add White layout * Update Corne RGB info * Add fun effects to layer indication for RGB Matrix enabled boards * Use proper define for product name detection * Update formatting * Use custom timeout mechanism for OLED timeout * Fix up OLED screen HSV code for new HSV structure * Better handle turning off RGB Matrix when sleeping * Disable MultiSplash Animation * Change Iris back to using serial * Why was RGB disabled?!?!?! * Limit val in rgb_matrix_layer_helper function * Remove EECONFIG setting for RGB matrix
4 years ago
[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
[Keymap] Big Drashna code update (#6639) * Add a quefrency keymap * New Alt-ernate layouts * Enable Per Key Tapping Term to preserve sanity * Use underglow and mod lights for status on Corne * Update the drashna_ms keymap for quefrency * Disable Audio since there isn't enough space * Update KC_MAKE to ues :flash target * Cleanup ergodox layout * Enable i2c support for Iris * Add keymap support for CG_SWAP * Enable RGB Matrix Shutdown mode * enable heatmap * Update gitlab CI to install python3 * Remove game macros These are no longer needed, and haven't been used in ages * Cleanup planck layout * Add RGB Matrix fun and RGB cleanup * Add keycode and config for RGB Matrix idle animations * Clean up rgb idle animation code * Add rgb idle keycode to keymaps * Fix issues with rgb matrix idle animation * Fix some handling for idle animation * Reduce idle animation timeout to 15s to be more reasonable * fix up rgb stuff * Fix isses with rgb functions not being called for matrix * Use custom EEPROM Magic Number so testing is easier * Extend Default Layer macro to support a lot more layers * Fix bjohnson macropad * Adjust KC_MAKE to process mods for more consistent behavior * Fix up rgb stuff on corne * Corne OLED Overhaul * Fixes a number of issues with weirdness. * Fixes issues with keylogger (should be more reliable now) * Modulaize the OLED render sections * Rewrite layer display code * Update URL for Font Editor Due to odd issues, I ended up rewriting from scratch. And using PROGMEM versions, since I think I was getting memory overflows. * Update polling rate on all keebs * Fix planck ez layout config * Remove macros from Viterbi
4 years ago
[Keymap] Drashna's Feature madness (#6128) * Fix my Tap Dance issues after I broke them * Cleanup and organization of userspace documentation As well as some additional cleanup of functions due to review of documentation. * Enable Tapdance on Glow and remove more animations * Revert to Eager PR debouncing * Add better check for startup animation * Move where RGB Matrix defines are listed * Limit RGB Matrix max val * Update keyboard for Iris Rev 3 conflicts * Enable encoder support on planck ez * Remove is_master check from corne\'s OLED code * Overhaul OLED screens for my Corne * One last removal * Show RGB valu On both sides * Updates for OLED display info * Fix compile issues for rgb config * Disabled Space Cadet for all drashna keymaps * Fix OLED Screen configs * Minor OLED Tweaks * Revert some Iris changes * Fix song include * Handle MAKE macro for the Corne boards better * Add super hacky-hack for eeconfig initialization * Add audio support for Fractal since Elite Cs support it * Add defines for keycode steps * Add White layout * Update Corne RGB info * Add fun effects to layer indication for RGB Matrix enabled boards * Use proper define for product name detection * Update formatting * Use custom timeout mechanism for OLED timeout * Fix up OLED screen HSV code for new HSV structure * Better handle turning off RGB Matrix when sleeping * Disable MultiSplash Animation * Change Iris back to using serial * Why was RGB disabled?!?!?! * Limit val in rgb_matrix_layer_helper function * Remove EECONFIG setting for RGB matrix
4 years ago
  1. // Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "drashna.h"
  4. #include "version.h"
  5. #ifdef AUTOCORRECTION_ENABLE
  6. # include "autocorrection/autocorrection.h"
  7. #endif
  8. #ifdef __AVR__
  9. # include <avr/wdt.h>
  10. #endif
  11. uint16_t copy_paste_timer;
  12. bool host_driver_disabled = false;
  13. // Defines actions tor my global custom keycodes. Defined in drashna.h file
  14. // Then runs the _keymap's record handier if not processed here
  15. /**
  16. * @brief Keycode handler for keymaps
  17. *
  18. * This handles the keycodes at the keymap level, useful for keyboard specific customization
  19. */
  20. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  21. __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
  22. /**
  23. * @brief Main user keycode handler
  24. *
  25. * This handles all of the keycodes for the user, including calling feature handlers.
  26. *
  27. * @param keycode Keycode from matrix
  28. * @param record keyrecord_t data structure
  29. * @return true Continue processing keycode and send to host
  30. * @return false Stop process keycode and do not send to host
  31. */
  32. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  33. #ifdef ENCODER_ENABLE // some debouncing for weird issues
  34. if (IS_ENCODEREVENT(record->event)) {
  35. static bool ignore_first = true;
  36. if (ignore_first) {
  37. ignore_first = false;
  38. return false;
  39. }
  40. }
  41. #endif
  42. // If console is enabled, it will print the matrix position and status of each key pressed
  43. #ifdef KEYLOGGER_ENABLE
  44. uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
  45. #endif // KEYLOGGER_ENABLE
  46. #if defined(OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER)
  47. process_record_user_oled(keycode, record);
  48. #endif // OLED
  49. if (!(process_record_keymap(keycode, record) && process_record_secrets(keycode, record)
  50. #ifdef CUSTOM_RGB_MATRIX
  51. && process_record_user_rgb_matrix(keycode, record)
  52. #endif
  53. #ifdef CUSTOM_RGBLIGHT
  54. && process_record_user_rgb_light(keycode, record)
  55. #endif
  56. #ifdef CUSTOM_UNICODE_ENABLE
  57. && process_record_unicode(keycode, record)
  58. #endif
  59. #if defined(CUSTOM_POINTING_DEVICE)
  60. && process_record_pointing(keycode, record)
  61. #endif
  62. #ifdef AUTOCORRECTION_ENABLE
  63. && process_autocorrection(keycode, record)
  64. #endif
  65. && true)) {
  66. return false;
  67. }
  68. switch (keycode) {
  69. case FIRST_DEFAULT_LAYER_KEYCODE ... LAST_DEFAULT_LAYER_KEYCODE:
  70. if (record->event.pressed) {
  71. uint8_t mods = mod_config(get_mods() | get_oneshot_mods());
  72. if (!mods) {
  73. set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE);
  74. #if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 3)
  75. } else if (mods & MOD_MASK_SHIFT) {
  76. set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE + 4);
  77. # if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 7)
  78. } else if (mods & MOD_MASK_CTRL) {
  79. set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE + 8);
  80. # endif
  81. #endif
  82. }
  83. }
  84. break;
  85. case VRSN: // Prints firmware version
  86. if (record->event.pressed) {
  87. send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
  88. }
  89. break;
  90. case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
  91. #ifdef TAP_DANCE_ENABLE
  92. if (record->event.pressed) {
  93. for (uint8_t index = 0; index < 4; index++) {
  94. diablo_timer[index].key_interval = 0;
  95. }
  96. }
  97. #endif // TAP_DANCE_ENABLE
  98. break;
  99. case KC_CCCV: // One key copy/paste
  100. if (record->event.pressed) {
  101. copy_paste_timer = timer_read();
  102. } else {
  103. if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
  104. tap_code16(LCTL(KC_C));
  105. } else { // Tap, paste
  106. tap_code16(LCTL(KC_V));
  107. }
  108. }
  109. break;
  110. case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
  111. #if defined(CUSTOM_RGBLIGHT) || defined(CUSTOM_RGB_MATRIX)
  112. if (record->event.pressed) {
  113. userspace_config.rgb_layer_change ^= 1;
  114. dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
  115. eeconfig_update_user(userspace_config.raw);
  116. if (userspace_config.rgb_layer_change) {
  117. # if defined(CUSTOM_RGB_MATRIX)
  118. rgb_matrix_set_flags(LED_FLAG_UNDERGLOW | LED_FLAG_KEYLIGHT | LED_FLAG_INDICATOR);
  119. # if defined(CUSTOM_RGBLIGHT)
  120. rgblight_enable_noeeprom();
  121. # endif
  122. # endif
  123. layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
  124. # if defined(CUSTOM_RGB_MATRIX)
  125. } else {
  126. rgb_matrix_set_flags(LED_FLAG_ALL);
  127. # if defined(CUSTOM_RGBLIGHT)
  128. rgblight_disable_noeeprom();
  129. # endif
  130. # endif
  131. }
  132. }
  133. #endif // CUSTOM_RGBLIGHT
  134. break;
  135. #if defined(CUSTOM_RGBLIGHT) || defined(CUSTOM_RGB_MATRIX)
  136. case RGB_TOG:
  137. // Split keyboards need to trigger on key-up for edge-case issue
  138. # ifndef SPLIT_KEYBOARD
  139. if (record->event.pressed) {
  140. # else
  141. if (!record->event.pressed) {
  142. # endif
  143. # if defined(CUSTOM_RGBLIGHT) && !defined(RGBLIGHT_DISABLE_KEYCODES)
  144. rgblight_toggle();
  145. # endif
  146. # if defined(CUSTOM_RGB_MATRIX) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
  147. rgb_matrix_toggle();
  148. # endif
  149. }
  150. return false;
  151. break;
  152. case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
  153. if (record->event.pressed) {
  154. bool is_eeprom_updated;
  155. # if defined(CUSTOM_RGBLIGHT) && !defined(RGBLIGHT_DISABLE_KEYCODES)
  156. // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
  157. if (userspace_config.rgb_layer_change) {
  158. userspace_config.rgb_layer_change = false;
  159. dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
  160. is_eeprom_updated = true;
  161. }
  162. # endif
  163. # if defined(CUSTOM_RGB_MATRIX) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
  164. if (userspace_config.rgb_matrix_idle_anim) {
  165. userspace_config.rgb_matrix_idle_anim = false;
  166. dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
  167. is_eeprom_updated = true;
  168. }
  169. # endif
  170. if (is_eeprom_updated) {
  171. eeconfig_update_user(userspace_config.raw);
  172. }
  173. }
  174. break;
  175. #endif
  176. case KEYLOCK: {
  177. static host_driver_t *host_driver = 0;
  178. if (record->event.pressed) {
  179. if (host_get_driver()) {
  180. host_driver = host_get_driver();
  181. clear_keyboard();
  182. host_set_driver(0);
  183. host_driver_disabled = true;
  184. } else {
  185. host_set_driver(host_driver);
  186. host_driver_disabled = false;
  187. }
  188. }
  189. break;
  190. }
  191. }
  192. return true;
  193. }
  194. __attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t *record) {}
  195. void post_process_record_user(uint16_t keycode, keyrecord_t *record) { post_process_record_keymap(keycode, record); }