1
0

keymap.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* Copyright 2021 Conor Burns
  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. _HOME,
  19. _FN2,
  20. _FN3,
  21. _FN4
  22. };
  23. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  24. [_HOME] = LAYOUT(
  25. QK_GESC, 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_BSPC, KC_DEL,
  26. 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_BSLS, KC_HOME,
  27. 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_ENT, KC_PGUP,
  28. KC_LSFT, KC_LSFT, 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,
  29. KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
  30. ),
  31. [_FN2] = LAYOUT(
  32. _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______,
  33. _______, _______, _______, _______, _______, _______, _______, RALT(KC_U), _______, RALT(KC_O), _______, _______, _______, _______, _______,
  34. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  35. _______, _______, RALT(KC_A), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  36. _______, _______, _______, MO(2), _______, _______, _______, _______, _______, _______, _______
  37. ),
  38. [_FN3] = LAYOUT(
  39. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  40. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  41. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  42. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  43. _______, _______, _______, _______, _______, MO(3), _______, _______, _______, _______, _______
  44. ),
  45. [_FN4] = LAYOUT(
  46. QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  47. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  48. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  49. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  50. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  51. ),
  52. };
  53. // RGB LED Indicators
  54. const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
  55. {0, 3, HSV_PURPLE} // Light 3 LEDs, starting with LED 0
  56. );
  57. const rgblight_segment_t PROGMEM my_2_layer[] = RGBLIGHT_LAYER_SEGMENTS(
  58. {3, 1, HSV_PURPLE} // Light 1 LED, starting with LED 3
  59. );
  60. const rgblight_segment_t PROGMEM my_3_layer[] = RGBLIGHT_LAYER_SEGMENTS(
  61. {4, 1, HSV_PURPLE} // Light 1 LED, starting with LED 4
  62. );
  63. const rgblight_segment_t PROGMEM my_4_layer[] = RGBLIGHT_LAYER_SEGMENTS(
  64. {5, 1, HSV_PURPLE} // Light 1 LED, starting with LED 5
  65. );
  66. // Now define the array of layers. Later layers take precedence
  67. const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
  68. my_capslock_layer, // 0
  69. my_2_layer, // 1
  70. my_3_layer, // 2
  71. my_4_layer // 3
  72. );
  73. void keyboard_post_init_user(void) {
  74. // Enable the LED layers
  75. rgblight_layers = my_rgb_layers;
  76. }
  77. bool led_update_user(led_t led_state) {
  78. rgblight_set_layer_state(0, led_state.caps_lock);
  79. return true;
  80. }
  81. layer_state_t layer_state_set_user(layer_state_t state) {
  82. rgblight_set_layer_state(1, layer_state_cmp(state, _FN2));
  83. rgblight_set_layer_state(2, layer_state_cmp(state, _FN3));
  84. rgblight_set_layer_state(3, layer_state_cmp(state, _FN4));
  85. return state;
  86. }