logo

qmk_firmware

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

keymap.c (4922B)


  1. /* Copyright 2023 GSKY <gskyGit@gsky.com.tw>
  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. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  18. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  19. enum my_keycodes {
  20. RGB_R = QK_USER,
  21. RGB_G,
  22. RGB_B,
  23. RGB_W,
  24. SW_cy,
  25. };
  26. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  27. switch (keycode) {
  28. case RGB_R:
  29. if (record->event.pressed) {
  30. rgb_matrix_sethsv(0, 255, 255);
  31. rgb_matrix_mode(1);
  32. }
  33. return false; /* Skip all further processing of this key */
  34. case RGB_G:
  35. if (record->event.pressed) {
  36. rgb_matrix_sethsv(85, 255, 255);
  37. rgb_matrix_mode(1);
  38. }
  39. return false; /* Skip all further processing of this key */
  40. case RGB_B:
  41. if (record->event.pressed) {
  42. rgb_matrix_sethsv(170, 255, 255);
  43. rgb_matrix_mode(1);
  44. }
  45. return false; /* Skip all further processing of this key */
  46. case RGB_W:
  47. if (record->event.pressed) {
  48. rgb_matrix_sethsv(0, 0, 255);
  49. rgb_matrix_mode(1);
  50. }
  51. return false; /* Skip all further processing of this key */
  52. case SW_cy:
  53. rgb_matrix_sethsv(0, 255, 255);
  54. rgb_matrix_mode(13);
  55. return false; /* Skip all further processing of this key */
  56. default:
  57. return true; /* Process all other keycodes normally */
  58. }
  59. };
  60. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  61. /* Keymap _BL: Base Layer (Default Layer)
  62. */
  63. [0] = LAYOUT(
  64. QK_GESC, 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, KC_DEL,
  65. 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, KC_PGUP,
  66. 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, KC_PGDN,
  67. 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_END,
  68. KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
  69. [1] = LAYOUT(
  70. 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, KC_TRNS,
  71. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RM_TOGG, RM_NEXT, RM_PREV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  72. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  73. KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RSFT, RM_VALU, KC_TRNS,
  74. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_TRNS, RM_SPDD, RM_VALD, RM_SPDU),
  75. [2] = LAYOUT(
  76. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  77. QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  78. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  79. KC_TRNS, RGB_R, RGB_G, RGB_B, RGB_W, SW_cy, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  80. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
  81. };