Guest User

KeyChron K0 Max KeyMap for Different Active RGB Layers - Example

a guest
Dec 4th, 2025
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. /* Copyright 2025 @ Keychron (https://www.keychron.com)
  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.  
  17. #include QMK_KEYBOARD_H
  18. #include "keychron_common.h"
  19.  
  20. enum layers {
  21. BASE,
  22. L1,
  23. L2,
  24. L3,
  25. FN,
  26. };
  27. // clang-format off
  28. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  29. [BASE] = LAYOUT_tenkey_27(
  30. TO(L1), KC_ESC, KC_DEL, KC_TAB, KC_BSPC,
  31. KC_PSCR, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
  32. MC_2, KC_P7, KC_P8, KC_P9, KC_PPLS,
  33. MO(L3), KC_P4, KC_P5, KC_P6,
  34. MO(L2), KC_P1, KC_P2, KC_P3,
  35. KC_SPC, KC_P0, KC_PDOT, KC_PENT ),
  36.  
  37. [L1] = LAYOUT_tenkey_27(
  38. TO(L2), KC_ESC, KC_DEL, KC_TAB, KC_BSPC,
  39. MC_1, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
  40. MC_2, KC_P7, KC_P8, KC_P9, KC_PPLS,
  41. MC_3, KC_P4, KC_P5, KC_P6,
  42. MC_4, KC_P1, KC_P2, KC_P3,
  43. MO(FN), KC_P0, KC_PDOT, KC_PENT ),
  44.  
  45. [L2] = LAYOUT_tenkey_27(
  46. TO(L3), KC_ESC, KC_DEL, KC_TAB, KC_BSPC,
  47. MC_1, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
  48. MC_2, KC_P7, KC_P8, KC_P9, KC_PPLS,
  49. MC_3, KC_P4, KC_P5, KC_P6,
  50. MC_4, KC_P1, KC_P2, KC_P3,
  51. MO(FN), KC_P0, KC_PDOT, KC_PENT ),
  52.  
  53. [L3] = LAYOUT_tenkey_27(
  54. TO(BASE), KC_ESC, KC_DEL, KC_TAB, KC_BSPC,
  55. MC_1, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
  56. MC_2, KC_P7, KC_P8, KC_P9, KC_PPLS,
  57. MC_3, KC_P4, KC_P5, KC_P6,
  58. MC_4, KC_P1, KC_P2, KC_P3,
  59. MO(FN), KC_P0, KC_PDOT, KC_PENT ),
  60.  
  61. [FN] = LAYOUT_tenkey_27(
  62. UG_TOGG, BT_HST1, BT_HST2, BT_HST3, P2P4G,
  63. _______, UG_NEXT, UG_VALU, UG_HUEU, _______,
  64. _______, UG_PREV, UG_VALD, UG_HUED, _______,
  65. _______, UG_SATU, UG_SPDU, KC_MPRV,
  66. _______, UG_SATD, UG_SPDD, KC_MPLY,
  67. _______, UG_TOGG, KC_MNXT, _______),
  68. };
  69.  
  70. // clang-format on
  71. #if defined(ENCODER_MAP_ENABLE)
  72. const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
  73. [BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
  74. [L1] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
  75. [L2] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
  76. [L3] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
  77. [FN] = {ENCODER_CCW_CW(UG_VALD, UG_VALU)},
  78. };
  79. #endif // ENCODER_MAP_ENABLE
  80.  
  81. bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
  82. for (uint8_t i = led_min; i < led_max; i++) {
  83. switch(get_highest_layer(layer_state|default_layer_state)) {
  84. case FN:
  85. rgb_matrix_set_color(i, RGB_WHITE);
  86. break;
  87. case L3:
  88. rgb_matrix_set_color(i, RGB_BLUE);
  89. break;
  90. case L2:
  91. rgb_matrix_set_color(i, RGB_RED);
  92. break;
  93. case L1:
  94. rgb_matrix_set_color(i, RGB_YELLOW);
  95. break;
  96. default:
  97. rgb_matrix_set_color(i, RGB_OFF);
  98. break;
  99. }
  100. }
  101. return false;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment