From cc7506b6d257a1e85c2604ae5862e79ef9d809f4 Mon Sep 17 00:00:00 2001 From: Rune Harlyk Date: Fri, 5 May 2023 02:37:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=AA=20Removes=20unused=20library=20cod?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/OV2640.h | 43 ---------- include/index_other.h | 60 ------------- src/OV2640.cpp | 193 ------------------------------------------ 3 files changed, 296 deletions(-) delete mode 100644 include/OV2640.h delete mode 100644 include/index_other.h delete mode 100644 src/OV2640.cpp diff --git a/include/OV2640.h b/include/OV2640.h deleted file mode 100644 index 39927df..0000000 --- a/include/OV2640.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef OV2640_H_ -#define OV2640_H_ - -#include -#include -#include -#include "esp_log.h" -#include "esp_attr.h" -#include "esp_camera.h" - -extern camera_config_t esp32cam_config, esp32cam_aithinker_config, esp32cam_ttgo_t_config; - -class OV2640 -{ -public: - OV2640(){ - fb = NULL; - }; - ~OV2640(){ - }; - esp_err_t init(camera_config_t config); - void run(void); - size_t getSize(void); - uint8_t *getfb(void); - int getWidth(void); - int getHeight(void); - framesize_t getFrameSize(void); - pixformat_t getPixelFormat(void); - - void setFrameSize(framesize_t size); - void setPixelFormat(pixformat_t format); - -private: - void runIfNeeded(); // grab a frame if we don't already have one - - // camera_framesize_t _frame_size; - // camera_pixelformat_t _pixel_format; - camera_config_t _cam_config; - - camera_fb_t *fb; -}; - -#endif //OV2640_H_ \ No newline at end of file diff --git a/include/index_other.h b/include/index_other.h deleted file mode 100644 index e49025e..0000000 --- a/include/index_other.h +++ /dev/null @@ -1,60 +0,0 @@ -const char index_simple_html[] = R"=====( - - - - - - - - - -

Spot Micro Controller

-
- -
- - -)====="; - -size_t index_simple_html_len = sizeof(index_simple_html)-1; \ No newline at end of file diff --git a/src/OV2640.cpp b/src/OV2640.cpp deleted file mode 100644 index 174fa52..0000000 --- a/src/OV2640.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include "OV2640.h" - -#define TAG "OV2640" - -// definitions appropriate for the ESP32-CAM devboard (and most clones) -camera_config_t esp32cam_config{ - - .pin_pwdn = -1, // FIXME: on the TTGO T-Journal I think this is GPIO 0 - .pin_reset = 15, - - .pin_xclk = 27, - - .pin_sscb_sda = 25, - .pin_sscb_scl = 23, - - .pin_d7 = 19, - .pin_d6 = 36, - .pin_d5 = 18, - .pin_d4 = 39, - .pin_d3 = 5, - .pin_d2 = 34, - .pin_d1 = 35, - .pin_d0 = 17, - .pin_vsync = 22, - .pin_href = 26, - .pin_pclk = 21, - .xclk_freq_hz = 20000000, - .ledc_timer = LEDC_TIMER_0, - .ledc_channel = LEDC_CHANNEL_0, - .pixel_format = PIXFORMAT_JPEG, - // .frame_size = FRAMESIZE_UXGA, // needs 234K of framebuffer space - // .frame_size = FRAMESIZE_SXGA, // needs 160K for framebuffer - // .frame_size = FRAMESIZE_XGA, // needs 96K or even smaller FRAMESIZE_SVGA - can work if using only 1 fb - .frame_size = FRAMESIZE_SVGA, - .jpeg_quality = 12, //0-63 lower numbers are higher quality - .fb_count = 2 // if more than one i2s runs in continous mode. Use only with jpeg -}; - -camera_config_t esp32cam_aithinker_config{ - - .pin_pwdn = 32, - .pin_reset = -1, - - .pin_xclk = 0, - - .pin_sscb_sda = 26, - .pin_sscb_scl = 27, - - // Note: LED GPIO is apparently 4 not sure where that goes - // per https://github.com/donny681/ESP32_CAMERA_QR/blob/e4ef44549876457cd841f33a0892c82a71f35358/main/led.c - .pin_d7 = 35, - .pin_d6 = 34, - .pin_d5 = 39, - .pin_d4 = 36, - .pin_d3 = 21, - .pin_d2 = 19, - .pin_d1 = 18, - .pin_d0 = 5, - .pin_vsync = 25, - .pin_href = 23, - .pin_pclk = 22, - .xclk_freq_hz = 20000000, - .ledc_timer = LEDC_TIMER_1, - .ledc_channel = LEDC_CHANNEL_1, - .pixel_format = PIXFORMAT_JPEG, - // .frame_size = FRAMESIZE_UXGA, // needs 234K of framebuffer space - // .frame_size = FRAMESIZE_SXGA, // needs 160K for framebuffer - // .frame_size = FRAMESIZE_XGA, // needs 96K or even smaller FRAMESIZE_SVGA - can work if using only 1 fb - .frame_size = FRAMESIZE_SVGA, - .jpeg_quality = 12, //0-63 lower numbers are higher quality - .fb_count = 2 // if more than one i2s runs in continous mode. Use only with jpeg -}; - -camera_config_t esp32cam_ttgo_t_config{ - - .pin_pwdn = 26, - .pin_reset = -1, - - .pin_xclk = 32, - - .pin_sscb_sda = 13, - .pin_sscb_scl = 12, - - .pin_d7 = 39, - .pin_d6 = 36, - .pin_d5 = 23, - .pin_d4 = 18, - .pin_d3 = 15, - .pin_d2 = 4, - .pin_d1 = 14, - .pin_d0 = 5, - .pin_vsync = 27, - .pin_href = 25, - .pin_pclk = 19, - .xclk_freq_hz = 20000000, - .ledc_timer = LEDC_TIMER_0, - .ledc_channel = LEDC_CHANNEL_0, - .pixel_format = PIXFORMAT_JPEG, - .frame_size = FRAMESIZE_SVGA, - .jpeg_quality = 12, //0-63 lower numbers are higher quality - .fb_count = 2 // if more than one i2s runs in continous mode. Use only with jpeg -}; - -void OV2640::run(void) -{ - if (fb) - //return the frame buffer back to the driver for reuse - esp_camera_fb_return(fb); - - fb = esp_camera_fb_get(); -} - -void OV2640::runIfNeeded(void) -{ - if (!fb) - run(); -} - -int OV2640::getWidth(void) -{ - runIfNeeded(); - return fb->width; -} - -int OV2640::getHeight(void) -{ - runIfNeeded(); - return fb->height; -} - -size_t OV2640::getSize(void) -{ - runIfNeeded(); - if (!fb) - return 0; // FIXME - this shouldn't be possible but apparently the new cam board returns null sometimes? - return fb->len; -} - -uint8_t *OV2640::getfb(void) -{ - runIfNeeded(); - if (!fb) - return NULL; // FIXME - this shouldn't be possible but apparently the new cam board returns null sometimes? - - return fb->buf; -} - -framesize_t OV2640::getFrameSize(void) -{ - return _cam_config.frame_size; -} - -void OV2640::setFrameSize(framesize_t size) -{ - _cam_config.frame_size = size; -} - -pixformat_t OV2640::getPixelFormat(void) -{ - return _cam_config.pixel_format; -} - -void OV2640::setPixelFormat(pixformat_t format) -{ - switch (format) - { - case PIXFORMAT_RGB565: - case PIXFORMAT_YUV422: - case PIXFORMAT_GRAYSCALE: - case PIXFORMAT_JPEG: - _cam_config.pixel_format = format; - break; - default: - _cam_config.pixel_format = PIXFORMAT_GRAYSCALE; - break; - } -} - -esp_err_t OV2640::init(camera_config_t config) -{ - memset(&_cam_config, 0, sizeof(_cam_config)); - memcpy(&_cam_config, &config, sizeof(config)); - - esp_err_t err = esp_camera_init(&_cam_config); - if (err != ESP_OK) - { - printf("Camera probe failed with error 0x%x", err); - return err; - } - // ESP_ERROR_CHECK(gpio_install_isr_service(0)); - - return ESP_OK; -} \ No newline at end of file