logo

qmk_firmware

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

keymap.c (5303B)


  1. /*
  2. Copyright 2020 Oliver Gaskell <me@gaskell.tech>
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. enum layers {
  16. _QWERTY = 0,
  17. _NUMPAD,
  18. _LOWER,
  19. _RAISE,
  20. _ADJUST
  21. };
  22. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  23. [_QWERTY] = LAYOUT_ortho_4x12(
  24. KC_MUTE, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
  25. KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
  26. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
  27. KC_BSPC, KC_LCTL, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT),
  28. [_NUMPAD] = LAYOUT_ortho_4x12(
  29. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS,
  30. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST,
  31. KC_TRNS, TG(_NUMPAD), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PENT,
  32. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PMNS, KC_PPLS),
  33. [_LOWER] = LAYOUT_ortho_4x12(
  34. KC_VOLD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_INS,
  35. KC_NUM, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LCBR, KC_RCBR, KC_UNDS, KC_PLUS, LSFT(KC_NUHS),
  36. KC_TRNS, LSFT(KC_NUBS), KC_GRAVE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT(KC_GRV), LSFT(KC_NUBS), KC_TRNS,
  37. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END),
  38. [_RAISE] = LAYOUT_ortho_4x12(
  39. KC_VOLU, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
  40. KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_LBRC, KC_RBRC, KC_MINS, KC_EQL, KC_NUHS,
  41. KC_TRNS, KC_PSCR, KC_SCRL, KC_PAUS, KC_APP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_GRV, KC_NUBS, KC_TRNS,
  42. KC_TAB, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT),
  43. [_ADJUST] = LAYOUT_ortho_4x12(
  44. KC_TRNS, UG_TOGG, UG_NEXT, UG_HUED, UG_HUEU, UG_SATD, UG_SATU, UG_VALD, UG_VALU, KC_TRNS, KC_TRNS, QK_BOOT,
  45. KC_TRNS, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_X, RGB_M_G, RGB_M_T, KC_TRNS, KC_TRNS,
  46. KC_TRNS, TG(_NUMPAD), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  47. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
  48. };
  49. const rgblight_segment_t PROGMEM _RAISE_lighting[] = RGBLIGHT_LAYER_SEGMENTS(
  50. {7, 1, 1, 202, 110}
  51. );
  52. const rgblight_segment_t PROGMEM _LOWER_lighting[] = RGBLIGHT_LAYER_SEGMENTS(
  53. {7, 1, 125, 188, 80}
  54. );
  55. const rgblight_segment_t PROGMEM _ADJUST_lighting[] = RGBLIGHT_LAYER_SEGMENTS(
  56. {7, 1, 32, 25, 127}
  57. );
  58. const rgblight_segment_t PROGMEM _NUMPAD_lighting[] = RGBLIGHT_LAYER_SEGMENTS(
  59. {7, 1, HSV_BLUE}
  60. );
  61. const rgblight_segment_t PROGMEM _DEFAULT_lighting[] = RGBLIGHT_LAYER_SEGMENTS(
  62. {7, 1, HSV_OFF}
  63. );
  64. const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
  65. _DEFAULT_lighting,
  66. _NUMPAD_lighting,
  67. _LOWER_lighting,
  68. _RAISE_lighting,
  69. _ADJUST_lighting
  70. );
  71. void keyboard_post_init_user(void) {
  72. rgblight_layers = my_rgb_layers;
  73. // Uncomment for debug mode
  74. //debug_enable=true;
  75. //debug_matrix=true;
  76. //debug_keyboard=true;
  77. //debug_mouse=true;
  78. }
  79. layer_state_t layer_state_set_user(layer_state_t state) {
  80. state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  81. rgblight_set_layer_state(_QWERTY, layer_state_cmp(state, _QWERTY));
  82. rgblight_set_layer_state(_NUMPAD, layer_state_cmp(state, _NUMPAD));
  83. rgblight_set_layer_state(_LOWER, layer_state_cmp(state, _LOWER));
  84. rgblight_set_layer_state(_RAISE, layer_state_cmp(state, _RAISE));
  85. rgblight_set_layer_state(_ADJUST, layer_state_cmp(state, _ADJUST));
  86. return state;
  87. }
  88. #ifdef ENCODER_MAP_ENABLE
  89. const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
  90. [_QWERTY] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
  91. [_NUMPAD] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
  92. [_LOWER] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
  93. [_RAISE] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
  94. [_ADJUST] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
  95. };
  96. #endif