Lines Matching +full:output +full:- +full:pixel +full:- +full:format

4  * SPDX-License-Identifier: Apache-2.0
12 #include <zephyr/drivers/video-controls.h>
188 #define OV7670_VIDEO_FORMAT_CAP(width, height, format) \
190 .pixelformat = (format), .width_min = (width), .width_max = (width), \
212 /* configure the output timing */
216 /* Brightness Control, with signal -128 to +128, 0x00 is middle value */
219 /* Internal clock pre-scalar,F(internal clock) = F(input clock)/(Bit[5:0]+1) */
226 /* Output Drive Capability */
227 {OV7670_COM2, 0x00}, /* Common Control 2, Output Drive Capability: 1x */
236 {OV7670_DNSTH, 0x00}, /* De-noise Strength */
263 /* config the output window data, this can be configed later */
271 /* AGC/AEC - Automatic Gain Control/Automatic exposure Control */
330 /* Histogram-based AEC/AGC Control */
350 caps->format_caps = fmts;
357 const struct ov7670_config *config = dev->config;
358 struct ov7670_data *data = dev->data;
363 if (fmt->pixelformat != VIDEO_PIX_FMT_RGB565 && fmt->pixelformat != VIDEO_PIX_FMT_YUYV) {
365 return -ENOTSUP;
368 if (!memcmp(&data->fmt, fmt, sizeof(data->fmt))) {
373 memcpy(&data->fmt, fmt, sizeof(data->fmt));
375 /* Set output resolution */
377 if (fmts[i].width_min == fmt->width && fmts[i].height_min == fmt->height &&
378 fmts[i].pixelformat == fmt->pixelformat) {
379 /* Set output format */
395 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM7,
396 resolution->com7);
400 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM3,
401 resolution->com3);
405 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM14,
406 resolution->com14);
410 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_XSC,
411 resolution->scaling_xsc);
415 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_YSC,
416 resolution->scaling_ysc);
420 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_DCWCTR,
421 resolution->dcwctr);
425 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_PCLK_DIV,
426 resolution->pclk_div);
430 return i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_PCLK_DELAY,
431 resolution->pclk_delay);
436 LOG_ERR("Unsupported format");
437 return -ENOTSUP;
443 struct ov7670_data *data = dev->data;
446 return -EINVAL;
448 memcpy(fmt, &data->fmt, sizeof(data->fmt));
454 const struct ov7670_config *config = dev->config;
460 if (!i2c_is_ready_dt(&config->bus)) {
462 return -ENODEV;
467 if (config->pwdn.port != NULL) {
468 if (!gpio_is_ready_dt(&config->pwdn)) {
469 return -ENODEV;
471 ret = gpio_pin_configure_dt(&config->pwdn, GPIO_OUTPUT_INACTIVE);
480 if (config->reset.port != NULL) {
481 if (!gpio_is_ready_dt(&config->reset)) {
482 return -ENODEV;
484 ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT);
490 gpio_pin_set_dt(&config->reset, 0);
492 gpio_pin_set_dt(&config->reset, 1);
499 * spec- which *should* be I2C compatible, but in practice does
506 ret = i2c_write_dt(&config->bus, &cmd, sizeof(cmd));
511 ret = i2c_read_dt(&config->bus, &pid, sizeof(pid));
519 return -ENODEV;
523 ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM7, 0x80);
531 /* Set default camera format (QVGA, YUYV) */
544 ret = i2c_reg_write_byte_dt(&config->bus, reg->reg, reg->cmd);
560 const struct ov7670_config *config = dev->config;
564 return i2c_reg_update_byte_dt(&config->bus, OV7670_MVFP,
567 return i2c_reg_update_byte_dt(&config->bus, OV7670_MVFP,
570 return -ENOTSUP;