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.

85 lines
2.5 KiB

  1. /* Copyright 2021 SethBarberee <seth.barberee@gmail.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 "sethBarberee.h"
  17. #include "version.h"
  18. __attribute__ ((weak)) void keyboard_pre_init_keymap(void) {}
  19. void keyboard_pre_init_user(void){
  20. #if defined(BOOTLOADER_CATERINA)
  21. // Make sure the red LEDs don't light
  22. setPinOutput(D5);
  23. writePinHigh(D5);
  24. setPinOutput(B0);
  25. writePinHigh(B0);
  26. #endif
  27. keyboard_pre_init_keymap();
  28. }
  29. __attribute__ ((weak)) layer_state_t layer_state_set_keymap (layer_state_t state) { return state; }
  30. layer_state_t layer_state_set_user(layer_state_t state){
  31. if (!is_keyboard_master()) {
  32. return state;
  33. }
  34. state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
  35. #if defined(RGBLIGHT_ENABLE)
  36. state = layer_state_set_rgb_light(state);
  37. #endif
  38. return layer_state_set_keymap(state);
  39. }
  40. __attribute__ ((weak)) void keyboard_post_init_keymap(void) {}
  41. void keyboard_post_init_user(void)
  42. {
  43. #if defined(RGBLIGHT_ENABLE)
  44. keyboard_post_init_rgb_light();
  45. #endif
  46. keyboard_post_init_keymap();
  47. }
  48. __attribute__((weak)) void suspend_power_down_keymap(void) {}
  49. void suspend_power_down_user(void) {
  50. #ifdef OLED_ENABLE
  51. oled_off();
  52. #endif
  53. suspend_power_down_keymap();
  54. }
  55. __attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
  56. void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); }
  57. __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true;}
  58. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  59. if (process_record_keymap(keycode, record))
  60. {
  61. switch (keycode) {
  62. case KC_VRSN: // Prints firmware version
  63. if (record->event.pressed) {
  64. SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
  65. }
  66. break;
  67. }
  68. }
  69. return true;
  70. }