/*
 * Copyright (c) 2019, Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

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

 #include "../nrf52-bindings.h"
 
 &spi1 { /* MOSI on D11 / P0.23 */
	 compatible = "nordic,nrf-spim";
	 led_strip: ws2812@0 {
		 compatible = "worldsemi,ws2812-spi";
 
		 /* SPI */
		 reg = <0>; /* ignored, but necessary for SPI bindings */
		 spi-max-frequency = <SPI_FREQ>;
 
		 /* WS2812 */
		 chain-length = <6>; /* arbitrary; change at will */
		 color-mapping = <LED_COLOR_ID_GREEN
				  LED_COLOR_ID_RED
				  LED_COLOR_ID_BLUE>;
		 spi-one-frame = <ONE_FRAME>;
		 spi-zero-frame = <ZERO_FRAME>;
	 };
 };
 
 &spi1_default {
	 group1 {
		 psels = <NRF_PSEL(SPIM_MOSI, 0, 29)>, // pin p0.29 gets the data signal
				 <NRF_PSEL(SPIM_SCK, 0, 30)>; // clock is not used for WS2812
				 //<NRF_PSEL(SPIM_MISO, 0, 31)>;
	 };
 };
 &spi1_sleep {
	 group1 {
		 psels = <NRF_PSEL(SPIM_MOSI, 0, 29)>,
				 <NRF_PSEL(SPIM_SCK, 0, 30)>;
				 //<NRF_PSEL(SPIM_MISO, 0, 31)>;
		 low-power-enable;
	 };
 };
 / {
	 aliases {
		 led-strip = &led_strip;
	 };
 };