/*
 * Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

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

&spi3 {
	/* Workaround to support WS2812 driver */
	line-idle-low;

        led_strip: ws2812@0 {
                compatible = "worldsemi,ws2812-spi";

                /* SPI */
                reg = <0>; /* ignored, but necessary for SPI bindings */
                spi-max-frequency = <6400000>;

                /* WS2812 */
                chain-length = <1>; /* arbitrary; change at will */
                spi-cpha;
                spi-one-frame = <0xf0>; /* 11110000: 625 ns high and 625 ns low */
                spi-zero-frame = <0xc0>; /* 11000000: 312.5 ns high and 937.5 ns low */
                color-mapping = <LED_COLOR_ID_GREEN
                                 LED_COLOR_ID_RED
                                 LED_COLOR_ID_BLUE>;
        };
};

&pinctrl {
	spim3_default: spim3_default {
		group2 {
			pinmux = <SPIM3_MOSI_GPIO48>;
		};
	};
};

/ {
        aliases {
                led-strip = &led_strip;
        };
};
