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.

78 lines
2.3 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. // Keyboard Layers
  18. enum keyboard_layers{
  19. _BASE = 0,
  20. _CONTROL
  21. };
  22. // Tap Dance Declarations
  23. enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 };
  24. qk_tap_dance_action_t tap_dance_actions[] = {
  25. // Tap once for standard key, twice to toggle to control layer
  26. [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL),
  27. [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)};
  28. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  29. [_BASE] = LAYOUT( /* Base */
  30. KC_S, KC_V,
  31. KC_A, KC_B, KC_C, KC_D,
  32. KC_E, KC_F, KC_G, KC_H,
  33. KC_I, KC_J, KC_K, KC_L,
  34. KC_M, KC_N, KC_O, TD(TD_TO_LED)
  35. ),
  36. [_CONTROL] = LAYOUT( /* LED Control */
  37. KC_NO, KC_NO,
  38. _______, RGB_MOD, RGB_RMOD, RGB_TOG,
  39. RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI,
  40. RGB_SAD, RGB_SAI, _______, _______,
  41. _______, _______, RESET, TD(TD_TO_DEFAULT)
  42. ),
  43. };
  44. void encoder_update_user(uint8_t index, bool clockwise) {
  45. if (index == 0) { /* Left Encoder */
  46. if (clockwise) {
  47. tap_code(KC_R);
  48. } else {
  49. tap_code(KC_Q);
  50. }
  51. } else if (index == 1) { /* Right Encoder */
  52. if (clockwise) {
  53. tap_code(KC_U);
  54. } else {
  55. tap_code(KC_T);
  56. }
  57. }
  58. }
  59. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  60. switch (keycode) {
  61. // Example of "pressing" CONTROL+SHIFT+V instead of "A" on keyboard
  62. // More info: https://docs.qmk.fm/#/feature_macros
  63. // case KC_A:
  64. // if (record->event.pressed) {
  65. // SEND_STRING(SS_LCTL(SS_LSFT("v")));
  66. // } else {
  67. // }
  68. // break;
  69. }
  70. return true;
  71. };