keymap.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #include QMK_KEYBOARD_H
  2. extern keymap_config_t keymap_config;
  3. #ifdef RGBLIGHT_ENABLE
  4. //Following line allows macro to read current RGB settings
  5. extern rgblight_config_t rgblight_config;
  6. #endif
  7. extern uint8_t is_master;
  8. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  9. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  10. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  11. // entirely and just use numbers.
  12. enum layer_number {
  13. _QWERTY = 0,
  14. _LOWER,
  15. _RAISE,
  16. _ADJUST,
  17. };
  18. enum custom_keycodes {
  19. RGB_RST = SAFE_RANGE
  20. };
  21. // Layer Mode aliases
  22. #define KC_SNUBS S(KC_NUBS)
  23. #define KC_SNUHS S(KC_NUHS)
  24. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  25. [_QWERTY] = LAYOUT(
  26. //,-----------------------------------------------------| |-----------------------------------------------------.
  27. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
  28. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  29. KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
  30. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  31. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
  32. //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
  33. MO(_ADJUST),KC_LCTRL, KC_LALT, KC_LGUI,MO(_LOWER),KC_SPC,KC_SPC,MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT
  34. //`------------------------------------------------------------------------------------------------------------'
  35. ),
  36. [_LOWER] = LAYOUT(
  37. //,-----------------------------------------------------| |-----------------------------------------------------.
  38. KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR,KC_LPRN, KC_RPRN, KC_DEL,
  39. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  40. _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
  41. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  42. _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,KC_SNUHS,KC_SNUBS, _______, _______, _______,
  43. //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
  44. _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
  45. //`------------------------------------------------------------------------------------------------------------'
  46. ),
  47. [_RAISE] = LAYOUT(
  48. //,-----------------------------------------------------| |-----------------------------------------------------.
  49. KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
  50. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  51. _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
  52. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  53. _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______,
  54. //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
  55. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  56. //`------------------------------------------------------------------------------------------------------------'
  57. ),
  58. [_ADJUST] = LAYOUT( /* Base */
  59. //,-----------------------------------------------------| |-----------------------------------------------------.
  60. _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
  61. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  62. _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_MOD, XXXXXXX,LCA(KC_DEL),LALT(KC_PSCR),KC_PSCR,
  63. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  64. _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI,
  65. //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
  66. _______, _______, _______, _______, _______, RESET, RESET, _______, _______, _______, _______, _______
  67. //`------------------------------------------------------------------------------------------------------------'
  68. )
  69. };
  70. int RGB_current_mode;
  71. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  72. bool result = false;
  73. switch (keycode) {
  74. #ifdef RGBLIGHT_ENABLE
  75. case RGB_MOD:
  76. if (record->event.pressed) {
  77. rgblight_mode(RGB_current_mode);
  78. rgblight_step();
  79. RGB_current_mode = rgblight_config.mode;
  80. }
  81. break;
  82. case RGB_RST:
  83. if (record->event.pressed) {
  84. eeconfig_update_rgblight_default();
  85. rgblight_enable();
  86. RGB_current_mode = rgblight_config.mode;
  87. }
  88. break;
  89. #endif
  90. default:
  91. result = true;
  92. break;
  93. }
  94. return result;
  95. }
  96. void matrix_init_user(void) {
  97. }