]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/rgb_matrix.h
Move disable JTAG code from `keyboard_init` to `keyboard_setup`
[qmk_firmware.git] / quantum / rgb_matrix.h
index ef93c6d5cb8acf45ab7dc4801028e7562dc60931..d2450a7d999b2978665420935bf3314b4d6d3725 100644 (file)
@@ -1,5 +1,6 @@
 /* Copyright 2017 Jason Williams
  * Copyright 2017 Jack Humbert
+ * Copyright 2018 Yiancar
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <stdint.h>
 #include <stdbool.h>
 #include "color.h"
-#include "is31fl3731.h"
 #include "quantum.h"
 
+#ifdef IS31FL3731
+    #include "is31fl3731.h"
+#elif defined (IS31FL3733)
+    #include "is31fl3733.h"
+#endif
+
 typedef struct Point {
        uint8_t x;
        uint8_t y;
@@ -58,12 +64,12 @@ typedef union {
     uint16_t hue     :9;
     uint8_t  sat     :8;
     uint8_t  val     :8;
+    uint8_t  speed   :8;//EECONFIG needs to be increased to support this
   };
 } rgb_config_t;
 
 enum rgb_matrix_effects {
        RGB_MATRIX_SOLID_COLOR = 1,
-    RGB_MATRIX_SOLID_REACTIVE,
     RGB_MATRIX_ALPHAS_MODS,
     RGB_MATRIX_DUAL_BEACON,
     RGB_MATRIX_GRADIENT_UP_DOWN,
@@ -75,7 +81,9 @@ enum rgb_matrix_effects {
     RGB_MATRIX_RAINBOW_PINWHEELS,
     RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
     RGB_MATRIX_JELLYBEAN_RAINDROPS,
+    RGB_MATRIX_DIGITAL_RAIN,
 #ifdef RGB_MATRIX_KEYPRESSES
+    RGB_MATRIX_SOLID_REACTIVE,
     RGB_MATRIX_SPLASH,
     RGB_MATRIX_MULTISPLASH,
     RGB_MATRIX_SOLID_SPLASH,
@@ -92,9 +100,8 @@ void rgb_matrix_indicators(void);
 void rgb_matrix_indicators_kb(void);
 void rgb_matrix_indicators_user(void);
 
-void rgb_matrix_single_LED_test(void);
-
-void rgb_matrix_init_drivers(void);
+void rgb_matrix_init(void);
+void rgb_matrix_setup_drivers(void);
 
 void rgb_matrix_set_suspend_state(bool state);
 void rgb_matrix_set_indicator_state(uint8_t state);
@@ -117,11 +124,11 @@ void rgb_matrix_decrease(void);
 // void backlight_get_key_color( uint8_t led, HSV *hsv );
 // void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv );
 
-void rgb_matrix_test_led( uint8_t index, bool red, bool green, bool blue );
 uint32_t rgb_matrix_get_tick(void);
 
 void rgblight_toggle(void);
 void rgblight_step(void);
+void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
 void rgblight_step_reverse(void);
 void rgblight_increase_hue(void);
 void rgblight_decrease_hue(void);
@@ -129,7 +136,23 @@ void rgblight_increase_sat(void);
 void rgblight_decrease_sat(void);
 void rgblight_increase_val(void);
 void rgblight_decrease_val(void);
+void rgblight_increase_speed(void);
+void rgblight_decrease_speed(void);
 void rgblight_mode(uint8_t mode);
 uint32_t rgblight_get_mode(void);
 
+typedef struct {
+    /* Perform any initialisation required for the other driver functions to work. */
+    void (*init)(void);
+
+    /* Set the colour of a single LED in the buffer. */
+    void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b);
+    /* Set the colour of all LEDS on the keyboard in the buffer. */
+    void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b);
+    /* Flush any buffered changes to the hardware. */
+    void (*flush)(void);
+} rgb_matrix_driver_t;
+
+extern const rgb_matrix_driver_t rgb_matrix_driver;
+
 #endif