add github action (#296)

Co-authored-by: zhouli <zhouli@espressif.com>
This commit is contained in:
ZHOU Li
2021-07-16 16:51:49 +08:00
committed by GitHub
parent 6b1efc1edd
commit e0110c2eca
11 changed files with 135 additions and 7 deletions

75
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: Build examples
on: push
jobs:
build-master:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: esp-idf build
uses: espressif/esp-idf-ci-action@latest
with:
path: 'examples'
build-release-v4_0:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: esp-idf build
uses: espressif/esp-idf-ci-action@release-v4.0
with:
path: 'examples'
build-release-v4_1:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: esp-idf build
uses: espressif/esp-idf-ci-action@release-v4.1
with:
path: 'examples'
build-release-v4_2:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: esp-idf build
uses: espressif/esp-idf-ci-action@release-v4.2
with:
path: 'examples'
build-release-v4_3:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: esp-idf build
uses: espressif/esp-idf-ci-action@release-v4.3
with:
path: 'examples'
build-release-v3_3:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: esp-idf build
uses: espressif/esp-idf-ci-action@release-v3.3
with:
path: 'examples'

4
.gitignore vendored
View File

@ -1 +1,5 @@
*.DS_Store *.DS_Store
.vscode
**/build
**/sdkconfig
**/sdkconfig.old

View File

@ -1,5 +1,6 @@
# ESP32 Camera Driver # ESP32 Camera Driver
[![Build examples](https://github.com/espressif/esp32-camera/actions/workflows/build.yml/badge.svg)](https://github.com/espressif/esp32-camera/actions/workflows/build.yml)
## General Information ## General Information
This repository hosts ESP32 series Soc compatible driver for image sensors. Additionally it provides a few tools, which allow converting the captured frame data to the more common BMP and JPEG formats. This repository hosts ESP32 series Soc compatible driver for image sensors. Additionally it provides a few tools, which allow converting the captured frame data to the more common BMP and JPEG formats.

9
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
# 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 "../")
add_compile_options(-fdiagnostics-color=always)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(camera_example)

11
examples/Makefile Normal file
View File

@ -0,0 +1,11 @@
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#
PROJECT_NAME := camera_example
EXTRA_COMPONENT_DIRS := ../
include $(IDF_PATH)/make/project.mk

View File

@ -0,0 +1,3 @@
set(COMPONENT_SRCS take_picture.c)
set(COMPONENT_ADD_INCLUDEDIRS .)
register_component()

View File

@ -0,0 +1,5 @@
#
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)

View File

@ -29,7 +29,6 @@
// ================================ CODE ====================================== // ================================ CODE ======================================
#include <esp_event_loop.h>
#include <esp_log.h> #include <esp_log.h>
#include <esp_system.h> #include <esp_system.h>
#include <nvs_flash.h> #include <nvs_flash.h>
@ -41,6 +40,8 @@
#include "esp_camera.h" #include "esp_camera.h"
#define BOARD_WROVER_KIT 1
// WROVER-KIT PIN Map // WROVER-KIT PIN Map
#ifdef BOARD_WROVER_KIT #ifdef BOARD_WROVER_KIT
@ -113,8 +114,8 @@ static camera_config_t camera_config = {
.ledc_timer = LEDC_TIMER_0, .ledc_timer = LEDC_TIMER_0,
.ledc_channel = LEDC_CHANNEL_0, .ledc_channel = LEDC_CHANNEL_0,
.pixel_format = PIXFORMAT_JPEG, //YUV422,GRAYSCALE,RGB565,JPEG .pixel_format = PIXFORMAT_RGB565, //YUV422,GRAYSCALE,RGB565,JPEG
.frame_size = FRAMESIZE_VGA, //QQVGA-UXGA Do not use sizes above QVGA when not JPEG .frame_size = FRAMESIZE_QVGA, //QQVGA-UXGA Do not use sizes above QVGA when not JPEG
.jpeg_quality = 12, //0-63 lower number means higher quality .jpeg_quality = 12, //0-63 lower number means higher quality
.fb_count = 1, //if more than one, i2s runs in continuous mode. Use only with JPEG .fb_count = 1, //if more than one, i2s runs in continuous mode. Use only with JPEG
@ -136,7 +137,9 @@ static esp_err_t init_camera()
void app_main() void app_main()
{ {
init_camera(); if(ESP_OK != init_camera()) {
return;
}
while (1) while (1)
{ {
@ -149,4 +152,4 @@ void app_main()
vTaskDelay(5000 / portTICK_RATE_MS); vTaskDelay(5000 / portTICK_RATE_MS);
} }
} }

View File

@ -0,0 +1,17 @@
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_PARTITION_TABLE_OFFSET=0x10000
CONFIG_FREERTOS_HZ=1000
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_SPIRAM_SUPPORT=y
CONFIG_ESP32_SPIRAM_SUPPORT=y
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
CONFIG_SPIRAM_SPEED_80M=y

View File

@ -16,10 +16,9 @@
#include <string.h> #include <string.h>
#include "soc/i2s_struct.h" #include "soc/i2s_struct.h"
#include "esp_idf_version.h" #include "esp_idf_version.h"
#if ESP_IDF_VERSION_MAJOR >= 4 #if (ESP_IDF_VERSION_MAJOR >= 4) && (ESP_IDF_VERSION_MINOR > 1)
#include "hal/gpio_ll.h" #include "hal/gpio_ll.h"
#else #else
#include "rom/ets_sys.h"
#include "soc/gpio_periph.h" #include "soc/gpio_periph.h"
#define esp_rom_delay_us ets_delay_us #define esp_rom_delay_us ets_delay_us
static inline int gpio_ll_get_level(gpio_dev_t *hw, int gpio_num) static inline int gpio_ll_get_level(gpio_dev_t *hw, int gpio_num)

View File

@ -16,6 +16,7 @@
#include <stdint.h> #include <stdint.h>
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_idf_version.h"
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 #if ESP_IDF_VERSION_MAJOR >= 4
#include "esp32/rom/lldesc.h" #include "esp32/rom/lldesc.h"