Lines Matching +full:spi +full:- +full:zero +full:- +full:frame

6  * SPDX-License-Identifier: Apache-2.0
21 #include <zephyr/drivers/spi.h>
24 #include <zephyr/dt-bindings/led/led.h>
26 /* spi-one-frame and spi-zero-frame in DT are for 8-bit frames. */
30 * SPI master configuration:
32 * - mode 0 (the default), 8 bit, MSB first (arbitrary), one-line SPI
33 * - no shenanigans (don't hold CS, don't hold the device lock, this
52 return dev->config; in dev_cfg()
56 * Serialize an 8-bit color channel value into an equivalent sequence
57 * of SPI frames, MSbit first, where a one bit becomes SPI frame
58 * one_frame, and zero bit becomes zero_frame.
66 buf[i] = color & BIT(7 - i) ? one_frame : zero_frame; in ws2812_spi_ser()
83 const uint8_t one = cfg->one_frame, zero = cfg->zero_frame; in ws2812_strip_update_rgb() local
85 .buf = cfg->px_buf, in ws2812_strip_update_rgb()
86 .len = (cfg->length * 8 * cfg->num_colors), in ws2812_strip_update_rgb()
92 uint8_t *px_buf = cfg->px_buf; in ws2812_strip_update_rgb()
97 * Convert pixel data into SPI frames. Each frame has pixel data in ws2812_strip_update_rgb()
98 * in color mapping on-wire format (e.g. GRB, GRBW, RGB, etc). in ws2812_strip_update_rgb()
103 for (j = 0; j < cfg->num_colors; j++) { in ws2812_strip_update_rgb()
106 switch (cfg->color_mapping[j]) { in ws2812_strip_update_rgb()
121 return -EINVAL; in ws2812_strip_update_rgb()
123 ws2812_spi_ser(px_buf, pixel, one, zero); in ws2812_strip_update_rgb()
131 rc = spi_write_dt(&cfg->bus, &tx); in ws2812_strip_update_rgb()
132 ws2812_reset_delay(cfg->reset_delay); in ws2812_strip_update_rgb()
141 return cfg->length; in ws2812_strip_length()
149 if (!spi_is_ready_dt(&cfg->bus)) { in ws2812_spi_init()
150 LOG_ERR("SPI device %s not ready", cfg->bus.bus->name); in ws2812_spi_init()
151 return -ENODEV; in ws2812_spi_init()
154 for (i = 0; i < cfg->num_colors; i++) { in ws2812_spi_init()
155 switch (cfg->color_mapping[i]) { in ws2812_spi_init()
163 "Check the color-mapping DT property", in ws2812_spi_init()
164 dev->name); in ws2812_spi_init()
165 return -EINVAL; in ws2812_spi_init()
190 * "color-mapping" DT property.
198 /* Get the latch/reset delay from the "reset-delay" DT property. */