You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
4.2 KiB

  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. enum layer_names {
  18. _QWERTY,
  19. _LOWER,
  20. _RAISE,
  21. _ADJUST
  22. };
  23. enum custom_keycodes {
  24. QWERTY = SAFE_RANGE,
  25. LOWER,
  26. RAISE,
  27. ADJUST
  28. };
  29. #define CTL_TAB CTL_T(KC_TAB)
  30. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  31. [_QWERTY] = LAYOUT_split_3x7_4(
  32. KC_ESC , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_LPRN, KC_RPRN, KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSPC,
  33. CTL_TAB, KC_A , KC_S , KC_D , KC_F , KC_G , KC_LBRC, KC_RBRC, KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT,
  34. KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , ADJUST , ADJUST , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_ENT ,
  35. KC_LALT, LOWER , KC_LGUI, KC_SPC , KC_SPC , KC_RGUI, RAISE , KC_RALT
  36. ),
  37. [_LOWER] = LAYOUT_split_3x7_4(
  38. KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , _______, _______, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_BSLS,
  39. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL , _______,
  40. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  41. _______, _______, _______, _______, _______, _______, _______, _______
  42. ),
  43. [_RAISE] = LAYOUT_split_3x7_4(
  44. KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , _______, _______, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_BSLS,
  45. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL , _______,
  46. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  47. _______, _______, _______, _______, _______, _______, _______, _______
  48. ),
  49. [_ADJUST] = LAYOUT_split_3x7_4(
  50. _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_LCBR, KC_RCBR, KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , _______,
  51. _______, KC_F11 , KC_F12 , _______, _______, _______, KC_LCBR, KC_RCBR, KC_HOME, KC_PGDN, KC_PGUP, KC_END , _______, _______,
  52. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  53. _______, _______, _______, _______, _______, _______, _______, _______
  54. )
  55. };
  56. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  57. if (record->event.pressed) {
  58. // set_timelog();
  59. }
  60. switch (keycode) {
  61. case LOWER:
  62. if (record->event.pressed) {
  63. layer_on(_LOWER);
  64. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  65. } else {
  66. layer_off(_LOWER);
  67. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  68. }
  69. return false;
  70. break;
  71. case RAISE:
  72. if (record->event.pressed) {
  73. layer_on(_RAISE);
  74. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  75. } else {
  76. layer_off(_RAISE);
  77. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  78. }
  79. return false;
  80. break;
  81. case ADJUST:
  82. if (record->event.pressed) {
  83. layer_on(_ADJUST);
  84. } else {
  85. layer_off(_ADJUST);
  86. }
  87. return false;
  88. break;
  89. }
  90. return true;
  91. }