keymap.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright 2021 Jonathan Rascher
  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. enum layer {
  18. LAYER_FIRST,
  19. LAYER_SECOND,
  20. };
  21. #define LY_SECND MO(LAYER_SECOND)
  22. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  23. // clang-format off
  24. [LAYER_FIRST] = LAYOUT(
  25. KC_MUTE, LY_SECND, BL_BRTG,
  26. KC_F4, KC_F5, KC_F6,
  27. KC_F1, KC_F2, KC_F3
  28. ),
  29. [LAYER_SECOND] = LAYOUT(
  30. EEP_RST, _______, RESET,
  31. KC_F10, KC_F11, KC_F12,
  32. KC_F7, KC_F8, KC_F9
  33. ),
  34. // clang-format on
  35. };
  36. bool encoder_update_user(uint8_t index, bool clockwise) {
  37. switch (index) {
  38. /* Top-left encoder (volume) */
  39. case 0:
  40. tap_code(clockwise ? KC_VOLU : KC_VOLD);
  41. return false;
  42. /* Top-right encoder (backlight brightness) */
  43. case 1:
  44. #if defined(BACKLIGHT_ENABLE)
  45. if (clockwise) {
  46. backlight_increase();
  47. } else {
  48. backlight_decrease();
  49. }
  50. #endif
  51. return false;
  52. }
  53. return true;
  54. }