keymap.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Copyright 2015-2017 Jack Humbert
  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. extern keymap_config_t keymap_config;
  18. enum layers {
  19. _BASE,
  20. _FUNC
  21. };
  22. enum custom_keycodes {
  23. FUNC = SAFE_RANGE,
  24. BACKLIT
  25. };
  26. #define _______ KC_TRNS
  27. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  28. /* Base
  29. * ,------.
  30. * | 1 |
  31. * ,------+------.
  32. * | 2 | 3 |
  33. * ,------+------+------.
  34. * | 4 | FUNC | 6 |
  35. * `--------------------'
  36. */
  37. [_BASE] = LAYOUT(
  38. KC_1,
  39. KC_2, KC_3,
  40. KC_4, MO(_FUNC), KC_6
  41. ),
  42. /* Func
  43. * ,------.
  44. * |BCKLIT|
  45. * ,------+------.
  46. * | 8 | 9 |
  47. * ,------+------+------.
  48. * | 0 | FUNC | RESET|
  49. * `--------------------'
  50. */
  51. [_FUNC] = LAYOUT(
  52. BACKLIT,
  53. KC_8, KC_9,
  54. KC_0, _______, RESET
  55. )
  56. };
  57. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  58. switch (keycode) {
  59. case BACKLIT:
  60. if (record->event.pressed) {
  61. register_code(KC_RSFT);
  62. #ifdef BACKLIGHT_ENABLE
  63. register_code(KC_LSFT);
  64. backlight_step();
  65. #endif
  66. } else {
  67. unregister_code(KC_RSFT);
  68. unregister_code(KC_LSFT);
  69. }
  70. return false;
  71. break;
  72. }
  73. return true;
  74. }