logo

qmk_firmware

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

keymap.c (3129B)


  1. /*
  2. Copyright 2022 imchipwood && deveth0
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. // clang-format off
  16. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  17. /*
  18. BASE LAYER - Num Pad
  19. /-----------------------------------------------------`
  20. | | 7 | 8 | 9 | - |
  21. | |---------|---------|---------|---------|
  22. | | 4 | 5 | 6 | + |
  23. | |---------|---------|---------|---------|
  24. | | 1 | 2 | 3 | * |
  25. |-------------|---------|---------|---------|---------|
  26. | Mute | TT(1) | 0 | | Enter |
  27. \-----------------------------------------------------'
  28. */
  29. [0] = LAYOUT(
  30. KC_P7, KC_P8, KC_P9, KC_PMNS,
  31. KC_P4, KC_P5, KC_P6, KC_PPLS,
  32. KC_P1, KC_P2, KC_P3, KC_PAST,
  33. KC_MUTE, TT(1), KC_P0, _______, KC_ENTER
  34. ),
  35. /*
  36. SUB LAYER - RGB controls, Modes on encoder
  37. /-----------------------------------------------------`
  38. | | On/Off | Bright- | Bright+ | Reset |
  39. | |---------|---------|---------|---------|
  40. | | | Hue- | Hue+ | |
  41. | |---------|---------|---------|---------|
  42. | | | Sat- | Sat+ | |
  43. |-------------|---------|---------|---------|---------|
  44. | | TT(1) | Effect- | Effect+ | |
  45. \-----------------------------------------------------'
  46. */
  47. [1] = LAYOUT(
  48. RM_TOGG, RM_VALD, RM_VALU, QK_BOOT,
  49. KC_NO, RM_HUED, RM_HUEU, KC_NO,
  50. KC_NO, RM_SATD, RM_SATU, KC_NO,
  51. KC_NO, _______, RM_SPDD, RM_SPDU, KC_NO
  52. ),
  53. };
  54. // clang-format on
  55. bool encoder_update_user(uint8_t index, bool clockwise) {
  56. switch (get_highest_layer(layer_state)) {
  57. case 0:
  58. // main layer, volume
  59. if (clockwise) {
  60. tap_code(KC_VOLU);
  61. } else {
  62. tap_code(KC_VOLD);
  63. }
  64. break;
  65. default:
  66. // rgb control layer, effects
  67. if (clockwise) {
  68. rgblight_step();
  69. } else {
  70. rgblight_step_reverse();
  71. }
  72. break;
  73. }
  74. return false;
  75. }