camera_define.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef CAMERADEFINED
  2. #define CAMERADEFINED
  3. #if defined(CAMERA_MODEL_WROVER_KIT)
  4. #define PWDN_GPIO_NUM -1
  5. #define RESET_GPIO_NUM -1
  6. #define XCLK_GPIO_NUM 21
  7. #define SIOD_GPIO_NUM 26
  8. #define SIOC_GPIO_NUM 27
  9. #define Y9_GPIO_NUM 35
  10. #define Y8_GPIO_NUM 34
  11. #define Y7_GPIO_NUM 39
  12. #define Y6_GPIO_NUM 36
  13. #define Y5_GPIO_NUM 19
  14. #define Y4_GPIO_NUM 18
  15. #define Y3_GPIO_NUM 5
  16. #define Y2_GPIO_NUM 4
  17. #define VSYNC_GPIO_NUM 25
  18. #define HREF_GPIO_NUM 23
  19. #define PCLK_GPIO_NUM 22
  20. #elif defined(CAMERA_MODEL_M5STACK_PSRAM)
  21. #define PWDN_GPIO_NUM -1
  22. #define RESET_GPIO_NUM 15
  23. #define XCLK_GPIO_NUM 27
  24. #define SIOD_GPIO_NUM 25
  25. #define SIOC_GPIO_NUM 23
  26. #define Y9_GPIO_NUM 19
  27. #define Y8_GPIO_NUM 36
  28. #define Y7_GPIO_NUM 18
  29. #define Y6_GPIO_NUM 39
  30. #define Y5_GPIO_NUM 5
  31. #define Y4_GPIO_NUM 34
  32. #define Y3_GPIO_NUM 35
  33. #define Y2_GPIO_NUM 32
  34. #define VSYNC_GPIO_NUM 22
  35. #define HREF_GPIO_NUM 26
  36. #define PCLK_GPIO_NUM 21
  37. #elif defined(CAMERA_MODEL_AI_THINKER)
  38. #define PWDN_GPIO_NUM GPIO_NUM_32
  39. #define RESET_GPIO_NUM -1
  40. #define XCLK_GPIO_NUM GPIO_NUM_0
  41. #define SIOD_GPIO_NUM GPIO_NUM_26
  42. #define SIOC_GPIO_NUM GPIO_NUM_27
  43. #define Y9_GPIO_NUM GPIO_NUM_35
  44. #define Y8_GPIO_NUM GPIO_NUM_34
  45. #define Y7_GPIO_NUM GPIO_NUM_39
  46. #define Y6_GPIO_NUM GPIO_NUM_36
  47. #define Y5_GPIO_NUM GPIO_NUM_21
  48. #define Y4_GPIO_NUM GPIO_NUM_19
  49. #define Y3_GPIO_NUM GPIO_NUM_18
  50. #define Y2_GPIO_NUM GPIO_NUM_5
  51. #define VSYNC_GPIO_NUM GPIO_NUM_25
  52. #define HREF_GPIO_NUM GPIO_NUM_23
  53. #define PCLK_GPIO_NUM GPIO_NUM_22
  54. #else
  55. #error "Camera model not selected"
  56. #endif
  57. static camera_config_t camera_config = {
  58. .pin_pwdn = PWDN_GPIO_NUM,
  59. .pin_reset = RESET_GPIO_NUM,
  60. .pin_xclk = XCLK_GPIO_NUM,
  61. .pin_sscb_sda = SIOD_GPIO_NUM,
  62. .pin_sscb_scl = SIOC_GPIO_NUM,
  63. .pin_d7 = Y9_GPIO_NUM,
  64. .pin_d6 = Y8_GPIO_NUM,
  65. .pin_d5 = Y7_GPIO_NUM,
  66. .pin_d4 = Y6_GPIO_NUM,
  67. .pin_d3 = Y5_GPIO_NUM,
  68. .pin_d2 = Y4_GPIO_NUM,
  69. .pin_d1 = Y3_GPIO_NUM,
  70. .pin_d0 = Y2_GPIO_NUM,
  71. .pin_vsync = VSYNC_GPIO_NUM,
  72. .pin_href = HREF_GPIO_NUM,
  73. .pin_pclk = PCLK_GPIO_NUM,
  74. //XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental)
  75. .xclk_freq_hz = 20000000,
  76. .ledc_timer = LEDC_TIMER_0,
  77. .ledc_channel = LEDC_CHANNEL_0,
  78. .pixel_format = PIXFORMAT_JPEG,//YUV422,GRAYSCALE,RGB565,JPEG
  79. // .pixel_format = PIXFORMAT_RGB888,//YUV422,GRAYSCALE,RGB565,JPEG
  80. // .frame_size = FRAMESIZE_QVGA,//QQVGA-QXGA Do not use sizes above QVGA when not JPEG
  81. .frame_size = FRAMESIZE_SVGA,//QQVGA-QXGA Do not use sizes above QVGA when not JPEG
  82. .jpeg_quality = 12, //0-63 lower number means higher quality
  83. .fb_count = 1 //if more than one, i2s runs in continuous mode. Use only with JPEG
  84. };
  85. #endif