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.

69 lines
2.0 KiB

  1. /*
  2. Based on userspace written by @drashna 2017
  3. Copyright 2018 Hsian Chang <ishtob@gmail.com> @ishtob
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License, or
  7. (at your option) any later version.
  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. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #include "ishtob.h"
  16. #include "action.h"
  17. #include "action_layer.h"
  18. // #include "dynamic_macro.h"
  19. #ifdef AUDIO_ENABLE
  20. #include "audio.h"
  21. #endif
  22. // Add reconfigurable functions here, for keymap customization
  23. // This allows for a global, userspace functions, and continued
  24. // customization of the keymap. Use _keymap instead of _user
  25. // functions in the keymaps
  26. __attribute__ ((weak))
  27. void matrix_init_keymap(void) {}
  28. __attribute__ ((weak))
  29. void matrix_scan_keymap(void) {}
  30. __attribute__ ((weak))
  31. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  32. return true;
  33. }
  34. __attribute__ ((weak))
  35. bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
  36. return true;
  37. }
  38. // Call user matrix init, then call the keymap's init function
  39. void matrix_init_user(void) {
  40. matrix_init_keymap();
  41. }
  42. // No global matrix scan code, so just run keymap's matix
  43. // scan function
  44. void matrix_scan_user(void) {
  45. matrix_scan_keymap();
  46. }
  47. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  48. switch (keycode) {
  49. case DFU:
  50. if (record->event.pressed) {
  51. clear_keyboard();
  52. reset_keyboard();
  53. }
  54. return false;
  55. break;
  56. }
  57. return process_record_keymap(keycode, record) && process_record_secrets(keycode, record);
  58. }