logo

qmk_firmware

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

keymap.c (2515B)


  1. /* Copyright 2020 William Ehman
  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. // clang-format off
  18. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  19. [0] = LAYOUT_ortho_4x4(
  20. KC_F1, KC_F2, KC_F3, KC_F4,
  21. KC_F5, KC_F6, KC_F7, KC_F8,
  22. KC_F9, KC_F10, KC_F11, KC_F12,
  23. KC_F13, KC_F14, KC_F15, TO(1)
  24. ),
  25. [1] = LAYOUT_ortho_4x4(
  26. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  27. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  28. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  29. KC_TRNS, KC_TRNS, KC_TRNS, TO(2)
  30. ),
  31. [2] = LAYOUT_ortho_4x4(
  32. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  33. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  34. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  35. KC_TRNS, KC_TRNS, KC_TRNS, TO(0)
  36. ),
  37. };
  38. // clang-format on
  39. layer_state_t layer_state_set_user(layer_state_t state) {
  40. switch (get_highest_layer(state)) {
  41. case 0:
  42. rgblight_sethsv_at(HSV_WHITE, 0);
  43. break;
  44. case 1:
  45. rgblight_sethsv_at(HSV_GREEN, 0);
  46. break;
  47. case 2:
  48. rgblight_sethsv_at(HSV_BLUE, 0);
  49. break;
  50. }
  51. return state;
  52. }
  53. bool encoder_update_user(uint8_t index, bool clockwise) {
  54. /* With an if statement we can check which encoder was turned. */
  55. if (index == 0) { /* First encoder */
  56. /* And with another if statement we can check the direction. */
  57. if (clockwise) {
  58. /* This is where the actual magic happens: this bit of code taps on the
  59. Page Down key. You can do anything QMK allows you to do here.
  60. You'll want to replace these lines with the things you want your
  61. encoders to do. */
  62. tap_code(KC_AUDIO_VOL_UP);
  63. } else {
  64. /* And likewise for the other direction, this time Vol Down is pressed. */
  65. tap_code(KC_AUDIO_VOL_DOWN);
  66. }
  67. }
  68. return true;
  69. }