-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complete refactor of internal Camera drivers
- Loading branch information
Showing
10 changed files
with
172 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
#ifndef CAMFREENOVE_H | ||
#define CAMFREENOVE_H | ||
|
||
#include "CameraBase.hpp" | ||
#include "esp_camera.h" | ||
|
||
class CamFreenove { | ||
private: | ||
public: | ||
camera_fb_t* fb; | ||
sensor_t* sensor; | ||
camera_config_t* config; | ||
bool begin(); | ||
bool get(); | ||
bool free(); | ||
class CamFreenove : public CameraBase { | ||
public: | ||
using CameraBase::begin; | ||
using CameraBase::free; | ||
using CameraBase::get; | ||
|
||
CamFreenove() { | ||
config.pin_pwdn = -1; | ||
config.pin_reset = -1; | ||
config.pin_xclk = 15; | ||
config.pin_sscb_sda = 4; | ||
config.pin_sscb_scl = 5; | ||
config.pin_d7 = 16; | ||
config.pin_d6 = 17; | ||
config.pin_d5 = 18; | ||
config.pin_d4 = 12; | ||
config.pin_d3 = 10; | ||
config.pin_d2 = 8; | ||
config.pin_d1 = 9; | ||
config.pin_d0 = 11; | ||
config.pin_vsync = 6; | ||
config.pin_href = 7; | ||
config.pin_pclk = 13; | ||
config.xclk_freq_hz = 20000000; | ||
config.ledc_timer = LEDC_TIMER_0; | ||
config.ledc_channel = LEDC_CHANNEL_0; | ||
config.pixel_format = PIXFORMAT_RGB565; | ||
config.frame_size = FRAMESIZE_QVGA; | ||
config.jpeg_quality = 0; | ||
config.fb_count = 2; | ||
config.fb_location = CAMERA_FB_IN_PSRAM; | ||
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY; | ||
} | ||
}; | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
#ifndef CAMTJOURNAL_H | ||
#define CAMTJOURNAL_H | ||
|
||
#include "CameraBase.hpp" | ||
#include "esp_camera.h" | ||
|
||
class CamTJournal { | ||
private: | ||
public: | ||
camera_fb_t* fb; | ||
sensor_t* sensor; | ||
camera_config_t* config; | ||
bool begin(); | ||
bool get(); | ||
bool free(); | ||
class CamTJournal : public CameraBase { | ||
public: | ||
using CameraBase::begin; | ||
using CameraBase::free; | ||
using CameraBase::get; | ||
|
||
CamTJournal(){ | ||
config.pin_reset = 15; | ||
config.pin_xclk = 27; | ||
config.pin_sscb_sda = 25; | ||
config.pin_sscb_scl = 23; | ||
config.pin_d7 = 19; | ||
config.pin_d6 = 36; | ||
config.pin_d5 = 18; | ||
config.pin_d4 = 39; | ||
config.pin_d3 = 5; | ||
config.pin_d2 = 34; | ||
config.pin_d1 = 35; | ||
config.pin_d0 = 17; | ||
config.pin_vsync = 22; | ||
config.pin_href = 26; | ||
config.pin_pclk = 21; | ||
config.xclk_freq_hz = 20000000; | ||
config.ledc_timer = LEDC_TIMER_0; | ||
config.ledc_channel = LEDC_CHANNEL_0; | ||
config.pixel_format = PIXFORMAT_JPEG; | ||
config.frame_size = FRAMESIZE_QVGA; | ||
config.jpeg_quality = 12; | ||
config.fb_count = 1; | ||
config.fb_location = CAMERA_FB_IN_DRAM; | ||
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY; | ||
} | ||
}; | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,43 @@ | ||
#ifndef CAMXIAO_H | ||
#define CAMXIAO_H | ||
|
||
#include "CameraBase.hpp" | ||
#include "esp_camera.h" | ||
#include "xiao_pins.h" | ||
|
||
class CamXiao { | ||
private: | ||
public: | ||
camera_fb_t* fb; | ||
sensor_t* sensor; | ||
camera_config_t* config; | ||
bool begin(); | ||
bool get(); | ||
bool free(); | ||
class CamXiao : public CameraBase { | ||
public: | ||
using CameraBase::begin; | ||
using CameraBase::free; | ||
using CameraBase::get; | ||
|
||
CamXiao() { | ||
config.pin_pwdn = PWDN_GPIO_NUM; | ||
config.pin_reset = RESET_GPIO_NUM; | ||
config.pin_xclk = XCLK_GPIO_NUM; | ||
config.pin_sscb_sda = SIOD_GPIO_NUM; | ||
config.pin_sscb_scl = SIOC_GPIO_NUM; | ||
config.pin_d7 = Y9_GPIO_NUM; | ||
config.pin_d6 = Y8_GPIO_NUM; | ||
config.pin_d5 = Y7_GPIO_NUM; | ||
config.pin_d4 = Y6_GPIO_NUM; | ||
config.pin_d3 = Y5_GPIO_NUM; | ||
config.pin_d2 = Y4_GPIO_NUM; | ||
config.pin_d1 = Y3_GPIO_NUM; | ||
config.pin_d0 = Y2_GPIO_NUM; | ||
config.pin_vsync = VSYNC_GPIO_NUM; | ||
config.pin_href = HREF_GPIO_NUM; | ||
config.pin_pclk = PCLK_GPIO_NUM; | ||
config.xclk_freq_hz = 20000000; | ||
config.ledc_timer = LEDC_TIMER_0; | ||
config.ledc_channel = LEDC_CHANNEL_0; | ||
config.pixel_format = PIXFORMAT_RGB565; | ||
config.frame_size = FRAMESIZE_QVGA; | ||
config.jpeg_quality = 12; | ||
config.fb_count = 2; | ||
config.fb_location = CAMERA_FB_IN_PSRAM; | ||
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY; | ||
} | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "esp_camera.h" | ||
|
||
class CameraBase { | ||
private: | ||
public: | ||
camera_fb_t* fb; | ||
sensor_t* sensor; | ||
camera_config_t config; | ||
|
||
bool begin() { | ||
esp_err_t err = esp_camera_init(&config); | ||
if (err != ESP_OK) { | ||
return false; | ||
} | ||
sensor = esp_camera_sensor_get(); | ||
return true; | ||
} | ||
|
||
bool get() { | ||
fb = esp_camera_fb_get(); | ||
if (!fb) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
bool free() { | ||
if (fb) { | ||
esp_camera_fb_return(fb); | ||
return true; | ||
} | ||
return false; | ||
} | ||
}; |
Oops, something went wrong.