Lines Matching +full:scan +full:- +full:limit
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()
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()
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()
137 while (count--) { in skip_pixel()
146 return -ENOTSUP; in max7219_blanking_on()
153 return -ENOTSUP; in max7219_blanking_off()
159 const struct max7219_config *dev_config = dev->config; in max7219_write()
160 struct max7219_data *dev_data = dev->data; in max7219_write()
163 const uint16_t max_height = dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE; in max7219_write()
168 __ASSERT((desc->pitch * desc->height) <= (desc->buf_size * 8U), "Input buffer to small"); in max7219_write()
169 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width"); in max7219_write()
170 __ASSERT(desc->pitch <= max_width, "Pitch in descriptor is larger than screen size"); in max7219_write()
171 __ASSERT(desc->height <= max_height, "Height in descriptor is larger than screen size"); in max7219_write()
172 __ASSERT(x + desc->pitch <= max_width, in max7219_write()
174 __ASSERT(y + desc->height <= max_height, in max7219_write()
177 if (desc->width > desc->pitch || (desc->pitch * desc->height) > (desc->buf_size * 8U)) { in max7219_write()
178 return -EINVAL; in max7219_write()
181 if ((x + desc->pitch) > max_width || (y + desc->height) > max_height) { in max7219_write()
182 return -EINVAL; in max7219_write()
185 const uint16_t end_x = x + desc->width; in max7219_write()
186 const uint16_t end_y = y + desc->height; in max7219_write()
188 const uint16_t to_skip = desc->pitch - desc->width; in max7219_write()
195 uint8_t segment = dev_data->digit_buf[py]; in max7219_write()
210 dev_data->digit_buf[y] = segment; in max7219_write()
225 return -ENOTSUP; in max7219_read()
257 return -ENOTSUP; in max7219_set_contrast()
269 return -ENOTSUP; in max7219_set_pixel_format()
282 return -ENOTSUP; in max7219_set_orientation()
288 const struct max7219_config *dev_config = dev->config; in max7219_get_capabilities()
290 caps->x_resolution = MAX7219_SEGMENTS_PER_DIGIT; in max7219_get_capabilities()
291 caps->y_resolution = MAX7219_DIGITS_PER_DEVICE * dev_config->num_cascading; in max7219_get_capabilities()
292 caps->supported_pixel_formats = PIXEL_FORMAT_MONO01; in max7219_get_capabilities()
293 caps->screen_info = 0; in max7219_get_capabilities()
294 caps->current_pixel_format = PIXEL_FORMAT_MONO01; in max7219_get_capabilities()
295 caps->current_orientation = DISPLAY_ORIENTATION_NORMAL; in max7219_get_capabilities()
313 const struct max7219_config *dev_config = dev->config; in max7219_init()
314 struct max7219_data *dev_data = dev->data; in max7219_init()
317 if (!spi_is_ready_dt(&dev_config->spi)) { in max7219_init()
319 return -ENODEV; in max7219_init()
323 memset(dev_data->digit_buf, 0, in max7219_init()
324 dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE * sizeof(uint8_t)); in max7219_init()
338 ret = max7219_transmit_all(dev, MAX7219_REG_INTENSITY, dev_config->intensity); in max7219_init()
344 ret = max7219_transmit_all(dev, MAX7219_REG_SCAN_LIMIT, dev_config->scan_limit); in max7219_init()
346 LOG_ERR("Failed to set scan limit"); in max7219_init()
357 .buf_size = dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE, in max7219_init()
358 .height = dev_config->num_cascading * MAX7219_DIGITS_PER_DEVICE, in max7219_init()
363 ret = max7219_write(dev, 0, 0, &desc, dev_data->digit_buf); in max7219_init()