keymap.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /* Copyright 2021 Aaron VerDow
  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. // Layer declarations
  18. enum {
  19. DEF_LAYER,
  20. MOD_LAYER,
  21. };
  22. // Tap Dance declarations
  23. enum {
  24. TD_CAR,
  25. TD_PRINT,
  26. TD_CAM_UP,
  27. TD_CAM_DN
  28. };
  29. void camera_number(uint16_t tens, uint16_t ones) {
  30. /* Switch to a specific camera number
  31. *
  32. * I haven't been able to find official docs for this.
  33. *
  34. * To determine the number click the dropdown in UI and
  35. * count from the top. The list can change with updates.
  36. *
  37. * Shift must be held between both * presses or the combo
  38. * won't be recognized.
  39. */
  40. register_code16(KC_LSFT);
  41. tap_code(KC_8);
  42. tap_code(KC_8);
  43. unregister_code16(KC_LSFT);
  44. tap_code(tens);
  45. tap_code(ones);
  46. tap_code(KC_ENT);
  47. }
  48. void cam_up(qk_tap_dance_state_t *state, void *user_data) {
  49. switch (state->count) {
  50. case 1:
  51. tap_code(KC_C); // tap once for next cam
  52. break;
  53. case 2:
  54. camera_number(KC_2,KC_0); // tap twice for reverse chase cam
  55. break;
  56. }
  57. }
  58. void cam_down(qk_tap_dance_state_t *state, void *user_data) {
  59. switch (state->count) {
  60. case 1:
  61. tap_code16(LSFT(KC_C)); // tap once for prev cam
  62. break;
  63. case 2:
  64. camera_number(KC_1,KC_8); // tap twice for chase cam
  65. break;
  66. }
  67. }
  68. // Tap Dance definitions
  69. qk_tap_dance_action_t tap_dance_actions[] = {
  70. [TD_CAR] = ACTION_TAP_DANCE_DOUBLE(
  71. LSFT(KC_V), // tap once for prev car
  72. LCTL(KC_V) // tap twice for my car
  73. ),
  74. [TD_PRINT] = ACTION_TAP_DANCE_DOUBLE(
  75. LCTL(LALT(LSFT(KC_S))), // tap once for iRacing screenshot (must be enabled in options)
  76. LGUI(KC_PSCR) // tap twice for Windows print screen and save to file
  77. ),
  78. [TD_CAM_UP] = ACTION_TAP_DANCE_FN(cam_up),
  79. [TD_CAM_DN] = ACTION_TAP_DANCE_FN(cam_down)
  80. };
  81. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  82. [DEF_LAYER] = LAYOUT_ortho_6x4( /* Base */
  83. TD(TD_CAM_UP), // next cam, double tap for reverse chase cam
  84. KC_V, // next car
  85. LSFT(KC_P3), // next lap
  86. LCTL(KC_P3), // next inc
  87. TD(TD_CAM_DN), // prev cam, double tap for chase cam
  88. TD(TD_CAR), // prev car, double tap for my car
  89. LSFT(KC_P1), // prev lap
  90. LCTL(KC_P1), // prev inc
  91. LSFT(KC_P4), // rewind
  92. KC_P5, // play/pause
  93. LSFT(KC_P6), // fast forward
  94. KC_P8, // slow mo
  95. KC_P4, // prev frame
  96. KC_W, // up
  97. KC_P6, // next frame
  98. TD(TD_PRINT), // print screen
  99. KC_A, // left
  100. KC_S, // down
  101. KC_D, // right
  102. LALT(KC_K), // toggle click and drag ui elements (in car)
  103. KC_LCTL, // ctrl
  104. KC_LALT, // alt
  105. LCTL(KC_F12), // camera tool
  106. LT(MOD_LAYER, KC_SPACE) // press once for UI, hold for MOD layer
  107. ),
  108. [MOD_LAYER] = LAYOUT_ortho_6x4( /* Base */
  109. KC_B, // next sub cam
  110. KC_PGUP, // next driver cam
  111. LCTL(KC_P6), // next session
  112. KC_P7, // start
  113. LSFT(KC_B), // prev sub cam
  114. KC_PGDOWN, // prev driver cam
  115. LCTL(KC_P4), // prev session
  116. KC_P1, // end
  117. KC_RBRC, // FOV up
  118. KC_EQL, // step factor up
  119. _______,
  120. _______,
  121. KC_LBRC, // FOV down
  122. KC_MINS, // step factor down
  123. _______,
  124. _______,
  125. _______,
  126. _______,
  127. _______,
  128. _______,
  129. _______,
  130. LALT(KC_M), // cycle aim
  131. RALT(KC_ENTER), // fullscreen (unreliable)
  132. _______
  133. ),
  134. };