logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (1879B)


  1. /*
  2. * Copyright (C) 2019-2020 Maxr1998 <max.rumpf1998@gmail.com>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include QMK_KEYBOARD_H
  18. enum layers {
  19. DEFAULT
  20. };
  21. enum combo_events {
  22. LED_ADJUST
  23. };
  24. const uint16_t PROGMEM led_adjust_combo[] = {KC_LEFT, KC_RGHT, COMBO_END};
  25. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  26. [DEFAULT] = LAYOUT(
  27. KC_END, KC_UP, KC_MUTE,
  28. KC_LEFT, KC_DOWN, KC_RGHT
  29. )
  30. };
  31. combo_t key_combos[] = {
  32. [LED_ADJUST] = COMBO_ACTION(led_adjust_combo)
  33. };
  34. bool led_adjust_active = false;
  35. void process_combo_event(uint16_t combo_index, bool pressed) {
  36. if (combo_index == LED_ADJUST) {
  37. led_adjust_active = pressed;
  38. }
  39. }
  40. bool encoder_update_user(uint8_t index, bool clockwise) {
  41. if (index == 0) {
  42. if (led_adjust_active) {
  43. if (clockwise) {
  44. rgblight_increase_val();
  45. } else {
  46. rgblight_decrease_val();
  47. }
  48. return false;
  49. }
  50. } else if (index == 1) {
  51. if (led_adjust_active) {
  52. if (clockwise) {
  53. rgblight_increase_hue();
  54. } else {
  55. rgblight_decrease_hue();
  56. }
  57. return false;
  58. }
  59. }
  60. return true;
  61. }