]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/protocol/arm_atsam/led_matrix.h
RGB Matrix support for Massdrop CTRL/ALT (#5328)
[qmk_firmware.git] / tmk_core / protocol / arm_atsam / led_matrix.h
index cedea8a856dcaff2cd5b94c162a33f2cc4ec0d96..1316efd9a4fd2a669a2f77c56bc4df14377b2f10 100644 (file)
@@ -18,6 +18,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #ifndef _LED_MATRIX_H_
 #define _LED_MATRIX_H_
 
+#include "quantum.h"
+
 //From keyboard
 #include "config_led.h"
 
@@ -75,24 +77,20 @@ typedef struct issi3733_led_s {
     uint8_t scan;               //Key scan code from wiring (set 0xFF if no key)
 } issi3733_led_t;
 
-typedef struct led_disp_s {
-    uint64_t frame;
-    float left;
-    float right;
-    float top;
-    float bottom;
-    float width;
-    float height;
-} led_disp_t;
+extern issi3733_driver_t issidrv[ISSI3733_DRIVER_COUNT];
 
-uint8_t led_matrix_init(void);
-void rgb_matrix_init_user(void);
+extern uint8_t gcr_desired;
+extern uint8_t gcr_breathe;
+extern uint8_t gcr_actual;
+extern uint8_t gcr_actual_last;
 
-#define LED_MODE_NORMAL             0   //Must be 0
-#define LED_MODE_KEYS_ONLY          1
-#define LED_MODE_NON_KEYS_ONLY      2
-#define LED_MODE_INDICATORS_ONLY    3
-#define LED_MODE_MAX_INDEX          LED_MODE_INDICATORS_ONLY   //Must be highest value
+void gcr_compute(void);
+
+void led_matrix_indicators(void);
+
+/*-------------------------  Legacy Lighting Support  ------------------------*/
+
+#ifdef USE_MASSDROP_CONFIGURATOR
 
 #define EF_NONE         0x00000000  //No effect
 #define EF_OVER         0x00000001  //Overwrite any previous color information with new
@@ -113,32 +111,48 @@ typedef struct led_setup_s {
   uint8_t end;      //Set to signal end of the setup
 } led_setup_t;
 
-extern issi3733_driver_t issidrv[ISSI3733_DRIVER_COUNT];
+extern const uint8_t led_setups_count;
+extern void *led_setups[];
 
-extern uint8_t gcr_desired;
-extern uint8_t gcr_breathe;
-extern uint8_t gcr_actual;
-extern uint8_t gcr_actual_last;
+//LED Extra Instructions
+#define LED_FLAG_NULL                0x00       //Matching and coloring not used (default)
+#define LED_FLAG_MATCH_ID            0x01       //Match on the ID of the LED (set id#'s to desired bit pattern, first LED is id 1)
+#define LED_FLAG_MATCH_LAYER         0x02       //Match on the current active layer (set layer to desired match layer)
+#define LED_FLAG_USE_RGB             0x10       //Use a specific RGB value (set r, g, b to desired output color values)
+#define LED_FLAG_USE_PATTERN         0x20       //Use a specific pattern ID (set pattern_id to desired output pattern)
+#define LED_FLAG_USE_ROTATE_PATTERN  0x40       //Use pattern the user has cycled to manually
+
+typedef struct led_instruction_s {
+    uint16_t flags; // Bitfield for LED instructions
+    uint32_t id0; // Bitwise id, IDs 0-31
+    uint32_t id1; // Bitwise id, IDs 32-63
+    uint32_t id2; // Bitwise id, IDs 64-95
+    uint32_t id3; // Bitwise id, IDs 96-127
+    uint8_t layer;
+    uint8_t r;
+    uint8_t g;
+    uint8_t b;
+    uint8_t pattern_id;
+    uint8_t end;
+} led_instruction_t;
+
+extern led_instruction_t led_instructions[];
 
+extern uint8_t led_animation_breathing;
 extern uint8_t led_animation_id;
-extern uint8_t led_enabled;
 extern float led_animation_speed;
 extern uint8_t led_lighting_mode;
-extern uint8_t led_animation_direction;
-extern uint8_t led_animation_orientation;
-extern uint8_t led_animation_breathing;
+extern uint8_t led_enabled;
 extern uint8_t led_animation_breathe_cur;
+extern uint8_t led_animation_direction;
 extern uint8_t breathe_dir;
-extern const uint8_t led_setups_count;
 
-extern void *led_setups[];
-
-extern issi3733_led_t *led_cur;
-extern issi3733_led_t *lede;
-
-void led_matrix_run(void);
-void led_matrix_task(void);
+#define LED_MODE_NORMAL             0   //Must be 0
+#define LED_MODE_KEYS_ONLY          1
+#define LED_MODE_NON_KEYS_ONLY      2
+#define LED_MODE_INDICATORS_ONLY    3
+#define LED_MODE_MAX_INDEX          LED_MODE_INDICATORS_ONLY   //Must be highest value
 
-void gcr_compute(void);
+#endif // USE_MASSDROP_CONFIGURATOR
 
 #endif //_LED_MATRIX_H_