Lines Matching +full:count +full:- +full:width

4  * SPDX-License-Identifier: Apache-2.0
19 * Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
22 * 1. This driver only implements no-decode mode.
38 /* clang-format off */
59 /* clang-format on */
76 const struct max7219_config *dev_config = dev->config; in max7219_transmit_all()
77 struct max7219_data *dev_data = dev->data; in max7219_transmit_all()
80 .buf = dev_data->tx_buf, in max7219_transmit_all()
81 .len = dev_config->num_cascading * 2, in max7219_transmit_all()
85 .count = 1U, in max7219_transmit_all()
88 for (int i = 0; i < dev_config->num_cascading; i++) { in max7219_transmit_all()
89 dev_data->tx_buf[i * 2] = addr; in max7219_transmit_all()
90 dev_data->tx_buf[i * 2 + 1] = value; in max7219_transmit_all()
93 return spi_write_dt(&dev_config->spi, &tx_bufs); in max7219_transmit_all()
99 const struct max7219_config *dev_config = dev->config; in max7219_transmit_one()
100 struct max7219_data *dev_data = dev->data; in max7219_transmit_one()
103 .buf = dev_data->tx_buf, in max7219_transmit_one()
104 .len = dev_config->num_cascading * 2, in max7219_transmit_one()
108 .count = 1U, in max7219_transmit_one()
111 for (int i = 0; i < dev_config->num_cascading; i++) { in max7219_transmit_one()
112 if (i != (dev_config->num_cascading - 1 - max7219_idx)) { in max7219_transmit_one()
113 dev_data->tx_buf[i * 2] = MAX7219_REG_NOOP; in max7219_transmit_one()
114 dev_data->tx_buf[i * 2 + 1] = MAX7219_NOOP; in max7219_transmit_one()
118 dev_data->tx_buf[i * 2] = addr; in max7219_transmit_one()
119 dev_data->tx_buf[i * 2 + 1] = value; in max7219_transmit_one()
122 return spi_write_dt(&dev_config->spi, &tx_bufs); in max7219_transmit_one()
135 static inline void skip_pixel(uint8_t *mask, uint8_t *data, const uint8_t **buf, uint16_t count) in skip_pixel() argument
137 while (count--) { in skip_pixel()
145 const struct max7219_config *dev_config = dev->config; in max7219_write()
146 struct max7219_data *dev_data = dev->data; in max7219_write()
149 const uint16_t max_height = dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE; in max7219_write()
154 __ASSERT((desc->pitch * desc->height) <= (desc->buf_size * 8U), "Input buffer to small"); in max7219_write()
155 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width"); in max7219_write()
156 __ASSERT(desc->pitch <= max_width, "Pitch in descriptor is larger than screen size"); in max7219_write()
157 __ASSERT(desc->height <= max_height, "Height in descriptor is larger than screen size"); in max7219_write()
158 __ASSERT(x + desc->pitch <= max_width, in max7219_write()
160 __ASSERT(y + desc->height <= max_height, in max7219_write()
163 if (desc->width > desc->pitch || (desc->pitch * desc->height) > (desc->buf_size * 8U)) { in max7219_write()
164 return -EINVAL; in max7219_write()
167 if ((x + desc->pitch) > max_width || (y + desc->height) > max_height) { in max7219_write()
168 return -EINVAL; in max7219_write()
171 const uint16_t end_x = x + desc->width; in max7219_write()
172 const uint16_t end_y = y + desc->height; in max7219_write()
174 const uint16_t to_skip = desc->pitch - desc->width; in max7219_write()
181 uint8_t segment = dev_data->digit_buf[py]; in max7219_write()
196 dev_data->digit_buf[y] = segment; in max7219_write()
228 return -ENOTSUP; in max7219_set_pixel_format()
241 return -ENOTSUP; in max7219_set_orientation()
247 const struct max7219_config *dev_config = dev->config; in max7219_get_capabilities()
249 caps->x_resolution = MAX7219_SEGMENTS_PER_DIGIT; in max7219_get_capabilities()
250 caps->y_resolution = MAX7219_DIGITS_PER_DEVICE * dev_config->num_cascading; in max7219_get_capabilities()
251 caps->supported_pixel_formats = PIXEL_FORMAT_MONO01; in max7219_get_capabilities()
252 caps->screen_info = 0; in max7219_get_capabilities()
253 caps->current_pixel_format = PIXEL_FORMAT_MONO01; in max7219_get_capabilities()
254 caps->current_orientation = DISPLAY_ORIENTATION_NORMAL; in max7219_get_capabilities()
267 const struct max7219_config *dev_config = dev->config; in max7219_init()
268 struct max7219_data *dev_data = dev->data; in max7219_init()
271 if (!spi_is_ready_dt(&dev_config->spi)) { in max7219_init()
273 return -ENODEV; in max7219_init()
277 memset(dev_data->digit_buf, 0, in max7219_init()
278 dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE * sizeof(uint8_t)); in max7219_init()
292 ret = max7219_transmit_all(dev, MAX7219_REG_INTENSITY, dev_config->intensity); in max7219_init()
298 ret = max7219_transmit_all(dev, MAX7219_REG_SCAN_LIMIT, dev_config->scan_limit); in max7219_init()
311 .buf_size = dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE, in max7219_init()
312 .height = dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE, in max7219_init()
313 .width = MAX7219_DIGITS_PER_DEVICE, in max7219_init()
317 ret = max7219_write(dev, 0, 0, &desc, dev_data->digit_buf); in max7219_init()