logo

qmk_firmware

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

keymap.c (4817B)


  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_4x7_4(
  32. 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,
  33. 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,
  34. CTL_TAB, 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,
  35. 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 ,
  36. KC_LALT, LOWER , KC_LGUI, KC_SPC , KC_SPC , KC_RGUI, RAISE , KC_RALT
  37. ),
  38. [_LOWER] = LAYOUT_split_4x7_4(
  39. KC_GRV , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL , _______,
  40. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  41. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  42. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  43. _______, _______, _______, _______, _______, _______, _______, _______
  44. ),
  45. [_RAISE] = LAYOUT_split_4x7_4(
  46. KC_GRV , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL , _______,
  47. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  48. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  49. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  50. _______, _______, _______, _______, _______, _______, _______, _______
  51. ),
  52. [_ADJUST] = LAYOUT_split_4x7_4(
  53. _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , _______, _______, KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , _______,
  54. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_F11 , KC_F12 , _______,
  55. _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END , _______, _______,
  56. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  57. _______, _______, _______, _______, _______, _______, _______, _______
  58. )
  59. };
  60. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  61. if (record->event.pressed) {
  62. // set_timelog();
  63. }
  64. switch (keycode) {
  65. case LOWER:
  66. if (record->event.pressed) {
  67. layer_on(_LOWER);
  68. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  69. } else {
  70. layer_off(_LOWER);
  71. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  72. }
  73. return false;
  74. break;
  75. case RAISE:
  76. if (record->event.pressed) {
  77. layer_on(_RAISE);
  78. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  79. } else {
  80. layer_off(_RAISE);
  81. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  82. }
  83. return false;
  84. break;
  85. case ADJUST:
  86. if (record->event.pressed) {
  87. layer_on(_ADJUST);
  88. } else {
  89. layer_off(_ADJUST);
  90. }
  91. return false;
  92. break;
  93. }
  94. return true;
  95. }