diff --git a/Kconfig b/Kconfig index 5af4569498..5601b4628c 100755 --- a/Kconfig +++ b/Kconfig @@ -67,5 +67,21 @@ menu "Camera configuration" bool "NO_AFFINITY" endchoice + menu "Camera Pins" + choice CAMERA_MODEL + bool "Select Camera Pinout" + default BOARD_ESP32CAM_AITHINKER + help + Select Camera Pinout. + config BOARD_WROVER_KIT + + bool "WROVER-KIT OV2640 Module" + config BOARD_ESP32CAM_AITHINKER + + bool "ESP32-CAM by AI-Thinker" + endchoice + endmenu + endmenu + diff --git a/driver/include/esp_camera.h b/driver/include/esp_camera.h index dadd0c0983..adf45d9adf 100755 --- a/driver/include/esp_camera.h +++ b/driver/include/esp_camera.h @@ -74,6 +74,57 @@ extern "C" { #endif + +#define BOARD_WROVER_KIT CONFIG_BOARD_WROVER_KIT +#define BOARD_ESP32CAM_AITHINKER CONFIG_BOARD_ESP32CAM_AITHINKER + +// WROVER-KIT PIN Map +#if BOARD_WROVER_KIT + +#define CAM_PIN_PWDN -1 //power down is not used +#define CAM_PIN_RESET -1 //software reset will be performed +#define CAM_PIN_XCLK 21 +#define CAM_PIN_SIOD 26 +#define CAM_PIN_SIOC 27 + +#define CAM_PIN_D7 35 +#define CAM_PIN_D6 34 +#define CAM_PIN_D5 39 +#define CAM_PIN_D4 36 +#define CAM_PIN_D3 19 +#define CAM_PIN_D2 18 +#define CAM_PIN_D1 5 +#define CAM_PIN_D0 4 +#define CAM_PIN_VSYNC 25 +#define CAM_PIN_HREF 23 +#define CAM_PIN_PCLK 22 + +// ESP32Cam (AiThinker) PIN Map +#elif BOARD_ESP32CAM_AITHINKER + + +#define CAM_PIN_PWDN 32 +#define CAM_PIN_RESET -1 //software reset will be performed +#define CAM_PIN_XCLK 0 +#define CAM_PIN_SIOD 26 +#define CAM_PIN_SIOC 27 + +#define CAM_PIN_D7 35 +#define CAM_PIN_D6 34 +#define CAM_PIN_D5 39 +#define CAM_PIN_D4 36 +#define CAM_PIN_D3 21 +#define CAM_PIN_D2 19 +#define CAM_PIN_D1 18 +#define CAM_PIN_D0 5 +#define CAM_PIN_VSYNC 25 +#define CAM_PIN_HREF 23 +#define CAM_PIN_PCLK 22 + +#endif + + + /** * @brief Configuration structure for camera initialization */ diff --git a/examples/take_picture.c b/examples/take_picture.c index 96b224fda8..2f8c7e789e 100644 --- a/examples/take_picture.c +++ b/examples/take_picture.c @@ -41,51 +41,7 @@ #include "esp_camera.h" -// WROVER-KIT PIN Map -#ifdef BOARD_WROVER_KIT - -#define CAM_PIN_PWDN -1 //power down is not used -#define CAM_PIN_RESET -1 //software reset will be performed -#define CAM_PIN_XCLK 21 -#define CAM_PIN_SIOD 26 -#define CAM_PIN_SIOC 27 - -#define CAM_PIN_D7 35 -#define CAM_PIN_D6 34 -#define CAM_PIN_D5 39 -#define CAM_PIN_D4 36 -#define CAM_PIN_D3 19 -#define CAM_PIN_D2 18 -#define CAM_PIN_D1 5 -#define CAM_PIN_D0 4 -#define CAM_PIN_VSYNC 25 -#define CAM_PIN_HREF 23 -#define CAM_PIN_PCLK 22 - -#endif - -// ESP32Cam (AiThinker) PIN Map -#ifdef BOARD_ESP32CAM_AITHINKER - -#define CAM_PIN_PWDN 32 -#define CAM_PIN_RESET -1 //software reset will be performed -#define CAM_PIN_XCLK 0 -#define CAM_PIN_SIOD 26 -#define CAM_PIN_SIOC 27 - -#define CAM_PIN_D7 35 -#define CAM_PIN_D6 34 -#define CAM_PIN_D5 39 -#define CAM_PIN_D4 36 -#define CAM_PIN_D3 21 -#define CAM_PIN_D2 19 -#define CAM_PIN_D1 18 -#define CAM_PIN_D0 5 -#define CAM_PIN_VSYNC 25 -#define CAM_PIN_HREF 23 -#define CAM_PIN_PCLK 22 - -#endif + static const char *TAG = "example:take_picture"; @@ -147,4 +103,4 @@ void app_main() vTaskDelay(5000 / portTICK_RATE_MS); } -} \ No newline at end of file +}