logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (2047B)


  1. /* Copyright 2018 QMK Community
  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. #define _BL 0
  18. #define _FN 1
  19. // Define keyboard specific keycodes for controlling on/off for all LEDs as they
  20. // are all on different pins with this PCB, rather than a single backlight pin
  21. enum custom_keycodes {
  22. SS_LON = SAFE_RANGE,
  23. SS_LOFF
  24. };
  25. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  26. /* Base Layer: Media Keys
  27. * ,-----------.
  28. * |FN | V-| V+|
  29. * |---+---+---|
  30. * |Prv|Ply|Nxt|
  31. * `-----------'
  32. */
  33. [_BL] = LAYOUT( /* Base */
  34. MO(_FN), KC_VOLD, KC_VOLU,
  35. KC_MPRV, KC_MPLY, KC_MNXT
  36. ),
  37. /* FN Layer: LED control
  38. * ,-----------.
  39. * |FN | V-| V+|
  40. * |---+---+---|
  41. * |Prv|Ply|Nxt|
  42. * `-----------'
  43. */
  44. [_FN] = LAYOUT(
  45. KC_TRNS, SS_LON, SS_LOFF,
  46. KC_NO, KC_NO, KC_NO
  47. ),
  48. };
  49. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  50. // Put your per-action keyboard code here.
  51. // Runs for every action, just before processing by the firmware.
  52. if (record->event.pressed) {
  53. // Check for custom keycodes for turning on and off LEDs
  54. switch(keycode) {
  55. case SS_LON:
  56. sixshooter_led_all_on();
  57. return false;
  58. case SS_LOFF:
  59. sixshooter_led_all_off();
  60. return false;
  61. }
  62. }
  63. return true;
  64. };
  65. void matrix_init_user(void) {
  66. // Default all LEDs to on
  67. sixshooter_led_all_on();
  68. }