swapper.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. /*
  3. Copyright 2018-2022 Eric Gebhart <e.a.gebhart@gmail.com>
  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 QMK_KEYBOARD_H
  16. #include USERSPACE_H
  17. typedef struct {
  18. bool active;
  19. uint16_t mod;
  20. uint16_t forward;
  21. uint16_t reverse;
  22. uint16_t forward_trigger;
  23. uint16_t reverse_trigger;
  24. } swapper_state_t;
  25. extern swapper_state_t swapper_states[];
  26. extern uint8_t NUM_SWAPPER_STATES;
  27. #undef SWAPPER_KEY
  28. #define SWAPPER_KEY(KC, REVERSE_IT_KC, FWD_KC, REV_KC, MOD) \
  29. {false, MOD, FWD_KC, REV_KC, KC, REVERSE_IT_KC},
  30. void process_swappers(uint16_t keycode, keyrecord_t *record);