From a7113c8ed090d0ac647f30ee9b8ef41252e568ed Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Tue, 30 Apr 2019 00:18:50 +0200 Subject: Updated rgb_led struct field modifier to flags (#5619) Updated effects to test led flags Updated massdrop to use new flags field for led toggle --- docs/feature_rgb_matrix.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 4ce9d15f0..91ec77ace 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -127,13 +127,13 @@ Configure the hardware via your `config.h`: From this point forward the configuration is the same for all the drivers. The struct rgb_led array tells the system for each led, what key electrical matrix it represents, what the physical position is on the board, and if the led is for a modifier key or not. Here is a brief example: ```C -const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { /* {row | col << 4} * | {x=0..224, y=0..64} - * | | modifier + * | | flags * | | | */ {{0|(0<<4)}, {20.36*0, 21.33*0}, 1}, - {{0|(1<<4)}, {20.36*1, 21.33*0}, 1}, + {{0|(1<<4)}, {20.36*1, 21.33*0}, 4}, .... } ``` @@ -147,7 +147,19 @@ y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. -`modifier` is a boolean, whether or not a certain key is considered a modifier (used in some effects). +`flags` is a bitmask, whether or not a certain LEDs is of a certain type. It is recommended that LEDs are set to only 1 type. + +## Flags + +|Define |Description | +|------------------------------------|-------------------------------------------| +|`#define HAS_FLAGS(bits, flags)` |Returns true if `bits` has all `flags` set.| +|`#define HAS_ANY_FLAGS(bits, flags)`|Returns true if `bits` has any `flags` set.| +|`#define LED_FLAG_NONE 0x00` |If thes LED has no flags. | +|`#define LED_FLAG_ALL 0xFF` |If thes LED has all flags. | +|`#define LED_FLAG_MODIFIER 0x01` |If the Key for this LED is a modifier. | +|`#define LED_FLAG_UNDERGLOW 0x02` |If the LED is for underglow. | +|`#define LED_FLAG_KEYLIGHT 0x04` |If the LED is for key backlight. | ## Keycodes -- cgit v1.2.3-24-g4f1b