keymap.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #include "tap_tog.h"
  2. #ifdef AUDIO_ENABLE
  3. #include "audio.h"
  4. #include "sounds.h"
  5. #endif
  6. #ifdef RGBLIGHT_ENABLE
  7. #include "rgb.h"
  8. #endif
  9. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  10. // Run `./qmk show levinson` from parent dir to see this layer.
  11. [_QWERTY] = LAYOUT_ortho_4x12_wrapper(
  12. KC_ESC , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________ , APPS ,
  13. KC_TAB , _________________QWERTY_L2_________________, _________________QWERTY_R2_________________ , MO(_NAVI) ,
  14. OSMSFT , _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ , KC_QUOTE ,
  15. KC_LCTL , MODSFT , KC_LALT , KC_LGUI , KC_BSPACE , KC_SPC , KC_ENTER , KC_TAB , KC_UP , KC_DOWN , KC_LEFT , KC_RGHT
  16. ), // Note: visualizer expects this closing parens to be right at the start of the line.
  17. // Run `./qmk show levinson` from parent dir to see this layer.
  18. [_SYMB] = LAYOUT_ortho_4x12_wrapper(
  19. _______ , _________________SYMB_L1___________________, _________________SYMB_R1___________________ , KC_ESC ,
  20. _______ , _________________SYMB_L2___________________, _________________SYMB_R2___________________ , KC_DQT ,
  21. _______ , _________________SYMB_L3___________________, _________________SYMB_R3___________________ , KC_QUOTE ,
  22. _______ , ___________________BLANK___________________, _______ , _______ , KC_ESC , KC_COLN , KC_PERC , LOCK
  23. ), // Note: visualizer expects this closing parens to be right at the start of the line.
  24. // Run `./qmk show levinson` from parent dir to see this layer.
  25. [_NUMP] = LAYOUT_ortho_4x12_wrapper(
  26. _______ , _________________NUMP_L1___________________ , _________________NUMP_R1___________________ , RESET ,
  27. _______ , _________________NUMP_L2___________________ , _________________NUMP_R2___________________ , _______ ,
  28. _______ , _________________NUMP_L3___________________ , _________________NUMP_R3___________________ , _______ ,
  29. _______ , ___________________BLANK___________________ , _______ , _______ , _______ , _______ , TO(_OVERWATCH) , _______
  30. ), // Note: visualizer expects this closing parens to be right at the start of the line.
  31. // Run `./qmk show levinson` from parent dir to see this layer.
  32. [_OVERWATCH] = LAYOUT_ortho_4x12_wrapper(
  33. ______________OVERWATCH_L1_________________ , TO(0) , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , EEP_RST ,
  34. ______________OVERWATCH_L2_________________ , RGB_MODE_FORWARD , RGB_MODE_REVERSE , RGB_VAI , RGB_VAD , XXXXXXX , RGB_TOG ,
  35. ______________OVERWATCH_L3_________________ , RGB_MODE_PLAIN , RGB_MODE_BREATHE , RGB_MODE_RAINBOW , RGB_MODE_SWIRL , RGB_MODE_SNAKE , RGB_MODE_XMAS ,
  36. ______________OVERWATCH_L4_________________ , KC_SPACE, RGB_HUI , RGB_HUD , RGB_SAI , RGB_SAD , RGB_MODE_RGBTEST , RGB_MODE_GRADIENT
  37. ), // Note: visualizer expects this closing parens to be right at the start of the line.
  38. // Run `./qmk show levinson` from parent dir to see this layer.
  39. [_NAVI] = LAYOUT_ortho_4x12_wrapper(
  40. XXXXXXX , _________________NAVI_L1___________________ , _________________NAVI_R1___________________ , XXXXXXX ,
  41. XXXXXXX , _________________NAVI_L2___________________ , _________________NAVI_R2___________________ , XXXXXXX ,
  42. XXXXXXX , _________________NAVI_L3___________________ , _________________NAVI_R3___________________ , XXXXXXX ,
  43. XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , APPS , KC_LGUI , MODSFT , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
  44. ), // Note: visualizer expects this closing parens to be right at the start of the line.
  45. };
  46. // called by QMK during key processing before the actual key event is handled. Useful for macros.
  47. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  48. switch (keycode) {
  49. case LOCK:
  50. if (record->event.pressed) {
  51. rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL);
  52. }
  53. return true; // Let QMK send the press/release events
  54. break;
  55. case TAP_TOG_LAYER:
  56. process_tap_tog(_SYMB,record);
  57. return false;
  58. break;
  59. default:
  60. tap_tog_count = 0; // reset counter.
  61. tap_tog_layer_other_key_pressed = true; // always set this to true, TAP_TOG_LAYER handlers will handle interpreting this
  62. break;
  63. }
  64. return true;
  65. }
  66. // Runs constantly in the background, in a loop every 100ms or so.
  67. // Best used for LED status output triggered when user isn't actively typing.
  68. void matrix_scan_user(void) {
  69. #ifdef RGBLIGHT_ENABLE
  70. matrix_scan_rgb();
  71. #endif // RGBLIGHT_ENABLE
  72. }
  73. // only runs when when the layer is changed, good for updating LED's and clearing sticky state
  74. // RGB modes: https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight.h
  75. uint32_t layer_state_set_user(uint32_t state) {
  76. #ifdef RGBLIGHT_ENABLE
  77. layer_state_set_rgb(state);
  78. #endif
  79. uint8_t layer = biton32(state);
  80. combo_enable(); // by default, enable combos.
  81. switch (layer) {
  82. case 0:
  83. break;
  84. case 1:
  85. clear_mods();
  86. break;
  87. case 2:
  88. clear_mods();
  89. break;
  90. case _OVERWATCH:
  91. clear_mods();
  92. combo_disable(); // We don't want combos in overwatch
  93. #ifdef AUDIO_ENABLE
  94. // PLAY_SONG(song_overwatch);
  95. #endif
  96. break;
  97. default:
  98. break;
  99. }
  100. return state;
  101. };
  102. // Runs boot tasks for keyboard.
  103. // Plays a welcome song and clears RGB state.
  104. void matrix_init_user(void) {
  105. #ifdef RGBLIGHT_ENABLE
  106. keyboard_post_init_rgb();
  107. #endif
  108. }