template.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 VRSN:
  43. if (record->event.pressed) {
  44. SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
  45. }
  46. return false;
  47. break;
  48. }
  49. return process_record_keymap(keycode, record);
  50. }
  51. __attribute__ ((weak))
  52. uint32_t layer_state_set_keymap (uint32_t state) {
  53. return state;
  54. }
  55. uint32_t layer_state_set_user (uint32_t state) {
  56. return layer_state_set_keymap (state);
  57. }
  58. __attribute__ ((weak))
  59. void led_set_keymap(uint8_t usb_led) {}
  60. void led_set_user(uint8_t usb_led) {
  61. led_set_keymap(usb_led);
  62. }
  63. __attribute__ ((weak))
  64. void suspend_power_down_keymap(void) {}
  65. void suspend_power_down_user(void)
  66. {
  67. suspend_power_down_keymap();
  68. }
  69. __attribute__ ((weak))
  70. void suspend_wakeup_init_keymap(void) {}
  71. void suspend_wakeup_init_user(void)
  72. {
  73. suspend_wakeup_init_keymap();
  74. #ifdef KEYBOARD_ergodox_ez
  75. wait_ms(10);
  76. #endif
  77. }
  78. __attribute__ ((weak))
  79. void startup_keymap(void) {}
  80. void startup_user (void) {
  81. #ifdef RGBLIGHT_ENABLE
  82. matrix_init_rgb();
  83. #endif //RGBLIGHT_ENABLE
  84. startup_keymap();
  85. }
  86. __attribute__ ((weak))
  87. void shutdown_keymap(void) {}
  88. void shutdown_user (void) {
  89. shutdown_keymap();
  90. }