keymap.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* Copyright 2019 Danny Nguyen <danny@keeb.io>
  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 _AUDACITY 0
  18. #define _LIGHTS 1
  19. enum custom_keycodes {
  20. AUDACITY = SAFE_RANGE,
  21. LIGHTS,
  22. };
  23. #define KC_ KC_TRNS
  24. #define KC_AUD AUDACITY
  25. #define KC_LITE LIGHTS
  26. #define KC_ZNRM LCTL(KC_2) // zoom normal
  27. #define KC_SAVE LCTL(KC_S) // save
  28. #define KC_SYNC LALT(KC_S) // sync-lock tracks
  29. #define KC_SLNC LCTL(KC_L) // silence selection
  30. #define KC_BL_S BL_STEP
  31. #define KC_RGBM RGB_MOD
  32. #define KC_RGBT RGB_TOG
  33. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  34. /*
  35. | Knob 1: Vol Dn/Up | | Knob 2: Page Dn/Up |
  36. | Press: Mute | Home | Press: Play/Pause |
  37. | Hold: Layer 2 | Up | RGB Mode |
  38. | Left | Down | Right |
  39. */
  40. [_AUDACITY] = LAYOUT(
  41. //,-------+-------+-------.
  42. KC_LITE,KC_SAVE,KC_ZNRM,
  43. //|-------+-------+-------|
  44. KC_SYNC,KC_SLNC,KC_BSPC,
  45. //|-------+-------+-------|
  46. KC_SPC , KC_F1 , KC_F2
  47. //`-------+-------+-------'
  48. ),
  49. /*
  50. | QK_BOOT | N/A | Media Stop |
  51. | Held: Layer 2 | Home | RGB Mode |
  52. | Media Previous | End | Media Next |
  53. */
  54. [_LIGHTS] = LAYOUT(
  55. //,-------+-------+-------.
  56. KC_ ,KC_BL_S,KC_STOP,
  57. //|-------+-------+-------|
  58. KC_RGBM,KC_HOME,KC_RGBT,
  59. //|-------+-------+-------|
  60. KC_MPRV,KC_END ,KC_MNXT
  61. //`-------+-------+-------'
  62. ),
  63. };
  64. bool encoder_update_user(uint8_t index, bool clockwise) {
  65. if (index == 0) {
  66. if (clockwise) {
  67. tap_code(KC_RGHT);
  68. } else {
  69. tap_code(KC_LEFT);
  70. }
  71. }
  72. else if (index == 1) {
  73. if (clockwise) {
  74. SEND_STRING(SS_LCTRL("1")); // audacity zoom in
  75. } else {
  76. SEND_STRING(SS_LCTRL("3")); // audacity zoom out
  77. }
  78. }
  79. return true;
  80. }