keymap.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Copyright 2019 Stanrc85
  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. #include "stanrc85.h"
  18. enum keys {
  19. U_LAYR = SAFE_RANGE,
  20. D_LAYR
  21. };
  22. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  23. [_NUMPAD] = LAYOUT(
  24. KC_7, KC_8, KC_9,
  25. KC_4, KC_5, KC_6,
  26. KC_1, KC_2, KC_3,
  27. U_LAYR, KC_0, KC_ENT),
  28. [_NAVKEY] = LAYOUT(
  29. KC_HOME, KC_INS, KC_PGUP,
  30. KC_END, KC_UP, KC_PGDN,
  31. KC_LEFT, KC_DOWN, KC_RGHT,
  32. U_LAYR, TD_TWIN, D_LAYR),
  33. [_MEDIA] = LAYOUT(
  34. KC_MUTE, KC_VOLD, KC_VOLU,
  35. CA_QUOT, KC_MPLY, CA_SCLN,
  36. CA_COPY, CA_PSTE, KC_NO,
  37. U_LAYR, KC_NO, D_LAYR),
  38. [_RGB] = LAYOUT(
  39. RGB_SAI, RGB_VAI, RGB_HUI,
  40. RGB_SAD, RGB_VAD, RGB_HUD,
  41. RGB_TOG, RGB_MOD, KC_NO,
  42. U_LAYR, KC_NO, D_LAYR),
  43. [_FN1PAD] = LAYOUT(
  44. KC_NO, KC_NO, KC_NO,
  45. KC_NO, KC_NO, RESET,
  46. KC_NO, KC_NO, KC_MAKE,
  47. KC_NO, KC_LSFT, D_LAYR)
  48. };
  49. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  50. keypos_t key;
  51. uint8_t current_layer;
  52. uint8_t next_layer;
  53. switch (keycode) {
  54. case U_LAYR: //cycles up the layers
  55. if (!record->event.pressed) {
  56. current_layer = layer_switch_get_layer(key);
  57. next_layer = current_layer+1;
  58. layer_move(next_layer);
  59. }
  60. break;
  61. case D_LAYR: //cycles down the layers
  62. if (!record->event.pressed) {
  63. current_layer = layer_switch_get_layer(key);
  64. next_layer = current_layer-1;
  65. layer_move(next_layer);
  66. }
  67. break;
  68. }
  69. return true;
  70. };