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
2.0 KiB

  1. /* Copyright 2019 Josh Johnson
  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 QMK_KEYBOARD_H
  17. // Function key we are 'wrapping' usual key presses in
  18. #define KC_WRAP KC_F24
  19. // Tap Dance Declarations
  20. enum { TD_TO_LED = 0, TD_TO_DEFAULT = 1 };
  21. qk_tap_dance_action_t tap_dance_actions[] = {
  22. // Tap once for HID, twice to toggle layer 1
  23. [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 1),
  24. [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 0)};
  25. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  26. [0] = LAYOUT( /* Base */
  27. KC_S, KC_V,
  28. KC_A, KC_B, KC_C, KC_D,
  29. KC_E, KC_F, KC_G, KC_H,
  30. KC_I, KC_J, KC_K, KC_L,
  31. KC_M, KC_N, KC_O, TD(TD_TO_LED)
  32. ),
  33. [1] = LAYOUT( /* LED Control */
  34. KC_NO, KC_NO,
  35. _______, RGB_MOD, RGB_RMOD, RGB_TOG,
  36. RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI,
  37. RGB_SAD, RGB_SAI, _______, _______,
  38. _______, _______, RESET, TD(TD_TO_DEFAULT)
  39. ),
  40. };
  41. // Keyboard is setup to 'warp' the pressed key with F24,
  42. // allowing for easy differentiation from a real keyboard.
  43. void encoder_update_user(uint8_t index, bool clockwise) {
  44. if (index == 0) { /* Left Encoder */
  45. if (clockwise) {
  46. tap_code(KC_R);
  47. } else {
  48. tap_code(KC_Q);
  49. }
  50. } else if (index == 1) { /* Right Encoder */
  51. if (clockwise) {
  52. tap_code(KC_U);
  53. } else {
  54. tap_code(KC_T);
  55. }
  56. }
  57. }