2
0

visualizer.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright 2017 Fred Sundvik
  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. #pragma once
  17. #include "visualizer.h"
  18. #include "visualizer_keyframes.h"
  19. #include "led.h"
  20. #include "default_animations.h"
  21. static bool initial_update = true;
  22. // Feel free to modify the animations below, or even add new ones if needed
  23. void initialize_user_visualizer(visualizer_state_t* state) {
  24. // The brightness will be dynamically adjustable in the future
  25. // But for now, change it here.
  26. initial_update = true;
  27. start_keyframe_animation(&default_startup_animation);
  28. }
  29. void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
  30. // Add more tests, change the colors and layer texts here
  31. // Usually you want to check the high bits (higher layers first)
  32. // because that's the order layers are processed for keypresses
  33. // You can for check for example:
  34. // state->status.layer
  35. // state->status.default_layer
  36. // state->status.leds (see led.h for available statuses)
  37. if (initial_update) { initial_update=false; start_keyframe_animation(&led_test_animation); }
  38. }
  39. void user_visualizer_suspend(visualizer_state_t* state) {
  40. start_keyframe_animation(&default_suspend_animation);
  41. }
  42. void user_visualizer_resume(visualizer_state_t* state) {
  43. initial_update = true;
  44. start_keyframe_animation(&default_startup_animation);
  45. }