keymap.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright 2020-2021 adamkraus6
  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. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  18. [0] = LAYOUT(
  19. KC_7, KC_8, KC_9, TO(0),
  20. KC_4, KC_5, KC_6, TO(1),
  21. KC_1, KC_2, KC_3, TO(2),
  22. KC_0, KC_BSPC, KC_ENTER
  23. ),
  24. [1] = LAYOUT(
  25. KC_NO, KC_NO, KC_NO, KC_TRNS,
  26. KC_NO, KC_NO, KC_NO, KC_TRNS,
  27. KC_NO, KC_NO, KC_NO, KC_TRNS,
  28. KC_NO, KC_NO, KC_NO
  29. ),
  30. [2] = LAYOUT(
  31. KC_NO, KC_NO, KC_NO, KC_TRNS,
  32. KC_NO, KC_NO, KC_NO, KC_TRNS,
  33. KC_NO, KC_NO, KC_NO, KC_TRNS,
  34. KC_NO, KC_NO, KC_NO
  35. ),
  36. [3] = LAYOUT(
  37. KC_NO, KC_NO, KC_NO, KC_TRNS,
  38. KC_NO, KC_NO, KC_NO, KC_TRNS,
  39. KC_NO, KC_NO, KC_NO, KC_TRNS,
  40. KC_NO, KC_NO, KC_NO
  41. )
  42. };
  43. bool encoder_update_user(uint8_t index, bool clockwise) {
  44. if (index == 0) { /* First encoder */
  45. if (clockwise) {
  46. rgblight_increase_hue(); //Cycle through the RGB hue
  47. } else {
  48. rgblight_decrease_hue();
  49. }
  50. } else if (index == 1) { /* Second encoder */
  51. if (clockwise) {
  52. rgblight_increase_sat();
  53. } else {
  54. rgblight_decrease_sat();
  55. }
  56. } else if (index == 2) { /* Third encoder */
  57. if (clockwise) {
  58. rgblight_increase_val(); //Change brightness on the RGB LEDs
  59. } else {
  60. rgblight_decrease_val();
  61. }
  62. }
  63. return true;
  64. }