mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 04:43:02 +00:00
Rename RGBW
define to WS2812_RGBW
(#23585)
This commit is contained in:
parent
8f8fffc174
commit
0ff53b2498
@ -164,7 +164,6 @@
|
|||||||
"RGBLIGHT_DEFAULT_SAT": {"info_key": "rgblight.default.sat", "value_type": "int"},
|
"RGBLIGHT_DEFAULT_SAT": {"info_key": "rgblight.default.sat", "value_type": "int"},
|
||||||
"RGBLIGHT_DEFAULT_VAL": {"info_key": "rgblight.default.val", "value_type": "int"},
|
"RGBLIGHT_DEFAULT_VAL": {"info_key": "rgblight.default.val", "value_type": "int"},
|
||||||
"RGBLIGHT_DEFAULT_SPD": {"info_key": "rgblight.default.speed", "value_type": "int"},
|
"RGBLIGHT_DEFAULT_SPD": {"info_key": "rgblight.default.speed", "value_type": "int"},
|
||||||
"RGBW": {"info_key": "rgblight.rgbw", "value_type": "flag"},
|
|
||||||
|
|
||||||
// Secure
|
// Secure
|
||||||
"SECURE_IDLE_TIMEOUT": {"info_key": "secure.idle_timeout", "value_type": "int"},
|
"SECURE_IDLE_TIMEOUT": {"info_key": "secure.idle_timeout", "value_type": "int"},
|
||||||
@ -215,6 +214,7 @@
|
|||||||
"WS2812_DI_PIN": {"info_key": "ws2812.pin"},
|
"WS2812_DI_PIN": {"info_key": "ws2812.pin"},
|
||||||
"WS2812_I2C_ADDRESS": {"info_key": "ws2812.i2c_address", "value_type": "hex"},
|
"WS2812_I2C_ADDRESS": {"info_key": "ws2812.i2c_address", "value_type": "hex"},
|
||||||
"WS2812_I2C_TIMEOUT": {"info_key": "ws2812.i2c_timeout", "value_type": "int"},
|
"WS2812_I2C_TIMEOUT": {"info_key": "ws2812.i2c_timeout", "value_type": "int"},
|
||||||
|
"WS2812_RGBW": {"info_key": "ws2812.rgbw", "value_type": "flag"},
|
||||||
|
|
||||||
"LAYOUTS": {"info_key": "layout_aliases", "value_type": "mapping"},
|
"LAYOUTS": {"info_key": "layout_aliases", "value_type": "mapping"},
|
||||||
|
|
||||||
@ -229,6 +229,7 @@
|
|||||||
"PREVENT_STUCK_MODIFIERS": {"info_key": "_invalid.prevent_stuck_mods", "invalid": true},
|
"PREVENT_STUCK_MODIFIERS": {"info_key": "_invalid.prevent_stuck_mods", "invalid": true},
|
||||||
"QMK_KEYS_PER_SCAN": {"info_key": "qmk.keys_per_scan", "value_type": "int", "deprecated": true},
|
"QMK_KEYS_PER_SCAN": {"info_key": "qmk.keys_per_scan", "value_type": "int", "deprecated": true},
|
||||||
"RGB_DI_PIN": {"info_key": "rgblight.pin", "invalid": true, "replace_with": "WS2812_DI_PIN or APA102_DI_PIN"},
|
"RGB_DI_PIN": {"info_key": "rgblight.pin", "invalid": true, "replace_with": "WS2812_DI_PIN or APA102_DI_PIN"},
|
||||||
|
"RGBW": {"info_key": "rgblight.rgbw", "invalid": true, "replace_with": "WS2812_RGBW"},
|
||||||
"RGB_DISABLE_WHEN_USB_SUSPENDED": {"info_key": "_invalid.rgb_matrix_sleep", "invalid": true, "replace_with": "RGB_MATRIX_SLEEP"},
|
"RGB_DISABLE_WHEN_USB_SUSPENDED": {"info_key": "_invalid.rgb_matrix_sleep", "invalid": true, "replace_with": "RGB_MATRIX_SLEEP"},
|
||||||
"RGBLIGHT_ANIMATIONS": {"info_key": "_invalid.rgblight.animations.all", "value_type": "flag", "invalid": true},
|
"RGBLIGHT_ANIMATIONS": {"info_key": "_invalid.rgblight.animations.all", "value_type": "flag", "invalid": true},
|
||||||
"TAPPING_FORCE_HOLD": {"info_key": "tapping.force_hold", "value_type": "flag", "deprecated": true},
|
"TAPPING_FORCE_HOLD": {"info_key": "tapping.force_hold", "value_type": "flag", "deprecated": true},
|
||||||
|
@ -661,7 +661,10 @@
|
|||||||
"$ref": "qmk.definitions.v1#/mcu_pin",
|
"$ref": "qmk.definitions.v1#/mcu_pin",
|
||||||
"$comment": "Deprecated: use ws2812.pin instead"
|
"$comment": "Deprecated: use ws2812.pin instead"
|
||||||
},
|
},
|
||||||
"rgbw": {"type": "boolean"},
|
"rgbw": {
|
||||||
|
"type": "boolean",
|
||||||
|
"$comment": "Deprecated: use ws2812.rgbw instead"
|
||||||
|
},
|
||||||
"saturation_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
"saturation_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||||
"sleep": {"type": "boolean"},
|
"sleep": {"type": "boolean"},
|
||||||
"split": {"type": "boolean"},
|
"split": {"type": "boolean"},
|
||||||
@ -937,6 +940,7 @@
|
|||||||
"enum": ["bitbang", "custom", "i2c", "pwm", "spi", "vendor"]
|
"enum": ["bitbang", "custom", "i2c", "pwm", "spi", "vendor"]
|
||||||
},
|
},
|
||||||
"pin": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
"pin": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
||||||
|
"rgbw": {"type": "boolean"},
|
||||||
"i2c_address": {"$ref": "qmk.definitions.v1#/hex_number_2d"},
|
"i2c_address": {"$ref": "qmk.definitions.v1#/hex_number_2d"},
|
||||||
"i2c_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"}
|
"i2c_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"}
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ If you define these options you will enable the associated feature, which may in
|
|||||||
* units to step when in/decreasing saturation
|
* units to step when in/decreasing saturation
|
||||||
* `#define RGBLIGHT_VAL_STEP 12`
|
* `#define RGBLIGHT_VAL_STEP 12`
|
||||||
* units to step when in/decreasing value (brightness)
|
* units to step when in/decreasing value (brightness)
|
||||||
* `#define RGBW`
|
* `#define WS2812_RGBW`
|
||||||
* Enables RGBW LED support
|
* Enables RGBW LED support
|
||||||
|
|
||||||
## Mouse Key Options
|
## Mouse Key Options
|
||||||
|
@ -6,7 +6,7 @@ QMK has the ability to control RGB LEDs attached to your keyboard. This is commo
|
|||||||
|
|
||||||
Some keyboards come with RGB LEDs preinstalled. Others must have them installed after the fact. See the [Hardware Modification](#hardware-modification) section for information on adding RGB lighting to your keyboard.
|
Some keyboards come with RGB LEDs preinstalled. Others must have them installed after the fact. See the [Hardware Modification](#hardware-modification) section for information on adding RGB lighting to your keyboard.
|
||||||
|
|
||||||
Currently QMK supports the following addressable LEDs (however, the white LED in RGBW variants is not supported):
|
Currently QMK supports the following addressable LEDs:
|
||||||
|
|
||||||
* WS2811, WS2812, WS2812B, WS2812C, etc.
|
* WS2811, WS2812, WS2812B, WS2812C, etc.
|
||||||
* SK6812, SK6812MINI, SK6805
|
* SK6812, SK6812MINI, SK6805
|
||||||
|
@ -588,9 +588,6 @@ Configures the [RGB Lighting](feature_rgblight.md) feature.
|
|||||||
* `max_brightness`
|
* `max_brightness`
|
||||||
* The maximum value which the HSV "V" component is scaled to, from 0 to 255.
|
* The maximum value which the HSV "V" component is scaled to, from 0 to 255.
|
||||||
* Default: `255`
|
* Default: `255`
|
||||||
* `rgbw`
|
|
||||||
* Enable RGBW LEDs.
|
|
||||||
* Default: `false`
|
|
||||||
* `saturation_steps`
|
* `saturation_steps`
|
||||||
* The number of saturation adjustment steps.
|
* The number of saturation adjustment steps.
|
||||||
* Default: `17`
|
* Default: `17`
|
||||||
@ -855,3 +852,6 @@ Configures the [WS2812](ws2812_driver.md) driver.
|
|||||||
* `i2c_timeout`
|
* `i2c_timeout`
|
||||||
* The I²C timeout in milliseconds (`i2c` driver only).
|
* The I²C timeout in milliseconds (`i2c` driver only).
|
||||||
* Default: `100` (100 ms)
|
* Default: `100` (100 ms)
|
||||||
|
* `rgbw`
|
||||||
|
* Enable RGBW LEDs.
|
||||||
|
* Default: `false`
|
||||||
|
@ -33,6 +33,7 @@ Add the following to your `config.h`:
|
|||||||
|`WS2812_T0H` |`350` |The length of a "0" bit's high phase in nanoseconds |
|
|`WS2812_T0H` |`350` |The length of a "0" bit's high phase in nanoseconds |
|
||||||
|`WS2812_TRST_US` |`280` |The length of the reset phase in microseconds |
|
|`WS2812_TRST_US` |`280` |The length of the reset phase in microseconds |
|
||||||
|`WS2812_BYTE_ORDER`|`WS2812_BYTE_ORDER_GRB`|The byte order of the RGB data |
|
|`WS2812_BYTE_ORDER`|`WS2812_BYTE_ORDER_GRB`|The byte order of the RGB data |
|
||||||
|
|`WS2812_RGBW` |*Not defined* |Enables RGBW support (except `i2c` driver) |
|
||||||
|
|
||||||
### Timing Adjustment :id=timing-adjustment
|
### Timing Adjustment :id=timing-adjustment
|
||||||
|
|
||||||
@ -58,6 +59,27 @@ Where the byte order may be one of:
|
|||||||
|`RGB` |WS2812B-2020 |
|
|`RGB` |WS2812B-2020 |
|
||||||
|`BGR` |TM1812 |
|
|`BGR` |TM1812 |
|
||||||
|
|
||||||
|
### RGBW Support :id=rgbw-support
|
||||||
|
|
||||||
|
Rendering the color white with RGB LEDs is typically inconsistent due to inherent variations between each individual LED die. However, some WS2812 variants (such as SK6812RGBW) also possess a white LED along with the red, green, and blue channels, which allows for a more accurate white to be displayed.
|
||||||
|
|
||||||
|
QMK can automatically convert the RGB data to be sent to the LEDs to mix in the white channel:
|
||||||
|
|
||||||
|
```
|
||||||
|
w = min(r, g, b)
|
||||||
|
r -= w
|
||||||
|
g -= w
|
||||||
|
b -= w
|
||||||
|
```
|
||||||
|
|
||||||
|
Thus, an RGB triplet of `255,255,255` will simply turn on the white LED fully (`0,0,0,255`).
|
||||||
|
|
||||||
|
To enable RGBW conversion, add the following to your `config.h`:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#define WS2812_RGBW
|
||||||
|
```
|
||||||
|
|
||||||
## Driver Configuration :id=driver-configuration
|
## Driver Configuration :id=driver-configuration
|
||||||
|
|
||||||
Driver selection can be configured in `rules.mk` as `WS2812_DRIVER`, or in `info.json` as `ws2812.driver`. Valid values are `bitbang` (default), `i2c`, `spi`, `pwm`, `vendor`, or `custom`. See below for information on individual drivers.
|
Driver selection can be configured in `rules.mk` as `WS2812_DRIVER`, or in `info.json` as `ws2812.driver`. Valid values are `bitbang` (default), `i2c`, `spi`, `pwm`, `vendor`, or `custom`. See below for information on individual drivers.
|
||||||
|
@ -73,8 +73,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
/* fix space cadet rollover issue */
|
/* fix space cadet rollover issue */
|
||||||
#define DISABLE_SPACE_CADET_ROLLOVER
|
#define DISABLE_SPACE_CADET_ROLLOVER
|
||||||
|
|
||||||
#define RGBW
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The debounce filtering reports a key/switch change directly,
|
* The debounce filtering reports a key/switch change directly,
|
||||||
* without any extra delay. After that the debounce logic will filter
|
* without any extra delay. After that the debounce logic will filter
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
"debounce_type": "sym_eager_pr"
|
"debounce_type": "sym_eager_pr"
|
||||||
},
|
},
|
||||||
"ws2812": {
|
"ws2812": {
|
||||||
"pin": "D7"
|
"pin": "D7",
|
||||||
|
"rgbw": true
|
||||||
},
|
},
|
||||||
"rgb_matrix": {
|
"rgb_matrix": {
|
||||||
"animations": {
|
"animations": {
|
||||||
|
@ -25,7 +25,7 @@ void setleds_custom(rgb_led_t *led, uint16_t led_num) {
|
|||||||
uint16_t length = 0;
|
uint16_t length = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
# ifdef RGBW
|
# ifdef WS2812_RGBW
|
||||||
int bytes_per_led = 4;
|
int bytes_per_led = 4;
|
||||||
# else
|
# else
|
||||||
int bytes_per_led = 3;
|
int bytes_per_led = 3;
|
||||||
@ -52,7 +52,7 @@ void setleds_custom(rgb_led_t *led, uint16_t led_num) {
|
|||||||
data[j++] = data_byte[0];
|
data[j++] = data_byte[0];
|
||||||
data[j++] = data_byte[1];
|
data[j++] = data_byte[1];
|
||||||
data[j++] = data_byte[2];
|
data[j++] = data_byte[2];
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
data[j++] = data_byte[3];
|
data[j++] = data_byte[3];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define RGBW
|
|
||||||
|
|
||||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
#define LOCKING_SUPPORT_ENABLE
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
/* Locking resynchronize hack */
|
/* Locking resynchronize hack */
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws2812": {
|
"ws2812": {
|
||||||
"pin": "D1"
|
"pin": "D1",
|
||||||
|
"rgbw": true
|
||||||
},
|
},
|
||||||
"features": {
|
"features": {
|
||||||
"bootmagic": true,
|
"bootmagic": true,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "ws2812.h"
|
#include "ws2812.h"
|
||||||
#include "i2c_master.h"
|
#include "i2c_master.h"
|
||||||
|
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
# error "RGBW not supported"
|
# error "RGBW not supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) {
|
|||||||
rgb_matrix_ws2812_array[i].g = g;
|
rgb_matrix_ws2812_array[i].g = g;
|
||||||
rgb_matrix_ws2812_array[i].b = b;
|
rgb_matrix_ws2812_array[i].b = b;
|
||||||
}
|
}
|
||||||
# ifdef RGBW
|
# ifdef WS2812_RGBW
|
||||||
convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]);
|
convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define RGBW
|
|
||||||
|
|
||||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
#define LOCKING_SUPPORT_ENABLE
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
/* Locking resynchronize hack */
|
/* Locking resynchronize hack */
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws2812": {
|
"ws2812": {
|
||||||
"pin": "E6"
|
"pin": "E6",
|
||||||
|
"rgbw": true
|
||||||
},
|
},
|
||||||
"processor": "atmega32u4",
|
"processor": "atmega32u4",
|
||||||
"bootloader": "atmel-dfu",
|
"bootloader": "atmel-dfu",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "ws2812.h"
|
#include "ws2812.h"
|
||||||
#include "i2c_master.h"
|
#include "i2c_master.h"
|
||||||
|
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
# error "RGBW not supported"
|
# error "RGBW not supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ static void ws2812_dma_callback(void* p, uint32_t ct) {
|
|||||||
// FIFO is already empty.
|
// FIFO is already empty.
|
||||||
rtcnt_t time_to_completion = (pio_sm_get_tx_fifo_level(pio, STATE_MACHINE) + 1) * MAX(WS2812_T1H + WS2812_T1L, WS2812_T0H + WS2812_T0L);
|
rtcnt_t time_to_completion = (pio_sm_get_tx_fifo_level(pio, STATE_MACHINE) + 1) * MAX(WS2812_T1H + WS2812_T1L, WS2812_T0H + WS2812_T0L);
|
||||||
|
|
||||||
#if defined(RGBW)
|
#if defined(WS2812_RGBW)
|
||||||
time_to_completion *= 32;
|
time_to_completion *= 32;
|
||||||
#else
|
#else
|
||||||
time_to_completion *= 24;
|
time_to_completion *= 24;
|
||||||
@ -222,7 +222,7 @@ void ws2812_init(void) {
|
|||||||
sm_config_set_sideset(&config, 1, false, false);
|
sm_config_set_sideset(&config, 1, false, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RGBW)
|
#if defined(WS2812_RGBW)
|
||||||
sm_config_set_out_shift(&config, false, true, 32);
|
sm_config_set_out_shift(&config, false, true, 32);
|
||||||
#else
|
#else
|
||||||
sm_config_set_out_shift(&config, false, true, 24);
|
sm_config_set_out_shift(&config, false, true, 24);
|
||||||
@ -270,7 +270,7 @@ void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
|
|||||||
sync_ws2812_transfer();
|
sync_ws2812_transfer();
|
||||||
|
|
||||||
for (int i = 0; i < leds; i++) {
|
for (int i = 0; i < leds; i++) {
|
||||||
#if defined(RGBW)
|
#if defined(WS2812_RGBW)
|
||||||
WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w);
|
WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w);
|
||||||
#else
|
#else
|
||||||
WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, 0);
|
WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, 0);
|
||||||
|
@ -101,7 +101,7 @@ void ws2812_setleds(rgb_led_t *ledarray, uint16_t leds) {
|
|||||||
sendByte(ledarray[i].r);
|
sendByte(ledarray[i].r);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
sendByte(ledarray[i].w);
|
sendByte(ledarray[i].w);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* Adapted from https://github.com/joewa/WS2812-LED-Driver_ChibiOS/ */
|
/* Adapted from https://github.com/joewa/WS2812-LED-Driver_ChibiOS/ */
|
||||||
|
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
# define WS2812_CHANNELS 4
|
# define WS2812_CHANNELS 4
|
||||||
#else
|
#else
|
||||||
# define WS2812_CHANNELS 3
|
# define WS2812_CHANNELS 3
|
||||||
@ -262,7 +262,7 @@
|
|||||||
# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 0, (bit))
|
# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 0, (bit))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
/**
|
/**
|
||||||
* @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given white bit
|
* @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given white bit
|
||||||
*
|
*
|
||||||
@ -381,7 +381,7 @@ void ws2812_write_led_rgbw(uint16_t led_number, uint8_t r, uint8_t g, uint8_t b,
|
|||||||
ws2812_frame_buffer[WS2812_RED_BIT(led_number, bit)] = ((r >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
ws2812_frame_buffer[WS2812_RED_BIT(led_number, bit)] = ((r >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
||||||
ws2812_frame_buffer[WS2812_GREEN_BIT(led_number, bit)] = ((g >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
ws2812_frame_buffer[WS2812_GREEN_BIT(led_number, bit)] = ((g >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
||||||
ws2812_frame_buffer[WS2812_BLUE_BIT(led_number, bit)] = ((b >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
ws2812_frame_buffer[WS2812_BLUE_BIT(led_number, bit)] = ((b >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
ws2812_frame_buffer[WS2812_WHITE_BIT(led_number, bit)] = ((w >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
ws2812_frame_buffer[WS2812_WHITE_BIT(led_number, bit)] = ((w >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -390,7 +390,7 @@ void ws2812_write_led_rgbw(uint16_t led_number, uint8_t r, uint8_t g, uint8_t b,
|
|||||||
// Setleds for standard RGB
|
// Setleds for standard RGB
|
||||||
void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
|
void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
|
||||||
for (uint16_t i = 0; i < leds; i++) {
|
for (uint16_t i = 0; i < leds; i++) {
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
ws2812_write_led_rgbw(i, ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w);
|
ws2812_write_led_rgbw(i, ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w);
|
||||||
#else
|
#else
|
||||||
ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b);
|
ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b);
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BYTES_FOR_LED_BYTE 4
|
#define BYTES_FOR_LED_BYTE 4
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
# define WS2812_CHANNELS 4
|
# define WS2812_CHANNELS 4
|
||||||
#else
|
#else
|
||||||
# define WS2812_CHANNELS 3
|
# define WS2812_CHANNELS 3
|
||||||
@ -131,7 +131,7 @@ static void set_led_color_rgb(rgb_led_t color, int pos) {
|
|||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j);
|
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 4 + j] = get_protocol_eq(color.w, j);
|
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 4 + j] = get_protocol_eq(color.w, j);
|
||||||
#endif
|
#endif
|
||||||
|
@ -109,7 +109,7 @@ RGB hsv_to_rgb_nocie(HSV hsv) {
|
|||||||
return hsv_to_rgb_impl(hsv, false);
|
return hsv_to_rgb_impl(hsv, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
void convert_rgb_to_rgbw(rgb_led_t *led) {
|
void convert_rgb_to_rgbw(rgb_led_t *led) {
|
||||||
// Determine lowest value in all three colors, put that into
|
// Determine lowest value in all three colors, put that into
|
||||||
// the white channel and then shift all colors by that amount
|
// the white channel and then shift all colors by that amount
|
||||||
|
@ -96,7 +96,7 @@ typedef struct PACKED rgb_led_t {
|
|||||||
uint8_t g;
|
uint8_t g;
|
||||||
uint8_t r;
|
uint8_t r;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
uint8_t w;
|
uint8_t w;
|
||||||
#endif
|
#endif
|
||||||
} rgb_led_t;
|
} rgb_led_t;
|
||||||
@ -111,6 +111,6 @@ typedef struct PACKED HSV {
|
|||||||
|
|
||||||
RGB hsv_to_rgb(HSV hsv);
|
RGB hsv_to_rgb(HSV hsv);
|
||||||
RGB hsv_to_rgb_nocie(HSV hsv);
|
RGB hsv_to_rgb_nocie(HSV hsv);
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
void convert_rgb_to_rgbw(rgb_led_t *led);
|
void convert_rgb_to_rgbw(rgb_led_t *led);
|
||||||
#endif
|
#endif
|
||||||
|
@ -185,7 +185,7 @@ static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) {
|
|||||||
rgb_matrix_ws2812_array[i].r = r;
|
rgb_matrix_ws2812_array[i].r = r;
|
||||||
rgb_matrix_ws2812_array[i].g = g;
|
rgb_matrix_ws2812_array[i].g = g;
|
||||||
rgb_matrix_ws2812_array[i].b = b;
|
rgb_matrix_ws2812_array[i].b = b;
|
||||||
# ifdef RGBW
|
# ifdef WS2812_RGBW
|
||||||
convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]);
|
convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, rgb_led_t *led1) {
|
|||||||
led1->r = r;
|
led1->r = r;
|
||||||
led1->g = g;
|
led1->g = g;
|
||||||
led1->b = b;
|
led1->b = b;
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
led1->w = 0;
|
led1->w = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -652,7 +652,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
|
|||||||
led[i].r = r;
|
led[i].r = r;
|
||||||
led[i].g = g;
|
led[i].g = g;
|
||||||
led[i].b = b;
|
led[i].b = b;
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
led[i].w = 0;
|
led[i].w = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -667,7 +667,7 @@ void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) {
|
|||||||
led[index].r = r;
|
led[index].r = r;
|
||||||
led[index].g = g;
|
led[index].g = g;
|
||||||
led[index].b = b;
|
led[index].b = b;
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
led[index].w = 0;
|
led[index].w = 0;
|
||||||
#endif
|
#endif
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
@ -704,7 +704,7 @@ void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8
|
|||||||
led[i].r = r;
|
led[i].r = r;
|
||||||
led[i].g = g;
|
led[i].g = g;
|
||||||
led[i].b = b;
|
led[i].b = b;
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
led[i].w = 0;
|
led[i].w = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -905,7 +905,7 @@ void rgblight_set(void) {
|
|||||||
led[i].r = 0;
|
led[i].r = 0;
|
||||||
led[i].g = 0;
|
led[i].g = 0;
|
||||||
led[i].b = 0;
|
led[i].b = 0;
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
led[i].w = 0;
|
led[i].w = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -933,7 +933,7 @@ void rgblight_set(void) {
|
|||||||
start_led = led + rgblight_ranges.clipping_start_pos;
|
start_led = led + rgblight_ranges.clipping_start_pos;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGBW
|
#ifdef WS2812_RGBW
|
||||||
for (uint8_t i = 0; i < num_leds; i++) {
|
for (uint8_t i = 0; i < num_leds; i++) {
|
||||||
convert_rgb_to_rgbw(&start_led[i]);
|
convert_rgb_to_rgbw(&start_led[i]);
|
||||||
}
|
}
|
||||||
@ -1263,7 +1263,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
|
|||||||
ledp->r = 0;
|
ledp->r = 0;
|
||||||
ledp->g = 0;
|
ledp->g = 0;
|
||||||
ledp->b = 0;
|
ledp->b = 0;
|
||||||
# ifdef RGBW
|
# ifdef WS2812_RGBW
|
||||||
ledp->w = 0;
|
ledp->w = 0;
|
||||||
# endif
|
# endif
|
||||||
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
|
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
|
||||||
@ -1323,7 +1323,7 @@ void rgblight_effect_knight(animation_status_t *anim) {
|
|||||||
led[i].r = 0;
|
led[i].r = 0;
|
||||||
led[i].g = 0;
|
led[i].g = 0;
|
||||||
led[i].b = 0;
|
led[i].b = 0;
|
||||||
# ifdef RGBW
|
# ifdef WS2812_RGBW
|
||||||
led[i].w = 0;
|
led[i].w = 0;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@ -1337,7 +1337,7 @@ void rgblight_effect_knight(animation_status_t *anim) {
|
|||||||
led[cur].r = 0;
|
led[cur].r = 0;
|
||||||
led[cur].g = 0;
|
led[cur].g = 0;
|
||||||
led[cur].b = 0;
|
led[cur].b = 0;
|
||||||
# ifdef RGBW
|
# ifdef WS2812_RGBW
|
||||||
led[cur].w = 0;
|
led[cur].w = 0;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user