You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.6 KiB

  1. /*
  2. Copyright 2018 Kenneth Aloysius
  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. _LAYER0,
  17. _LAYER1,
  18. _LAYER2,
  19. _LAYER3,
  20. _LAYER4
  21. };
  22. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  23. [_LAYER0] = LAYOUT(
  24. /* ┌─────────┬─────────┬─────────┐ */
  25. KC_UP, TO(_LAYER1),
  26. /* ├─────────┼─────────┼─────────┤ */
  27. KC_LEFT, KC_DOWN, KC_RIGHT
  28. /* └─────────┴─────────┴─────────┘ */
  29. ),
  30. [_LAYER1] = LAYOUT(
  31. /* ┌─────────┬─────────┬─────────┐ */
  32. KC_PGUP, TO(_LAYER2),
  33. /* ├─────────┼─────────┼─────────┤ */
  34. KC_HOME, KC_PGDN, KC_END
  35. /* └─────────┴─────────┴─────────┘ */
  36. ),
  37. [_LAYER2] = LAYOUT(
  38. /* ┌─────────┬─────────┬─────────┐ */
  39. KC_MSEL, TO(_LAYER3),
  40. /* ├─────────┼─────────┼─────────┤ */
  41. KC_MPRV, KC_MPLY, KC_MNXT
  42. /* └─────────┴─────────┴─────────┘ */
  43. ),
  44. [_LAYER3] = LAYOUT(
  45. /* ┌─────────┬─────────┬─────────┐ */
  46. KC_MS_U, TO(_LAYER4),
  47. /* ├─────────┼─────────┼─────────┤ */
  48. KC_MS_L, KC_MS_D, KC_MS_R
  49. /* └─────────┴─────────┴─────────┘ */
  50. ),
  51. [_LAYER4] = LAYOUT(
  52. /* ┌─────────┬─────────┬─────────┐ */
  53. XXXXXXX, TO(_LAYER0),
  54. /* ├─────────┼─────────┼─────────┤ */
  55. RGB_TOG, BL_TOGG, BL_STEP
  56. /* └─────────┴─────────┴─────────┘ */
  57. ),
  58. };
  59. void eeconfig_init_user(void) {
  60. // use the non noeeprom versions, to write these values to EEPROM too
  61. rgblight_enable();
  62. rgblight_mode(RGBLIGHT_MODE_BREATHING+1);
  63. backlight_enable();
  64. }
  65. void keyboard_post_init_user(void) {
  66. //layer_state_set_user is not called for inital state - set it here
  67. rgblight_sethsv_noeeprom_white();
  68. }
  69. layer_state_t layer_state_set_user(layer_state_t state) {
  70. switch (get_highest_layer(state)) {
  71. case _LAYER1:
  72. rgblight_sethsv_noeeprom_cyan();
  73. break;
  74. case _LAYER2:
  75. rgblight_sethsv_noeeprom_magenta();
  76. break;
  77. case _LAYER3:
  78. rgblight_sethsv_noeeprom_red();
  79. break;
  80. case _LAYER4:
  81. rgblight_sethsv_noeeprom_orange();
  82. break;
  83. case _LAYER0:
  84. default: // for any other layers, or the default layer
  85. rgblight_sethsv_noeeprom_white();
  86. break;
  87. }
  88. return state;
  89. }