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.

97 lines
2.4 KiB

[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. # Custom Userspace Function handlers
  2. Specifically QMK works by using customized handlers for everything. This allows for multiple levels of customization.
  3. `matrix_scan` calls `matrix_scan_quantum`, which calls `matrix_scan_kb`, which calls `matrix_scan_user`.
  4. `process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user`
  5. The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions.
  6. All (most) `_user` functions are handled here, in the userspace instead. To allow keyboard specific configuration, I've created `_keymap` functions that can be called by the keymap.c files instead.
  7. This allows for keyboard specific configuration while maintaining the ability to customize the board.
  8. My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/community/ergodox/drashna/keymap.c) is a good example of this, as it uses the LEDs as modifier indicators.
  9. But for a list:
  10. ```c
  11. __attribute__ ((weak))
  12. void matrix_init_keymap(void) {}
  13. void matrix_init_user(void) {
  14. matrix_init_keymap();
  15. }
  16. __attribute__((weak))
  17. void keyboard_post_init_keymap(void){ }
  18. void keyboard_post_init_user(void){
  19. keyboard_post_init_keymap();
  20. }
  21. __attribute__ ((weak))
  22. void matrix_scan_keymap(void) {}
  23. void matrix_scan_user(void) {
  24. matrix_scan_keymap();
  25. }
  26. __attribute__ ((weak))
  27. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  28. return true;
  29. }
  30. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  31. return process_record_keymap(keycode, record);
  32. }
  33. __attribute__ ((weak))
  34. layer_state_t layer_state_set_keymap (layer_state_t state) {
  35. return state;
  36. }
  37. layer_state_t layer_state_set_user (layer_state_t state) {
  38. return layer_state_set_keymap (state);
  39. }
  40. __attribute__ ((weak))
  41. void led_set_keymap(uint8_t usb_led) {}
  42. void led_set_user(uint8_t usb_led) {
  43. led_set_keymap(usb_led);
  44. }
  45. __attribute__ ((weak))
  46. void suspend_power_down_keymap(void) {}
  47. void suspend_power_down_user(void) {
  48. suspend_power_down_keymap();
  49. }
  50. __attribute__ ((weak))
  51. void suspend_wakeup_init_keymap(void) {}
  52. void suspend_wakeup_init_user(void) {
  53. suspend_wakeup_init_keymap();
  54. }
  55. __attribute__ ((weak))
  56. void shutdown_keymap(void) {}
  57. void shutdown_user (void) {
  58. shutdown_keymap();
  59. }
  60. __attribute__ ((weak))
  61. void eeconfig_init_keymap(void) {}
  62. void eeconfig_init_user(void) {
  63. eeconfig_init_keymap();
  64. }
  65. ```