logo

qmk_firmware

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

keymap.c (4354B)


  1. /* Copyright 2023 a_marmot
  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. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  18. //generic default keymap with Razor defaults (+ mode toggle)
  19. /*
  20. * ┌───┬───┬───┬───┬───┐
  21. * │Esc│ 1 │ 2 │ 3 │ 4 │
  22. * ├───┼───┼───┼───┼───┤
  23. * │Tab│ q │ w │ e │ r │
  24. * ├───┼───┼───┼───┼───┤
  25. * │Cap│ a │ s │ d │ f │
  26. * ├───┼───┼───┼───┼───┤
  27. * │Shi│ z │ x │ c │ v │
  28. * ├───┼───┼───┼───┼───┤
  29. * │Alt│ ↑ │ ↓ │ → │ ← │
  30. * ├───────┴┬──┴───┴───┤
  31. * │Spacebar│change map│
  32. * └────────┴──────────┘
  33. */
  34. [0] = LAYOUT(
  35. KC_ESC, KC_1, KC_2, KC_3, KC_4,
  36. KC_TAB, KC_Q, KC_W, KC_E, KC_R,
  37. KC_CAPS, KC_A, KC_S, KC_D, KC_F,
  38. KC_LSFT, KC_Z, KC_X, KC_C, KC_V,
  39. KC_LALT, KC_UP, KC_DOWN, KC_RIGHT, KC_LEFT,
  40. KC_SPACE, TO(1)
  41. ),
  42. //Second example keymap with all modifier keys replaced with numbers or letters
  43. /*
  44. * ┌───┬───┬───┬───┬───┐
  45. * │ 0 │ 1 │ 2 │ 3 │ 4 │
  46. * ├───┼───┼───┼───┼───┤
  47. * │ i │ q │ w │ e │ r │
  48. * ├───┼───┼───┼───┼───┤
  49. * │ j │ a │ s │ d │ f │
  50. * ├───┼───┼───┼───┼───┤
  51. * │ k │ z │ x │ c │ v │
  52. * ├───┼───┼───┼───┼───┤
  53. * │ l │ ↑ │ ↓ │ → │ ← │
  54. * ├───────┴┬──┴───┴───┤
  55. * │Spacebar│change map│
  56. * └────────┴──────────┘
  57. */
  58. [1] = LAYOUT(
  59. KC_0, KC_1, KC_2, KC_3, KC_4,
  60. KC_I, KC_Q, KC_W, KC_E, KC_R,
  61. KC_J, KC_A, KC_S, KC_D, KC_F,
  62. KC_K, KC_Z, KC_X, KC_C, KC_V,
  63. KC_L, KC_UP, KC_DOWN, KC_RIGHT, KC_LEFT,
  64. KC_SPACE, TO(0)
  65. )
  66. //, add more keymaps here
  67. };
  68. static const uint8_t colormap[][20][3] = {
  69. // colors for the default key map in hex RGB values
  70. {
  71. {0x00, 0x00, 0xFF},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},
  72. {0xFF, 0x70, 0x00},{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},
  73. {0xFF, 0x70, 0x00},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},
  74. {0xFF, 0x70, 0x00},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF}
  75. },
  76. // colors for the 2nd key map
  77. {
  78. {0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},
  79. {0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},
  80. {0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},
  81. {0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF}
  82. }
  83. //, add more keymaps here
  84. };
  85. bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
  86. for (uint8_t i = led_min; i < led_max; i++) {
  87. rgb_matrix_set_color(i,
  88. colormap[get_highest_layer(layer_state|default_layer_state)][i][0],
  89. colormap[get_highest_layer(layer_state|default_layer_state)][i][1],
  90. colormap[get_highest_layer(layer_state|default_layer_state)][i][2]);
  91. }
  92. return false;
  93. }