From 83e6ddbbb4c8e715bfe419c4d7fc0ae305ea5bd5 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 6 Mar 2024 03:02:37 -0800 Subject: [Audio] Add support for audio shutdown pin (#22731) Co-authored-by: Ryan --- docs/reference_info_json.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs/reference_info_json.md') diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md index 796db1f244..b715c14041 100644 --- a/docs/reference_info_json.md +++ b/docs/reference_info_json.md @@ -123,10 +123,17 @@ Configures the [Audio](feature_audio.md) feature. * Default: `false` * `pins` (Required) * The GPIO pin(s) connected to the speaker(s). + * `power_control` + * `on_state` + * The logical GPIO state required to turn the speaker on. + * Default: `1` (on = high) + * `pin` + * The GPIO pin connected to speaker power circuit. * `voices` * Use multiple audio voices. * Default: `false` + ## Backlight :id=backlight Configures the [Backlight](feature_backlight.md) feature. -- cgit v1.2.3 From 23b7a02ebe2e6df738baa624c17e821c1573b69b Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 17 Mar 2024 19:23:14 +1100 Subject: LED drivers: add support for IS31FL3236 (#23264) --- builddefs/common_features.mk | 16 ++- data/schemas/keyboard.jsonschema | 2 + docs/reference_info_json.md | 2 +- drivers/led/issi/is31fl3236-mono.c | 168 +++++++++++++++++++++++++++++++ drivers/led/issi/is31fl3236-mono.h | 101 +++++++++++++++++++ drivers/led/issi/is31fl3236.c | 172 ++++++++++++++++++++++++++++++++ drivers/led/issi/is31fl3236.h | 103 +++++++++++++++++++ quantum/led_matrix/led_matrix_drivers.c | 8 ++ quantum/led_matrix/led_matrix_drivers.h | 2 + quantum/rgb_matrix/rgb_matrix_drivers.c | 8 ++ quantum/rgb_matrix/rgb_matrix_drivers.h | 2 + 11 files changed, 581 insertions(+), 3 deletions(-) create mode 100644 drivers/led/issi/is31fl3236-mono.c create mode 100644 drivers/led/issi/is31fl3236-mono.h create mode 100644 drivers/led/issi/is31fl3236.c create mode 100644 drivers/led/issi/is31fl3236.h (limited to 'docs/reference_info_json.md') diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 7227a5558e..49197dc91e 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -340,7 +340,7 @@ LED_MATRIX_DRIVER := snled27351 endif LED_MATRIX_ENABLE ?= no -VALID_LED_MATRIX_TYPES := is31fl3218 is31fl3729 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a snled27351 custom +VALID_LED_MATRIX_TYPES := is31fl3218 is31fl3236 is31fl3729 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a snled27351 custom ifeq ($(strip $(LED_MATRIX_ENABLE)), yes) ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),) @@ -365,6 +365,12 @@ ifeq ($(strip $(LED_MATRIX_ENABLE)), yes) SRC += is31fl3218-mono.c endif + ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3236) + I2C_DRIVER_REQUIRED = yes + COMMON_VPATH += $(DRIVER_PATH)/led/issi + SRC += is31fl3236-mono.c + endif + ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3729) I2C_DRIVER_REQUIRED = yes COMMON_VPATH += $(DRIVER_PATH)/led/issi @@ -443,7 +449,7 @@ endif RGB_MATRIX_ENABLE ?= no -VALID_RGB_MATRIX_TYPES := aw20216s is31fl3218 is31fl3729 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a snled27351 ws2812 custom +VALID_RGB_MATRIX_TYPES := aw20216s is31fl3218 is31fl3236 is31fl3729 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a snled27351 ws2812 custom ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),) $(call CATASTROPHIC_ERROR,Invalid RGB_MATRIX_DRIVER,RGB_MATRIX_DRIVER="$(RGB_MATRIX_DRIVER)" is not a valid matrix type) @@ -474,6 +480,12 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) SRC += is31fl3218.c endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3236) + I2C_DRIVER_REQUIRED = yes + COMMON_VPATH += $(DRIVER_PATH)/led/issi + SRC += is31fl3236.c + endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), is31fl3729) I2C_DRIVER_REQUIRED = yes COMMON_VPATH += $(DRIVER_PATH)/led/issi diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 5c6788913b..25aaabcf4a 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -453,6 +453,7 @@ "enum": [ "custom", "is31fl3218", + "is31fl3236", "is31fl3729", "is31fl3731", "is31fl3733", @@ -535,6 +536,7 @@ "aw20216s", "custom", "is31fl3218", + "is31fl3236", "is31fl3729", "is31fl3731", "is31fl3733", diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md index b715c14041..e6bc34e79e 100644 --- a/docs/reference_info_json.md +++ b/docs/reference_info_json.md @@ -640,7 +640,7 @@ Configures the [RGB Matrix](feature_rgb_matrix.md) feature. * The default animation speed. * Default: `128` * `driver` (Required) - * The driver to use. Must be one of `aw20216s`, `custom`, `is31fl3218`, `is31fl3729`, `is31fl3731`, `is31fl3733`, `is31fl3736`, `is31fl3737`, `is31fl3741`, `is31fl3742a`, `is31fl3743a`, `is31fl3745`, `is31fl3746a`, `snled27351`, `ws2812`. + * The driver to use. Must be one of `aw20216s`, `custom`, `is31fl3218`, `is31fl3236`, `is31fl3729`, `is31fl3731`, `is31fl3733`, `is31fl3736`, `is31fl3737`, `is31fl3741`, `is31fl3742a`, `is31fl3743a`, `is31fl3745`, `is31fl3746a`, `snled27351`, `ws2812`. * `hue_steps` * The number of hue adjustment steps. * Default: `8` diff --git a/drivers/led/issi/is31fl3236-mono.c b/drivers/led/issi/is31fl3236-mono.c new file mode 100644 index 0000000000..b80245a1dc --- /dev/null +++ b/drivers/led/issi/is31fl3236-mono.c @@ -0,0 +1,168 @@ +// Copyright 2024 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "is31fl3236-mono.h" +#include "i2c_master.h" +#include "gpio.h" + +#define IS31FL3236_PWM_REGISTER_COUNT 36 +#define IS31FL3236_LED_CONTROL_REGISTER_COUNT 36 + +#ifndef IS31FL3236_I2C_TIMEOUT +# define IS31FL3236_I2C_TIMEOUT 100 +#endif + +#ifndef IS31FL3236_I2C_PERSISTENCE +# define IS31FL3236_I2C_PERSISTENCE 0 +#endif + +#ifndef IS31FL3236_PWM_FREQUENCY +# define IS31FL3236_PWM_FREQUENCY IS31FL3236_PWM_FREQUENCY_3K_HZ // OFS - IS31FL3236A only +#endif + +const uint8_t i2c_addresses[IS31FL3236_DRIVER_COUNT] = { + IS31FL3236_I2C_ADDRESS_1, +#ifdef IS31FL3236_I2C_ADDRESS_2 + IS31FL3236_I2C_ADDRESS_2, +# ifdef IS31FL3236_I2C_ADDRESS_3 + IS31FL3236_I2C_ADDRESS_3, +# ifdef IS31FL3236_I2C_ADDRESS_4 + IS31FL3236_I2C_ADDRESS_4, +# endif +# endif +#endif +}; + +typedef struct is31fl3236_driver_t { + uint8_t pwm_buffer[IS31FL3236_PWM_REGISTER_COUNT]; + bool pwm_buffer_dirty; + uint8_t led_control_buffer[IS31FL3236_LED_CONTROL_REGISTER_COUNT]; + bool led_control_buffer_dirty; +} PACKED is31fl3236_driver_t; + +is31fl3236_driver_t driver_buffers[IS31FL3236_DRIVER_COUNT] = {{ + .pwm_buffer = {0}, + .pwm_buffer_dirty = false, + .led_control_buffer = {0}, + .led_control_buffer_dirty = false, +}}; + +void is31fl3236_write_register(uint8_t index, uint8_t reg, uint8_t data) { +#if IS31FL3236_I2C_PERSISTENCE > 0 + for (uint8_t i = 0; i < IS31FL3236_I2C_PERSISTENCE; i++) { + if (i2c_write_register(i2c_addresses[index] << 1, reg, &data, 1, IS31FL3236_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + } +#else + i2c_write_register(i2c_addresses[index] << 1, reg, &data, 1, IS31FL3236_I2C_TIMEOUT); +#endif +} + +void is31fl3236_write_pwm_buffer(uint8_t index) { +#if IS31FL3236_I2C_PERSISTENCE > 0 + for (uint8_t i = 0; i < IS31FL3236_I2C_PERSISTENCE; i++) { + if (i2c_write_register(i2c_addresses[index] << 1, IS31FL3236_REG_PWM, driver_buffers[index].pwm_buffer, 36, IS31FL3236_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + } +#else + i2c_write_register(i2c_addresses[index] << 1, IS31FL3236_REG_PWM, driver_buffers[index].pwm_buffer, 36, IS31FL3236_I2C_TIMEOUT); +#endif +} + +void is31fl3236_init_drivers(void) { + i2c_init(); + +#if defined(IS31FL3236_SDB_PIN) + gpio_set_pin_output(IS31FL3236_SDB_PIN); + gpio_write_pin_high(IS31FL3236_SDB_PIN); +#endif + + for (uint8_t i = 0; i < IS31FL3236_DRIVER_COUNT; i++) { + is31fl3236_init(i); + } + + for (uint8_t i = 0; i < IS31FL3236_LED_COUNT; i++) { + is31fl3236_set_led_control_register(i, true); + } + + for (uint8_t i = 0; i < IS31FL3236_DRIVER_COUNT; i++) { + is31fl3236_update_led_control_registers(i); + } +} + +void is31fl3236_init(uint8_t index) { + // In case we ever want to reinitialize (?) + is31fl3236_write_register(index, IS31FL3236_REG_RESET, 0x00); + + // Turn off software shutdown + is31fl3236_write_register(index, IS31FL3236_REG_SHUTDOWN, 0x01); + + // Set all PWM values to zero + for (uint8_t i = 0; i < IS31FL3236_PWM_REGISTER_COUNT; i++) { + is31fl3236_write_register(index, IS31FL3236_REG_PWM + i, 0x00); + } + + // turn off all LEDs in the LED control register + for (uint8_t i = 0; i < IS31FL3236_LED_CONTROL_REGISTER_COUNT; i++) { + is31fl3236_write_register(index, IS31FL3236_REG_LED_CONTROL + i, 0x00); + } + + // Set PWM frequency (IS31FL3236A) + is31fl3236_write_register(index, IS31FL3236_REG_PWM_FREQUENCY, IS31FL3236_PWM_FREQUENCY); + + // Load PWM registers and LED Control register data + is31fl3236_write_register(index, IS31FL3236_REG_UPDATE, 0x01); +} + +void is31fl3236_set_value(int index, uint8_t value) { + is31fl3236_led_t led; + + if (index < IS31FL3236_LED_COUNT) { + memcpy_P(&led, (&g_is31fl3236_leds[index]), sizeof(led)); + + if (driver_buffers[led.driver].pwm_buffer[led.v] == value) { + return; + } + + driver_buffers[led.driver].pwm_buffer[led.v] = value; + driver_buffers[led.driver].pwm_buffer_dirty = true; + } +} + +void is31fl3236_set_value_all(uint8_t value) { + for (uint8_t i = 0; i < IS31FL3236_LED_COUNT; i++) { + is31fl3236_set_value(i, value); + } +} + +void is31fl3236_set_led_control_register(uint8_t index, bool value) { + is31fl3236_led_t led; + memcpy_P(&led, (&g_is31fl3236_leds[index]), sizeof(led)); + + driver_buffers[led.driver].led_control_buffer[led.v] = value ? 0x01 : 0x00; + driver_buffers[led.driver].led_control_buffer_dirty = true; +} + +void is31fl3236_update_pwm_buffers(uint8_t index) { + if (driver_buffers[index].pwm_buffer_dirty) { + is31fl3236_write_pwm_buffer(index); + // Load PWM registers and LED Control register data + is31fl3236_write_register(index, IS31FL3236_REG_UPDATE, 0x01); + + driver_buffers[index].pwm_buffer_dirty = false; + } +} + +void is31fl3236_update_led_control_registers(uint8_t index) { + if (driver_buffers[index].led_control_buffer_dirty) { + for (uint8_t i = 0; i < IS31FL3236_LED_CONTROL_REGISTER_COUNT; i++) { + is31fl3236_write_register(index, IS31FL3236_REG_LED_CONTROL + i, driver_buffers[index].led_control_buffer[i]); + } + + driver_buffers[index].led_control_buffer_dirty = false; + } +} + +void is31fl3236_flush(void) { + for (uint8_t i = 0; i < IS31FL3236_DRIVER_COUNT; i++) { + is31fl3236_update_pwm_buffers(i); + } +} diff --git a/drivers/led/issi/is31fl3236-mono.h b/drivers/led/issi/is31fl3236-mono.h new file mode 100644 index 0000000000..90735bb1aa --- /dev/null +++ b/drivers/led/issi/is31fl3236-mono.h @@ -0,0 +1,101 @@ +// Copyright 2024 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include "progmem.h" +#include "util.h" + +#define IS31FL3236_REG_SHUTDOWN 0x00 +#define IS31FL3236_REG_PWM 0x01 +#define IS31FL3236_REG_UPDATE 0x25 +#define IS31FL3236_REG_LED_CONTROL 0x26 +#define IS31FL3236_REG_GLOBAL_CONTROL 0x4A +#define IS31FL3236_REG_PWM_FREQUENCY 0x4B +#define IS31FL3236_REG_RESET 0x4F + +#define IS31FL3236_I2C_ADDRESS_GND 0x3C +#define IS31FL3236_I2C_ADDRESS_SCL 0x3D +#define IS31FL3236_I2C_ADDRESS_SDA 0x3E +#define IS31FL3236_I2C_ADDRESS_VCC 0x3F + +#if defined(LED_MATRIX_IS31FL3236) +# define IS31FL3236_LED_COUNT LED_MATRIX_LED_COUNT +#endif + +#if defined(IS31FL3236_I2C_ADDRESS_4) +# define IS31FL3236_DRIVER_COUNT 4 +#elif defined(IS31FL3236_I2C_ADDRESS_3) +# define IS31FL3236_DRIVER_COUNT 3 +#elif defined(IS31FL3236_I2C_ADDRESS_2) +# define IS31FL3236_DRIVER_COUNT 2 +#elif defined(IS31FL3236_I2C_ADDRESS_1) +# define IS31FL3236_DRIVER_COUNT 1 +#endif + +typedef struct is31fl3236_led_t { + uint8_t driver : 2; + uint8_t v; +} PACKED is31fl3236_led_t; + +extern const is31fl3236_led_t PROGMEM g_is31fl3236_leds[IS31FL3236_LED_COUNT]; + +void is31fl3236_init_drivers(void); + +void is31fl3236_init(uint8_t index); + +void is31fl3236_write_register(uint8_t index, uint8_t reg, uint8_t data); + +void is31fl3236_set_value(int index, uint8_t value); + +void is31fl3236_set_value_all(uint8_t value); + +void is31fl3236_set_led_control_register(uint8_t index, bool value); + +void is31fl3236_update_pwm_buffers(uint8_t index); + +void is31fl3236_update_led_control_registers(uint8_t index); + +void is31fl3236_flush(void); + +#define IS31FL3236_PWM_FREQUENCY_3K_HZ 0b0 +#define IS31FL3236_PWM_FREQUENCY_22K_HZ 0b1 + +#define OUT1 0x00 +#define OUT2 0x01 +#define OUT3 0x02 +#define OUT4 0x03 +#define OUT5 0x04 +#define OUT6 0x05 +#define OUT7 0x06 +#define OUT8 0x07 +#define OUT9 0x08 +#define OUT10 0x09 +#define OUT11 0x0A +#define OUT12 0x0B +#define OUT13 0x0C +#define OUT14 0x0D +#define OUT15 0x0E +#define OUT16 0x0F +#define OUT17 0x10 +#define OUT18 0x11 +#define OUT19 0x12 +#define OUT20 0x13 +#define OUT21 0x14 +#define OUT22 0x15 +#define OUT23 0x16 +#define OUT24 0x17 +#define OUT25 0x18 +#define OUT26 0x19 +#define OUT27 0x1A +#define OUT28 0x1B +#define OUT29 0x1C +#define OUT30 0x1D +#define OUT31 0x1E +#define OUT32 0x1F +#define OUT33 0x20 +#define OUT34 0x21 +#define OUT35 0x22 +#define OUT36 0x23 diff --git a/drivers/led/issi/is31fl3236.c b/drivers/led/issi/is31fl3236.c new file mode 100644 index 0000000000..b8aa9c34b1 --- /dev/null +++ b/drivers/led/issi/is31fl3236.c @@ -0,0 +1,172 @@ +// Copyright 2024 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "is31fl3236.h" +#include "i2c_master.h" +#include "gpio.h" + +#define IS31FL3236_PWM_REGISTER_COUNT 36 +#define IS31FL3236_LED_CONTROL_REGISTER_COUNT 36 + +#ifndef IS31FL3236_I2C_TIMEOUT +# define IS31FL3236_I2C_TIMEOUT 100 +#endif + +#ifndef IS31FL3236_I2C_PERSISTENCE +# define IS31FL3236_I2C_PERSISTENCE 0 +#endif + +#ifndef IS31FL3236_PWM_FREQUENCY +# define IS31FL3236_PWM_FREQUENCY IS31FL3236_PWM_FREQUENCY_3K_HZ // OFS - IS31FL3236A only +#endif + +const uint8_t i2c_addresses[IS31FL3236_DRIVER_COUNT] = { + IS31FL3236_I2C_ADDRESS_1, +#ifdef IS31FL3236_I2C_ADDRESS_2 + IS31FL3236_I2C_ADDRESS_2, +# ifdef IS31FL3236_I2C_ADDRESS_3 + IS31FL3236_I2C_ADDRESS_3, +# ifdef IS31FL3236_I2C_ADDRESS_4 + IS31FL3236_I2C_ADDRESS_4, +# endif +# endif +#endif +}; + +typedef struct is31fl3236_driver_t { + uint8_t pwm_buffer[IS31FL3236_PWM_REGISTER_COUNT]; + bool pwm_buffer_dirty; + uint8_t led_control_buffer[IS31FL3236_LED_CONTROL_REGISTER_COUNT]; + bool led_control_buffer_dirty; +} PACKED is31fl3236_driver_t; + +is31fl3236_driver_t driver_buffers[IS31FL3236_DRIVER_COUNT] = {{ + .pwm_buffer = {0}, + .pwm_buffer_dirty = false, + .led_control_buffer = {0}, + .led_control_buffer_dirty = false, +}}; + +void is31fl3236_write_register(uint8_t index, uint8_t reg, uint8_t data) { +#if IS31FL3236_I2C_PERSISTENCE > 0 + for (uint8_t i = 0; i < IS31FL3236_I2C_PERSISTENCE; i++) { + if (i2c_write_register(i2c_addresses[index] << 1, reg, &data, 1, IS31FL3236_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + } +#else + i2c_write_register(i2c_addresses[index] << 1, reg, &data, 1, IS31FL3236_I2C_TIMEOUT); +#endif +} + +void is31fl3236_write_pwm_buffer(uint8_t index) { +#if IS31FL3236_I2C_PERSISTENCE > 0 + for (uint8_t i = 0; i < IS31FL3236_I2C_PERSISTENCE; i++) { + if (i2c_write_register(i2c_addresses[index] << 1, IS31FL3236_REG_PWM, driver_buffers[index].pwm_buffer, 36, IS31FL3236_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + } +#else + i2c_write_register(i2c_addresses[index] << 1, IS31FL3236_REG_PWM, driver_buffers[index].pwm_buffer, 36, IS31FL3236_I2C_TIMEOUT); +#endif +} + +void is31fl3236_init_drivers(void) { + i2c_init(); + +#if defined(IS31FL3236_SDB_PIN) + gpio_set_pin_output(IS31FL3236_SDB_PIN); + gpio_write_pin_high(IS31FL3236_SDB_PIN); +#endif + + for (uint8_t i = 0; i < IS31FL3236_DRIVER_COUNT; i++) { + is31fl3236_init(i); + } + + for (uint8_t i = 0; i < IS31FL3236_LED_COUNT; i++) { + is31fl3236_set_led_control_register(i, true, true, true); + } + + for (uint8_t i = 0; i < IS31FL3236_DRIVER_COUNT; i++) { + is31fl3236_update_led_control_registers(i); + } +} + +void is31fl3236_init(uint8_t index) { + // In case we ever want to reinitialize (?) + is31fl3236_write_register(index, IS31FL3236_REG_RESET, 0x00); + + // Turn off software shutdown + is31fl3236_write_register(index, IS31FL3236_REG_SHUTDOWN, 0x01); + + // Set all PWM values to zero + for (uint8_t i = 0; i < IS31FL3236_PWM_REGISTER_COUNT; i++) { + is31fl3236_write_register(index, IS31FL3236_REG_PWM + i, 0x00); + } + + // turn off all LEDs in the LED control register + for (uint8_t i = 0; i < IS31FL3236_LED_CONTROL_REGISTER_COUNT; i++) { + is31fl3236_write_register(index, IS31FL3236_REG_LED_CONTROL + i, 0x00); + } + + // Set PWM frequency (IS31FL3236A) + is31fl3236_write_register(index, IS31FL3236_REG_PWM_FREQUENCY, IS31FL3236_PWM_FREQUENCY); + + // Load PWM registers and LED Control register data + is31fl3236_write_register(index, IS31FL3236_REG_UPDATE, 0x01); +} + +void is31fl3236_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { + is31fl3236_led_t led; + + if (index < IS31FL3236_LED_COUNT) { + memcpy_P(&led, (&g_is31fl3236_leds[index]), sizeof(led)); + + if (driver_buffers[led.driver].pwm_buffer[led.r] == red && driver_buffers[led.driver].pwm_buffer[led.g] == green && driver_buffers[led.driver].pwm_buffer[led.b] == blue) { + return; + } + + driver_buffers[led.driver].pwm_buffer[led.r] = red; + driver_buffers[led.driver].pwm_buffer[led.g] = green; + driver_buffers[led.driver].pwm_buffer[led.b] = blue; + driver_buffers[led.driver].pwm_buffer_dirty = true; + } +} + +void is31fl3236_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { + for (uint8_t i = 0; i < IS31FL3236_LED_COUNT; i++) { + is31fl3236_set_color(i, red, green, blue); + } +} + +void is31fl3236_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { + is31fl3236_led_t led; + memcpy_P(&led, (&g_is31fl3236_leds[index]), sizeof(led)); + + driver_buffers[led.driver].led_control_buffer[led.r] = red ? 0x01 : 0x00; + driver_buffers[led.driver].led_control_buffer[led.g] = green ? 0x01 : 0x00; + driver_buffers[led.driver].led_control_buffer[led.b] = blue ? 0x01 : 0x00; + driver_buffers[led.driver].led_control_buffer_dirty = true; +} + +void is31fl3236_update_pwm_buffers(uint8_t index) { + if (driver_buffers[index].pwm_buffer_dirty) { + is31fl3236_write_pwm_buffer(index); + // Load PWM registers and LED Control register data + is31fl3236_write_register(index, IS31FL3236_REG_UPDATE, 0x01); + + driver_buffers[index].pwm_buffer_dirty = false; + } +} + +void is31fl3236_update_led_control_registers(uint8_t index) { + if (driver_buffers[index].led_control_buffer_dirty) { + for (uint8_t i = 0; i < IS31FL3236_LED_CONTROL_REGISTER_COUNT; i++) { + is31fl3236_write_register(index, IS31FL3236_REG_LED_CONTROL + i, driver_buffers[index].led_control_buffer[i]); + } + + driver_buffers[index].led_control_buffer_dirty = false; + } +} + +void is31fl3236_flush(void) { + for (uint8_t i = 0; i < IS31FL3236_DRIVER_COUNT; i++) { + is31fl3236_update_pwm_buffers(i); + } +} diff --git a/drivers/led/issi/is31fl3236.h b/drivers/led/issi/is31fl3236.h new file mode 100644 index 0000000000..1e490796b2 --- /dev/null +++ b/drivers/led/issi/is31fl3236.h @@ -0,0 +1,103 @@ +// Copyright 2024 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include "progmem.h" +#include "util.h" + +#define IS31FL3236_REG_SHUTDOWN 0x00 +#define IS31FL3236_REG_PWM 0x01 +#define IS31FL3236_REG_UPDATE 0x25 +#define IS31FL3236_REG_LED_CONTROL 0x26 +#define IS31FL3236_REG_GLOBAL_CONTROL 0x4A +#define IS31FL3236_REG_PWM_FREQUENCY 0x4B +#define IS31FL3236_REG_RESET 0x4F + +#define IS31FL3236_I2C_ADDRESS_GND 0x3C +#define IS31FL3236_I2C_ADDRESS_SCL 0x3D +#define IS31FL3236_I2C_ADDRESS_SDA 0x3E +#define IS31FL3236_I2C_ADDRESS_VCC 0x3F + +#if defined(RGB_MATRIX_IS31FL3236) +# define IS31FL3236_LED_COUNT RGB_MATRIX_LED_COUNT +#endif + +#if defined(IS31FL3236_I2C_ADDRESS_4) +# define IS31FL3236_DRIVER_COUNT 4 +#elif defined(IS31FL3236_I2C_ADDRESS_3) +# define IS31FL3236_DRIVER_COUNT 3 +#elif defined(IS31FL3236_I2C_ADDRESS_2) +# define IS31FL3236_DRIVER_COUNT 2 +#elif defined(IS31FL3236_I2C_ADDRESS_1) +# define IS31FL3236_DRIVER_COUNT 1 +#endif + +typedef struct is31fl3236_led_t { + uint8_t driver : 2; + uint8_t r; + uint8_t g; + uint8_t b; +} PACKED is31fl3236_led_t; + +extern const is31fl3236_led_t PROGMEM g_is31fl3236_leds[IS31FL3236_LED_COUNT]; + +void is31fl3236_init_drivers(void); + +void is31fl3236_init(uint8_t index); + +void is31fl3236_write_register(uint8_t index, uint8_t reg, uint8_t data); + +void is31fl3236_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); + +void is31fl3236_set_color_all(uint8_t red, uint8_t green, uint8_t blue); + +void is31fl3236_set_led_control_register(uint8_t index, bool red, bool green, bool blue); + +void is31fl3236_update_pwm_buffers(uint8_t index); + +void is31fl3236_update_led_control_registers(uint8_t index); + +void is31fl3236_flush(void); + +#define IS31FL3236_PWM_FREQUENCY_3K_HZ 0b0 +#define IS31FL3236_PWM_FREQUENCY_22K_HZ 0b1 + +#define OUT1 0x00 +#define OUT2 0x01 +#define OUT3 0x02 +#define OUT4 0x03 +#define OUT5 0x04 +#define OUT6 0x05 +#define OUT7 0x06 +#define OUT8 0x07 +#define OUT9 0x08 +#define OUT10 0x09 +#define OUT11 0x0A +#define OUT12 0x0B +#define OUT13 0x0C +#define OUT14 0x0D +#define OUT15 0x0E +#define OUT16 0x0F +#define OUT17 0x10 +#define OUT18 0x11 +#define OUT19 0x12 +#define OUT20 0x13 +#define OUT21 0x14 +#define OUT22 0x15 +#define OUT23 0x16 +#define OUT24 0x17 +#define OUT25 0x18 +#define OUT26 0x19 +#define OUT27 0x1A +#define OUT28 0x1B +#define OUT29 0x1C +#define OUT30 0x1D +#define OUT31 0x1E +#define OUT32 0x1F +#define OUT33 0x20 +#define OUT34 0x21 +#define OUT35 0x22 +#define OUT36 0x23 diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 2e80bd0375..bd4852e939 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c @@ -33,6 +33,14 @@ const led_matrix_driver_t led_matrix_driver = { .set_value_all = is31fl3218_set_value_all, }; +#elif defined(LED_MATRIX_IS31FL3236) +const led_matrix_driver_t led_matrix_driver = { + .init = is31fl3236_init_drivers, + .flush = is31fl3236_flush, + .set_value = is31fl3236_set_value, + .set_value_all = is31fl3236_set_value_all, +}; + #elif defined(LED_MATRIX_IS31FL3729) const led_matrix_driver_t led_matrix_driver = { .init = is31fl3729_init_drivers, diff --git a/quantum/led_matrix/led_matrix_drivers.h b/quantum/led_matrix/led_matrix_drivers.h index a961784a62..60354e4677 100644 --- a/quantum/led_matrix/led_matrix_drivers.h +++ b/quantum/led_matrix/led_matrix_drivers.h @@ -7,6 +7,8 @@ #if defined(LED_MATRIX_IS31FL3218) # include "is31fl3218-mono.h" +#elif defined(LED_MATRIX_IS31FL3236) +# include "is31fl3236-mono.h" #elif defined(LED_MATRIX_IS31FL3729) # include "is31fl3729-mono.h" #elif defined(LED_MATRIX_IS31FL3731) diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 95d1e884f0..729dcdb439 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -36,6 +36,14 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color_all = is31fl3218_set_color_all, }; +#elif defined(RGB_MATRIX_IS31FL3236) +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = is31fl3236_init_drivers, + .flush = is31fl3236_flush, + .set_color = is31fl3236_set_color, + .set_color_all = is31fl3236_set_color_all, +}; + #elif defined(RGB_MATRIX_IS31FL3729) const rgb_matrix_driver_t rgb_matrix_driver = { .init = is31fl3729_init_drivers, diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.h b/quantum/rgb_matrix/rgb_matrix_drivers.h index a24cb03a18..1ea5f0817d 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.h +++ b/quantum/rgb_matrix/rgb_matrix_drivers.h @@ -7,6 +7,8 @@ #if defined(RGB_MATRIX_AW20216S) # include "aw20216s.h" +#elif defined(RGB_MATRIX_IS31FL3236) +# include "is31fl3236.h" #elif defined(RGB_MATRIX_IS31FL3218) # include "is31fl3218.h" #elif defined(RGB_MATRIX_IS31FL3729) -- cgit v1.2.3 From 16cca527a6b46c2aa365428d7d1e214509068c4a Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Wed, 24 Apr 2024 19:33:52 +0100 Subject: Fix WAIT_FOR_USB handling (#23598) --- data/mappings/info_rules.hjson | 2 +- data/schemas/keyboard.jsonschema | 2 +- docs/config_options.md | 2 +- docs/ja/config_options.md | 2 +- docs/reference_info_json.md | 2 +- keyboards/converter/hp_46010a/keyboard.json | 3 ++- keyboards/converter/hp_46010a/rules.mk | 1 - keyboards/geekboards/macropad_v2/config.h | 2 -- keyboards/geekboards/macropad_v2/keyboard.json | 3 ++- keyboards/ristretto/keyboard.json | 3 ++- keyboards/ristretto/rules.mk | 1 - tmk_core/protocol.mk | 4 ++++ tmk_core/protocol/chibios/chibios.c | 7 ++++++- tmk_core/protocol/lufa/lufa.c | 7 ++++++- 14 files changed, 27 insertions(+), 14 deletions(-) delete mode 100644 keyboards/ristretto/rules.mk (limited to 'docs/reference_info_json.md') diff --git a/data/mappings/info_rules.hjson b/data/mappings/info_rules.hjson index 35e2e8dfc0..5d08be2fc1 100644 --- a/data/mappings/info_rules.hjson +++ b/data/mappings/info_rules.hjson @@ -44,7 +44,7 @@ "SPLIT_TRANSPORT": {"info_key": "split.transport.protocol", "to_c": false}, "STENO_ENABLE": {"info_key": "stenography.enabled", "value_type": "bool"}, "STENO_PROTOCOL": {"info_key": "stenography.protocol"}, - "WAIT_FOR_USB": {"info_key": "usb.wait_for", "value_type": "bool"}, + "USB_WAIT_FOR_ENUMERATION": {"info_key": "usb.wait_for_enumeration", "value_type": "bool"}, "WEAR_LEVELING_DRIVER": {"info_key": "eeprom.wear_leveling.driver"}, "WS2812_DRIVER": {"info_key": "ws2812.driver"}, diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index f3116fd271..24f7fec9ab 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -894,7 +894,7 @@ } }, "suspend_wakeup_delay": {"$ref": "qmk.definitions.v1#/unsigned_int"}, - "wait_for": {"type": "boolean"} + "wait_for_enumeration": {"type": "boolean"} } }, "qmk": { diff --git a/docs/config_options.md b/docs/config_options.md index 045d9c0747..fca80e54fd 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -446,7 +446,7 @@ Use these to enable or disable building certain features. The more you have enab * Allows replacing the standard matrix scanning routine with a custom one. * `DEBOUNCE_TYPE` * Allows replacing the standard key debouncing routine with an alternative or custom one. -* `WAIT_FOR_USB` +* `USB_WAIT_FOR_ENUMERATION` * Forces the keyboard to wait for a USB connection to be established before it starts up * `NO_USB_STARTUP_CHECK` * Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master. diff --git a/docs/ja/config_options.md b/docs/ja/config_options.md index a349081d6a..6cc1b6bfcd 100644 --- a/docs/ja/config_options.md +++ b/docs/ja/config_options.md @@ -378,7 +378,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。 * 標準マトリックス走査ルーチンを独自のものに置き換えることができます。 * `DEBOUNCE_TYPE` * 標準キーデバウンスルーチンを代替または独自のものに置き換えることができます。 -* `WAIT_FOR_USB` +* `USB_WAIT_FOR_ENUMERATION` * キーボードが起動する前に、USB 接続が確立されるのをキーボードに待機させます * `NO_USB_STARTUP_CHECK` * キーボードの起動後の usb サスペンドチェックを無効にします。通常、キーボードはタスクが実行される前にホストがウェイク アップするのを待ちます。分割キーボードは半分はウェイクアップコールを取得できませんが、マスタにコマンドを送信する必要があるため、役に立ちます。 diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md index e6bc34e79e..6f0b84c414 100644 --- a/docs/reference_info_json.md +++ b/docs/reference_info_json.md @@ -833,7 +833,7 @@ Configures the [Stenography](feature_stenography.md) feature. * `suspend_wakeup_delay` * The amount of time to wait after sending a wakeup packet, in milliseconds. * Default: `0` (disabled) - * `wait_for` + * `wait_for_enumeration` * Force the keyboard to wait for USB enumeration before starting up. * Default: `false` diff --git a/keyboards/converter/hp_46010a/keyboard.json b/keyboards/converter/hp_46010a/keyboard.json index 0296bda5e9..4519306981 100644 --- a/keyboards/converter/hp_46010a/keyboard.json +++ b/keyboards/converter/hp_46010a/keyboard.json @@ -6,7 +6,8 @@ "usb": { "vid": "0xFEED", "pid": "0x6060", - "device_version": "0.0.1" + "device_version": "0.0.1", + "wait_for_enumeration": true }, "processor": "atmega32u4", "bootloader": "halfkay", diff --git a/keyboards/converter/hp_46010a/rules.mk b/keyboards/converter/hp_46010a/rules.mk index 3c6124d20a..857395fb40 100644 --- a/keyboards/converter/hp_46010a/rules.mk +++ b/keyboards/converter/hp_46010a/rules.mk @@ -1,4 +1,3 @@ -WAIT_FOR_USB = yes CUSTOM_MATRIX = yes SRC = matrix.c diff --git a/keyboards/geekboards/macropad_v2/config.h b/keyboards/geekboards/macropad_v2/config.h index dca98f0c95..e452c886f6 100644 --- a/keyboards/geekboards/macropad_v2/config.h +++ b/keyboards/geekboards/macropad_v2/config.h @@ -21,5 +21,3 @@ #define WS2812_PWM_PAL_MODE 1 #define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM3 #define WS2812_PWM_DMA_CHANNEL 3 - -#define WAIT_FOR_USB diff --git a/keyboards/geekboards/macropad_v2/keyboard.json b/keyboards/geekboards/macropad_v2/keyboard.json index 035a83c157..54d779570a 100644 --- a/keyboards/geekboards/macropad_v2/keyboard.json +++ b/keyboards/geekboards/macropad_v2/keyboard.json @@ -6,7 +6,8 @@ "usb": { "vid": "0x0483", "pid": "0xA372", - "device_version": "0.0.2" + "device_version": "0.0.2", + "wait_for_enumeration": true }, "qmk": { "tap_keycode_delay": 10 diff --git a/keyboards/ristretto/keyboard.json b/keyboards/ristretto/keyboard.json index b28f3c1dc1..e8e812b7d2 100644 --- a/keyboards/ristretto/keyboard.json +++ b/keyboards/ristretto/keyboard.json @@ -6,7 +6,8 @@ "usb": { "vid": "0x666B", "pid": "0x7273", - "device_version": "0.0.1" + "device_version": "0.0.1", + "wait_for_enumeration": true }, "features": { "bootmagic": false, diff --git a/keyboards/ristretto/rules.mk b/keyboards/ristretto/rules.mk deleted file mode 100644 index 908e5e972e..0000000000 --- a/keyboards/ristretto/rules.mk +++ /dev/null @@ -1 +0,0 @@ -WAIT_FOR_USB = yes diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk index fd5342d637..796b4e8787 100644 --- a/tmk_core/protocol.mk +++ b/tmk_core/protocol.mk @@ -66,6 +66,10 @@ ifeq ($(strip $(NO_USB_STARTUP_CHECK)), yes) OPT_DEFS += -DNO_USB_STARTUP_CHECK endif +ifeq ($(strip $(USB_WAIT_FOR_ENUMERATION)), yes) + OPT_DEFS += -DUSB_WAIT_FOR_ENUMERATION +endif + ifeq ($(strip $(JOYSTICK_SHARED_EP)), yes) OPT_DEFS += -DJOYSTICK_SHARED_EP SHARED_EP_ENABLE = yes diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index a02097785f..a249af8d38 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c @@ -51,6 +51,11 @@ #define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED (2U) +#ifdef WAIT_FOR_USB +// TODO: Remove backwards compatibility with old define +# define USB_WAIT_FOR_ENUMERATION +#endif + /* ------------------------- * TMK host driver defs * ------------------------- @@ -143,7 +148,7 @@ void protocol_pre_init(void) { /* Wait until USB is active */ while (true) { -#if defined(WAIT_FOR_USB) +#if defined(USB_WAIT_FOR_ENUMERATION) if (USB_DRIVER.state == USB_ACTIVE) { driver = &chibios_driver; break; diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index d6f0c69b6b..2142b04460 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -67,6 +67,11 @@ # include "raw_hid.h" #endif +#ifdef WAIT_FOR_USB +// TODO: Remove backwards compatibility with old define +# define USB_WAIT_FOR_ENUMERATION +#endif + uint8_t keyboard_idle = 0; /* 0: Boot Protocol, 1: Report Protocol(default) */ uint8_t keyboard_protocol = 1; @@ -807,7 +812,7 @@ void protocol_pre_init(void) { /* wait for USB startup & debug output */ -#ifdef WAIT_FOR_USB +#ifdef USB_WAIT_FOR_ENUMERATION while (USB_DeviceState != DEVICE_STATE_Configured) { # if defined(INTERRUPT_CONTROL_ENDPOINT) ; -- cgit v1.2.3 From d333a25868039292a327a141dc90c0015b7fd017 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 26 Apr 2024 05:41:22 +0100 Subject: Add audio driver to keyboard.json schema (#23616) --- data/mappings/info_rules.hjson | 1 + data/schemas/keyboard.jsonschema | 4 ++++ docs/reference_info_json.md | 2 ++ keyboards/adafruit/macropad/keyboard.json | 1 + keyboards/adafruit/macropad/rules.mk | 1 - keyboards/arrowmechanics/wings/keyboard.json | 3 +++ keyboards/arrowmechanics/wings/rules.mk | 1 - keyboards/boardsource/equals/48/keyboard.json | 3 +++ keyboards/boardsource/equals/48/rules.mk | 1 - keyboards/boardsource/equals/60/keyboard.json | 3 +++ keyboards/boardsource/equals/60/rules.mk | 1 - keyboards/boardsource/unicorne/keyboard.json | 3 +++ keyboards/boardsource/unicorne/rules.mk | 1 - keyboards/custommk/cmk11/keyboard.json | 3 +++ keyboards/custommk/cmk11/rules.mk | 1 - keyboards/custommk/ergostrafer/keyboard.json | 3 +++ keyboards/custommk/ergostrafer/rules.mk | 1 - keyboards/custommk/evo70_r2/keyboard.json | 3 +++ keyboards/custommk/evo70_r2/rules.mk | 2 -- keyboards/handwired/macroboard/f411/keyboard.json | 3 +++ keyboards/handwired/macroboard/f411/rules.mk | 1 - keyboards/handwired/tractyl_manuform/5x6_right/f303/keyboard.json | 3 +++ keyboards/handwired/tractyl_manuform/5x6_right/f303/rules.mk | 1 - keyboards/handwired/tractyl_manuform/5x6_right/f411/keyboard.json | 3 +++ keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk | 1 - keyboards/nack/keyboard.json | 3 +++ keyboards/nack/rules.mk | 1 - keyboards/planck/ez/info.json | 3 +++ keyboards/planck/ez/rules.mk | 2 -- keyboards/quokka/keyboard.json | 3 +++ keyboards/quokka/rules.mk | 1 - keyboards/rgbkb/sol3/rev1/keyboard.json | 3 +++ keyboards/rgbkb/sol3/rules.mk | 1 - keyboards/tzarc/djinn/info.json | 3 +++ keyboards/tzarc/djinn/rules.mk | 2 -- keyboards/yanghu/unicorne/info.json | 3 +++ keyboards/yanghu/unicorne/rules.mk | 2 -- keyboards/zsa/moonlander/keyboard.json | 3 +++ keyboards/zsa/moonlander/rules.mk | 1 - 39 files changed, 59 insertions(+), 22 deletions(-) delete mode 100644 keyboards/custommk/cmk11/rules.mk delete mode 100644 keyboards/custommk/ergostrafer/rules.mk delete mode 100644 keyboards/handwired/macroboard/f411/rules.mk delete mode 100644 keyboards/nack/rules.mk (limited to 'docs/reference_info_json.md') diff --git a/data/mappings/info_rules.hjson b/data/mappings/info_rules.hjson index 5d08be2fc1..97611bcf58 100644 --- a/data/mappings/info_rules.hjson +++ b/data/mappings/info_rules.hjson @@ -11,6 +11,7 @@ // invalid: Default `false`. Set to `true` to generate errors when a value exists // replace_with: use with a key marked deprecated or invalid to designate a replacement + "AUDIO_DRIVER": {"info_key": "audio.driver"}, "BACKLIGHT_DRIVER": {"info_key": "backlight.driver"}, "BLUETOOTH_DRIVER": {"info_key": "bluetooth.driver"}, "BOARD": {"info_key": "board"}, diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 24f7fec9ab..585c64777f 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -133,6 +133,10 @@ "clicky": {"type": "boolean"} } }, + "driver": { + "type": "string", + "enum": ["dac_additive", "dac_basic", "pwm_software", "pwm_hardware"] + }, "macro_beep": {"type": "boolean"}, "pins": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}, "power_control": { diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md index 6f0b84c414..d1dc5d3bea 100644 --- a/docs/reference_info_json.md +++ b/docs/reference_info_json.md @@ -118,6 +118,8 @@ Configures the [Audio](feature_audio.md) feature. * `clicky` * The default audio clicky enabled state. * Default: `true` + * `driver` + * The driver to use. Must be one of `dac_additive`, `dac_basic`, `pwm_software`, `pwm_hardware`. * `macro_beep` * Play a short beep for `\a` (ASCII `BEL`) characters in Send String macros. * Default: `false` diff --git a/keyboards/adafruit/macropad/keyboard.json b/keyboards/adafruit/macropad/keyboard.json index 86601c0167..94f2673f98 100644 --- a/keyboards/adafruit/macropad/keyboard.json +++ b/keyboards/adafruit/macropad/keyboard.json @@ -19,6 +19,7 @@ "oled": true }, "audio": { + "driver": "pwm_hardware", "power_control": { "pin": "GP14" } diff --git a/keyboards/adafruit/macropad/rules.mk b/keyboards/adafruit/macropad/rules.mk index 1630b74cea..d7ca5b3b90 100644 --- a/keyboards/adafruit/macropad/rules.mk +++ b/keyboards/adafruit/macropad/rules.mk @@ -1,2 +1 @@ -AUDIO_DRIVER = pwm_hardware OLED_TRANSPORT = spi diff --git a/keyboards/arrowmechanics/wings/keyboard.json b/keyboards/arrowmechanics/wings/keyboard.json index fca38314c9..0f1e6696f7 100644 --- a/keyboards/arrowmechanics/wings/keyboard.json +++ b/keyboards/arrowmechanics/wings/keyboard.json @@ -17,6 +17,9 @@ "mousekey": true, "rgb_matrix": true }, + "audio": { + "driver": "pwm_hardware" + }, "matrix_pins": { "cols": ["GP8", "GP9", "GP10", "GP11", "GP12", "GP13", "GP14", "GP15", "GP16"], "rows": ["GP22", "GP21", "GP20", "GP19", "GP18", "GP17"] diff --git a/keyboards/arrowmechanics/wings/rules.mk b/keyboards/arrowmechanics/wings/rules.mk index 22ce54190c..161ec22b16 100644 --- a/keyboards/arrowmechanics/wings/rules.mk +++ b/keyboards/arrowmechanics/wings/rules.mk @@ -1,2 +1 @@ SERIAL_DRIVER = vendor -AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/boardsource/equals/48/keyboard.json b/keyboards/boardsource/equals/48/keyboard.json index 5b63355931..13bc0d80ab 100644 --- a/keyboards/boardsource/equals/48/keyboard.json +++ b/keyboards/boardsource/equals/48/keyboard.json @@ -10,6 +10,9 @@ "cols": ["GP0", "GP1", "GP2", "GP3", "GP4", "GP5", "GP6", "GP7", "GP8", "GP9", "GP10", "GP11"], "rows": ["GP12", "GP13", "GP16", "GP17"] }, + "audio": { + "driver": "pwm_hardware" + }, "ws2812": { "driver": "vendor", "pin": "GP21" diff --git a/keyboards/boardsource/equals/48/rules.mk b/keyboards/boardsource/equals/48/rules.mk index 2f75fc139f..ec94c118ee 100644 --- a/keyboards/boardsource/equals/48/rules.mk +++ b/keyboards/boardsource/equals/48/rules.mk @@ -1,2 +1 @@ -AUDIO_DRIVER = pwm_hardware QUANTUM_PAINTER_DRIVERS += st7735_spi diff --git a/keyboards/boardsource/equals/60/keyboard.json b/keyboards/boardsource/equals/60/keyboard.json index 3bc1f49be3..63cb4717e5 100644 --- a/keyboards/boardsource/equals/60/keyboard.json +++ b/keyboards/boardsource/equals/60/keyboard.json @@ -10,6 +10,9 @@ "cols": ["GP0", "GP1", "GP2", "GP3", "GP4", "GP5", "GP6", "GP7", "GP8", "GP9", "GP10", "GP11"], "rows": ["GP12", "GP13", "GP16", "GP17", "GP18"] }, + "audio": { + "driver": "pwm_hardware" + }, "ws2812": { "driver": "vendor", "pin": "GP21" diff --git a/keyboards/boardsource/equals/60/rules.mk b/keyboards/boardsource/equals/60/rules.mk index 2f75fc139f..ec94c118ee 100644 --- a/keyboards/boardsource/equals/60/rules.mk +++ b/keyboards/boardsource/equals/60/rules.mk @@ -1,2 +1 @@ -AUDIO_DRIVER = pwm_hardware QUANTUM_PAINTER_DRIVERS += st7735_spi diff --git a/keyboards/boardsource/unicorne/keyboard.json b/keyboards/boardsource/unicorne/keyboard.json index 6afbcc044c..4fb63de9e3 100644 --- a/keyboards/boardsource/unicorne/keyboard.json +++ b/keyboards/boardsource/unicorne/keyboard.json @@ -32,6 +32,9 @@ "pid": "0x7563", "vid": "0x4273" }, + "audio": { + "driver": "pwm_hardware" + }, "ws2812": { "driver": "vendor", "pin": "GP29" diff --git a/keyboards/boardsource/unicorne/rules.mk b/keyboards/boardsource/unicorne/rules.mk index d123b2a2fa..48b30dcd51 100644 --- a/keyboards/boardsource/unicorne/rules.mk +++ b/keyboards/boardsource/unicorne/rules.mk @@ -1,3 +1,2 @@ SERIAL_DRIVER = vendor -AUDIO_DRIVER = pwm_hardware POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/custommk/cmk11/keyboard.json b/keyboards/custommk/cmk11/keyboard.json index d831351aa7..9a853063ba 100644 --- a/keyboards/custommk/cmk11/keyboard.json +++ b/keyboards/custommk/cmk11/keyboard.json @@ -18,6 +18,9 @@ "nkro": true, "rgb_matrix": true }, + "audio": { + "driver": "pwm_hardware" + }, "matrix_pins": { "cols": ["B0", "A1", "A2", "A3", "A6", "B10"], "rows": ["A5", "A4"] diff --git a/keyboards/custommk/cmk11/rules.mk b/keyboards/custommk/cmk11/rules.mk deleted file mode 100644 index 72f75f4367..0000000000 --- a/keyboards/custommk/cmk11/rules.mk +++ /dev/null @@ -1 +0,0 @@ -AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/custommk/ergostrafer/keyboard.json b/keyboards/custommk/ergostrafer/keyboard.json index a1283114c8..4f23417415 100644 --- a/keyboards/custommk/ergostrafer/keyboard.json +++ b/keyboards/custommk/ergostrafer/keyboard.json @@ -17,6 +17,9 @@ "encoder": true, "audio": true }, + "audio": { + "driver": "pwm_hardware" + }, "matrix_pins": { "cols": ["B0", "A1", "A2", "A3", "A6", "B6", "B10"], "rows": ["C13", "C14", "C15", "B1", "A7", "A5"] diff --git a/keyboards/custommk/ergostrafer/rules.mk b/keyboards/custommk/ergostrafer/rules.mk deleted file mode 100644 index 72f75f4367..0000000000 --- a/keyboards/custommk/ergostrafer/rules.mk +++ /dev/null @@ -1 +0,0 @@ -AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/custommk/evo70_r2/keyboard.json b/keyboards/custommk/evo70_r2/keyboard.json index dea56ed257..5f10d6705d 100644 --- a/keyboards/custommk/evo70_r2/keyboard.json +++ b/keyboards/custommk/evo70_r2/keyboard.json @@ -51,6 +51,9 @@ "twinkle": true } }, + "audio": { + "driver": "pwm_hardware" + }, "ws2812": { "driver": "pwm", "pin": "A10" diff --git a/keyboards/custommk/evo70_r2/rules.mk b/keyboards/custommk/evo70_r2/rules.mk index 193fe4f1a4..3961343ce4 100644 --- a/keyboards/custommk/evo70_r2/rules.mk +++ b/keyboards/custommk/evo70_r2/rules.mk @@ -1,5 +1,3 @@ -AUDIO_DRIVER = pwm_hardware - # project specific files SRC += matrix.c diff --git a/keyboards/handwired/macroboard/f411/keyboard.json b/keyboards/handwired/macroboard/f411/keyboard.json index 03a8aadc1b..8b1155d774 100644 --- a/keyboards/handwired/macroboard/f411/keyboard.json +++ b/keyboards/handwired/macroboard/f411/keyboard.json @@ -9,6 +9,9 @@ "rows": ["A15", "B3", "B4", "B5", "B7"] }, "diode_direction": "COL2ROW", + "audio": { + "driver": "pwm_hardware" + }, "ws2812": { "driver": "pwm" }, diff --git a/keyboards/handwired/macroboard/f411/rules.mk b/keyboards/handwired/macroboard/f411/rules.mk deleted file mode 100644 index 72f75f4367..0000000000 --- a/keyboards/handwired/macroboard/f411/rules.mk +++ /dev/null @@ -1 +0,0 @@ -AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f303/keyboard.json b/keyboards/handwired/tractyl_manuform/5x6_right/f303/keyboard.json index 000d8f0dd7..499390c610 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f303/keyboard.json +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f303/keyboard.json @@ -12,6 +12,9 @@ "led_count": 20, "split_count": [10, 10] }, + "audio": { + "driver": "dac_additive" + }, "ws2812": { "pin": "A6", "driver": "pwm" diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f303/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/f303/rules.mk index 23f790a1ad..22915ec000 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f303/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f303/rules.mk @@ -1,4 +1,3 @@ # KEYBOARD_SHARED_EP = yes SERIAL_DRIVER = usart -AUDIO_DRIVER = dac_additive diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/keyboard.json b/keyboards/handwired/tractyl_manuform/5x6_right/f411/keyboard.json index 73c13e8e31..7182ee1701 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/keyboard.json +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/keyboard.json @@ -15,6 +15,9 @@ "build": { "debounce_type": "asym_eager_defer_pk" }, + "audio": { + "driver": "pwm_hardware" + }, "ws2812": { "pin": "A1", "driver": "pwm" diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk index e75692030f..f26cbbced1 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk @@ -2,4 +2,3 @@ KEYBOARD_SHARED_EP = yes MOUSE_SHARED_EP = yes SERIAL_DRIVER = usart -AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/nack/keyboard.json b/keyboards/nack/keyboard.json index 6a3b6db3ad..cd08aac0af 100644 --- a/keyboards/nack/keyboard.json +++ b/keyboards/nack/keyboard.json @@ -17,6 +17,9 @@ "rgb_matrix": true, "unicode": true }, + "audio": { + "driver": "dac_basic" + }, "ws2812": { "pin": "B5", "driver": "spi" diff --git a/keyboards/nack/rules.mk b/keyboards/nack/rules.mk deleted file mode 100644 index 72354402a6..0000000000 --- a/keyboards/nack/rules.mk +++ /dev/null @@ -1 +0,0 @@ -AUDIO_DRIVER = dac_basic diff --git a/keyboards/planck/ez/info.json b/keyboards/planck/ez/info.json index 4244b4d83d..f7b2a8f8a1 100644 --- a/keyboards/planck/ez/info.json +++ b/keyboards/planck/ez/info.json @@ -75,6 +75,9 @@ "rows": ["A10", "A9", "A8", "B15", "C13", "C14", "C15", "A2"] }, "diode_direction": "COL2ROW", + "audio": { + "driver": "dac_additive" + }, "encoder": { "rotary": [ {"pin_a": "B12", "pin_b": "B13"} diff --git a/keyboards/planck/ez/rules.mk b/keyboards/planck/ez/rules.mk index 6cdb6ed4c2..ef20f95b65 100644 --- a/keyboards/planck/ez/rules.mk +++ b/keyboards/planck/ez/rules.mk @@ -1,5 +1,3 @@ -AUDIO_DRIVER = dac_additive - RGBLIGHT_SUPPORTED = no BAKCLIGHT_SUPPORTED = no diff --git a/keyboards/quokka/keyboard.json b/keyboards/quokka/keyboard.json index 0c34b0ee65..094e3e496e 100644 --- a/keyboards/quokka/keyboard.json +++ b/keyboards/quokka/keyboard.json @@ -13,6 +13,9 @@ "oled": true, "rgb_matrix": true }, + "audio": { + "driver": "pwm_hardware" + }, "matrix_pins": { "cols": ["GP8", "GP7", "GP6", "GP5", "GP4"], "rows": ["GP10", "GP19", "GP20", "GP18"] diff --git a/keyboards/quokka/rules.mk b/keyboards/quokka/rules.mk index c53818be73..161ec22b16 100644 --- a/keyboards/quokka/rules.mk +++ b/keyboards/quokka/rules.mk @@ -1,2 +1 @@ -AUDIO_DRIVER = pwm_hardware SERIAL_DRIVER = vendor diff --git a/keyboards/rgbkb/sol3/rev1/keyboard.json b/keyboards/rgbkb/sol3/rev1/keyboard.json index 3b8b7d060c..83e0a7a927 100644 --- a/keyboards/rgbkb/sol3/rev1/keyboard.json +++ b/keyboards/rgbkb/sol3/rev1/keyboard.json @@ -24,6 +24,9 @@ "twinkle": true } }, + "audio": { + "driver": "dac_additive" + }, "ws2812": { "pin": "B5", "driver": "pwm" diff --git a/keyboards/rgbkb/sol3/rules.mk b/keyboards/rgbkb/sol3/rules.mk index bf22130a55..0c48b5d30e 100644 --- a/keyboards/rgbkb/sol3/rules.mk +++ b/keyboards/rgbkb/sol3/rules.mk @@ -14,7 +14,6 @@ CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = yes # Enable N-Key Rollover AUDIO_ENABLE = yes # Audio output -AUDIO_DRIVER = dac_additive DYNAMIC_MACRO_ENABLE = yes DIP_SWITCH_ENABLE = yes diff --git a/keyboards/tzarc/djinn/info.json b/keyboards/tzarc/djinn/info.json index fddee1c21f..be0710ebef 100644 --- a/keyboards/tzarc/djinn/info.json +++ b/keyboards/tzarc/djinn/info.json @@ -31,6 +31,9 @@ "rows": ["B13", "B14", "B15", "C6", "C7", "C8"], "cols": ["C0", "C1", "C2", "C3", "A0", "A1", "A2"] }, + "audio": { + "driver": "pwm_software" + }, "backlight": { "pin": "A7", "levels": 4 diff --git a/keyboards/tzarc/djinn/rules.mk b/keyboards/tzarc/djinn/rules.mk index 5a4589a86f..78912d16d0 100644 --- a/keyboards/tzarc/djinn/rules.mk +++ b/keyboards/tzarc/djinn/rules.mk @@ -4,8 +4,6 @@ SERIAL_DRIVER = usart CIE1931_CURVE = yes -AUDIO_DRIVER = pwm_software - QUANTUM_PAINTER_DRIVERS = ili9341_spi SRC += \ diff --git a/keyboards/yanghu/unicorne/info.json b/keyboards/yanghu/unicorne/info.json index 504df68fb0..1b890dcaba 100644 --- a/keyboards/yanghu/unicorne/info.json +++ b/keyboards/yanghu/unicorne/info.json @@ -18,6 +18,9 @@ "oled": true, "rgblight": true }, + "audio": { + "driver": "pwm_hardware" + }, "rgblight": { "led_count": 8, "animations": { diff --git a/keyboards/yanghu/unicorne/rules.mk b/keyboards/yanghu/unicorne/rules.mk index 13cbb6b1e7..96852c8abf 100644 --- a/keyboards/yanghu/unicorne/rules.mk +++ b/keyboards/yanghu/unicorne/rules.mk @@ -1,3 +1 @@ -AUDIO_DRIVER = pwm_hardware - DEFAULT_FOLDER = yanghu/unicorne/f411 diff --git a/keyboards/zsa/moonlander/keyboard.json b/keyboards/zsa/moonlander/keyboard.json index 233cb46bba..08864fe2d7 100644 --- a/keyboards/zsa/moonlander/keyboard.json +++ b/keyboards/zsa/moonlander/keyboard.json @@ -22,6 +22,9 @@ "rgb_matrix": true, "swap_hands": true }, + "audio": { + "driver": "dac_additive" + }, "dynamic_keymap": { "layer_count": 8 }, diff --git a/keyboards/zsa/moonlander/rules.mk b/keyboards/zsa/moonlander/rules.mk index 4637558489..10928ea061 100644 --- a/keyboards/zsa/moonlander/rules.mk +++ b/keyboards/zsa/moonlander/rules.mk @@ -1,4 +1,3 @@ -AUDIO_DRIVER = dac_additive CUSTOM_MATRIX = lite # project specific files -- cgit v1.2.3 From 0ff53b24984e88f385638e47ea076b4d2945c0c6 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 28 Apr 2024 00:36:54 +1000 Subject: Rename `RGBW` define to `WS2812_RGBW` (#23585) --- data/mappings/info_config.hjson | 3 ++- data/schemas/keyboard.jsonschema | 6 +++++- docs/config_options.md | 2 +- docs/feature_rgblight.md | 2 +- docs/reference_info_json.md | 6 +++--- docs/ws2812_driver.md | 22 ++++++++++++++++++++++ keyboards/ergodox_ez/config.h | 2 -- keyboards/ergodox_ez/info.json | 3 ++- keyboards/ergodox_ez/shine/rgblight_custom.c | 4 ++-- keyboards/handwired/tennie/config.h | 2 -- keyboards/handwired/tennie/keyboard.json | 3 ++- keyboards/oddforge/vea/ws2812_custom.c | 2 +- keyboards/rgbkb/pan/pan.c | 2 +- keyboards/westfoxtrot/aanzee/config.h | 2 -- keyboards/westfoxtrot/aanzee/keyboard.json | 3 ++- platforms/avr/drivers/ws2812_i2c.c | 2 +- .../drivers/vendor/RP/RP2040/ws2812_vendor.c | 6 +++--- platforms/chibios/drivers/ws2812_bitbang.c | 2 +- platforms/chibios/drivers/ws2812_pwm.c | 8 ++++---- platforms/chibios/drivers/ws2812_spi.c | 4 ++-- quantum/color.c | 2 +- quantum/color.h | 4 ++-- quantum/rgb_matrix/rgb_matrix_drivers.c | 2 +- quantum/rgblight/rgblight.c | 18 +++++++++--------- 24 files changed, 68 insertions(+), 44 deletions(-) (limited to 'docs/reference_info_json.md') diff --git a/data/mappings/info_config.hjson b/data/mappings/info_config.hjson index c0417b8839..b61ca04071 100644 --- a/data/mappings/info_config.hjson +++ b/data/mappings/info_config.hjson @@ -164,7 +164,6 @@ "RGBLIGHT_DEFAULT_SAT": {"info_key": "rgblight.default.sat", "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"}, - "RGBW": {"info_key": "rgblight.rgbw", "value_type": "flag"}, // Secure "SECURE_IDLE_TIMEOUT": {"info_key": "secure.idle_timeout", "value_type": "int"}, @@ -215,6 +214,7 @@ "WS2812_DI_PIN": {"info_key": "ws2812.pin"}, "WS2812_I2C_ADDRESS": {"info_key": "ws2812.i2c_address", "value_type": "hex"}, "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"}, @@ -229,6 +229,7 @@ "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}, "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"}, "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}, diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 585c64777f..de01809b43 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -661,7 +661,10 @@ "$ref": "qmk.definitions.v1#/mcu_pin", "$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"}, "sleep": {"type": "boolean"}, "split": {"type": "boolean"}, @@ -937,6 +940,7 @@ "enum": ["bitbang", "custom", "i2c", "pwm", "spi", "vendor"] }, "pin": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "rgbw": {"type": "boolean"}, "i2c_address": {"$ref": "qmk.definitions.v1#/hex_number_2d"}, "i2c_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"} } diff --git a/docs/config_options.md b/docs/config_options.md index fca80e54fd..046429a587 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -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 * `#define RGBLIGHT_VAL_STEP 12` * units to step when in/decreasing value (brightness) -* `#define RGBW` +* `#define WS2812_RGBW` * Enables RGBW LED support ## Mouse Key Options diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index a6a89d1d00..ae37ceca92 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md @@ -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. -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. * SK6812, SK6812MINI, SK6805 diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md index d1dc5d3bea..5b06e9a326 100644 --- a/docs/reference_info_json.md +++ b/docs/reference_info_json.md @@ -588,9 +588,6 @@ Configures the [RGB Lighting](feature_rgblight.md) feature. * `max_brightness` * The maximum value which the HSV "V" component is scaled to, from 0 to 255. * Default: `255` - * `rgbw` - * Enable RGBW LEDs. - * Default: `false` * `saturation_steps` * The number of saturation adjustment steps. * Default: `17` @@ -855,3 +852,6 @@ Configures the [WS2812](ws2812_driver.md) driver. * `i2c_timeout` * The I²C timeout in milliseconds (`i2c` driver only). * Default: `100` (100 ms) + * `rgbw` + * Enable RGBW LEDs. + * Default: `false` diff --git a/docs/ws2812_driver.md b/docs/ws2812_driver.md index 006529cc8a..8851c042f0 100644 --- a/docs/ws2812_driver.md +++ b/docs/ws2812_driver.md @@ -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_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_RGBW` |*Not defined* |Enables RGBW support (except `i2c` driver) | ### Timing Adjustment :id=timing-adjustment @@ -58,6 +59,27 @@ Where the byte order may be one of: |`RGB` |WS2812B-2020 | |`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 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. diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h index 8209c21dba..3688e00785 100644 --- a/keyboards/ergodox_ez/config.h +++ b/keyboards/ergodox_ez/config.h @@ -73,8 +73,6 @@ along with this program. If not, see . /* fix space cadet rollover issue */ #define DISABLE_SPACE_CADET_ROLLOVER -#define RGBW - /* * The debounce filtering reports a key/switch change directly, * without any extra delay. After that the debounce logic will filter diff --git a/keyboards/ergodox_ez/info.json b/keyboards/ergodox_ez/info.json index f2495a409c..a560e97a0b 100644 --- a/keyboards/ergodox_ez/info.json +++ b/keyboards/ergodox_ez/info.json @@ -27,7 +27,8 @@ "debounce_type": "sym_eager_pr" }, "ws2812": { - "pin": "D7" + "pin": "D7", + "rgbw": true }, "rgb_matrix": { "animations": { diff --git a/keyboards/ergodox_ez/shine/rgblight_custom.c b/keyboards/ergodox_ez/shine/rgblight_custom.c index feac50cba0..29060e76fc 100644 --- a/keyboards/ergodox_ez/shine/rgblight_custom.c +++ b/keyboards/ergodox_ez/shine/rgblight_custom.c @@ -25,7 +25,7 @@ void setleds_custom(rgb_led_t *led, uint16_t led_num) { uint16_t length = 0; int i = 0; int j = 0; -# ifdef RGBW +# ifdef WS2812_RGBW int bytes_per_led = 4; # else 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[1]; data[j++] = data_byte[2]; -#ifdef RGBW +#ifdef WS2812_RGBW data[j++] = data_byte[3]; #endif } diff --git a/keyboards/handwired/tennie/config.h b/keyboards/handwired/tennie/config.h index 7c77f53a82..dcbcfeaaa8 100644 --- a/keyboards/handwired/tennie/config.h +++ b/keyboards/handwired/tennie/config.h @@ -17,8 +17,6 @@ along with this program. If not, see . #pragma once -#define RGBW - /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ diff --git a/keyboards/handwired/tennie/keyboard.json b/keyboards/handwired/tennie/keyboard.json index 34e6676c95..36c1266d50 100644 --- a/keyboards/handwired/tennie/keyboard.json +++ b/keyboards/handwired/tennie/keyboard.json @@ -26,7 +26,8 @@ } }, "ws2812": { - "pin": "D1" + "pin": "D1", + "rgbw": true }, "features": { "bootmagic": true, diff --git a/keyboards/oddforge/vea/ws2812_custom.c b/keyboards/oddforge/vea/ws2812_custom.c index a037b88b3e..317f98130b 100644 --- a/keyboards/oddforge/vea/ws2812_custom.c +++ b/keyboards/oddforge/vea/ws2812_custom.c @@ -1,7 +1,7 @@ #include "ws2812.h" #include "i2c_master.h" -#ifdef RGBW +#ifdef WS2812_RGBW # error "RGBW not supported" #endif diff --git a/keyboards/rgbkb/pan/pan.c b/keyboards/rgbkb/pan/pan.c index 191ff1ac1f..401831e0e2 100644 --- a/keyboards/rgbkb/pan/pan.c +++ b/keyboards/rgbkb/pan/pan.c @@ -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].b = b; } -# ifdef RGBW +# ifdef WS2812_RGBW convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]); # endif } diff --git a/keyboards/westfoxtrot/aanzee/config.h b/keyboards/westfoxtrot/aanzee/config.h index c024f9d8d9..cd1f84bc1f 100644 --- a/keyboards/westfoxtrot/aanzee/config.h +++ b/keyboards/westfoxtrot/aanzee/config.h @@ -17,8 +17,6 @@ along with this program. If not, see . #pragma once -#define RGBW - /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ diff --git a/keyboards/westfoxtrot/aanzee/keyboard.json b/keyboards/westfoxtrot/aanzee/keyboard.json index 7a12a3e52e..898fe9e62b 100644 --- a/keyboards/westfoxtrot/aanzee/keyboard.json +++ b/keyboards/westfoxtrot/aanzee/keyboard.json @@ -52,7 +52,8 @@ } }, "ws2812": { - "pin": "E6" + "pin": "E6", + "rgbw": true }, "processor": "atmega32u4", "bootloader": "atmel-dfu", diff --git a/platforms/avr/drivers/ws2812_i2c.c b/platforms/avr/drivers/ws2812_i2c.c index 60b466c32a..86a5ac8394 100644 --- a/platforms/avr/drivers/ws2812_i2c.c +++ b/platforms/avr/drivers/ws2812_i2c.c @@ -1,7 +1,7 @@ #include "ws2812.h" #include "i2c_master.h" -#ifdef RGBW +#ifdef WS2812_RGBW # error "RGBW not supported" #endif diff --git a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c index 95a827e4b8..41a5311719 100644 --- a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c +++ b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c @@ -161,7 +161,7 @@ static void ws2812_dma_callback(void* p, uint32_t ct) { // 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); -#if defined(RGBW) +#if defined(WS2812_RGBW) time_to_completion *= 32; #else time_to_completion *= 24; @@ -222,7 +222,7 @@ void ws2812_init(void) { sm_config_set_sideset(&config, 1, false, false); #endif -#if defined(RGBW) +#if defined(WS2812_RGBW) sm_config_set_out_shift(&config, false, true, 32); #else 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(); 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); #else WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, 0); diff --git a/platforms/chibios/drivers/ws2812_bitbang.c b/platforms/chibios/drivers/ws2812_bitbang.c index 9ed6bacd5a..96378ec0ac 100644 --- a/platforms/chibios/drivers/ws2812_bitbang.c +++ b/platforms/chibios/drivers/ws2812_bitbang.c @@ -101,7 +101,7 @@ void ws2812_setleds(rgb_led_t *ledarray, uint16_t leds) { sendByte(ledarray[i].r); #endif -#ifdef RGBW +#ifdef WS2812_RGBW sendByte(ledarray[i].w); #endif } diff --git a/platforms/chibios/drivers/ws2812_pwm.c b/platforms/chibios/drivers/ws2812_pwm.c index 7dc3414ead..1e9d2ebb41 100644 --- a/platforms/chibios/drivers/ws2812_pwm.c +++ b/platforms/chibios/drivers/ws2812_pwm.c @@ -16,7 +16,7 @@ /* Adapted from https://github.com/joewa/WS2812-LED-Driver_ChibiOS/ */ -#ifdef RGBW +#ifdef WS2812_RGBW # define WS2812_CHANNELS 4 #else # define WS2812_CHANNELS 3 @@ -262,7 +262,7 @@ # define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 0, (bit)) #endif -#ifdef RGBW +#ifdef WS2812_RGBW /** * @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_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; -#ifdef RGBW +#ifdef WS2812_RGBW ws2812_frame_buffer[WS2812_WHITE_BIT(led_number, bit)] = ((w >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; #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 void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) { 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); #else ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b); diff --git a/platforms/chibios/drivers/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c index 5b990ccaa0..ad2e87781c 100644 --- a/platforms/chibios/drivers/ws2812_spi.c +++ b/platforms/chibios/drivers/ws2812_spi.c @@ -76,7 +76,7 @@ #endif #define BYTES_FOR_LED_BYTE 4 -#ifdef RGBW +#ifdef WS2812_RGBW # define WS2812_CHANNELS 4 #else # 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++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j); #endif -#ifdef RGBW +#ifdef WS2812_RGBW 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); #endif diff --git a/quantum/color.c b/quantum/color.c index 395383f428..96d548a33c 100644 --- a/quantum/color.c +++ b/quantum/color.c @@ -109,7 +109,7 @@ RGB hsv_to_rgb_nocie(HSV hsv) { return hsv_to_rgb_impl(hsv, false); } -#ifdef RGBW +#ifdef WS2812_RGBW void convert_rgb_to_rgbw(rgb_led_t *led) { // Determine lowest value in all three colors, put that into // the white channel and then shift all colors by that amount diff --git a/quantum/color.h b/quantum/color.h index 00a3bfb3f8..b6a9dd0641 100644 --- a/quantum/color.h +++ b/quantum/color.h @@ -96,7 +96,7 @@ typedef struct PACKED rgb_led_t { uint8_t g; uint8_t r; #endif -#ifdef RGBW +#ifdef WS2812_RGBW uint8_t w; #endif } rgb_led_t; @@ -111,6 +111,6 @@ typedef struct PACKED HSV { RGB hsv_to_rgb(HSV hsv); RGB hsv_to_rgb_nocie(HSV hsv); -#ifdef RGBW +#ifdef WS2812_RGBW void convert_rgb_to_rgbw(rgb_led_t *led); #endif diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 4370996d0e..db3a2ef9e0 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -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].g = g; rgb_matrix_ws2812_array[i].b = b; -# ifdef RGBW +# ifdef WS2812_RGBW convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]); # endif } diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 62137c020b..b0f2dfdc1d 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -149,7 +149,7 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, rgb_led_t *led1) { led1->r = r; led1->g = g; led1->b = b; -#ifdef RGBW +#ifdef WS2812_RGBW led1->w = 0; #endif } @@ -652,7 +652,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { led[i].r = r; led[i].g = g; led[i].b = b; -#ifdef RGBW +#ifdef WS2812_RGBW led[i].w = 0; #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].g = g; led[index].b = b; -#ifdef RGBW +#ifdef WS2812_RGBW led[index].w = 0; #endif 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].g = g; led[i].b = b; -#ifdef RGBW +#ifdef WS2812_RGBW led[i].w = 0; #endif } @@ -905,7 +905,7 @@ void rgblight_set(void) { led[i].r = 0; led[i].g = 0; led[i].b = 0; -#ifdef RGBW +#ifdef WS2812_RGBW led[i].w = 0; #endif } @@ -933,7 +933,7 @@ void rgblight_set(void) { start_led = led + rgblight_ranges.clipping_start_pos; #endif -#ifdef RGBW +#ifdef WS2812_RGBW for (uint8_t i = 0; i < num_leds; i++) { convert_rgb_to_rgbw(&start_led[i]); } @@ -1263,7 +1263,7 @@ void rgblight_effect_snake(animation_status_t *anim) { ledp->r = 0; ledp->g = 0; ledp->b = 0; -# ifdef RGBW +# ifdef WS2812_RGBW ledp->w = 0; # endif 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].g = 0; led[i].b = 0; -# ifdef RGBW +# ifdef WS2812_RGBW led[i].w = 0; # endif } @@ -1337,7 +1337,7 @@ void rgblight_effect_knight(animation_status_t *anim) { led[cur].r = 0; led[cur].g = 0; led[cur].b = 0; -# ifdef RGBW +# ifdef WS2812_RGBW led[cur].w = 0; # endif } -- cgit v1.2.3 From ef0734b7a6b2a7650f2170631d840dbca7106bbd Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Fri, 10 May 2024 11:54:44 +0100 Subject: Remove 'split.transport.protocol=serial_usart' (#23668) --- data/schemas/keyboard.jsonschema | 2 +- docs/reference_info_json.md | 2 +- keyboards/era/sirind/tomak/keyboard.json | 1 - keyboards/keychron/q11/info.json | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'docs/reference_info_json.md') diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index de01809b43..b699f86277 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -805,7 +805,7 @@ "properties": { "protocol": { "type": "string", - "enum": ["custom", "i2c", "serial", "serial_usart"] + "enum": ["custom", "i2c", "serial"] }, "sync": { "type": "object", diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md index 5b06e9a326..8a2ded95f7 100644 --- a/docs/reference_info_json.md +++ b/docs/reference_info_json.md @@ -739,7 +739,7 @@ Configures the [Split Keyboard](feature_split_keyboard.md) feature. * Default: `1` * `transport` * `protocol` - * The split transport protocol to use. Must be one of `custom`, `i2c`, `serial`, `serial_usart`. + * The split transport protocol to use. Must be one of `custom`, `i2c`, `serial`. * `sync` * `activity` * Mirror the activity timestamps to the secondary half. diff --git a/keyboards/era/sirind/tomak/keyboard.json b/keyboards/era/sirind/tomak/keyboard.json index 58025e67a1..1d0d5b79b2 100644 --- a/keyboards/era/sirind/tomak/keyboard.json +++ b/keyboards/era/sirind/tomak/keyboard.json @@ -183,7 +183,6 @@ } }, "transport": { - "protocol": "serial_usart", "sync": { "indicators": true, "layer_state": true, diff --git a/keyboards/keychron/q11/info.json b/keyboards/keychron/q11/info.json index db70d2b7b6..51a8e5937e 100755 --- a/keyboards/keychron/q11/info.json +++ b/keyboards/keychron/q11/info.json @@ -54,7 +54,6 @@ } }, "transport": { - "protocol": "serial_usart", "sync" :{ "matrix_state": true } -- cgit v1.2.3