sensor.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include <stdio.h>
  2. #include "sensor.h"
  3. const camera_sensor_info_t camera_sensor[CAMERA_MODEL_MAX] = {
  4. // The sequence must be consistent with camera_model_t
  5. {CAMERA_OV7725, "OV7725", OV7725_SCCB_ADDR, OV7725_PID, FRAMESIZE_VGA, false},
  6. {CAMERA_OV2640, "OV2640", OV2640_SCCB_ADDR, OV2640_PID, FRAMESIZE_UXGA, true},
  7. {CAMERA_OV3660, "OV3660", OV3660_SCCB_ADDR, OV3660_PID, FRAMESIZE_QXGA, true},
  8. {CAMERA_OV5640, "OV5640", OV5640_SCCB_ADDR, OV5640_PID, FRAMESIZE_QSXGA, true},
  9. {CAMERA_OV7670, "OV7670", OV7670_SCCB_ADDR, OV7670_PID, FRAMESIZE_VGA, false},
  10. {CAMERA_NT99141, "NT99141", NT99141_SCCB_ADDR, NT99141_PID, FRAMESIZE_HD, true},
  11. {CAMERA_GC2145, "GC2145", GC2145_SCCB_ADDR, GC2145_PID, FRAMESIZE_UXGA, false},
  12. {CAMERA_GC032A, "GC032A", GC032A_SCCB_ADDR, GC032A_PID, FRAMESIZE_VGA, false},
  13. {CAMERA_GC0308, "GC0308", GC0308_SCCB_ADDR, GC0308_PID, FRAMESIZE_VGA, false},
  14. {CAMERA_BF3005, "BF3005", BF3005_SCCB_ADDR, BF3005_PID, FRAMESIZE_VGA, false},
  15. {CAMERA_BF20A6, "BF20A6", BF20A6_SCCB_ADDR, BF20A6_PID, FRAMESIZE_VGA, false},
  16. };
  17. const resolution_info_t resolution[FRAMESIZE_INVALID] = {
  18. { 96, 96, ASPECT_RATIO_1X1 }, /* 96x96 */
  19. { 160, 120, ASPECT_RATIO_4X3 }, /* QQVGA */
  20. { 176, 144, ASPECT_RATIO_5X4 }, /* QCIF */
  21. { 240, 176, ASPECT_RATIO_4X3 }, /* HQVGA */
  22. { 240, 240, ASPECT_RATIO_1X1 }, /* 240x240 */
  23. { 320, 240, ASPECT_RATIO_4X3 }, /* QVGA */
  24. { 400, 296, ASPECT_RATIO_4X3 }, /* CIF */
  25. { 480, 320, ASPECT_RATIO_3X2 }, /* HVGA */
  26. { 640, 480, ASPECT_RATIO_4X3 }, /* VGA */
  27. { 800, 600, ASPECT_RATIO_4X3 }, /* SVGA */
  28. { 1024, 768, ASPECT_RATIO_4X3 }, /* XGA */
  29. { 1280, 720, ASPECT_RATIO_16X9 }, /* HD */
  30. { 1280, 1024, ASPECT_RATIO_5X4 }, /* SXGA */
  31. { 1600, 1200, ASPECT_RATIO_4X3 }, /* UXGA */
  32. // 3MP Sensors
  33. { 1920, 1080, ASPECT_RATIO_16X9 }, /* FHD */
  34. { 720, 1280, ASPECT_RATIO_9X16 }, /* Portrait HD */
  35. { 864, 1536, ASPECT_RATIO_9X16 }, /* Portrait 3MP */
  36. { 2048, 1536, ASPECT_RATIO_4X3 }, /* QXGA */
  37. // 5MP Sensors
  38. { 2560, 1440, ASPECT_RATIO_16X9 }, /* QHD */
  39. { 2560, 1600, ASPECT_RATIO_16X10 }, /* WQXGA */
  40. { 1088, 1920, ASPECT_RATIO_9X16 }, /* Portrait FHD */
  41. { 2560, 1920, ASPECT_RATIO_4X3 }, /* QSXGA */
  42. };
  43. camera_sensor_info_t *esp_camera_sensor_get_info(sensor_id_t *id)
  44. {
  45. for (int i = 0; i < CAMERA_MODEL_MAX; i++) {
  46. if (id->PID == camera_sensor[i].pid) {
  47. return (camera_sensor_info_t *)&camera_sensor[i];
  48. }
  49. }
  50. return NULL;
  51. }