Compare commits
23 commits
master
...
circuitpyt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d529ebdffb | ||
|
|
9abb23ed43 | ||
|
|
8f3f2cc8cf | ||
|
|
e8d500e948 | ||
| 75035312ed | |||
| 2758089a06 | |||
|
|
68432607d5 | ||
| 2cd2a6d69f | |||
| 2710e44802 | |||
|
|
4ff7f348d0 | ||
|
|
d117548c22 | ||
|
|
7e51ff74b9 | ||
|
|
80b5754456 | ||
|
|
54c3f61c86 | ||
|
|
7613e49686 | ||
|
|
28804391c0 | ||
|
|
524ba7e0d2 | ||
|
|
86627584ef | ||
|
|
a12beb9bdb | ||
|
|
476bdc8ec6 | ||
|
|
2c75c07b44 | ||
|
|
0018898510 | ||
|
|
6c31a4dccd |
8 changed files with 54 additions and 8 deletions
|
|
@ -405,6 +405,9 @@ esp_err_t cam_config(const camera_config_t *config, framesize_t frame_size, uint
|
|||
#if CONFIG_CAMERA_CORE0
|
||||
xTaskCreatePinnedToCore(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 0);
|
||||
#elif CONFIG_CAMERA_CORE1
|
||||
#if CONFIG_FREERTOS_UNICORE
|
||||
#error "Cannot pin to core 1 on unicore"
|
||||
#endif
|
||||
xTaskCreatePinnedToCore(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 1);
|
||||
#else
|
||||
xTaskCreate(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle);
|
||||
|
|
@ -530,3 +533,10 @@ void cam_give_all(void) {
|
|||
cam_obj->frames[x].en = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool cam_avail(void)
|
||||
{
|
||||
camera_fb_t *dma_buffer = NULL;
|
||||
BaseType_t result = xQueuePeek(cam_obj->frame_buffer_queue, (void *)&dma_buffer, 0);
|
||||
return result != pdFALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -356,14 +356,25 @@ esp_err_t esp_camera_deinit()
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define FB_GET_TIMEOUT (4000 / portTICK_PERIOD_MS)
|
||||
#define FB_GET_TIMEOUT (4000)
|
||||
|
||||
camera_fb_t *esp_camera_fb_get()
|
||||
bool esp_camera_fb_available() {
|
||||
if (s_state == NULL) {
|
||||
return false;
|
||||
}
|
||||
return cam_avail();
|
||||
}
|
||||
|
||||
camera_fb_t *esp_camera_fb_get(void)
|
||||
{
|
||||
return esp_camera_fb_get_timeout(FB_GET_TIMEOUT);
|
||||
}
|
||||
|
||||
camera_fb_t *esp_camera_fb_get_timeout(int timeout) {
|
||||
if (s_state == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
camera_fb_t *fb = cam_take(FB_GET_TIMEOUT);
|
||||
camera_fb_t *fb = cam_take(timeout / portTICK_PERIOD_MS);
|
||||
//set the frame properties
|
||||
if (fb) {
|
||||
fb->width = resolution[s_state->sensor.status.framesize].width;
|
||||
|
|
|
|||
|
|
@ -202,6 +202,13 @@ esp_err_t esp_camera_init(const camera_config_t* config);
|
|||
*/
|
||||
esp_err_t esp_camera_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Obtain pointer to a frame buffer, with timeout.
|
||||
*
|
||||
* @return pointer to the frame buffer, or NULL if no frame was obtained within the timeout
|
||||
*/
|
||||
camera_fb_t* esp_camera_fb_get_timeout(int timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief Obtain pointer to a frame buffer.
|
||||
*
|
||||
|
|
@ -209,6 +216,13 @@ esp_err_t esp_camera_deinit(void);
|
|||
*/
|
||||
camera_fb_t* esp_camera_fb_get(void);
|
||||
|
||||
/**
|
||||
* @brief Check whether a framebuffer is avaiable without blocking
|
||||
*
|
||||
* @return true if available, false otherwise
|
||||
*/
|
||||
bool esp_camera_fb_available(void);
|
||||
|
||||
/**
|
||||
* @brief Return the frame buffer to be reused again.
|
||||
*
|
||||
|
|
@ -248,4 +262,3 @@ void esp_camera_return_all(void);
|
|||
#endif
|
||||
|
||||
#include "img_converters.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ void cam_stop(void);
|
|||
|
||||
void cam_start(void);
|
||||
|
||||
bool cam_avail(void);
|
||||
|
||||
camera_fb_t *cam_take(TickType_t timeout);
|
||||
|
||||
void cam_give(camera_fb_t *dma_buffer);
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@
|
|||
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
|
||||
#include "esp32-hal-log.h"
|
||||
#else
|
||||
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
|
||||
#include "esp_log.h"
|
||||
static const char* TAG = "sccb";
|
||||
#endif
|
||||
#include "esp_check.h"
|
||||
|
||||
#define LITTLETOBIG(x) ((x<<8)|(x>>8))
|
||||
|
||||
|
|
@ -48,7 +50,7 @@ static bool sccb_owns_i2c_port;
|
|||
|
||||
int SCCB_Init(int pin_sda, int pin_scl)
|
||||
{
|
||||
ESP_LOGI(TAG, "pin_sda %d pin_scl %d", pin_sda, pin_scl);
|
||||
ESP_LOGI(TAG, "yolo pin_sda %d pin_scl %d", pin_sda, pin_scl);
|
||||
i2c_config_t conf;
|
||||
esp_err_t ret;
|
||||
|
||||
|
|
@ -105,7 +107,7 @@ uint8_t SCCB_Probe(void)
|
|||
i2c_master_start(cmd);
|
||||
i2c_master_write_byte(cmd, ( slave_addr << 1 ) | WRITE_BIT, ACK_CHECK_EN);
|
||||
i2c_master_stop(cmd);
|
||||
esp_err_t ret = i2c_master_cmd_begin(sccb_i2c_port, cmd, 1000 / portTICK_RATE_MS);
|
||||
esp_err_t ret = i2c_master_cmd_begin(sccb_i2c_port, cmd, 50 / portTICK_RATE_MS);
|
||||
i2c_cmd_link_delete(cmd);
|
||||
if( ret == ESP_OK) {
|
||||
return slave_addr;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
static const char *TAG = "ov5640";
|
||||
#endif
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
//#define REG_DEBUG_ON
|
||||
|
||||
static int read_reg(uint8_t slv_addr, const uint16_t reg){
|
||||
|
|
@ -790,7 +792,7 @@ static int set_awb_gain_dsp(sensor_t *sensor, int enable)
|
|||
static int set_special_effect(sensor_t *sensor, int effect)
|
||||
{
|
||||
int ret=0;
|
||||
if (effect < 0 || effect > 6) {
|
||||
if (effect < 0 || effect >= ARRAY_SIZE(sensor_special_effects)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ static const DRAM_ATTR uint8_t sensor_saturation_levels[9][11] = {
|
|||
{0x1d, 0x60, 0x03, 0x11, 0xa8, 0xb9, 0xaf, 0x96, 0x19, 0x01, 0x98},//+4
|
||||
};
|
||||
|
||||
static const DRAM_ATTR uint8_t sensor_special_effects[7][4] = {
|
||||
static const DRAM_ATTR uint8_t sensor_special_effects[][4] = {
|
||||
{0x06, 0x40, 0x2c, 0x08},//Normal
|
||||
{0x46, 0x40, 0x28, 0x08},//Negative
|
||||
{0x1e, 0x80, 0x80, 0x08},//Grayscale
|
||||
|
|
@ -256,6 +256,7 @@ static const DRAM_ATTR uint8_t sensor_special_effects[7][4] = {
|
|||
{0x1e, 0x60, 0x60, 0x08},//Green Tint
|
||||
{0x1e, 0xa0, 0x40, 0x08},//Blue Tint
|
||||
{0x1e, 0x40, 0xa0, 0x08},//Sepia
|
||||
{0x06, 0x40, 0x2c, 0x09},//Solarize
|
||||
};
|
||||
|
||||
static const DRAM_ATTR uint16_t sensor_regs_gamma0[][2] = {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ esp_err_t xclk_timer_conf(int ledc_timer, int xclk_freq_hz)
|
|||
|
||||
esp_err_t camera_enable_out_clock(const camera_config_t* config)
|
||||
{
|
||||
if (config->ledc_channel == NO_CAMERA_LEDC_CHANNEL) {
|
||||
g_ledc_channel = NO_CAMERA_LEDC_CHANNEL;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t err = xclk_timer_conf(config->ledc_timer, config->xclk_freq_hz);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "ledc_timer_config failed, rc=%x", err);
|
||||
|
|
|
|||
Loading…
Reference in a new issue