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.

75 lines
2.6 KiB

  1. /* Copyright 2020 William Ehman
  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. // clang-format off
  18. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  19. [0] = LAYOUT_ortho_4x4(
  20. KC_F1, KC_F2, KC_F3, KC_F4,
  21. KC_F5, KC_F6, KC_F7, KC_F8,
  22. KC_F9, KC_F10, KC_F11, KC_F12,
  23. KC_F13, KC_F14, KC_F15, TO(1)
  24. ),
  25. [1] = LAYOUT_ortho_4x4(
  26. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  27. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  28. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  29. KC_TRNS, KC_TRNS, KC_TRNS, TO(2)
  30. ),
  31. [2] = LAYOUT_ortho_4x4(
  32. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  33. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  34. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  35. KC_TRNS, KC_TRNS, KC_TRNS, TO(0)
  36. ),
  37. };
  38. // clang-format on
  39. layer_state_t layer_state_set_user(layer_state_t state) {
  40. switch (get_highest_layer(state)) {
  41. case 0:
  42. sethsv(HSV_WHITE, (LED_TYPE *)&led[0]);
  43. rgblight_set();
  44. break;
  45. case 1:
  46. sethsv(HSV_GREEN, (LED_TYPE *)&led[0]);
  47. rgblight_set();
  48. break;
  49. case 2:
  50. sethsv(HSV_BLUE, (LED_TYPE *)&led[0]);
  51. rgblight_set();
  52. break;
  53. }
  54. return state;
  55. }
  56. bool encoder_update_user(uint8_t index, bool clockwise) {
  57. /* With an if statement we can check which encoder was turned. */
  58. if (index == 0) { /* First encoder */
  59. /* And with another if statement we can check the direction. */
  60. if (clockwise) {
  61. /* This is where the actual magic happens: this bit of code taps on the
  62. Page Down key. You can do anything QMK allows you to do here.
  63. You'll want to replace these lines with the things you want your
  64. encoders to do. */
  65. tap_code(KC_AUDIO_VOL_UP);
  66. } else {
  67. /* And likewise for the other direction, this time Vol Down is pressed. */
  68. tap_code(KC_AUDIO_VOL_DOWN);
  69. }
  70. }
  71. return true;
  72. }