fix: add gc0308 output only Y format support (#589)

This commit is contained in:
yuxinwww
2023-11-08 21:44:40 +08:00
committed by GitHub
parent efe711df9a
commit 81cd88c6a0
5 changed files with 8 additions and 4 deletions

View File

@ -22,7 +22,7 @@ This repository hosts ESP32 series Soc compatible driver for image sensors. Addi
| OV7725 | 640 x 480 | color | Raw RGB<br/>GRB 422<br/>RGB565/555/444<br/>YCbCr 422 | 1/4" | | OV7725 | 640 x 480 | color | Raw RGB<br/>GRB 422<br/>RGB565/555/444<br/>YCbCr 422 | 1/4" |
| NT99141 | 1280 x 720 | color | YCbCr 422<br/>RGB565/555/444<br/>Raw<br/>CCIR656<br/>JPEG compression | 1/4" | | NT99141 | 1280 x 720 | color | YCbCr 422<br/>RGB565/555/444<br/>Raw<br/>CCIR656<br/>JPEG compression | 1/4" |
| GC032A | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565 | 1/10" | | GC032A | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565 | 1/10" |
| GC0308 | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565 | 1/6.5" | | GC0308 | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565<br/>Grayscale | 1/6.5" |
| GC2145 | 1600 x 1200 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565 | 1/5" | | GC2145 | 1600 x 1200 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565 | 1/5" |
| BF3005 | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565 | 1/4" | | BF3005 | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>RGB565 | 1/4" |
| BF20A6 | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>Only Y | 1/10" | | BF20A6 | 640 x 480 | color | YUV/YCbCr422<br/>RAW Bayer<br/>Only Y | 1/10" |

View File

@ -160,6 +160,10 @@ static int set_pixformat(sensor_t *sensor, pixformat_t pixformat)
write_reg(sensor->slv_addr, 0xfe, 0x00); write_reg(sensor->slv_addr, 0xfe, 0x00);
ret = set_reg_bits(sensor->slv_addr, 0x24, 0, 0x0f, 2); //yuv422 Y Cb Y Cr ret = set_reg_bits(sensor->slv_addr, 0x24, 0, 0x0f, 2); //yuv422 Y Cb Y Cr
break; break;
case PIXFORMAT_GRAYSCALE:
write_reg(sensor->slv_addr, 0xfe, 0x00);
ret = write_reg(sensor->slv_addr, 0x24, 0xb1);
break;
default: default:
ESP_LOGW(TAG, "unsupport format"); ESP_LOGW(TAG, "unsupport format");
ret = -1; ret = -1;

View File

@ -491,7 +491,7 @@ size_t IRAM_ATTR ll_cam_memcpy(cam_obj_t *cam, uint8_t *out, const uint8_t *in,
esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_t xclk_freq_hz, uint16_t sensor_pid) esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_t xclk_freq_hz, uint16_t sensor_pid)
{ {
if (pix_format == PIXFORMAT_GRAYSCALE) { if (pix_format == PIXFORMAT_GRAYSCALE) {
if (sensor_pid == OV3660_PID || sensor_pid == OV5640_PID || sensor_pid == NT99141_PID || sensor_pid == SC031GS_PID || sensor_pid == BF20A6_PID) { if (sensor_pid == OV3660_PID || sensor_pid == OV5640_PID || sensor_pid == NT99141_PID || sensor_pid == SC031GS_PID || sensor_pid == BF20A6_PID || sensor_pid == GC0308_PID) {
if (xclk_freq_hz > 10000000) { if (xclk_freq_hz > 10000000) {
sampling_mode = SM_0A00_0B00; sampling_mode = SM_0A00_0B00;
dma_filter = ll_cam_dma_filter_yuyv_highspeed; dma_filter = ll_cam_dma_filter_yuyv_highspeed;

View File

@ -394,7 +394,7 @@ size_t IRAM_ATTR ll_cam_memcpy(cam_obj_t *cam, uint8_t *out, const uint8_t *in,
esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_t xclk_freq_hz, uint16_t sensor_pid) esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_t xclk_freq_hz, uint16_t sensor_pid)
{ {
if (pix_format == PIXFORMAT_GRAYSCALE) { if (pix_format == PIXFORMAT_GRAYSCALE) {
if (sensor_pid == OV3660_PID || sensor_pid == OV5640_PID || sensor_pid == NT99141_PID || sensor_pid == SC031GS_PID || sensor_pid == BF20A6_PID) { if (sensor_pid == OV3660_PID || sensor_pid == OV5640_PID || sensor_pid == NT99141_PID || sensor_pid == SC031GS_PID || sensor_pid == BF20A6_PID || sensor_pid == GC0308_PID) {
cam->in_bytes_per_pixel = 1; // camera sends Y8 cam->in_bytes_per_pixel = 1; // camera sends Y8
} else { } else {
cam->in_bytes_per_pixel = 2; // camera sends YU/YV cam->in_bytes_per_pixel = 2; // camera sends YU/YV

View File

@ -493,7 +493,7 @@ size_t IRAM_ATTR ll_cam_memcpy(cam_obj_t *cam, uint8_t *out, const uint8_t *in,
esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_t xclk_freq_hz, uint16_t sensor_pid) esp_err_t ll_cam_set_sample_mode(cam_obj_t *cam, pixformat_t pix_format, uint32_t xclk_freq_hz, uint16_t sensor_pid)
{ {
if (pix_format == PIXFORMAT_GRAYSCALE) { if (pix_format == PIXFORMAT_GRAYSCALE) {
if (sensor_pid == OV3660_PID || sensor_pid == OV5640_PID || sensor_pid == NT99141_PID || sensor_pid == SC031GS_PID || sensor_pid == BF20A6_PID) { if (sensor_pid == OV3660_PID || sensor_pid == OV5640_PID || sensor_pid == NT99141_PID || sensor_pid == SC031GS_PID || sensor_pid == BF20A6_PID || sensor_pid == GC0308_PID) {
cam->in_bytes_per_pixel = 1; // camera sends Y8 cam->in_bytes_per_pixel = 1; // camera sends Y8
} else { } else {
cam->in_bytes_per_pixel = 2; // camera sends YU/YV cam->in_bytes_per_pixel = 2; // camera sends YU/YV