logo

qmk_firmware

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

keymap.c (1986B)


  1. /* Copyright 2020 yushakobo
  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. // Defines names for use in layer keycodes and the keymap
  18. enum layer_names {
  19. _BASE,
  20. _FUNC1
  21. };
  22. // Defines the keycodes used by our macros in process_record_user
  23. enum custom_keycodes {
  24. YUSHAURL = SAFE_RANGE
  25. };
  26. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  27. /* Base */
  28. [_BASE] = LAYOUT(
  29. KC_MUTE, MO(_FUNC1), UG_NEXT,
  30. S(KC_TAB), KC_UP, KC_TAB,
  31. KC_LEFT, KC_DOWN, KC_RGHT
  32. ),
  33. [_FUNC1] = LAYOUT(
  34. QK_BOOT, KC_TRNS, UG_TOGG,
  35. KC_HOME, KC_VOLU, KC_END,
  36. KC_MPRV, KC_VOLD, KC_MNXT
  37. )
  38. };
  39. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  40. switch (keycode) {
  41. case YUSHAURL:
  42. if (record->event.pressed) {
  43. SEND_STRING("https://yushakobo.jp/\n");
  44. }
  45. break;
  46. }
  47. return true;
  48. }
  49. bool encoder_update_user(uint8_t index, bool clockwise) {
  50. if (index == 0) { // Left encoder
  51. if (clockwise) {
  52. tap_code(KC_VOLU);
  53. } else {
  54. tap_code(KC_VOLD);
  55. }
  56. }
  57. else if (index == 1) { // Right encoder
  58. if (clockwise) {
  59. rgblight_decrease_hue_noeeprom();
  60. } else {
  61. rgblight_increase_hue_noeeprom();
  62. }
  63. }
  64. return true;
  65. }