keymap.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 (qk_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. qk_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. };
  62. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  63. return MACRO_NONE ;
  64. }
  65. void matrix_init_user(void) {
  66. }
  67. void matrix_scan_user(void) {
  68. }
  69. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  70. // Nothing here, see dance_toggle
  71. return true;
  72. }
  73. void led_set_user(uint8_t usb_led) {
  74. if (usb_led & (1 << USB_LED_NUM_LOCK)) {
  75. } else {
  76. }
  77. if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
  78. } else {
  79. }
  80. if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
  81. } else {
  82. }
  83. if (usb_led & (1 << USB_LED_COMPOSE)) {
  84. } else {
  85. }
  86. if (usb_led & (1 << USB_LED_KANA)) {
  87. } else {
  88. }
  89. }