template.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include "drashna.h"
  2. #include "quantum.h"
  3. #include "action.h"
  4. #include "version.h"
  5. // Add reconfigurable functions here, for keymap customization
  6. // This allows for a global, userspace functions, and continued
  7. // customization of the keymap. Use _keymap instead of _user
  8. // functions in the keymaps
  9. __attribute__ ((weak))
  10. void matrix_init_keymap(void) {}
  11. __attribute__ ((weak))
  12. void matrix_scan_keymap(void) {}
  13. __attribute__ ((weak))
  14. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  15. return true;
  16. }
  17. __attribute__ ((weak))
  18. uint32_t layer_state_set_keymap (uint32_t state) {
  19. return state;
  20. }
  21. // Call user matrix init, then call the keymap's init function
  22. void matrix_init_user(void) {
  23. matrix_init_keymap();
  24. }
  25. // No global matrix scan code, so just run keymap's matix
  26. // scan function
  27. void matrix_scan_user(void) {
  28. matrix_scan_keymap();
  29. }
  30. // Defines actions tor my global custom keycodes. Defined in drashna.h file
  31. // Then runs the _keymap's recod handier if not processed here,
  32. // And use "NEWPLACEHOLDER" for new safe range
  33. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  34. switch (keycode) {
  35. case KC_MAKE:
  36. if (!record->event.pressed) {
  37. SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
  38. #ifndef BOOTLOADER_CATERINA
  39. SEND_STRING(":teensy ");
  40. #else
  41. SEND_STRING(" ");
  42. #endif
  43. SEND_STRING(SS_TAP(X_ENTER));
  44. }
  45. return false;
  46. break;
  47. case KC_RESET:
  48. if (!record->event.pressed) {
  49. reset_keyboard();
  50. }
  51. return false;
  52. break;
  53. case EPRM:
  54. if (record->event.pressed) {
  55. eeconfig_init();
  56. }
  57. return false;
  58. break;
  59. case VRSN:
  60. if (record->event.pressed) {
  61. SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
  62. }
  63. return false;
  64. break;
  65. }
  66. return process_record_keymap(keycode, record);
  67. }
  68. // Runs state check and changes underglow color and animation
  69. // on layer change, no matter where the change was initiated
  70. // Then runs keymap's layer change check
  71. uint32_t layer_state_set_user (uint32_t state) {
  72. return layer_state_set_keymap (state);
  73. }