logo

qmk_firmware

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

keymap.c (1744B)


  1. /*
  2. Copyright 2018 Cole Markham
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. extern rgblight_config_t rgblight_config;
  16. enum custom_keycodes {
  17. BL = SAFE_RANGE
  18. };
  19. enum custom_layers {
  20. BASE = 0,
  21. LED
  22. };
  23. //Tap Dance Declarations
  24. enum {
  25. TD_TOGGLE = 0
  26. };
  27. void dance_toggle (tap_dance_state_t *state, void *user_data) {
  28. if (state->count >= 2) {
  29. println("Double tapped, switching layers");
  30. if (layer_state_is(LED)) {
  31. layer_off(LED);
  32. } else {
  33. layer_on(LED);
  34. }
  35. } else {
  36. print("Single tapped: ");
  37. if (layer_state_is(LED)) {
  38. #ifdef RGBLIGHT_ENABLE
  39. if (!rgblight_config.enable) {
  40. rgblight_enable();
  41. }
  42. rgblight_step();
  43. #endif
  44. } else {
  45. println("Base layer, sending string");
  46. SEND_STRING("This thing is BIG!!\n");
  47. }
  48. }
  49. }
  50. //Tap Dance Definitions
  51. tap_dance_action_t tap_dance_actions[] = {
  52. [TD_TOGGLE] = ACTION_TAP_DANCE_FN(dance_toggle)
  53. // Other declarations would go here, separated by commas, if you have them
  54. };
  55. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  56. [BASE] = LAYOUT(
  57. TD(TD_TOGGLE)),
  58. [LED] = LAYOUT(
  59. TD(TD_TOGGLE)
  60. )
  61. };