keymap.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #include QMK_KEYBOARD_H
  2. extern keymap_config_t keymap_config;
  3. #define _QWERTY 0
  4. #define _LOWER 1
  5. #define _RAISE 2
  6. #define _ADJUST 16
  7. enum custom_keycodes {
  8. QWERTY = SAFE_RANGE,
  9. LOWER,
  10. RAISE,
  11. ADJUST,
  12. };
  13. #define EISU LALT(KC_GRV)
  14. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  15. /* Qwerty
  16. * ,----------------------------------------------------------------------------------------------------------------------.
  17. * | ESC | 1 | 2 | 3 | 4 | 5 | [ | | ] | 6 | 7 | 8 | 9 | 0 |Pscree|
  18. * |------+------+------+------+------+------+------+--------------------+------+------+------+------+------+------+------|
  19. * | ` | Q | W | E | R | T | - | | = | Y | U | I | O | P | \ |
  20. * |------+------+------+------+------+------+------+--------------------+------+------+------+------+------+------+------|
  21. * | Tab | A | S | D | F | G | Del | | Bksp | H | J | K | L | ; | " |
  22. * |------+------+------+------+------+------+---------------------------+------+------+------+------+------+------+------|
  23. * | Shift| Z | X | C | V | B | Space| | Enter| N | M | , | . | / | Shift|
  24. * |-------------+------+------+------+------+------+------+------+------+------+------+------+------+------+-------------|
  25. * | Ctrl | GUI | ALt | EISU |||||||| Lower| Space| Del |||||||| Bksp | Enter| Raise|||||||| Left | Down | Up | Right|
  26. * ,----------------------------------------------------------------------------------------------------------------------.
  27. */
  28. [_QWERTY] = LAYOUT( \
  29. KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC, KC_RBRC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PSCR, \
  30. KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS, KC_EQL , KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \
  31. KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_DEL , KC_BSPC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
  32. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_SPC , KC_ENT , KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
  33. KC_LCTL, KC_LGUI, KC_LALT, EISU, LOWER, KC_SPC ,KC_DEL, KC_BSPC,KC_ENT , RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
  34. ),
  35. /* Lower
  36. * ,----------------------------------------------------------------------------------------------------------------------.
  37. * | F11 | F1 | F2 | F3 | F4 | F5 | { | | } | F6 | F7 | F8 | F9 | F10 | F12 |
  38. * |------+------+------+------+------+------+------+--------------------+------+------+------+------+------+------+------|
  39. * | ~ | ! | @ | # | $ | % | _ | | + | ^ | & | * | ( | ) | | |
  40. * |------+------+------+------+------+------+------+--------------------+------+------+------+------+------+------+------|
  41. * | Tab | 1 | 2 | 3 | 4 | 5 | Del | | Bksp | H | J | K | L | : | " |
  42. * |------+------+------+------+------+------+---------------------------+------+------+------+------+------+------+------|
  43. * | Shift| 6 | 7 | 8 | 9 | 0 | Space| | Enter| N | M | < | > | ? | Shift|
  44. * |-------------+------+------+------+------+------+------+------+------+------+------+------+------+------+-------------|
  45. * | Ctrl | GUI | ALt | EISU |||||||| Lower| Space| Del |||||||| Bksp | Enter| Raise|||||||| Home |PageDn|PageUp| End |
  46. * ,----------------------------------------------------------------------------------------------------------------------.
  47. */
  48. [_LOWER] = LAYOUT(
  49. KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LCBR, KC_RCBR, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12, \
  50. KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_UNDS, KC_PLUS, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE, \
  51. KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_DEL , KC_BSPC, KC_H, KC_J, KC_K, KC_L, KC_COLN, KC_DQT , \
  52. KC_LSFT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SPC , KC_ENT , KC_N, KC_M, KC_LT, KC_GT, KC_QUES, KC_RSFT, \
  53. KC_LCTL, KC_LGUI, KC_LALT, EISU, LOWER, KC_SPC ,KC_DEL, KC_BSPC,KC_ENT , RAISE, KC_HOME, KC_PGDN, KC_PGUP, KC_END \
  54. ),
  55. /* Raise
  56. * ,----------------------------------------------------------------------------------------------------------------------.
  57. * | F11 | F1 | F2 | F3 | F4 | F5 | { | | } | F6 | F7 | F8 | F9 | F10 | F12 |
  58. * |------+------+------+------+------+------+------+--------------------+------+------+------+------+------+------+------|
  59. * | ~ | ! | @ | # | $ | % | _ | | + | ^ | & | * | ( | ) | | |
  60. * |------+------+------+------+------+------+------+--------------------+------+------+------+------+------+------+------|
  61. * | Tab | 1 | 2 | 3 | 4 | 5 | Del | | Bksp | H | J | K | L | : | " |
  62. * |------+------+------+------+------+------+---------------------------+------+------+------+------+------+------+------|
  63. * | Shift| 6 | 7 | 8 | 9 | 0 | Space| | Enter| N | M | < | > | ? | Shift|
  64. * |-------------+------+------+------+------+------+------+------+------+------+------+------+------+------+-------------|
  65. * | Ctrl | GUI | ALt | EISU |||||||| Lower| Space| Del |||||||| Bksp | Enter| Raise|||||||| Home |PageDn|PageUp| End |
  66. * ,----------------------------------------------------------------------------------------------------------------------.
  67. */
  68. [_RAISE] = LAYOUT(
  69. KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LCBR, KC_RCBR, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12, \
  70. KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_UNDS, KC_PLUS, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE, \
  71. KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_DEL , KC_BSPC, KC_H, KC_J, KC_K, KC_L, KC_COLN, KC_DQT , \
  72. KC_LSFT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SPC , KC_ENT , KC_N, KC_M, KC_LT, KC_GT, KC_QUES, KC_RSFT, \
  73. KC_LCTL, KC_LGUI, KC_LALT, EISU, LOWER, KC_SPC ,KC_DEL, KC_BSPC,KC_ENT , RAISE, KC_HOME, KC_PGDN, KC_PGUP, KC_END \
  74. ),
  75. /* Adjust
  76. * ,----------------------------------------------------------------------------------------------------------------------.
  77. * | | | | | | | | | | | | | | | |
  78. * |------+------+------+------+------+------+---------------------------+------+------+------+------+------+------+------|
  79. * | | Reset|RGB ON| MODE| HUE-| HUE+| | | | SAT-| SAT+| VAL-| VAL+| | |
  80. * |------+------+------+------+------+------+---------------------------+------+------+------+------+------+------+------|
  81. * | | | BL ON| BRTG| INC| DEC| | | | | | | | | |
  82. * |------+------+------+------+------+------+---------------------------+------+------+------+------+------+------+------|
  83. * | | | | | | | | | | | | | | | |
  84. * |-------------+------+------+------+------+------+------+------+------+------+------+------+------+------+-------------|
  85. * | | | | |||||||| | | |||||||| | | |||||||| | | | |
  86. * ,----------------------------------------------------------------------------------------------------------------------.
  87. */
  88. [_ADJUST] = LAYOUT(
  89. _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______, _______, _______, _______, \
  90. _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI,_______, _______, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, _______, \
  91. _______, _______, BL_TOGG, BL_BRTG, BL_INC , BL_DEC ,_______, _______, _______, _______, _______, _______, _______, _______, \
  92. _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______, _______, _______, _______, \
  93. _______, _______, _______, _______, _______,_______,_______, _______,_______, _______, _______, _______, _______, _______ \
  94. )
  95. };
  96. #ifdef AUDIO_ENABLE
  97. float tone_qwerty[][2] = SONG(QWERTY_SOUND);
  98. #endif
  99. void persistent_default_layer_set(uint16_t default_layer) {
  100. eeconfig_update_default_layer(default_layer);
  101. default_layer_set(default_layer);
  102. }
  103. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  104. switch (keycode) {
  105. case QWERTY:
  106. if (record->event.pressed) {
  107. print("mode just switched to qwerty and this is a huge string\n");
  108. set_single_persistent_default_layer(_QWERTY);
  109. }
  110. return false;
  111. break;
  112. case LOWER:
  113. if (record->event.pressed) {
  114. layer_on(_LOWER);
  115. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  116. } else {
  117. layer_off(_LOWER);
  118. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  119. }
  120. return false;
  121. break;
  122. case RAISE:
  123. if (record->event.pressed) {
  124. layer_on(_RAISE);
  125. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  126. } else {
  127. layer_off(_RAISE);
  128. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  129. }
  130. return false;
  131. break;
  132. case ADJUST:
  133. if (record->event.pressed) {
  134. layer_on(_ADJUST);
  135. } else {
  136. layer_off(_ADJUST);
  137. }
  138. return false;
  139. break;
  140. }
  141. return true;
  142. }