keymap.c 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright 2021 Mss Studio
  2. * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll>
  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. #include <lib/lib8tion/lib8tion.h>
  19. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  20. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  21. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  22. // entirely and just use numbers.
  23. enum layer_names {
  24. _BASE,
  25. _FN,
  26. };
  27. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  28. /*
  29. ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
  30. │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Bakspc│
  31. ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
  32. │ Tab │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \ │
  33. ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
  34. │ Caps │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ Enter │
  35. ├──────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬───┬───┤
  36. │LShift │ z │ x │ c │ v │ b │ n │ m │ , │ . │ / │Rft│ ↑ │Del│
  37. ├────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴───┼───┼───┼───┼───┼───┤
  38. │LCrl│GUI │LAlt│ Space │RAt│Fn │ ← │ ↓ │ → │
  39. └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘
  40. ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
  41. │ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │
  42. ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
  43. │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | │
  44. ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
  45. │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ │
  46. ├──────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬───┬───┤
  47. │LShift │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │Rft│ │ │
  48. ├────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴───┼───┼───┼───┼───┼───┤
  49. │ │ │ │ │ │ │ │ │ │
  50. └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘
  51. */
  52. /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 */
  53. [_BASE] = LAYOUT_64_ansi(
  54. KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
  55. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
  56. KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
  57. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL,
  58. KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_LEFT, KC_DOWN, KC_RIGHT
  59. ),
  60. /*
  61. ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
  62. │ ` │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ Delete│
  63. ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
  64. │Reset│ │ │ │ │ │ │ │Ins│ │PSc│ │Hui│ Mod │
  65. ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
  66. │ │ │ │ │ │ │ │ │ │Tog│ │ │ │
  67. ├──────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬───┬───┤
  68. │ │ │ │Cal│ │ │ │Mut│VoD│VoU│ │ │Vai│ │
  69. ├────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴───┼───┼───┼───┼───┼───┤
  70. │ │ │ │ │ │ │Spd│Vad│Spi│
  71. └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘
  72. */
  73. /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 */
  74. [_FN] = LAYOUT_64_ansi(
  75. KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
  76. QK_BOOT, _______, _______, _______, _______, _______, _______, _______, KC_INS, _______, KC_PSCR, _______, RM_HUEU, RM_NEXT,
  77. _______, _______, _______, _______, _______, _______, _______, _______, _______, RM_TOGG, _______, _______, _______,
  78. _______, _______, _______, KC_CALC, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RM_VALU, _______,
  79. _______, _______, _______, _______, _______, _______, RM_SPDD, RM_VALD, RM_SPDU
  80. ),
  81. };
  82. bool rgb_matrix_indicators_user(void) {
  83. hsv_t hsv = rgb_matrix_config.hsv;
  84. uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1));
  85. hsv.h = time;
  86. rgb_t rgb = hsv_to_rgb(hsv);
  87. if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) {
  88. if (host_keyboard_led_state().caps_lock) {
  89. rgb_matrix_set_color(28, rgb.r, rgb.g, rgb.b);
  90. }
  91. } else {
  92. if (host_keyboard_led_state().caps_lock) {
  93. rgb_matrix_set_color(28, rgb.r, rgb.g, rgb.b);
  94. } else {
  95. rgb_matrix_set_color(28, 0, 0, 0);
  96. }
  97. }
  98. return false;
  99. }