You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.8 KiB

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