Lines Matching +full:gpio +full:- +full:width
3 * Copyright (c) 2018-2020 PHYTEC Messtechnik GmbH
5 * SPDX-License-Identifier: Apache-2.0
16 #include <zephyr/drivers/gpio.h>
47 /* Width (bits) of integer type representing an x coordinate */
49 /* Width (bits) of integer type representing a y coordinate */
105 uint16_t width; member
114 const struct ssd16xx_config *config = dev->config; in ssd16xx_busy_wait()
115 int pin = gpio_pin_get_dt(&config->busy_gpio); in ssd16xx_busy_wait()
120 pin = gpio_pin_get_dt(&config->busy_gpio); in ssd16xx_busy_wait()
127 const struct ssd16xx_config *config = dev->config; in ssd16xx_write_cmd()
134 err = gpio_pin_set_dt(&config->dc_gpio, 1); in ssd16xx_write_cmd()
139 err = spi_write_dt(&config->bus, &buf_set); in ssd16xx_write_cmd()
148 err = gpio_pin_set_dt(&config->dc_gpio, 0); in ssd16xx_write_cmd()
153 err = spi_write_dt(&config->bus, &buf_set); in ssd16xx_write_cmd()
160 spi_release_dt(&config->bus); in ssd16xx_write_cmd()
173 const struct ssd16xx_config *config = dev->config; in ssd16xx_read_cmd()
174 const struct ssd16xx_data *dev_data = dev->data; in ssd16xx_read_cmd()
179 if (!dev_data->read_supported) { in ssd16xx_read_cmd()
180 return -ENOTSUP; in ssd16xx_read_cmd()
185 err = gpio_pin_set_dt(&config->dc_gpio, 1); in ssd16xx_read_cmd()
190 err = spi_write_dt(&config->bus, &buf_set); in ssd16xx_read_cmd()
199 err = gpio_pin_set_dt(&config->dc_gpio, 0); in ssd16xx_read_cmd()
204 err = spi_read_dt(&config->bus, &buf_set); in ssd16xx_read_cmd()
211 spi_release_dt(&config->bus); in ssd16xx_read_cmd()
218 const struct ssd16xx_config *config = dev->config; in push_x_param()
220 if (config->quirks->pp_width_bits == 8) { in push_x_param()
225 if (config->quirks->pp_width_bits == 16) { in push_x_param()
231 config->quirks->pp_width_bits); in push_x_param()
238 const struct ssd16xx_config *config = dev->config; in push_y_param()
240 if (config->quirks->pp_height_bits == 8) { in push_y_param()
245 if (config->quirks->pp_height_bits == 16) { in push_y_param()
251 config->quirks->pp_height_bits); in push_y_param()
313 const struct ssd16xx_config *config = dev->config; in ssd16xx_update_display()
314 const struct ssd16xx_data *data = dev->data; in ssd16xx_update_display()
315 const struct ssd16xx_profile *p = config->profiles[data->profile]; in ssd16xx_update_display()
316 const struct ssd16xx_quirks *quirks = config->quirks; in ssd16xx_update_display()
317 const bool load_lut = !p || p->lut.len == 0; in ssd16xx_update_display()
318 const bool load_temp = load_lut && config->tssv; in ssd16xx_update_display()
319 const bool partial = data->profile == SSD16XX_PROFILE_PARTIAL; in ssd16xx_update_display()
325 (partial ? quirks->ctrl2_partial : quirks->ctrl2_full) | in ssd16xx_update_display()
334 struct ssd16xx_data *data = dev->data; in ssd16xx_blanking_off()
336 if (data->blanking_on) { in ssd16xx_blanking_off()
337 data->blanking_on = false; in ssd16xx_blanking_off()
346 struct ssd16xx_data *data = dev->data; in ssd16xx_blanking_on()
348 if (!data->blanking_on) { in ssd16xx_blanking_on()
350 return -EIO; in ssd16xx_blanking_on()
354 data->blanking_on = true; in ssd16xx_blanking_on()
363 const struct ssd16xx_config *config = dev->config; in ssd16xx_set_window()
364 const struct ssd16xx_data *data = dev->data; in ssd16xx_set_window()
370 uint16_t panel_h = config->height - in ssd16xx_set_window()
371 config->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE; in ssd16xx_set_window()
373 if (desc->pitch < desc->width) { in ssd16xx_set_window()
374 LOG_ERR("Pitch is smaller than width"); in ssd16xx_set_window()
375 return -EINVAL; in ssd16xx_set_window()
378 if (desc->pitch > desc->width) { in ssd16xx_set_window()
380 return -ENOTSUP; in ssd16xx_set_window()
383 if ((y + desc->height) > panel_h) { in ssd16xx_set_window()
385 return -EINVAL; in ssd16xx_set_window()
388 if ((x + desc->width) > config->width) { in ssd16xx_set_window()
389 LOG_ERR("Buffer out of bounds (width)"); in ssd16xx_set_window()
390 return -EINVAL; in ssd16xx_set_window()
393 if ((desc->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE) != 0U) { in ssd16xx_set_window()
396 return -EINVAL; in ssd16xx_set_window()
402 return -EINVAL; in ssd16xx_set_window()
405 switch (data->scan_mode) { in ssd16xx_set_window()
408 x_end = (y + desc->height - 1) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
409 y_start = (x + desc->width - 1); in ssd16xx_set_window()
414 x_start = (panel_h - 1 - y) / SSD16XX_PIXELS_PER_BYTE; in ssd16xx_set_window()
415 x_end = (panel_h - 1 - (y + desc->height - 1)) / in ssd16xx_set_window()
418 y_end = (x + desc->width - 1); in ssd16xx_set_window()
421 return -EINVAL; in ssd16xx_set_window()
425 &data->scan_mode, sizeof(data->scan_mode)); in ssd16xx_set_window()
448 const struct ssd16xx_config *config = dev->config; in ssd16xx_write()
449 const struct ssd16xx_data *data = dev->data; in ssd16xx_write()
451 config->profiles[SSD16XX_PROFILE_PARTIAL] != NULL; in ssd16xx_write()
452 const bool partial_refresh = !data->blanking_on && have_partial_refresh; in ssd16xx_write()
453 const size_t buf_len = MIN(desc->buf_size, in ssd16xx_write()
454 desc->height * desc->width / 8); in ssd16xx_write()
459 return -EINVAL; in ssd16xx_write()
465 * a no-op if the profile is already active. in ssd16xx_write()
469 return -EIO; in ssd16xx_write()
484 if (!data->blanking_on) { in ssd16xx_write()
491 if (data->blanking_on && have_partial_refresh) { in ssd16xx_write()
511 * updates work on an up-to-date framebuffer. in ssd16xx_write()
528 const struct ssd16xx_data *data = dev->data; in ssd16xx_read_ram()
529 const size_t buf_len = MIN(desc->buf_size, in ssd16xx_read_ram()
530 desc->height * desc->width / 8); in ssd16xx_read_ram()
534 if (!data->read_supported) { in ssd16xx_read_ram()
535 return -ENOTSUP; in ssd16xx_read_ram()
548 return -EINVAL; in ssd16xx_read_ram()
553 return -EINVAL; in ssd16xx_read_ram()
594 return -ENOTSUP; in ssd16xx_set_brightness()
600 return -ENOTSUP; in ssd16xx_set_contrast()
606 const struct ssd16xx_config *config = dev->config; in ssd16xx_get_capabilities()
609 caps->x_resolution = config->width; in ssd16xx_get_capabilities()
610 caps->y_resolution = config->height - in ssd16xx_get_capabilities()
611 config->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE; in ssd16xx_get_capabilities()
612 caps->supported_pixel_formats = PIXEL_FORMAT_MONO10; in ssd16xx_get_capabilities()
613 caps->current_pixel_format = PIXEL_FORMAT_MONO10; in ssd16xx_get_capabilities()
614 caps->screen_info = SCREEN_INFO_MONO_VTILED | in ssd16xx_get_capabilities()
624 return -ENOTSUP; in ssd16xx_set_orientation()
635 return -ENOTSUP; in ssd16xx_set_pixel_format()
640 const struct ssd16xx_config *config = dev->config; in ssd16xx_clear_cntlr_mem()
641 uint16_t panel_h = config->height / EPD_PANEL_NUMOF_ROWS_PER_PAGE; in ssd16xx_clear_cntlr_mem()
642 uint16_t last_gate = config->width - 1; in ssd16xx_clear_cntlr_mem()
650 if (config->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE) { in ssd16xx_clear_cntlr_mem()
661 panel_h - 1, last_gate, in ssd16xx_clear_cntlr_mem()
674 size_t x = config->width; in ssd16xx_clear_cntlr_mem()
679 x -= l; in ssd16xx_clear_cntlr_mem()
692 const struct ssd16xx_config *config = dev->config; in ssd16xx_load_ws_from_otp_tssv()
700 config->tssv); in ssd16xx_load_ws_from_otp_tssv()
735 const struct ssd16xx_config *config = dev->config; in ssd16xx_load_lut()
737 if (lut && lut->len) { in ssd16xx_load_lut()
738 LOG_DBG("Using user-provided LUT"); in ssd16xx_load_lut()
740 lut->data, lut->len); in ssd16xx_load_lut()
742 if (config->tssv) { in ssd16xx_load_lut()
753 const struct ssd16xx_config *config = dev->config; in ssd16xx_set_profile()
754 struct ssd16xx_data *data = dev->data; in ssd16xx_set_profile()
756 const uint16_t last_gate = config->width - 1; in ssd16xx_set_profile()
762 return -EINVAL; in ssd16xx_set_profile()
765 p = config->profiles[type]; in ssd16xx_set_profile()
772 return -ENOENT; in ssd16xx_set_profile()
775 if (type == data->profile) { in ssd16xx_set_profile()
795 if (config->softstart.len) { in ssd16xx_set_profile()
797 config->softstart.data, in ssd16xx_set_profile()
798 config->softstart.len); in ssd16xx_set_profile()
804 err = ssd16xx_load_lut(dev, p ? &p->lut : NULL); in ssd16xx_set_profile()
809 if (p && p->override_dummy_line) { in ssd16xx_set_profile()
811 p->dummy_line); in ssd16xx_set_profile()
817 if (p && p->override_gate_line_width) { in ssd16xx_set_profile()
819 p->override_gate_line_width); in ssd16xx_set_profile()
825 if (p && p->gdv.len) { in ssd16xx_set_profile()
828 p->gdv.data, p->gdv.len); in ssd16xx_set_profile()
834 if (p && p->sdv.len) { in ssd16xx_set_profile()
837 p->sdv.data, p->sdv.len); in ssd16xx_set_profile()
843 if (p && p->override_vcom) { in ssd16xx_set_profile()
846 &p->vcom, 1); in ssd16xx_set_profile()
852 if (p && p->override_bwf) { in ssd16xx_set_profile()
855 &p->bwf, 1); in ssd16xx_set_profile()
861 data->profile = type; in ssd16xx_set_profile()
868 const struct ssd16xx_config *config = dev->config; in ssd16xx_controller_init()
869 struct ssd16xx_data *data = dev->data; in ssd16xx_controller_init()
874 data->blanking_on = false; in ssd16xx_controller_init()
875 data->profile = SSD16XX_PROFILE_INVALID; in ssd16xx_controller_init()
877 err = gpio_pin_set_dt(&config->reset_gpio, 1); in ssd16xx_controller_init()
883 err = gpio_pin_set_dt(&config->reset_gpio, 0); in ssd16xx_controller_init()
890 if (config->orientation == 1) { in ssd16xx_controller_init()
891 data->scan_mode = SSD16XX_DATA_ENTRY_XIYDY; in ssd16xx_controller_init()
893 data->scan_mode = SSD16XX_DATA_ENTRY_XDYIY; in ssd16xx_controller_init()
921 const struct ssd16xx_config *config = dev->config; in ssd16xx_init()
922 struct ssd16xx_data *data = dev->data; in ssd16xx_init()
927 if (!spi_is_ready_dt(&config->bus)) { in ssd16xx_init()
928 LOG_ERR("SPI bus %s not ready", config->bus.bus->name); in ssd16xx_init()
929 return -ENODEV; in ssd16xx_init()
932 data->read_supported = in ssd16xx_init()
933 (config->bus.config.operation & SPI_HALF_DUPLEX) != 0; in ssd16xx_init()
935 if (!gpio_is_ready_dt(&config->reset_gpio)) { in ssd16xx_init()
936 LOG_ERR("Reset GPIO device not ready"); in ssd16xx_init()
937 return -ENODEV; in ssd16xx_init()
940 err = gpio_pin_configure_dt(&config->reset_gpio, GPIO_OUTPUT_INACTIVE); in ssd16xx_init()
942 LOG_ERR("Failed to configure reset GPIO"); in ssd16xx_init()
946 if (!gpio_is_ready_dt(&config->dc_gpio)) { in ssd16xx_init()
947 LOG_ERR("DC GPIO device not ready"); in ssd16xx_init()
948 return -ENODEV; in ssd16xx_init()
951 err = gpio_pin_configure_dt(&config->dc_gpio, GPIO_OUTPUT_INACTIVE); in ssd16xx_init()
953 LOG_ERR("Failed to configure DC GPIO"); in ssd16xx_init()
957 if (!gpio_is_ready_dt(&config->busy_gpio)) { in ssd16xx_init()
958 LOG_ERR("Busy GPIO device not ready"); in ssd16xx_init()
959 return -ENODEV; in ssd16xx_init()
962 err = gpio_pin_configure_dt(&config->busy_gpio, GPIO_INPUT); in ssd16xx_init()
964 LOG_ERR("Failed to configure busy GPIO"); in ssd16xx_init()
968 if (config->width > config->quirks->max_width || in ssd16xx_init()
969 config->height > config->quirks->max_height) { in ssd16xx_init()
971 return -EINVAL; in ssd16xx_init()
1103 .width = DT_PROP(n, width), \