Browse Source

support RGB565

pull/88/head
jjsch-dev 6 years ago
parent
commit
5957101010
  1. 20
      driver/camera.c
  2. 1
      sensors/ov7670.c

20
driver/camera.c

@ -1108,22 +1108,13 @@ esp_err_t camera_init(const camera_config_t* config) @@ -1108,22 +1108,13 @@ esp_err_t camera_init(const camera_config_t* config)
}
s_state->fb_bytes_per_pixel = 1; // frame buffer stores Y8
} else if (pix_format == PIXFORMAT_YUV422 || pix_format == PIXFORMAT_RGB565) {
s_state->fb_size = s_state->width * s_state->height * 2;
if (is_hs_mode() && s_state->sensor.id.PID != OV7725_PID) {
if(s_state->sensor.id.PID == OV7670_PID) {
s_state->fb_size = s_state->width * s_state->height * 3;
if (is_hs_mode()) {
s_state->sampling_mode = SM_0A0B_0B0C;
s_state->dma_filter = &dma_filter_rgb888_highspeed;
}else{
s_state->sampling_mode = SM_0A0B_0C0D;
s_state->dma_filter = &dma_filter_rgb888;
}
s_state->in_bytes_per_pixel = 2; // camera sends RGB565
s_state->fb_bytes_per_pixel = 3; // frame buffer stores RGB888
}
else {
s_state->fb_size = s_state->width * s_state->height * 2;
if (is_hs_mode() && s_state->sensor.id.PID != OV7725_PID) {
s_state->sampling_mode = SM_0A00_0B00;
}
s_state->dma_filter = &dma_filter_yuyv_highspeed;
} else {
s_state->sampling_mode = SM_0A0B_0C0D;
@ -1131,11 +1122,14 @@ esp_err_t camera_init(const camera_config_t* config) @@ -1131,11 +1122,14 @@ esp_err_t camera_init(const camera_config_t* config)
}
s_state->in_bytes_per_pixel = 2; // camera sends YU/YV
s_state->fb_bytes_per_pixel = 2; // frame buffer stores YU/YV/RGB565
}
} else if (pix_format == PIXFORMAT_RGB888) {
s_state->fb_size = s_state->width * s_state->height * 3;
if (is_hs_mode()) {
if(s_state->sensor.id.PID == OV7670_PID) {
s_state->sampling_mode = SM_0A0B_0B0C;
}else{
s_state->sampling_mode = SM_0A00_0B00;
}
s_state->dma_filter = &dma_filter_rgb888_highspeed;
} else {
s_state->sampling_mode = SM_0A0B_0C0D;

1
sensors/ov7670.c

@ -224,6 +224,7 @@ int ret; @@ -224,6 +224,7 @@ int ret;
switch (pixformat) {
case PIXFORMAT_RGB565:
case PIXFORMAT_RGB888:
ret = ov7670_write_array(sensor, ov7670_fmt_rgb565);
break;

Loading…
Cancel
Save