keymap.c 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* Copyright 2018 'Masayuki Sunahara'
  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. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  20. // entirely and just use numbers.
  21. #define _QWERTY 0
  22. #define _LOWER 3
  23. #define _RAISE 4
  24. #define _ADJUST 16
  25. // Defines the keycodes used by our macros in process_record_user
  26. enum custom_keycodes {
  27. QWERTY = SAFE_RANGE,
  28. LOWER,
  29. RAISE,
  30. ADJUST
  31. };
  32. #define ________ KC_TRNS
  33. #define XXXXXXXX KC_NO
  34. #define KC_LOWER LOWER
  35. #define KC_RAISE RAISE
  36. #define KC_ADJ ADJUST
  37. #define KC_CTLTB CTL_T(KC_TAB)
  38. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  39. [_QWERTY] = LAYOUT( \
  40. //,---------------------------------------------------------------------. ,---------------------------------------------------------------------.
  41. KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LPRN, KC_RPRN, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,\
  42. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  43. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,\
  44. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  45. KC_CTLTB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LCBR, KC_RCBR, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,\
  46. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  47. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ADJ, KC_ADJ, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,\
  48. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  49. KC_LALT, KC_LOWER, KC_LGUI, KC_SPC, KC_SPC, KC_RGUI, KC_RAISE, KC_RALT \
  50. //`---------------------------------------' `---------------------------------------'
  51. ),
  52. [_LOWER] = LAYOUT( \
  53. //,---------------------------------------------------------------------. ,---------------------------------------------------------------------.
  54. KC_GRV, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, KC_MINS, KC_EQL, ________,\
  55. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  56. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________,\
  57. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  58. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________,\
  59. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  60. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________,\
  61. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  62. ________, ________, ________, ________, ________, ________, ________, ________ \
  63. //`---------------------------------------' `---------------------------------------'
  64. ),
  65. [_RAISE] = LAYOUT( \
  66. //,---------------------------------------------------------------------. ,---------------------------------------------------------------------.
  67. KC_GRV, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, KC_MINS, KC_EQL, ________,\
  68. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  69. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________,\
  70. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  71. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________,\
  72. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  73. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________,\
  74. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  75. ________, ________, ________, ________, ________, ________, ________, ________ \
  76. //`---------------------------------------' `---------------------------------------'
  77. ),
  78. [_ADJUST] = LAYOUT( \
  79. //,---------------------------------------------------------------------. ,---------------------------------------------------------------------.
  80. ________, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, ________, ________, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, ________,\
  81. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  82. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, KC_F11, KC_F12, ________,\
  83. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  84. ________, ________, ________, ________, ________, ________, ________, ________, KC_HOME, KC_PGDN, KC_PGUP, KC_END, ________, ________,\
  85. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  86. ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________, ________,\
  87. //|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
  88. ________, ________, ________, ________, ________, ________, ________, ________ \
  89. //`---------------------------------------' `---------------------------------------'
  90. )
  91. };
  92. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  93. if (record->event.pressed) {
  94. // set_timelog();
  95. }
  96. switch (keycode) {
  97. case QWERTY:
  98. if (record->event.pressed) {
  99. set_single_persistent_default_layer(_QWERTY);
  100. }
  101. return false;
  102. break;
  103. case LOWER:
  104. if (record->event.pressed) {
  105. layer_on(_LOWER);
  106. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  107. } else {
  108. layer_off(_LOWER);
  109. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  110. }
  111. return false;
  112. break;
  113. case RAISE:
  114. if (record->event.pressed) {
  115. layer_on(_RAISE);
  116. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  117. } else {
  118. layer_off(_RAISE);
  119. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  120. }
  121. return false;
  122. break;
  123. case ADJUST:
  124. if (record->event.pressed) {
  125. layer_on(_ADJUST);
  126. } else {
  127. layer_off(_ADJUST);
  128. }
  129. return false;
  130. break;
  131. }
  132. return true;
  133. }
  134. void matrix_init_user(void) {
  135. }
  136. void matrix_scan_user(void) {
  137. }
  138. void led_set_user(uint8_t usb_led) {
  139. }