keymap.c 8.3 KB

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