leds-group-multicolor

Vendor: Generic or vendor-independent

Note

An implementation of a driver matching this compatible is available in drivers/led/leds_group_multicolor.c.

Description

Combines several monochromatic LEDs into one multi-color LED.

Here is an example that defines an RGB LED with a group of monochromatic
PWM LEDs. Note that the pwms property definition handle depends on the PWM
controller model. In this example, an STM32 PWM controller is assumed.

#include <zephyr/dt-bindings/led/led.h>

/ {
        monochromatic-leds {
                compatible = "pwm-leds";

                red_pwm_led: led-0 {
                        pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
                };

                green_pwm_led: led-1 {
                        pwms = <&pwm2 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
                };

                blue_pwm_led: led-2 {
                        pwms = <&pwm3 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
                };
        };

        rgb-led {
                compatible = "leds-group-multicolor";

                leds = <&red_pwm_led>, <&green_pwm_led>, <&blue_pwm_led>;
                color-mapping = <LED_COLOR_ID_RED>,
                                <LED_COLOR_ID_GREEN>,
                                <LED_COLOR_ID_BLUE>;
        };
};

Properties

Properties not inherited from the base binding file.

Name

Type

Details

leds

phandles

References to monochromatic LED nodes.

This property is required.

color-mapping

array

Channel to color mapping of a multicolor LED. If a LED supports
several colors, then the color-mapping property can be used to
describe how the hardware channels and the colors are mapped.

For example the channel to color mapping of RGB LEDs would be

   color-mapping =
        <LED_COLOR_ID_RED>,
        <LED_COLOR_ID_GREEN>,
        <LED_COLOR_ID_BLUE>;