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.

98 lines
3.3 KiB

  1. /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "template.h"
  17. // Add reconfigurable functions here, for keymap customization
  18. // This allows for a global, userspace functions, and continued
  19. // customization of the keymap. Use _keymap instead of _user
  20. // functions in the keymaps
  21. __attribute__((weak)) void matrix_init_keymap(void) {}
  22. // Call user matrix init, then call the keymap's init function
  23. void matrix_init_user(void) { matrix_init_keymap(); }
  24. __attribute__((weak)) void matrix_scan_keymap(void) {}
  25. // No global matrix scan code, so just run keymap's matix
  26. // scan function
  27. void matrix_scan_user(void) { matrix_scan_keymap(); }
  28. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  29. // Defines actions tor my global custom keycodes. Defined in drashna.h file
  30. // Then runs the _keymap's recod handier if not processed here,
  31. // And use "NEWPLACEHOLDER" for new safe range
  32. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  33. switch (keycode) {
  34. case KC_MAKE:
  35. if (!record->event.pressed) {
  36. SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
  37. #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
  38. ":dfu"
  39. #elif defined(BOOTLOADER_HALFKAY)
  40. ":teensy"
  41. #elif defined(BOOTLOADER_CATERINA)
  42. ":avrdude"
  43. #endif
  44. SS_TAP(X_ENTER));
  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)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
  58. layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); }
  59. __attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
  60. void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
  61. __attribute__((weak)) void suspend_power_down_keymap(void) {}
  62. void suspend_power_down_user(void) { suspend_power_down_keymap(); }
  63. __attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
  64. void suspend_wakeup_init_user(void) {
  65. suspend_wakeup_init_keymap();
  66. #ifdef KEYBOARD_ergodox_ez
  67. wait_ms(10);
  68. #endif
  69. }
  70. __attribute__((weak)) void startup_keymap(void) {}
  71. void startup_user(void) {
  72. #ifdef RGBLIGHT_ENABLE
  73. matrix_init_rgb();
  74. #endif // RGBLIGHT_ENABLE
  75. startup_keymap();
  76. }
  77. __attribute__((weak)) void shutdown_keymap(void) {}
  78. void shutdown_user(void) { shutdown_keymap(); }