Lines Matching +full:min +full:- +full:y
4 * SPDX-License-Identifier: Apache-2.0
71 const struct ssd1306_config *config = dev->config; in ssd1306_bus_ready_i2c()
73 return i2c_is_ready_dt(&config->bus.i2c); in ssd1306_bus_ready_i2c()
78 const struct ssd1306_config *config = dev->config; in ssd1306_write_bus_i2c()
80 return i2c_burst_write_dt(&config->bus.i2c, in ssd1306_write_bus_i2c()
88 const struct ssd1306_config *config = dev->config; in ssd1306_bus_name_i2c()
90 return config->bus.i2c.bus->name; in ssd1306_bus_name_i2c()
98 const struct ssd1306_config *config = dev->config; in ssd1306_bus_ready_spi()
100 if (gpio_pin_configure_dt(&config->data_cmd, GPIO_OUTPUT_INACTIVE) < 0) { in ssd1306_bus_ready_spi()
104 return spi_is_ready_dt(&config->bus.spi); in ssd1306_bus_ready_spi()
109 const struct ssd1306_config *config = dev->config; in ssd1306_write_bus_spi()
112 gpio_pin_set_dt(&config->data_cmd, command ? 0 : 1); in ssd1306_write_bus_spi()
123 errno = spi_write_dt(&config->bus.spi, &tx_bufs); in ssd1306_write_bus_spi()
130 const struct ssd1306_config *config = dev->config; in ssd1306_bus_name_spi()
132 return config->bus.spi.bus->name; in ssd1306_bus_name_spi()
138 const struct ssd1306_config *config = dev->config; in ssd1306_bus_ready()
140 return config->bus_ready(dev); in ssd1306_bus_ready()
146 const struct ssd1306_config *config = dev->config; in ssd1306_write_bus()
148 return config->write_bus(dev, buf, len, command); in ssd1306_write_bus()
153 const struct ssd1306_config *config = dev->config; in ssd1306_set_panel_orientation()
154 uint8_t cmd_buf[] = {(config->segment_remap ? SSD1306_SET_SEGMENT_MAP_REMAPED in ssd1306_set_panel_orientation()
156 (config->com_invdir ? SSD1306_SET_COM_OUTPUT_SCAN_FLIPPED in ssd1306_set_panel_orientation()
164 const struct ssd1306_config *config = dev->config; in ssd1306_set_timing_setting()
168 config->prechargep, in ssd1306_set_timing_setting()
177 const struct ssd1306_config *config = dev->config; in ssd1306_set_hardware_config()
181 config->display_offset, in ssd1306_set_hardware_config()
183 (config->com_sequential ? SSD1306_SET_PADS_HW_SEQUENTIAL in ssd1306_set_hardware_config()
186 config->multiplex_ratio, in ssd1306_set_hardware_config()
194 const struct ssd1306_config *config = dev->config; in ssd1306_set_charge_pump()
196 (config->sh1106_compatible ? SH1106_SET_DCDC_MODE : SSD1306_SET_CHARGE_PUMP_ON), in ssd1306_set_charge_pump()
197 (config->sh1106_compatible ? SH1106_SET_DCDC_ENABLED in ssd1306_set_charge_pump()
223 static int ssd1306_write_default(const struct device *dev, const uint16_t x, const uint16_t y, in ssd1306_write_default() argument
232 (x + desc->width - 1), in ssd1306_write_default()
234 y/8, in ssd1306_write_default()
235 ((y + desc->height)/8 - 1) in ssd1306_write_default()
240 return -1; in ssd1306_write_default()
246 static int ssd1306_write_sh1106(const struct device *dev, const uint16_t x, const uint16_t y, in ssd1306_write_sh1106() argument
250 const struct ssd1306_config *config = dev->config; in ssd1306_write_sh1106()
251 uint8_t x_offset = x + config->segment_offset; in ssd1306_write_sh1106()
257 SSD1306_SET_PAGE_START_ADDRESS | (y / 8) in ssd1306_write_sh1106()
261 for (uint8_t n = 0; n < desc->height / 8; n++) { in ssd1306_write_sh1106()
262 cmd_buf[sizeof(cmd_buf) - 1] = in ssd1306_write_sh1106()
263 SSD1306_SET_PAGE_START_ADDRESS | (n + (y / 8)); in ssd1306_write_sh1106()
267 return -1; in ssd1306_write_sh1106()
270 if (ssd1306_write_bus(dev, buf_ptr, desc->width, false)) { in ssd1306_write_sh1106()
271 return -1; in ssd1306_write_sh1106()
274 buf_ptr = buf_ptr + desc->width; in ssd1306_write_sh1106()
277 return -1; in ssd1306_write_sh1106()
284 static int ssd1306_write(const struct device *dev, const uint16_t x, const uint16_t y, in ssd1306_write() argument
287 const struct ssd1306_config *config = dev->config; in ssd1306_write()
290 if (desc->pitch < desc->width) { in ssd1306_write()
292 return -1; in ssd1306_write()
295 buf_len = MIN(desc->buf_size, desc->height * desc->width / 8); in ssd1306_write()
298 return -1; in ssd1306_write()
301 if (desc->pitch > desc->width) { in ssd1306_write()
303 return -1; in ssd1306_write()
306 if ((y & 0x7) != 0U) { in ssd1306_write()
308 return -1; in ssd1306_write()
311 LOG_DBG("x %u, y %u, pitch %u, width %u, height %u, buf_len %u", x, y, desc->pitch, in ssd1306_write()
312 desc->width, desc->height, buf_len); in ssd1306_write()
314 if (config->sh1106_compatible) { in ssd1306_write()
315 return ssd1306_write_sh1106(dev, x, y, desc, buf, buf_len); in ssd1306_write()
318 return ssd1306_write_default(dev, x, y, desc, buf, buf_len); in ssd1306_write()
322 const uint16_t y, in ssd1306_read() argument
327 return -ENOTSUP; in ssd1306_read()
340 return -ENOTSUP; in ssd1306_set_brightness()
356 const struct ssd1306_config *config = dev->config; in ssd1306_get_capabilities()
358 caps->x_resolution = config->width; in ssd1306_get_capabilities()
359 caps->y_resolution = config->height; in ssd1306_get_capabilities()
360 caps->supported_pixel_formats = PIXEL_FORMAT_MONO10; in ssd1306_get_capabilities()
361 caps->current_pixel_format = PIXEL_FORMAT_MONO10; in ssd1306_get_capabilities()
362 caps->screen_info = SCREEN_INFO_MONO_VTILED; in ssd1306_get_capabilities()
370 return -ENOTSUP; in ssd1306_set_orientation()
380 return -ENOTSUP; in ssd1306_set_pixel_format()
385 const struct ssd1306_config *config = dev->config; in ssd1306_init_device()
389 (config->color_inversion ? SSD1306_SET_REVERSE_DISPLAY in ssd1306_init_device()
394 if (config->reset.port) { in ssd1306_init_device()
396 gpio_pin_set_dt(&config->reset, 1); in ssd1306_init_device()
398 gpio_pin_set_dt(&config->reset, 0); in ssd1306_init_device()
403 return -EIO; in ssd1306_init_device()
407 return -EIO; in ssd1306_init_device()
411 return -EIO; in ssd1306_init_device()
415 return -EIO; in ssd1306_init_device()
419 return -EIO; in ssd1306_init_device()
423 return -EIO; in ssd1306_init_device()
427 return -EIO; in ssd1306_init_device()
437 const struct ssd1306_config *config = dev->config; in ssd1306_init()
441 k_sleep(K_TIMEOUT_ABS_MS(config->ready_time_ms)); in ssd1306_init()
444 LOG_ERR("Bus device %s not ready!", config->bus_name(dev)); in ssd1306_init()
445 return -EINVAL; in ssd1306_init()
448 if (config->reset.port) { in ssd1306_init()
451 ret = gpio_pin_configure_dt(&config->reset, in ssd1306_init()
460 return -EIO; in ssd1306_init()