logo

qmk_firmware

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

keymap.c (4323B)


  1. /* Copyright 2021 Jay Greco
  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. _MA,
  19. _FN
  20. };
  21. enum custom_keycodes {
  22. KC_CUST = SAFE_RANGE,
  23. };
  24. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  25. [_MA] = LAYOUT_iso(
  26. KC_ESC, 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_HOME,
  27. KC_F13, 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_DEL,
  28. KC_F14, 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_NUHS, KC_ENT, KC_PGUP,
  29. KC_F15, KC_LSFT, KC_NUBS, 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_PGDN,
  30. KC_F16, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FN), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
  31. ),
  32. [_FN] = LAYOUT_iso(
  33. QK_BOOT, 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_HOME, KC_INS,
  34. UG_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  35. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  36. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  37. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  38. ),
  39. };
  40. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  41. // Send keystrokes to host keyboard, if connected (see readme)
  42. process_record_remote_kb(keycode, record);
  43. switch(keycode) {
  44. case KC_CUST: //custom macro
  45. if (record->event.pressed) {
  46. }
  47. break;
  48. case RM_1: //remote macro 1
  49. if (record->event.pressed) {
  50. }
  51. break;
  52. case RM_2: //remote macro 2
  53. if (record->event.pressed) {
  54. }
  55. break;
  56. case RM_3: //remote macro 3
  57. if (record->event.pressed) {
  58. }
  59. break;
  60. case RM_4: //remote macro 4
  61. if (record->event.pressed) {
  62. }
  63. break;
  64. }
  65. return true;
  66. }
  67. // RGB config, for changing RGB settings on non-VIA firmwares
  68. void change_RGB(bool clockwise) {
  69. bool shift = get_mods() & MOD_MASK_SHIFT;
  70. bool alt = get_mods() & MOD_MASK_ALT;
  71. bool ctrl = get_mods() & MOD_MASK_CTRL;
  72. if (clockwise) {
  73. if (alt) {
  74. rgblight_increase_hue();
  75. } else if (ctrl) {
  76. rgblight_increase_val();
  77. } else if (shift) {
  78. rgblight_increase_sat();
  79. } else {
  80. rgblight_step();
  81. }
  82. } else {
  83. if (alt) {
  84. rgblight_decrease_hue();
  85. } else if (ctrl) {
  86. rgblight_decrease_val();
  87. } else if (shift) {
  88. rgblight_decrease_sat();
  89. } else {
  90. rgblight_step_reverse();
  91. }
  92. }
  93. }
  94. bool encoder_update_user(uint8_t index, bool clockwise) {
  95. if (layer_state_is(1)) {
  96. //change RGB settings
  97. change_RGB(clockwise);
  98. }
  99. else {
  100. if (clockwise) {
  101. tap_code(KC_VOLU);
  102. } else {
  103. tap_code(KC_VOLD);
  104. }
  105. }
  106. return true;
  107. }
  108. void matrix_init_user(void) {
  109. // Initialize remote keyboard, if connected (see readme)
  110. matrix_init_remote_kb();
  111. }
  112. void matrix_scan_user(void) {
  113. // Scan and parse keystrokes from remote keyboard, if connected (see readme)
  114. matrix_scan_remote_kb();
  115. }