process_auto_shift.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright 2017 Jeremy Cowgar
  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. #pragma once
  17. #include "quantum.h"
  18. #ifndef AUTO_SHIFT_TIMEOUT
  19. # define AUTO_SHIFT_TIMEOUT 175
  20. #endif
  21. #define IS_LT(kc) ((kc) >= QK_LAYER_TAP && (kc) <= QK_LAYER_TAP_MAX)
  22. #define IS_MT(kc) ((kc) >= QK_MOD_TAP && (kc) <= QK_MOD_TAP_MAX)
  23. #define IS_RETRO(kc) (IS_MT(kc) || IS_LT(kc))
  24. #define DO_GET_AUTOSHIFT_TIMEOUT(keycode, record, ...) record
  25. // clang-format off
  26. #define AUTO_SHIFT_ALPHA KC_A ... KC_Z
  27. #define AUTO_SHIFT_NUMERIC KC_1 ... KC_0
  28. #define AUTO_SHIFT_SPECIAL \
  29. KC_TAB: \
  30. case KC_MINUS ... KC_SLASH: \
  31. case KC_NONUS_BACKSLASH
  32. // clang-format on
  33. bool process_auto_shift(uint16_t keycode, keyrecord_t *record);
  34. void retroshift_poll_time(keyevent_t *event);
  35. void retroshift_swap_times(void);
  36. void autoshift_enable(void);
  37. void autoshift_disable(void);
  38. void autoshift_toggle(void);
  39. bool get_autoshift_state(void);
  40. uint16_t get_generic_autoshift_timeout(void);
  41. // clang-format off
  42. uint16_t (get_autoshift_timeout)(uint16_t keycode, keyrecord_t *record);
  43. void set_autoshift_timeout(uint16_t timeout);
  44. void autoshift_matrix_scan(void);
  45. bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record);
  46. // clang-format on