Lines Matching +full:led +full:- +full:strips
4 * SPDX-License-Identifier: Apache-2.0
24 const struct led_strip_buffer *strips; member
40 const size_t mods_per_row = config->width / config->module_width; in pixel_index()
41 const size_t mod_w = config->module_width; in pixel_index()
42 const size_t mod_h = config->module_height; in pixel_index()
45 config->modules_start_from_bottom ? (mod_h - 1) - (y / mod_h) : y / mod_h; in pixel_index()
46 const size_t y_in_mod = config->start_from_bottom ? (mod_h - 1) - (y % mod_h) : y % mod_h; in pixel_index()
50 if (config->modules_circulative) { in pixel_index()
51 if (config->modules_start_from_right) { in pixel_index()
52 mod_col = mods_per_row - 1 - mod_col; in pixel_index()
55 if ((mod_row % 2) == !config->modules_start_from_right) { in pixel_index()
56 mod_col = mods_per_row - 1 - mod_col; in pixel_index()
60 if (config->circulative) { in pixel_index()
61 if (config->start_from_right) { in pixel_index()
62 x_in_mod = (mod_w - 1) - (x % mod_w); in pixel_index()
65 if ((y_in_mod % 2) == !config->start_from_right) { in pixel_index()
66 x_in_mod = (mod_w - 1) - (x % mod_w); in pixel_index()
78 for (size_t i = 0; i < config->num_of_strips; i++) { in pixel_address()
79 if (idx < config->strips[i].chain_length) { in pixel_address()
80 return &config->strips[i].pixels[idx]; in pixel_address()
82 idx -= config->strips[i].chain_length; in pixel_address()
91 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller than width"); in check_descriptor()
92 __ASSERT(desc->pitch <= config->width, "Pitch in descriptor is larger than screen size"); in check_descriptor()
93 __ASSERT(desc->height <= config->height, "Height in descriptor is larger than screen size"); in check_descriptor()
94 __ASSERT(x + desc->pitch <= config->width, in check_descriptor()
96 __ASSERT(y + desc->height <= config->height, in check_descriptor()
99 if (desc->width > desc->pitch || x + desc->pitch > config->width || in check_descriptor()
100 y + desc->height > config->height) { in check_descriptor()
101 return -EINVAL; in check_descriptor()
110 const struct led_strip_matrix_config *config = dev->config; in led_strip_matrix_write()
120 for (size_t ypos = y; ypos < (y + desc->height); ypos++) { in led_strip_matrix_write()
121 for (size_t xpos = x; xpos < (x + desc->width); xpos++) { in led_strip_matrix_write()
124 if (config->pixel_format == PIXEL_FORMAT_ARGB_8888) { in led_strip_matrix_write()
127 pix->r = (color >> 16) & 0xFF; in led_strip_matrix_write()
128 pix->g = (color >> 8) & 0xFF; in led_strip_matrix_write()
129 pix->b = (color) & 0xFF; in led_strip_matrix_write()
133 pix->r = *buf_ptr; in led_strip_matrix_write()
135 pix->g = *buf_ptr; in led_strip_matrix_write()
137 pix->b = *buf_ptr; in led_strip_matrix_write()
141 buf_ptr += (desc->pitch - desc->width) * in led_strip_matrix_write()
142 (config->pixel_format == PIXEL_FORMAT_ARGB_8888 ? 4 : 3); in led_strip_matrix_write()
145 for (size_t i = 0; i < config->num_of_strips; i++) { in led_strip_matrix_write()
146 rc = led_strip_update_rgb(config->strips[i].dev, config->strips[i].pixels, in led_strip_matrix_write()
147 config->width * config->height); in led_strip_matrix_write()
159 const struct led_strip_matrix_config *config = dev->config; in led_strip_matrix_read()
169 for (size_t ypos = y; ypos < (y + desc->height); ypos++) { in led_strip_matrix_read()
170 for (size_t xpos = x; xpos < (x + desc->width); xpos++) { in led_strip_matrix_read()
173 if (config->pixel_format == PIXEL_FORMAT_ARGB_8888) { in led_strip_matrix_read()
176 *pix_ptr = 0xFF000000 | pix->r << 16 | pix->g << 8 | pix->b; in led_strip_matrix_read()
178 *buf_ptr = pix->r; in led_strip_matrix_read()
180 *buf_ptr = pix->g; in led_strip_matrix_read()
182 *buf_ptr = pix->b; in led_strip_matrix_read()
186 buf_ptr += (desc->pitch - desc->width) * in led_strip_matrix_read()
187 (config->pixel_format == PIXEL_FORMAT_ARGB_8888 ? 4 : 3); in led_strip_matrix_read()
196 const struct led_strip_matrix_config *config = dev->config; in led_strip_matrix_get_capabilities()
199 caps->x_resolution = config->width; in led_strip_matrix_get_capabilities()
200 caps->y_resolution = config->height; in led_strip_matrix_get_capabilities()
201 caps->supported_pixel_formats = PIXEL_FORMAT_ARGB_8888 | PIXEL_FORMAT_RGB_888; in led_strip_matrix_get_capabilities()
202 caps->current_pixel_format = config->pixel_format; in led_strip_matrix_get_capabilities()
203 caps->screen_info = 0; in led_strip_matrix_get_capabilities()
214 const struct led_strip_matrix_config *config = dev->config; in led_strip_matrix_init()
216 for (size_t i = 0; i < config->num_of_strips; i++) { in led_strip_matrix_init()
217 if (!device_is_ready(config->strips[i].dev)) { in led_strip_matrix_init()
218 LOG_ERR("LED strip device %s is not ready", config->strips[i].dev->name); in led_strip_matrix_init()
219 return -EINVAL; in led_strip_matrix_init()
257 .strips = strip_buffer##inst, \