✨ code_recognition
parent
4341cf8b14
commit
45b5cebfc0
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>esp-code-scanner</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,22 @@
|
|||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
if(${IDF_TARGET} STREQUAL "esp32")
|
||||
set(links "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32" "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32s2")
|
||||
set(links "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s2" "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32s3")
|
||||
set(links "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3" "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
|
||||
endif()
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS include)
|
||||
|
||||
register_component()
|
||||
|
||||
target_link_libraries(${COMPONENT_TARGET} INTERFACE ${links})
|
||||
|
||||
set(lib libesp-code-scanner.a
|
||||
libnewlib_iconv.a)
|
||||
target_link_libraries(${COMPONENT_TARGET} INTERFACE ${lib})
|
|
@ -0,0 +1,102 @@
|
|||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
|
||||
|
||||
struct esp_image_scanner_s;
|
||||
/** opaque image scanner object. */
|
||||
typedef struct esp_image_scanner_s esp_image_scanner_t;
|
||||
|
||||
|
||||
|
||||
typedef enum{
|
||||
ESP_CODE_SCANNER_MODE_FAST = 0,
|
||||
/* more mode */
|
||||
}esp_code_scanner_mode_t;
|
||||
|
||||
typedef enum{
|
||||
ESP_CODE_SCANNER_IMAGE_GRAY = 0,
|
||||
ESP_CODE_SCANNER_IMAGE_RGB565,
|
||||
ESP_CODE_SCANNER_IMAGE_YUV422,
|
||||
/* more image format*/
|
||||
}esp_code_scanner_image_format_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
esp_code_scanner_mode_t mode;
|
||||
esp_code_scanner_image_format_t fmt;
|
||||
uint32_t width; /*!< iamge width */
|
||||
uint32_t height; /*!< iamge height */
|
||||
/* more config */
|
||||
} esp_code_scanner_config_t;
|
||||
|
||||
typedef enum{
|
||||
ESP_CODE_SCANNER_SYMBOL_CODE39,
|
||||
ESP_CODE_SCANNER_SYMBOL_CODE128,
|
||||
ESP_CODE_SCANNER_SYMBOL_QR
|
||||
}esp_code_scanner_symbol_type_t;
|
||||
|
||||
|
||||
typedef struct esp_code_scanner_symbol_t esp_code_scanner_symbol_t;
|
||||
struct esp_code_scanner_symbol_t
|
||||
{
|
||||
const char *type_name;
|
||||
const char *data;
|
||||
uint32_t datalen;
|
||||
esp_code_scanner_symbol_t* next;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Start a code_scanner
|
||||
* This function must be the first function to call,
|
||||
* and it returns a esp_image_scanner_t pointer that you must use as input to other functions in the interface.
|
||||
* This call MUST have a corresponding call to esp_code_scanner_cleanup when the operation is complete.
|
||||
*
|
||||
* @return
|
||||
* - `esp_image_scanner_t`
|
||||
* - NULL if any errors
|
||||
*/
|
||||
esp_image_scanner_t* esp_code_scanner_create();
|
||||
|
||||
/**
|
||||
* @brief Set config of code_scanner
|
||||
*
|
||||
* @param[in] config The configurations, see `esp_code_scanner_config_t`
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_FAIL if any errors
|
||||
*/
|
||||
esp_err_t esp_code_scanner_set_config(esp_image_scanner_t* scanner, const esp_code_scanner_config_t config);
|
||||
|
||||
/**
|
||||
* @brief Scan image data
|
||||
*
|
||||
* @param[in] scanner The esp_image_scanner_t
|
||||
* @param[in] image_data The image data, only supports grayscale images
|
||||
*
|
||||
* @return
|
||||
* - number of decoded symbol
|
||||
*/
|
||||
int esp_code_scanner_scan_image(esp_image_scanner_t* scanner, const uint8_t *image_data);
|
||||
|
||||
/**
|
||||
* @brief Release resources: including the instance and configuration
|
||||
*
|
||||
* @param[in] scanner The esp_code_scanner_handle_t
|
||||
*
|
||||
*/
|
||||
void esp_code_scanner_destroy(esp_image_scanner_t* scanner);
|
||||
|
||||
/**
|
||||
* @brief Get scan results
|
||||
*
|
||||
* @param[in] scanner The esp_code_scanner_handle_t
|
||||
*
|
||||
* @return
|
||||
* - `const esp_code_scanner_symbol_t`
|
||||
* - Returns NULL if no data is recognized
|
||||
*/
|
||||
const esp_code_scanner_symbol_t esp_code_scanner_result(esp_image_scanner_t* scanner);
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,8 @@
|
|||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS ../../components)
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(esp-code-recognition)
|
|
@ -0,0 +1,49 @@
|
|||
# Code recognition Example
|
||||
|
||||
This example demonstrates how to decode 1D/2D barcode. Currectly, the formats that can be decoded by [esp_code_scanner](./../../components/esp-code-scanner) are:
|
||||
- 1D barcode:
|
||||
- code39
|
||||
- code128
|
||||
- 2D barcode:
|
||||
- QR code
|
||||
|
||||
## How to Use Example
|
||||
|
||||
Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`.
|
||||
|
||||
### Hardware Required
|
||||
|
||||
* A development board with ESP32/ESP32-S2/ESP32-S3 SoC (e.g., ESP-EYE, ESP-WROVER-KIT, ESPS3-EYE etc.)
|
||||
* A USB cable for Power supply and programming
|
||||
* A Camera Module: OV2640/OV3660/GC0308/GC032A image sensor(recommended focal range: 5cm-20cm)
|
||||
* A LCD(optional): ST7789/...
|
||||
|
||||
Note: the default OV2640 camera on the development board may not be suitable for this example.
|
||||
|
||||
### Configure the Project
|
||||
|
||||
Some default settings have been set based on the development board using `sdkconfig.defaults.<chip_name>`
|
||||
|
||||
|
||||
### Build and Flash
|
||||
|
||||
Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
|
||||
|
||||
(To exit the serial monitor, type ``Ctrl-]``.)
|
||||
|
||||
See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
|
||||
|
||||
## Example Output
|
||||
|
||||
Please make sure the code can be clearly captured.
|
||||
If a qrcode can be succesfully decoded, you will be able to see information displayed as below:
|
||||
|
||||
```
|
||||
I (11164) APP_CODE_SCANNER: Decode time in 70 ms.
|
||||
I (11164) APP_CODE_SCANNER: Decoded QR-Code symbol "测试"
|
||||
```
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
For any technical queries, please open an [issue](https://github.com/espressif/esp-who/issues) on GitHub. We will get back to you soon.
|
|
@ -0,0 +1,6 @@
|
|||
idf_component_register( SRCS
|
||||
app_peripherals.c
|
||||
app_main.c
|
||||
INCLUDE_DIRS
|
||||
include
|
||||
)
|
|
@ -0,0 +1,69 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "esp_log.h"
|
||||
#include "esp_system.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "app_peripherals.h"
|
||||
|
||||
#include "esp_code_scanner.h"
|
||||
|
||||
static const char *TAG = "APP_CODE_SCANNER";
|
||||
|
||||
static void decode_task()
|
||||
{
|
||||
if(ESP_OK != app_camera_init()) {
|
||||
vTaskDelete(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef LCD_CONTROLLER
|
||||
int USE_LCD = 0;
|
||||
scr_driver_t g_lcd;
|
||||
if (ESP_OK == app_lcd_init(&g_lcd))
|
||||
USE_LCD = 1;
|
||||
#endif
|
||||
|
||||
camera_fb_t *fb = NULL;
|
||||
int64_t time1, time2;
|
||||
while (1)
|
||||
{
|
||||
fb = esp_camera_fb_get();
|
||||
if(fb == NULL){
|
||||
ESP_LOGI(TAG, "camera get failed\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
time1 = esp_timer_get_time();
|
||||
// Decode Progress
|
||||
esp_image_scanner_t *esp_scn = esp_code_scanner_create();
|
||||
esp_code_scanner_config_t config = {ESP_CODE_SCANNER_MODE_FAST, ESP_CODE_SCANNER_IMAGE_RGB565, fb->width, fb->height};
|
||||
esp_code_scanner_set_config(esp_scn, config);
|
||||
int decoded_num = esp_code_scanner_scan_image(esp_scn, fb->buf);
|
||||
|
||||
if(decoded_num){
|
||||
esp_code_scanner_symbol_t result = esp_code_scanner_result(esp_scn);
|
||||
time2 = esp_timer_get_time();
|
||||
ESP_LOGI(TAG, "Decode time in %lld ms.", (time2 - time1) / 1000);
|
||||
ESP_LOGI(TAG, "Decoded %s symbol \"%s\"\n", result.type_name, result.data);
|
||||
}
|
||||
esp_code_scanner_destroy(esp_scn);
|
||||
|
||||
|
||||
#ifdef LCD_CONTROLLER
|
||||
if(USE_LCD){
|
||||
g_lcd.draw_bitmap(0, 0, fb->width, fb->height, (uint16_t *)fb->buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
esp_camera_fb_return(fb);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void app_main()
|
||||
{
|
||||
xTaskCreatePinnedToCore(decode_task, TAG, 4 * 1024, NULL, 6, NULL, 0);
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
#include "app_peripherals.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_system.h"
|
||||
#include "st7789.h"
|
||||
|
||||
static const char *TAG = "app_peripherals";
|
||||
|
||||
esp_err_t app_camera_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Camera module is %s", CAMERA_MODULE_NAME);
|
||||
|
||||
#if CONFIG_CAMERA_MODEL_ESP_EYE || CONFIG_CAMERA_MODEL_ESP32_CAM_BOARD
|
||||
/* IO13, IO14 is designed for JTAG by default,
|
||||
* to use it as generalized input,
|
||||
* firstly declair it as pullup input */
|
||||
gpio_config_t conf;
|
||||
conf.mode = GPIO_MODE_INPUT;
|
||||
conf.pull_up_en = GPIO_PULLUP_ENABLE;
|
||||
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||
conf.intr_type = GPIO_INTR_DISABLE;
|
||||
conf.pin_bit_mask = 1LL << 13;
|
||||
gpio_config(&conf);
|
||||
conf.pin_bit_mask = 1LL << 14;
|
||||
gpio_config(&conf);
|
||||
#endif
|
||||
|
||||
camera_config_t config;
|
||||
config.ledc_channel = LEDC_CHANNEL_0;
|
||||
config.ledc_timer = LEDC_TIMER_0;
|
||||
config.pin_d0 = CAMERA_PIN_D0;
|
||||
config.pin_d1 = CAMERA_PIN_D1;
|
||||
config.pin_d2 = CAMERA_PIN_D2;
|
||||
config.pin_d3 = CAMERA_PIN_D3;
|
||||
config.pin_d4 = CAMERA_PIN_D4;
|
||||
config.pin_d5 = CAMERA_PIN_D5;
|
||||
config.pin_d6 = CAMERA_PIN_D6;
|
||||
config.pin_d7 = CAMERA_PIN_D7;
|
||||
config.pin_xclk = CAMERA_PIN_XCLK;
|
||||
config.pin_pclk = CAMERA_PIN_PCLK;
|
||||
config.pin_vsync = CAMERA_PIN_VSYNC;
|
||||
config.pin_href = CAMERA_PIN_HREF;
|
||||
config.pin_sscb_sda = CAMERA_PIN_SIOD;
|
||||
config.pin_sscb_scl = CAMERA_PIN_SIOC;
|
||||
config.pin_pwdn = CAMERA_PIN_PWDN;
|
||||
config.pin_reset = CAMERA_PIN_RESET;
|
||||
config.xclk_freq_hz = XCLK_FREQ_HZ;
|
||||
config.pixel_format = CAMERA_PIXFORMAT;
|
||||
config.frame_size = CAMERA_FRAME_SIZE;
|
||||
config.jpeg_quality = 12;
|
||||
config.fb_count = CAMERA_FB_COUNT;
|
||||
config.fb_location = CAMERA_FB_IN_PSRAM;
|
||||
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
|
||||
|
||||
// camera init
|
||||
esp_err_t err = esp_camera_init(&config);
|
||||
if (err != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "Camera init failed with error 0x%x", err);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
sensor_t *s = esp_camera_sensor_get();
|
||||
if (s->id.PID == OV3660_PID || s->id.PID == OV2640_PID)
|
||||
s->set_vflip(s, 1); //flip it back
|
||||
else if (s->id.PID == GC0308_PID){
|
||||
s->set_hmirror(s, 0);
|
||||
}
|
||||
else if (s->id.PID == GC032A_PID){
|
||||
s->set_vflip(s, 1);
|
||||
// s->set_hmirror(s, 0); //something wrong
|
||||
}
|
||||
|
||||
if (s->id.PID == OV3660_PID)
|
||||
{
|
||||
s->set_brightness(s, 2);
|
||||
s->set_contrast(s, 3);
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
#ifdef LCD_CONTROLLER
|
||||
esp_err_t app_lcd_init(scr_driver_t *g_lcd){
|
||||
static scr_info_t g_lcd_info;
|
||||
|
||||
spi_config_t bus_conf = {
|
||||
.miso_io_num = LCD_MISO,
|
||||
.mosi_io_num = LCD_MOSI,
|
||||
.sclk_io_num = LCD_SCLK,
|
||||
.max_transfer_sz = 2 * LCD_WIDTH * LCD_HEIGHT + 10,
|
||||
};
|
||||
spi_bus_handle_t spi_bus = spi_bus_create(SPI2_HOST, &bus_conf);
|
||||
|
||||
scr_interface_spi_config_t spi_lcd_cfg = {
|
||||
.spi_bus = spi_bus,
|
||||
.pin_num_cs = LCD_CS,
|
||||
.pin_num_dc = LCD_DC,
|
||||
.clk_freq = 40 * 1000000,
|
||||
.swap_data = 0,
|
||||
};
|
||||
|
||||
scr_interface_driver_t *iface_drv;
|
||||
scr_interface_create(SCREEN_IFACE_SPI, &spi_lcd_cfg, &iface_drv);
|
||||
esp_err_t ret = scr_find_driver(LCD_CONTROLLER, g_lcd);
|
||||
if (ESP_OK != ret)
|
||||
{
|
||||
ESP_LOGE(TAG, "screen find failed");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
scr_controller_config_t lcd_cfg = {
|
||||
.interface_drv = iface_drv,
|
||||
.pin_num_rst = LCD_RST,
|
||||
.pin_num_bckl = LCD_BCKL,
|
||||
.rst_active_level = 0,
|
||||
.bckl_active_level = 0,
|
||||
.offset_hor = 0,
|
||||
.offset_ver = 0,
|
||||
.width = LCD_WIDTH,
|
||||
.height = LCD_HEIGHT,
|
||||
.rotate = LCD_ROTATE,
|
||||
};
|
||||
ret = g_lcd->init(&lcd_cfg);
|
||||
if (ESP_OK != ret)
|
||||
{
|
||||
ESP_LOGE(TAG, "screen initialize failed");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
#if CONFIG_CAMERA_MODULE_ESP_S2_KALUGA
|
||||
lcd_st7789_set_invert(false);
|
||||
#endif
|
||||
|
||||
g_lcd->get_info(&g_lcd_info);
|
||||
ESP_LOGI(TAG, "Screen name:%s | width:%d | height:%d", g_lcd_info.name, g_lcd_info.width, g_lcd_info.height);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,249 @@
|
|||
#pragma once
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "esp_camera.h"
|
||||
#include "screen_driver.h"
|
||||
|
||||
|
||||
// camera pins
|
||||
#if CONFIG_CAMERA_MODULE_WROVER_KIT
|
||||
#define CAMERA_MODULE_NAME "Wrover Kit"
|
||||
#define CAMERA_PIN_PWDN -1
|
||||
#define CAMERA_PIN_RESET -1
|
||||
#define CAMERA_PIN_XCLK 21
|
||||
#define CAMERA_PIN_SIOD 26
|
||||
#define CAMERA_PIN_SIOC 27
|
||||
|
||||
#define CAMERA_PIN_D7 35
|
||||
#define CAMERA_PIN_D6 34
|
||||
#define CAMERA_PIN_D5 39
|
||||
#define CAMERA_PIN_D4 36
|
||||
#define CAMERA_PIN_D3 19
|
||||
#define CAMERA_PIN_D2 18
|
||||
#define CAMERA_PIN_D1 5
|
||||
#define CAMERA_PIN_D0 4
|
||||
#define CAMERA_PIN_VSYNC 25
|
||||
#define CAMERA_PIN_HREF 23
|
||||
#define CAMERA_PIN_PCLK 22
|
||||
|
||||
#elif CONFIG_CAMERA_MODULE_ESP_EYE
|
||||
#define CAMERA_MODULE_NAME "ESP-EYE"
|
||||
#define CAMERA_PIN_PWDN -1
|
||||
#define CAMERA_PIN_RESET -1
|
||||
#define CAMERA_PIN_XCLK 4
|
||||
#define CAMERA_PIN_SIOD 18
|
||||
#define CAMERA_PIN_SIOC 23
|
||||
|
||||
#define CAMERA_PIN_D7 36
|
||||
#define CAMERA_PIN_D6 37
|
||||
#define CAMERA_PIN_D5 38
|
||||
#define CAMERA_PIN_D4 39
|
||||
#define CAMERA_PIN_D3 35
|
||||
#define CAMERA_PIN_D2 14
|
||||
#define CAMERA_PIN_D1 13
|
||||
#define CAMERA_PIN_D0 34
|
||||
#define CAMERA_PIN_VSYNC 5
|
||||
#define CAMERA_PIN_HREF 27
|
||||
#define CAMERA_PIN_PCLK 25
|
||||
|
||||
#elif CONFIG_CAMERA_MODULE_ESP_S2_KALUGA
|
||||
#define CAMERA_MODULE_NAME "ESP-S2-KALUGA"
|
||||
#define CAMERA_PIN_PWDN -1
|
||||
#define CAMERA_PIN_RESET -1
|
||||
#define CAMERA_PIN_XCLK 1
|
||||
#define CAMERA_PIN_SIOD 8
|
||||
#define CAMERA_PIN_SIOC 7
|
||||
|
||||
#define CAMERA_PIN_D7 38
|
||||
#define CAMERA_PIN_D6 21
|
||||
#define CAMERA_PIN_D5 40
|
||||
#define CAMERA_PIN_D4 39
|
||||
#define CAMERA_PIN_D3 42
|
||||
#define CAMERA_PIN_D2 41
|
||||
#define CAMERA_PIN_D1 37
|
||||
#define CAMERA_PIN_D0 36
|
||||
#define CAMERA_PIN_VSYNC 2
|
||||
#define CAMERA_PIN_HREF 3
|
||||
#define CAMERA_PIN_PCLK 33
|
||||
|
||||
#elif CONFIG_CAMERA_MODULE_ESP_S3_EYE
|
||||
#define CAMERA_MODULE_NAME "ESP-S3-EYE"
|
||||
#define CAMERA_PIN_PWDN -1
|
||||
#define CAMERA_PIN_RESET -1
|
||||
|
||||
#define CAMERA_PIN_VSYNC 6
|
||||
#define CAMERA_PIN_HREF 7
|
||||
#define CAMERA_PIN_PCLK 13
|
||||
#define CAMERA_PIN_XCLK 15
|
||||
|
||||
#define CAMERA_PIN_SIOD 4
|
||||
#define CAMERA_PIN_SIOC 5
|
||||
|
||||
#define CAMERA_PIN_D0 11
|
||||
#define CAMERA_PIN_D1 9
|
||||
#define CAMERA_PIN_D2 8
|
||||
#define CAMERA_PIN_D3 10
|
||||
#define CAMERA_PIN_D4 12
|
||||
#define CAMERA_PIN_D5 18
|
||||
#define CAMERA_PIN_D6 17
|
||||
#define CAMERA_PIN_D7 16
|
||||
|
||||
#elif CONFIG_CAMERA_MODEL_ESP32_CAM_BOARD
|
||||
#define CAMERA_MODULE_NAME "ESP-DEVCAM"
|
||||
#define CAMERA_PIN_PWDN 32
|
||||
#define CAMERA_PIN_RESET 33
|
||||
|
||||
#define CAMERA_PIN_XCLK 4
|
||||
#define CAMERA_PIN_SIOD 18
|
||||
#define CAMERA_PIN_SIOC 23
|
||||
|
||||
#define CAMERA_PIN_D7 36
|
||||
#define CAMERA_PIN_D6 19
|
||||
#define CAMERA_PIN_D5 21
|
||||
#define CAMERA_PIN_D4 39
|
||||
#define CAMERA_PIN_D3 35
|
||||
#define CAMERA_PIN_D2 14
|
||||
#define CAMERA_PIN_D1 13
|
||||
#define CAMERA_PIN_D0 34
|
||||
#define CAMERA_PIN_VSYNC 5
|
||||
#define CAMERA_PIN_HREF 27
|
||||
#define CAMERA_PIN_PCLK 25
|
||||
|
||||
#elif CONFIG_CAMERA_MODULE_M5STACK_PSRAM
|
||||
#define CAMERA_MODULE_NAME "M5STACK-PSRAM"
|
||||
#define CAMERA_PIN_PWDN -1
|
||||
#define CAMERA_PIN_RESET 15
|
||||
|
||||
#define CAMERA_PIN_XCLK 27
|
||||
#define CAMERA_PIN_SIOD 25
|
||||
#define CAMERA_PIN_SIOC 23
|
||||
|
||||
#define CAMERA_PIN_D7 19
|
||||
#define CAMERA_PIN_D6 36
|
||||
#define CAMERA_PIN_D5 18
|
||||
#define CAMERA_PIN_D4 39
|
||||
#define CAMERA_PIN_D3 5
|
||||
#define CAMERA_PIN_D2 34
|
||||
#define CAMERA_PIN_D1 35
|
||||
#define CAMERA_PIN_D0 32
|
||||
#define CAMERA_PIN_VSYNC 22
|
||||
#define CAMERA_PIN_HREF 26
|
||||
#define CAMERA_PIN_PCLK 21
|
||||
|
||||
#elif CONFIG_CAMERA_MODULE_M5STACK_WIDE
|
||||
#define CAMERA_MODULE_NAME "M5STACK-WIDE"
|
||||
#define CAMERA_PIN_PWDN -1
|
||||
#define CAMERA_PIN_RESET 15
|
||||
#define CAMERA_PIN_XCLK 27
|
||||
#define CAMERA_PIN_SIOD 22
|
||||
#define CAMERA_PIN_SIOC 23
|
||||
|
||||
#define CAMERA_PIN_D7 19
|
||||
#define CAMERA_PIN_D6 36
|
||||
#define CAMERA_PIN_D5 18
|
||||
#define CAMERA_PIN_D4 39
|
||||
#define CAMERA_PIN_D3 5
|
||||
#define CAMERA_PIN_D2 34
|
||||
#define CAMERA_PIN_D1 35
|
||||
#define CAMERA_PIN_D0 32
|
||||
#define CAMERA_PIN_VSYNC 25
|
||||
#define CAMERA_PIN_HREF 26
|
||||
#define CAMERA_PIN_PCLK 21
|
||||
|
||||
#elif CONFIG_CAMERA_MODULE_AI_THINKER
|
||||
#define CAMERA_MODULE_NAME "AI-THINKER"
|
||||
#define CAMERA_PIN_PWDN 32
|
||||
#define CAMERA_PIN_RESET -1
|
||||
#define CAMERA_PIN_XCLK 0
|
||||
#define CAMERA_PIN_SIOD 26
|
||||
#define CAMERA_PIN_SIOC 27
|
||||
|
||||
#define CAMERA_PIN_D7 35
|
||||
#define CAMERA_PIN_D6 34
|
||||
#define CAMERA_PIN_D5 39
|
||||
#define CAMERA_PIN_D4 36
|
||||
#define CAMERA_PIN_D3 21
|
||||
#define CAMERA_PIN_D2 19
|
||||
#define CAMERA_PIN_D1 18
|
||||
#define CAMERA_PIN_D0 5
|
||||
#define CAMERA_PIN_VSYNC 25
|
||||
#define CAMERA_PIN_HREF 23
|
||||
#define CAMERA_PIN_PCLK 22
|
||||
|
||||
#elif CONFIG_CAMERA_MODULE_CUSTOM
|
||||
#define CAMERA_MODULE_NAME "CUSTOM"
|
||||
#define CAMERA_PIN_PWDN CONFIG_CAMERA_PIN_PWDN
|
||||
#define CAMERA_PIN_RESET CONFIG_CAMERA_PIN_RESET
|
||||
#define CAMERA_PIN_XCLK CONFIG_CAMERA_PIN_XCLK
|
||||
#define CAMERA_PIN_SIOD CONFIG_CAMERA_PIN_SIOD
|
||||
#define CAMERA_PIN_SIOC CONFIG_CAMERA_PIN_SIOC
|
||||
|
||||
#define CAMERA_PIN_D7 CONFIG_CAMERA_PIN_Y9
|
||||
#define CAMERA_PIN_D6 CONFIG_CAMERA_PIN_Y8
|
||||
#define CAMERA_PIN_D5 CONFIG_CAMERA_PIN_Y7
|
||||
#define CAMERA_PIN_D4 CONFIG_CAMERA_PIN_Y6
|
||||
#define CAMERA_PIN_D3 CONFIG_CAMERA_PIN_Y5
|
||||
#define CAMERA_PIN_D2 CONFIG_CAMERA_PIN_Y4
|
||||
#define CAMERA_PIN_D1 CONFIG_CAMERA_PIN_Y3
|
||||
#define CAMERA_PIN_D0 CONFIG_CAMERA_PIN_Y2
|
||||
#define CAMERA_PIN_VSYNC CONFIG_CAMERA_PIN_VSYNC
|
||||
#define CAMERA_PIN_HREF CONFIG_CAMERA_PIN_HREF
|
||||
#define CAMERA_PIN_PCLK CONFIG_CAMERA_PIN_PCLK
|
||||
#endif
|
||||
|
||||
#define XCLK_FREQ_HZ 20000000
|
||||
#define CAMERA_PIXFORMAT PIXFORMAT_RGB565
|
||||
#define CAMERA_FRAME_SIZE FRAMESIZE_240X240
|
||||
#define CAMERA_FB_COUNT 2
|
||||
|
||||
|
||||
|
||||
// lcd pins and setting
|
||||
#if CONFIG_CAMERA_MODULE_ESP_S3_EYE
|
||||
#define LCD_CONTROLLER SCREEN_CONTROLLER_ST7789
|
||||
|
||||
#define LCD_MOSI 46
|
||||
#define LCD_MISO -1
|
||||
#define LCD_SCLK 21
|
||||
#define LCD_CS 44
|
||||
#define LCD_DC 47
|
||||
#define LCD_RST -1
|
||||
#define LCD_BCKL 48
|
||||
|
||||
#define LCD_WIDTH 240
|
||||
#define LCD_HEIGHT 240
|
||||
#define LCD_ROTATE 0
|
||||
#elif CONFIG_CAMERA_MODULE_ESP_S2_KALUGA
|
||||
#define LCD_CONTROLLER SCREEN_CONTROLLER_ST7789
|
||||
|
||||
#define LCD_MOSI 9
|
||||
#define LCD_MISO -1
|
||||
#define LCD_SCLK 15
|
||||
#define LCD_CS 11
|
||||
#define LCD_DC 13
|
||||
#define LCD_RST 16
|
||||
#define LCD_BCKL 6
|
||||
|
||||
// LCD display width and height
|
||||
#define LCD_WIDTH 240
|
||||
#define LCD_HEIGHT 320
|
||||
#define LCD_ROTATE SCR_SWAP_XY|SCR_MIRROR_X
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
esp_err_t app_camera_init();
|
||||
esp_err_t app_lcd_init();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,6 @@
|
|||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
|
@ -0,0 +1,4 @@
|
|||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
|
||||
CONFIG_CAMERA_MODULE_ESP_EYE=y
|
|
@ -0,0 +1,8 @@
|
|||
CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
|
||||
|
||||
CONFIG_ESP32S2_DATA_CACHE_16KB=y
|
||||
ESP32S2_DATA_CACHE_LINE_32B=y
|
||||
|
||||
CONFIG_CAMERA_MODULE_ESP_S2_KALUGA=y
|
||||
CONFIG_LCD_DRIVER_SCREEN_CONTROLLER_ST7789=y
|
|
@ -0,0 +1,11 @@
|
|||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
|
||||
CONFIG_ESP32S3_DATA_CACHE_64KB=y
|
||||
CONFIG_ESP32S3_DATA_CACHE_8WAYS=y
|
||||
CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y
|
||||
|
||||
CONFIG_CAMERA_MODULE_ESP_S3_EYE=y
|
||||
CONFIG_LCD_DRIVER_SCREEN_CONTROLLER_ST7789=y
|
||||
CONFIG_ESPTOOLPY_NO_STUB=y
|
||||
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
|
Loading…
Reference in New Issue