keymap.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* Copyright 2020 zFrontier
  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. #include <print.h>
  18. enum {
  19. TD_ENTER = 0,
  20. };
  21. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  22. LAYOUT( TD(TD_ENTER) ),
  23. };
  24. void keyboard_post_init_user(void) {
  25. print("zFrontier S01.6 boot...\n");
  26. rgblight_enable_noeeprom();
  27. rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING);
  28. rgblight_sethsv_noeeprom(0,0,128);
  29. }
  30. void zf_switch_rgb_mode(void) {
  31. switch (rgblight_get_mode() ) {
  32. case RGBLIGHT_MODE_BREATHING:
  33. rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_MOOD);
  34. break;
  35. case RGBLIGHT_MODE_RAINBOW_MOOD:
  36. rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL);
  37. break;
  38. case RGBLIGHT_MODE_RAINBOW_SWIRL:
  39. rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE);
  40. break;
  41. case RGBLIGHT_MODE_SNAKE:
  42. rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT);
  43. break;
  44. case RGBLIGHT_MODE_KNIGHT:
  45. rgblight_mode_noeeprom(RGBLIGHT_MODE_CHRISTMAS);
  46. break;
  47. case RGBLIGHT_MODE_CHRISTMAS:
  48. rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_GRADIENT);
  49. break;
  50. case RGBLIGHT_MODE_STATIC_GRADIENT:
  51. rgblight_mode_noeeprom(RGBLIGHT_MODE_RGB_TEST);
  52. break;
  53. case RGBLIGHT_MODE_RGB_TEST:
  54. default:
  55. rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING);
  56. break;
  57. }
  58. }
  59. void zf_send_random_string(void) {
  60. uint8_t tmpu8 = (timer_read() & 0x7);
  61. switch (tmpu8) {
  62. case 0:
  63. case 1:
  64. SEND_STRING("Sazabi, launching!");
  65. break;
  66. case 2:
  67. case 3:
  68. SEND_STRING("I, Char Aznable, will purge them, Amuro!");
  69. break;
  70. case 4:
  71. case 5:
  72. SEND_STRING("Their souls are weighted down by gravity!");
  73. break;
  74. case 6:
  75. SEND_STRING("Go, Axis! With my unpleasant memories!");
  76. break;
  77. case 7:
  78. SEND_STRING("Hello from zFrontier!");
  79. break;
  80. }
  81. tap_code(KC_ENT);
  82. }
  83. void dance_finished(qk_tap_dance_state_t *state, void *user_data) {
  84. switch (state->count) {
  85. case 1:
  86. register_code(KC_ENTER);
  87. break;
  88. case 2:
  89. zf_switch_rgb_mode();
  90. break;
  91. default:
  92. zf_send_random_string();
  93. break;
  94. }
  95. }
  96. void dance_reset(qk_tap_dance_state_t *state, void *user_data) {
  97. if (state->count == 1) {
  98. unregister_code(KC_ENTER);
  99. }
  100. }
  101. qk_tap_dance_action_t tap_dance_actions[] = {
  102. [TD_ENTER] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_finished, dance_reset)
  103. };