aboutsummaryrefslogtreecommitdiff
path: root/quantum/visualizer/visualizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/visualizer/visualizer.h')
-rw-r--r--quantum/visualizer/visualizer.h41
1 files changed, 17 insertions, 24 deletions
diff --git a/quantum/visualizer/visualizer.h b/quantum/visualizer/visualizer.h
index 315af5022..d6f279e10 100644
--- a/quantum/visualizer/visualizer.h
+++ b/quantum/visualizer/visualizer.h
@@ -34,7 +34,7 @@ SOFTWARE.
34#include "lcd_backlight.h" 34#include "lcd_backlight.h"
35#endif 35#endif
36 36
37// use this function to merget both real_mods and oneshot_mods in a uint16_t 37// use this function to merge both real_mods and oneshot_mods in a uint16_t
38uint8_t visualizer_get_mods(void); 38uint8_t visualizer_get_mods(void);
39 39
40// This need to be called once at the start 40// This need to be called once at the start
@@ -68,6 +68,9 @@ typedef struct {
68 uint8_t mods; 68 uint8_t mods;
69 uint32_t leds; // See led.h for available statuses 69 uint32_t leds; // See led.h for available statuses
70 bool suspended; 70 bool suspended;
71#ifdef VISUALIZER_USER_DATA_SIZE
72 uint8_t user_data[VISUALIZER_USER_DATA_SIZE];
73#endif
71} visualizer_keyboard_status_t; 74} visualizer_keyboard_status_t;
72 75
73// The state struct is used by the various keyframe functions 76// The state struct is used by the various keyframe functions
@@ -123,32 +126,22 @@ void stop_keyframe_animation(keyframe_animation_t* animation);
123// Useful for crossfades for example 126// Useful for crossfades for example
124void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state); 127void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state);
125 128
126// Some predefined keyframe functions that can be used by the user code 129// The master can set userdata which will be transferred to the slave
127// Does nothing, useful for adding delays 130#ifdef VISUALIZER_USER_DATA_SIZE
128bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state); 131void visualizer_set_user_data(void* user_data);
129// Animates the LCD backlight color between the current color and the target color (of the state) 132#endif
130bool keyframe_animate_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state);
131// Sets the backlight color to the target color
132bool keyframe_set_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state);
133// Displays the layer text centered vertically on the screen
134bool keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state);
135// Displays a bitmap (0/1) of all the currently active layers
136bool keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
137// Displays a bitmap (0/1) of all the currently active mods
138bool keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
139
140bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
141bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
142
143// Call this once, when the initial animation has finished, alternatively you can call it
144// directly from the initalize_user_visualizer function (the animation can be null)
145bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state);
146 133
147// These functions have to be implemented by the user 134// These functions have to be implemented by the user
148void initialize_user_visualizer(visualizer_state_t* state); 135// Called regularly each time the state has changed (but not every scan loop)
149void update_user_visualizer_state(visualizer_state_t* state); 136void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status);
137// Called when the computer goes to suspend, will also stop calling update_user_visualizer_state
150void user_visualizer_suspend(visualizer_state_t* state); 138void user_visualizer_suspend(visualizer_state_t* state);
139// You have to start at least one animation as a response to the following two functions
140// When the animation has finished the visualizer will resume normal operation and start calling the
141// update_user_visualizer_state again
142// Called when the keyboard boots up
143void initialize_user_visualizer(visualizer_state_t* state);
144// Called when the computer resumes from a suspend
151void user_visualizer_resume(visualizer_state_t* state); 145void user_visualizer_resume(visualizer_state_t* state);
152 146
153
154#endif /* VISUALIZER_H */ 147#endif /* VISUALIZER_H */