From e0110c2ecaa761eda6e853ac5db3e783c776f19c Mon Sep 17 00:00:00 2001 From: ZHOU Li <39872773+TDA-2030@users.noreply.github.com> Date: Fri, 16 Jul 2021 16:51:49 +0800 Subject: [PATCH] add github action (#296) Co-authored-by: zhouli --- .github/workflows/build.yml | 75 ++++++++++++++++++++++++++++++ .gitignore | 4 ++ README.md | 1 + examples/CMakeLists.txt | 9 ++++ examples/Makefile | 11 +++++ examples/main/CMakeLists.txt | 3 ++ examples/main/component.mk | 5 ++ examples/{ => main}/take_picture.c | 13 ++++-- examples/sdkconfig.defaults | 17 +++++++ target/esp32/ll_cam.c | 3 +- target/private_include/ll_cam.h | 1 + 11 files changed, 135 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 examples/CMakeLists.txt create mode 100644 examples/Makefile create mode 100644 examples/main/CMakeLists.txt create mode 100644 examples/main/component.mk rename examples/{ => main}/take_picture.c (93%) create mode 100644 examples/sdkconfig.defaults diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fa1a03f --- /dev/null +++ b/.github/workflows/build.yml @@ -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' diff --git a/.gitignore b/.gitignore index 5509140..32125b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ *.DS_Store +.vscode +**/build +**/sdkconfig +**/sdkconfig.old \ No newline at end of file diff --git a/README.md b/README.md index 56c00b2..e93d5cd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # 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 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. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..0a03968 --- /dev/null +++ b/examples/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 0000000..f06df0e --- /dev/null +++ b/examples/Makefile @@ -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 + diff --git a/examples/main/CMakeLists.txt b/examples/main/CMakeLists.txt new file mode 100644 index 0000000..1735fb1 --- /dev/null +++ b/examples/main/CMakeLists.txt @@ -0,0 +1,3 @@ +set(COMPONENT_SRCS take_picture.c) +set(COMPONENT_ADD_INCLUDEDIRS .) +register_component() \ No newline at end of file diff --git a/examples/main/component.mk b/examples/main/component.mk new file mode 100644 index 0000000..0b9d758 --- /dev/null +++ b/examples/main/component.mk @@ -0,0 +1,5 @@ +# +# "main" pseudo-component makefile. +# +# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) + diff --git a/examples/take_picture.c b/examples/main/take_picture.c similarity index 93% rename from examples/take_picture.c rename to examples/main/take_picture.c index fc4ae7a..1cbad90 100644 --- a/examples/take_picture.c +++ b/examples/main/take_picture.c @@ -29,7 +29,6 @@ // ================================ CODE ====================================== -#include #include #include #include @@ -41,6 +40,8 @@ #include "esp_camera.h" +#define BOARD_WROVER_KIT 1 + // WROVER-KIT PIN Map #ifdef BOARD_WROVER_KIT @@ -113,8 +114,8 @@ static camera_config_t camera_config = { .ledc_timer = LEDC_TIMER_0, .ledc_channel = LEDC_CHANNEL_0, - .pixel_format = PIXFORMAT_JPEG, //YUV422,GRAYSCALE,RGB565,JPEG - .frame_size = FRAMESIZE_VGA, //QQVGA-UXGA Do not use sizes above QVGA when not JPEG + .pixel_format = PIXFORMAT_RGB565, //YUV422,GRAYSCALE,RGB565,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 .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() { - init_camera(); + if(ESP_OK != init_camera()) { + return; + } while (1) { @@ -149,4 +152,4 @@ void app_main() vTaskDelay(5000 / portTICK_RATE_MS); } -} \ No newline at end of file +} diff --git a/examples/sdkconfig.defaults b/examples/sdkconfig.defaults new file mode 100644 index 0000000..e5ac455 --- /dev/null +++ b/examples/sdkconfig.defaults @@ -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 + diff --git a/target/esp32/ll_cam.c b/target/esp32/ll_cam.c index 33a0dad..e513205 100644 --- a/target/esp32/ll_cam.c +++ b/target/esp32/ll_cam.c @@ -16,10 +16,9 @@ #include #include "soc/i2s_struct.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" #else -#include "rom/ets_sys.h" #include "soc/gpio_periph.h" #define esp_rom_delay_us ets_delay_us static inline int gpio_ll_get_level(gpio_dev_t *hw, int gpio_num) diff --git a/target/private_include/ll_cam.h b/target/private_include/ll_cam.h index 85798a7..70f5007 100644 --- a/target/private_include/ll_cam.h +++ b/target/private_include/ll_cam.h @@ -16,6 +16,7 @@ #include #include "sdkconfig.h" +#include "esp_idf_version.h" #if CONFIG_IDF_TARGET_ESP32 #if ESP_IDF_VERSION_MAJOR >= 4 #include "esp32/rom/lldesc.h"