From 763b26cdb98c2702f7b2f8de239d4edba0fa4065 Mon Sep 17 00:00:00 2001 From: Daniel Prilik Date: Wed, 3 Apr 2019 18:30:47 -0700 Subject: RGB Matrix support for Massdrop CTRL/ALT (#5328) * port Massdrop CTRL/ALT to use RGB Matrix Co-authored-by: Matt Schneeberger * Massdrop lighting support working This commit is to get the Massdrop lighting code working again through use of the compilation define USE_MASSDROP_CONFIGURATOR added to a keymap's rules.mk. Added keymaps for both CTRL and ALT named default_md and mac_md. These should be used if the Massdrop style lighting is desired. * Updating config based on testing results with patrickmt & compile errors * Updates for PR5328 For CTRL and ALT: Moved location of new RGB Matrix macros from config_led.h to config.h. Added RGB_MATRIX_LED_FLUSH_LIMIT (time between flushes) to config.h for correct LED driver update timing. Re-added missing breathing code for when Massdrop configurator mode is defined. * remove prilik keymap form PR --- tmk_core/protocol/arm_atsam/led_matrix.h | 84 ++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 36 deletions(-) (limited to 'tmk_core/protocol/arm_atsam/led_matrix.h') diff --git a/tmk_core/protocol/arm_atsam/led_matrix.h b/tmk_core/protocol/arm_atsam/led_matrix.h index 4513234e7..1316efd9a 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.h +++ b/tmk_core/protocol/arm_atsam/led_matrix.h @@ -18,6 +18,8 @@ along with this program. If not, see . #ifndef _LED_MATRIX_H_ #define _LED_MATRIX_H_ +#include "quantum.h" + //From keyboard #include "config_led.h" @@ -75,25 +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; - float max_distance; -} 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 @@ -114,33 +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 uint8_t led_animation_circular; -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_ -- cgit v1.2.3-24-g4f1b