Skip to content

Commit

Permalink
Merge pull request #30 from hpsaturn/fix_issue_29_driver_class
Browse files Browse the repository at this point in the history
Fix issue 29 driver class
  • Loading branch information
hpsaturn authored May 4, 2024
2 parents 25cff32 + 1184a2a commit 2f6738e
Show file tree
Hide file tree
Showing 13 changed files with 181 additions and 266 deletions.
9 changes: 7 additions & 2 deletions examples/tjournal-espnow-sender/tjournal-espnow-sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ESPNowCam radio;
void processFrame() {
if (Camera.get()) {
radio.sendData(Camera.fb->buf, Camera.fb->len);
delay(25); // ==> weird delay for this camera.
delay(35); // ==> weird delay for NOPSRAM camera.
printFPS("CAM:");
Camera.free();
}
Expand All @@ -25,14 +25,19 @@ void processFrame() {
void setup() {
Serial.begin(115200);

delay(5000); // only for debugging
delay(1000); // only for debugging

if(psramFound()){
size_t psram_size = esp_spiram_get_size() / 1048576;
Serial.printf("PSRAM size: %dMb\r\n", psram_size);
}

radio.init();

// You are able to change the Camera config E.g:
// Camera.config.fb_count = 2;
// Camera.config.frame_size = FRAMESIZE_QQVGA;

if (!Camera.begin()) {
Serial.println("Camera Init Fail");
delay(1000);
Expand Down
2 changes: 1 addition & 1 deletion examples/unitcams3-basic-sender/unitcams3-basic-sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void processFrame() {
void setup() {
Serial.begin(115200);

delay(5000); // only for debugging
delay(1000); // only for debugging

if(psramFound()){
size_t psram_size = esp_spiram_get_size() / 1048576;
Expand Down
2 changes: 1 addition & 1 deletion examples/xiao-espnow-sender/xiao-espnow-sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void processFrame() {
void setup() {
Serial.begin(115200);

delay(5000); // only for debugging
delay(1000); // only for debugging

if(psramFound()){
size_t psram_size = esp_spiram_get_size() / 1048576;
Expand Down
4 changes: 4 additions & 0 deletions examples/xiao-fpv-sender/xiao-fpv-sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ void setup() {
}

radio.init();

// You are able to change the Camera config E.g:
// Camera.config.frame_size = FRAMESIZE_QQVGA;

if (!Camera.begin()) {
Serial.println("Camera Init Fail");
delay(1000);
Expand Down
58 changes: 0 additions & 58 deletions src/drivers/CamFreenove.cpp

This file was deleted.

43 changes: 34 additions & 9 deletions src/drivers/CamFreenove.h
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_sccb_sda = 4;
config.pin_sccb_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
55 changes: 0 additions & 55 deletions src/drivers/CamTJournal.cpp

This file was deleted.

42 changes: 33 additions & 9 deletions src/drivers/CamTJournal.h
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
58 changes: 0 additions & 58 deletions src/drivers/CamXiao.cpp

This file was deleted.

43 changes: 34 additions & 9 deletions src/drivers/CamXiao.h
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_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_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
Loading

0 comments on commit 2f6738e

Please sign in to comment.