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.

62 lines
1.4 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. #include "process_records.h"
  2. #include "custom_keycodes.h"
  3. #ifdef RGB_ENABLE
  4. #include "custom_rgb.h"
  5. #endif
  6. #ifdef TRILAYER_ENABLED
  7. layer_state_t layer_state_set_user(layer_state_t state)
  8. {
  9. return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  10. }
  11. #endif
  12. bool process_record_user(uint16_t keycode, keyrecord_t *record)
  13. {
  14. static uint16_t reset_timer;
  15. #ifndef TAP_DANCE_ENABLE
  16. if (!process_custom_tap_dance(keycode, record))
  17. return false;
  18. #endif
  19. switch (keycode)
  20. {
  21. case RGBRST:
  22. #ifdef RGB_ENABLE
  23. if (record->event.pressed)
  24. rgb_reset();
  25. #endif
  26. return false;
  27. case RESET:
  28. {
  29. if (record->event.pressed)
  30. reset_timer = timer_read() + 500;
  31. else if (timer_expired(timer_read(), reset_timer))
  32. reset_keyboard();
  33. }
  34. return false;
  35. #if defined(RGB_MATRIX_TOG_LAYERS) && defined(RGB_ENABLE)
  36. case RGB_TOG:
  37. if (record->event.pressed) {
  38. rgb_matrix_increase_flags();
  39. }
  40. return false;
  41. #endif
  42. }
  43. return process_record_encoder(keycode, record) && process_record_keymap(keycode, record);
  44. }
  45. __attribute__ ((weak))
  46. bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
  47. {
  48. return true;
  49. }
  50. __attribute__ ((weak))
  51. bool process_record_encoder(uint16_t keycode, keyrecord_t *record)
  52. {
  53. return true;
  54. }