keymap.c 1.6 KB

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