]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/visualizer/visualizer.h
add support for pedal cc messages
[qmk_firmware.git] / quantum / visualizer / visualizer.h
index 22798cda6befe789c80b09d5f4b4d71135985441..315af50228afd3d024e80ea14194511afb663480 100644 (file)
@@ -28,31 +28,44 @@ SOFTWARE.
 #include <stdint.h>
 #include <stdbool.h>
 
-#ifdef LCD_ENABLE
 #include "gfx.h"
-#endif
 
 #ifdef LCD_BACKLIGHT_ENABLE
 #include "lcd_backlight.h"
 #endif
 
+// use this function to merget both real_mods and oneshot_mods in a uint16_t
+uint8_t visualizer_get_mods(void);
+
 // This need to be called once at the start
 void visualizer_init(void);
 // This should be called at every matrix scan
-void visualizer_update(uint32_t default_state, uint32_t state, uint32_t leds);
+void visualizer_update(uint32_t default_state, uint32_t state, uint8_t mods, uint32_t leds);
+
 // This should be called when the keyboard goes to suspend state
 void visualizer_suspend(void);
 // This should be called when the keyboard wakes up from suspend state
 void visualizer_resume(void);
 
-// If you need support for more than 8 keyframes per animation, you can change this
-#define MAX_VISUALIZER_KEY_FRAMES 8
+// These functions are week, so they can be overridden by the keyboard
+// if needed
+GDisplay* get_lcd_display(void);
+GDisplay* get_led_display(void);
+
+// For emulator builds, this function need to be implemented
+#ifdef EMULATOR
+void draw_emulator(void);
+#endif
+
+// If you need support for more than 16 keyframes per animation, you can change this
+#define MAX_VISUALIZER_KEY_FRAMES 16
 
 struct keyframe_animation_t;
 
 typedef struct {
     uint32_t layer;
     uint32_t default_layer;
+    uint8_t mods;
     uint32_t leds; // See led.h for available statuses
     bool suspended;
 } visualizer_keyboard_status_t;
@@ -95,12 +108,20 @@ typedef struct keyframe_animation_t {
     // keyframe update functions
     int current_frame;
     int time_left_in_frame;
+    bool first_update_of_frame;
+    bool last_update_of_frame;
     bool need_update;
 
 } keyframe_animation_t;
 
+extern GDisplay* LCD_DISPLAY;
+extern GDisplay* LED_DISPLAY;
+
 void start_keyframe_animation(keyframe_animation_t* animation);
 void stop_keyframe_animation(keyframe_animation_t* animation);
+// This runs the next keyframe, but does not update the animation state
+// Useful for crossfades for example
+void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state);
 
 // Some predefined keyframe functions that can be used by the user code
 // Does nothing, useful for adding delays
@@ -113,6 +134,8 @@ bool keyframe_set_backlight_color(keyframe_animation_t* animation, visualizer_st
 bool keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state);
 // Displays a bitmap (0/1) of all the currently active layers
 bool keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
+// Displays a bitmap (0/1) of all the currently active mods
+bool keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
 
 bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
 bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
@@ -121,7 +144,7 @@ bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualiz
 // directly from the initalize_user_visualizer function (the animation can be null)
 bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state);
 
-// These two functions have to be implemented by the user
+// These functions have to be implemented by the user
 void initialize_user_visualizer(visualizer_state_t* state);
 void update_user_visualizer_state(visualizer_state_t* state);
 void user_visualizer_suspend(visualizer_state_t* state);