keymap.c 2.4 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 "../../bigseries.h"
  15. #include "print.h"
  16. extern rgblight_config_t rgblight_config;
  17. enum custom_keycodes {
  18. BL = SAFE_RANGE
  19. };
  20. enum custom_layers {
  21. BASE = 0,
  22. LED
  23. };
  24. //Tap Dance Declarations
  25. enum {
  26. TD_TOGGLE = 0
  27. };
  28. void dance_toggle (qk_tap_dance_state_t *state, void *user_data) {
  29. if (state->count >= 2) {
  30. println("Double tapped, switching layers");
  31. if (layer_state_is(LED)) {
  32. layer_off(LED);
  33. } else {
  34. layer_on(LED);
  35. }
  36. } else {
  37. print("Single tapped: ");
  38. if (layer_state_is(LED)) {
  39. #ifdef RGBLIGHT_ENABLE
  40. if (!rgblight_config.enable) {
  41. rgblight_enable();
  42. }
  43. rgblight_step();
  44. #endif
  45. } else {
  46. println("Base layer, sending string");
  47. SEND_STRING("This thing is BIG!!\n");
  48. }
  49. }
  50. }
  51. //Tap Dance Definitions
  52. qk_tap_dance_action_t tap_dance_actions[] = {
  53. [TD_TOGGLE] = ACTION_TAP_DANCE_FN(dance_toggle)
  54. // Other declarations would go here, separated by commas, if you have them
  55. };
  56. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  57. [BASE] = KEYMAP(
  58. TD(TD_TOGGLE)),
  59. [LED] = KEYMAP(
  60. TD(TD_TOGGLE)
  61. )
  62. };
  63. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  64. return MACRO_NONE ;
  65. }
  66. void matrix_init_user(void) {
  67. }
  68. void matrix_scan_user(void) {
  69. }
  70. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  71. // Nothing here, see dance_toggle
  72. return true;
  73. }
  74. void led_set_user(uint8_t usb_led) {
  75. if (usb_led & (1 << USB_LED_NUM_LOCK)) {
  76. } else {
  77. }
  78. if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
  79. } else {
  80. }
  81. if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
  82. } else {
  83. }
  84. if (usb_led & (1 << USB_LED_COMPOSE)) {
  85. } else {
  86. }
  87. if (usb_led & (1 << USB_LED_KANA)) {
  88. } else {
  89. }
  90. }