Lines Matching +full:daisy +full:- +full:chain

4  * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/dt-bindings/led/led.h>
57 /** GS reference clock edge select bit for OUTXn on-off timing control in FC data */
60 /** Constant-current output enable bit in FC data (0 = output control enabled, 1 = blank). */
157 temp = pixel_data->r; in tlc5971_map_color()
160 temp = pixel_data->g; in tlc5971_map_color()
163 temp = pixel_data->b; in tlc5971_map_color()
174 * @brief serialize control data and pixel data for device daisy chain
180 * @param pixels pixel RGB data for daisy chain
181 * @param num_pixels number of pixels in daisy chain
186 const struct tlc5971_config *cfg = dev->config; in tlc5971_fill_data_buffer()
187 struct tlc5971_data *data = dev->data; in tlc5971_fill_data_buffer()
188 uint8_t *data_buffer = data->data_buffer; in tlc5971_fill_data_buffer()
192 * tlc5971 device order is reversed as the rgb data for the last device in the daisy chain in tlc5971_fill_data_buffer()
195 for (int device = (num_pixels / TLC5971_PIXELS_PER_DEVICE) - 1; device >= 0; device--) { in tlc5971_fill_data_buffer()
201 data_buffer[count++] = tlc5971_data_byte27(data->control_data); in tlc5971_fill_data_buffer()
202 data_buffer[count++] = tlc5971_data_byte26(data->control_data, data->gbc_color_1); in tlc5971_fill_data_buffer()
203 data_buffer[count++] = tlc5971_data_byte25(data->gbc_color_1, data->gbc_color_2); in tlc5971_fill_data_buffer()
204 data_buffer[count++] = tlc5971_data_byte24(data->gbc_color_2, data->gbc_color_3); in tlc5971_fill_data_buffer()
206 for (int pixel = (TLC5971_PIXELS_PER_DEVICE - 1); pixel >= 0; pixel--) { in tlc5971_fill_data_buffer()
215 for (int color = 0; color < cfg->num_colors; color++) { in tlc5971_fill_data_buffer()
217 tlc5971_map_color(cfg->color_mapping[color], pixel_data); in tlc5971_fill_data_buffer()
233 const struct tlc5971_config *cfg = dev->config; in tlc5971_transmit_data()
234 struct tlc5971_data *data = dev->data; in tlc5971_transmit_data()
237 .buf = data->data_buffer, in tlc5971_transmit_data()
246 return spi_write_dt(&cfg->bus, &tx); in tlc5971_transmit_data()
258 const struct tlc5971_config *cfg = dev->config; in tlc5971_length()
260 return (size_t)cfg->num_pixels; in tlc5971_length()
265 const struct tlc5971_config *cfg = dev->config; in tlc5971_set_global_brightness()
266 struct tlc5971_data *data = dev->data; in tlc5971_set_global_brightness()
267 int res = -EINVAL; in tlc5971_set_global_brightness()
272 data->gbc_color_1 = tlc5971_map_color(cfg->color_mapping[0], &pixel); in tlc5971_set_global_brightness()
273 data->gbc_color_2 = tlc5971_map_color(cfg->color_mapping[1], &pixel); in tlc5971_set_global_brightness()
274 data->gbc_color_3 = tlc5971_map_color(cfg->color_mapping[2], &pixel); in tlc5971_set_global_brightness()
283 const struct tlc5971_config *cfg = dev->config; in tlc5971_init()
284 struct tlc5971_data *data = dev->data; in tlc5971_init()
286 if (!spi_is_ready_dt(&cfg->bus)) { in tlc5971_init()
287 LOG_ERR("%s: SPI device %s not ready", dev->name, cfg->bus.bus->name); in tlc5971_init()
288 return -ENODEV; in tlc5971_init()
291 if ((cfg->num_pixels % TLC5971_PIXELS_PER_DEVICE) != 0) { in tlc5971_init()
292 LOG_ERR("%s: chain length must be multiple of 4", dev->name); in tlc5971_init()
293 return -EINVAL; in tlc5971_init()
296 if (cfg->num_colors != TLC5971_NUMBER_OF_COLORS) { in tlc5971_init()
297 LOG_ERR("%s: the tlc5971 only supports %i colors", dev->name, in tlc5971_init()
299 return -EINVAL; in tlc5971_init()
302 for (int i = 0; i < cfg->num_colors; i++) { in tlc5971_init()
303 switch (cfg->color_mapping[i]) { in tlc5971_init()
309 LOG_ERR("%s: invalid color mapping", dev->name); in tlc5971_init()
310 return -EINVAL; in tlc5971_init()
319 data->control_data = TLC5971_BYTE27_CTRL_BIT_OUTTMG | TLC5971_BYTE26_CTRL_BIT_DSPRPT | in tlc5971_init()