keymap.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* Copyright 2019 imchipwood
  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. #define _BASE 0
  18. #define _SUB 1
  19. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  20. /*
  21. BASE LAYER
  22. /-----------------------------------------------------`
  23. | | 7 | 8 | 9 | Bkspc |
  24. | |---------|---------|---------|---------|
  25. | | 4 | 5 | 6 | Esc |
  26. | |---------|---------|---------|---------|
  27. | | 1 | 2 | 3 | Tab |
  28. |-------------|---------|---------|---------|---------|
  29. | Left mouse | MO(SUB) | 0 | . | Enter |
  30. \-----------------------------------------------------'
  31. */
  32. [_BASE] = LAYOUT( /* Base */
  33. KC_7, KC_8, KC_9, KC_BSPC,
  34. KC_4, KC_5, KC_6, KC_ESC,
  35. KC_1, KC_2, KC_3, KC_TAB,
  36. KC_BTN1, MO(_SUB), KC_0, KC_DOT, KC_ENTER
  37. ),
  38. /*
  39. SUB LAYER
  40. /-----------------------------------------------------`
  41. | | | | | Reset |
  42. | |---------|---------|---------|---------|
  43. | | | | | + |
  44. | |---------|---------|---------|---------|
  45. | | | | | - |
  46. |-------------|---------|---------|---------|---------|
  47. | LOCK | | | | = |
  48. \-----------------------------------------------------'
  49. */
  50. [_SUB] = LAYOUT(
  51. _______, _______, _______, RESET,
  52. _______, _______, _______, KC_KP_PLUS,
  53. _______, _______, _______, KC_KP_MINUS,
  54. KC_LOCK, _______, _______, _______, KC_EQL
  55. ),
  56. };
  57. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  58. // If console is enabled, it will print the matrix position and status of each key pressed
  59. /*
  60. #ifdef CONSOLE_ENABLE
  61. uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
  62. #endif
  63. */
  64. return true;
  65. }
  66. void keyboard_post_init_user(void) {
  67. // Customise these values to desired behaviour
  68. //debug_enable = true;
  69. //debug_matrix = true;
  70. //debug_keyboard = true;
  71. //debug_mouse = true;
  72. }
  73. void matrix_init_user(void) {
  74. }
  75. void matrix_scan_user(void) {
  76. }
  77. void led_set_user(uint8_t usb_led) {
  78. }
  79. void encoder_update_user(uint8_t index, bool clockwise) {
  80. if (index == 0) {
  81. if (layer_state && 0x1) {
  82. if (clockwise) {
  83. tap_code(KC_VOLU);
  84. } else {
  85. tap_code(KC_VOLD);
  86. }
  87. } else {
  88. if (clockwise) {
  89. tap_code(KC_MS_R);
  90. } else {
  91. tap_code(KC_MS_L);
  92. }
  93. }
  94. }
  95. }