keymap.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* Copyright 2017 Zach White <skullydazed@gmail.com>
  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. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  18. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  19. #define _BL 0
  20. #define _FL 1
  21. #define _CL 2
  22. enum custom_keycodes {
  23. S_BSKTC = SAFE_RANGE,
  24. S_ODEJY,
  25. S_RCKBY,
  26. S_DOEDR,
  27. S_SCALE,
  28. S_ONEUP,
  29. S_COIN,
  30. S_SONIC,
  31. S_ZELDA
  32. };
  33. #ifdef AUDIO_ENABLE
  34. float song_basketcase[][2] = SONG(BASKET_CASE);
  35. float song_ode_to_joy[][2] = SONG(ODE_TO_JOY);
  36. float song_rock_a_bye_baby[][2] = SONG(ROCK_A_BYE_BABY);
  37. float song_doe_a_deer[][2] = SONG(DOE_A_DEER);
  38. float song_scale[][2] = SONG(MUSIC_SCALE_SOUND);
  39. float song_coin[][2] = SONG(COIN_SOUND);
  40. float song_one_up[][2] = SONG(ONE_UP_SOUND);
  41. float song_sonic_ring[][2] = SONG(SONIC_RING);
  42. float song_zelda_puzzle[][2] = SONG(ZELDA_PUZZLE);
  43. #endif
  44. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  45. /* Keymap _BL: Base Layer (Default Layer)
  46. */
  47. [_BL] = LAYOUT(
  48. KC_GESC,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC, KC_PGUP,
  49. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS, KC_PGDN,
  50. KC_CAPS,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT,
  51. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
  52. KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_SPC, KC_RGUI,KC_RALT,MO(_FL),KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT),
  53. /* Keymap _FL: Function Layer
  54. */
  55. [_FL] = LAYOUT(
  56. KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_VOLU,
  57. _______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_MUTE, KC_VOLD,
  58. _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,
  59. _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_PGUP,
  60. _______,_______,_______, _______,_______, _______,_______,MO(_FL),_______,KC_HOME,KC_PGDN,KC_END),
  61. /* Keymap _CL: Control layer
  62. */
  63. [_CL] = LAYOUT(
  64. BL_STEP,S_ONEUP,S_SCALE,RGB_M_R,RGB_M_SW,RGB_M_SN,RGB_M_K,RGB_M_X,RGB_M_G,_______,_______,_______,_______, BL_TOGG, BL_INC,
  65. _______,_______,_______,_______,QK_BOOT, _______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC,
  66. _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,
  67. _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, RGB_SAI,
  68. _______,_______,_______, BL_BRTG,BL_BRTG, _______,_______,MO(_FL),_______,RGB_HUD,RGB_SAD,RGB_HUI),
  69. };
  70. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  71. switch (keycode) {
  72. #ifdef AUDIO_ENABLE
  73. case S_BSKTC:
  74. if (record->event.pressed) {
  75. stop_all_notes();
  76. PLAY_SONG(song_basketcase);
  77. }
  78. return false;
  79. case S_ODEJY:
  80. if (record->event.pressed) {
  81. stop_all_notes();
  82. PLAY_SONG(song_ode_to_joy);
  83. }
  84. return false;
  85. case S_RCKBY:
  86. if (record->event.pressed) {
  87. stop_all_notes();
  88. PLAY_SONG(song_rock_a_bye_baby);
  89. }
  90. return false;
  91. case S_DOEDR:
  92. if (record->event.pressed) {
  93. stop_all_notes();
  94. PLAY_SONG(song_doe_a_deer);
  95. }
  96. return false;
  97. case S_SCALE:
  98. if (record->event.pressed) {
  99. stop_all_notes();
  100. PLAY_SONG(song_scale);
  101. }
  102. return false;
  103. case S_ONEUP:
  104. if (record->event.pressed) {
  105. stop_all_notes();
  106. PLAY_SONG(song_one_up);
  107. }
  108. return false;
  109. case S_COIN:
  110. if (record->event.pressed) {
  111. stop_all_notes();
  112. PLAY_SONG(song_coin);
  113. }
  114. return false;
  115. case S_SONIC:
  116. if (record->event.pressed) {
  117. stop_all_notes();
  118. PLAY_SONG(song_sonic_ring);
  119. }
  120. return false;
  121. case S_ZELDA:
  122. if (record->event.pressed) {
  123. stop_all_notes();
  124. PLAY_SONG(song_zelda_puzzle);
  125. }
  126. return false;
  127. #endif
  128. }
  129. return true;
  130. }