template.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #include "template.h"
  2. // Add reconfigurable functions here, for keymap customization
  3. // This allows for a global, userspace functions, and continued
  4. // customization of the keymap. Use _keymap instead of _user
  5. // functions in the keymaps
  6. __attribute__ ((weak))
  7. void matrix_init_keymap(void) {}
  8. // Call user matrix init, then call the keymap's init function
  9. void matrix_init_user(void) {
  10. matrix_init_keymap();
  11. }
  12. __attribute__ ((weak))
  13. void matrix_scan_keymap(void) {}
  14. // No global matrix scan code, so just run keymap's matix
  15. // scan function
  16. void matrix_scan_user(void) {
  17. matrix_scan_keymap();
  18. }
  19. __attribute__ ((weak))
  20. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  21. return true;
  22. }
  23. // Defines actions tor my global custom keycodes. Defined in drashna.h file
  24. // Then runs the _keymap's recod handier if not processed here,
  25. // And use "NEWPLACEHOLDER" for new safe range
  26. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  27. switch (keycode) {
  28. case KC_MAKE:
  29. if (!record->event.pressed) {
  30. SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
  31. #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
  32. ":dfu"
  33. #elif defined(BOOTLOADER_HALFKAY)
  34. ":teensy"
  35. #elif defined(BOOTLOADER_CATERINA)
  36. ":avrdude"
  37. #endif
  38. SS_TAP(X_ENTER));
  39. }
  40. return false;
  41. break;
  42. case EPRM:
  43. if (record->event.pressed) {
  44. eeconfig_init();
  45. }
  46. return false;
  47. break;
  48. case VRSN:
  49. if (record->event.pressed) {
  50. SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
  51. }
  52. return false;
  53. break;
  54. }
  55. return process_record_keymap(keycode, record);
  56. }
  57. __attribute__ ((weak))
  58. uint32_t layer_state_set_keymap (uint32_t state) {
  59. return state;
  60. }
  61. uint32_t layer_state_set_user (uint32_t state) {
  62. return layer_state_set_keymap (state);
  63. }
  64. __attribute__ ((weak))
  65. void led_set_keymap(uint8_t usb_led) {}
  66. void led_set_user(uint8_t usb_led) {
  67. led_set_keymap(usb_led);
  68. }
  69. __attribute__ ((weak))
  70. void suspend_power_down_keymap(void) {}
  71. void suspend_power_down_user(void)
  72. {
  73. suspend_power_down_keymap();
  74. }
  75. __attribute__ ((weak))
  76. void suspend_wakeup_init_keymap(void) {}
  77. void suspend_wakeup_init_user(void)
  78. {
  79. suspend_wakeup_init_keymap();
  80. #ifdef KEYBOARD_ergodox_ez
  81. wait_ms(10);
  82. #endif
  83. }
  84. __attribute__ ((weak))
  85. void startup_keymap(void) {}
  86. void startup_user (void) {
  87. #ifdef RGBLIGHT_ENABLE
  88. matrix_init_rgb();
  89. #endif //RGBLIGHT_ENABLE
  90. startup_keymap();
  91. }
  92. __attribute__ ((weak))
  93. void shutdown_keymap(void) {}
  94. void shutdown_user (void) {
  95. shutdown_keymap();
  96. }