template.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "template.h"
  4. // Add reconfigurable functions here, for keymap customization
  5. // This allows for a global, userspace functions, and continued
  6. // customization of the keymap. Use _keymap instead of _user
  7. // functions in the keymaps
  8. __attribute__((weak)) void matrix_init_keymap(void) {}
  9. // Call user matrix init, then call the keymap's init function
  10. void matrix_init_user(void) { matrix_init_keymap(); }
  11. __attribute__((weak)) void matrix_scan_keymap(void) {}
  12. // No global matrix scan code, so just run keymap's matix
  13. // scan function
  14. void matrix_scan_user(void) { matrix_scan_keymap(); }
  15. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  16. // Defines actions tor my global custom keycodes. Defined in drashna.h file
  17. // Then runs the _keymap's recod handier if not processed here,
  18. // And use "NEWPLACEHOLDER" for new safe range
  19. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  20. switch (keycode) {
  21. case VRSN:
  22. if (record->event.pressed) {
  23. SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
  24. }
  25. return false;
  26. break;
  27. }
  28. return process_record_keymap(keycode, record);
  29. }
  30. __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
  31. layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); }
  32. __attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
  33. void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
  34. __attribute__((weak)) void suspend_power_down_keymap(void) {}
  35. void suspend_power_down_user(void) { suspend_power_down_keymap(); }
  36. __attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
  37. void suspend_wakeup_init_user(void) {
  38. suspend_wakeup_init_keymap();
  39. #ifdef KEYBOARD_ergodox_ez
  40. wait_ms(10);
  41. #endif
  42. }
  43. __attribute__((weak)) void startup_keymap(void) {}
  44. void startup_user(void) {
  45. #ifdef RGBLIGHT_ENABLE
  46. matrix_init_rgb();
  47. #endif // RGBLIGHT_ENABLE
  48. startup_keymap();
  49. }
  50. __attribute__((weak)) void shutdown_keymap(void) {}
  51. void shutdown_user(void) { shutdown_keymap(); }