Skip to content

Commit 5040e1b

Browse files
authored
Merge pull request #6684 from jepler/espressif-camera-2
Rewrite camera support for the Espressif port
2 parents db837e2 + 554063a commit 5040e1b

File tree

42 files changed

+2430
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2430
-30
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,6 @@
307307
[submodule "frozen/circuitpython_picoed"]
308308
path = frozen/circuitpython_picoed
309309
url = https://github.com/elecfreaks/circuitpython_picoed.git
310+
[submodule "ports/espressif/esp32-camera"]
311+
path = ports/espressif/esp32-camera
312+
url = https://github.com/adafruit/esp32-camera/

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def autoapi_prepare_jinja_env(jinja_env):
199199
"ports/cxd56/spresense-exported-sdk",
200200
"ports/espressif/certificates",
201201
"ports/espressif/esp-idf",
202+
"ports/espressif/esp32-camera",
202203
"ports/espressif/.idf_tools",
203204
"ports/espressif/peripherals",
204205
"ports/litex/hw",

locale/circuitpython.pot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3254,6 +3254,10 @@ msgstr ""
32543254
msgid "invalid micropython decorator"
32553255
msgstr ""
32563256

3257+
#: ports/espressif/common-hal/esp32_camera/Camera.c
3258+
msgid "invalid setting"
3259+
msgstr ""
3260+
32573261
#: shared-bindings/random/__init__.c
32583262
msgid "invalid step"
32593263
msgstr ""
@@ -3509,7 +3513,7 @@ msgstr ""
35093513
msgid "no response from SD card"
35103514
msgstr ""
35113515

3512-
#: py/objobject.c py/runtime.c
3516+
#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c
35133517
msgid "no such attribute"
35143518
msgstr ""
35153519

ports/espressif/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)
88
# can build.
99
set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip wpa_supplicant freertos bt usb)
1010

11+
if("${CIRCUITPY_ESP32_CAMERA}")
12+
message("Including esp32-camera")
13+
set(EXTRA_COMPONENT_DIRS "esp32-camera")
14+
list(APPEND COMPONENTS "esp32-camera")
15+
message("COMPONENTS = ${COMPONENTS}")
16+
endif()
17+
1118
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
1219
project(circuitpython)
1320

ports/espressif/Makefile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ SRC_C += \
261261
peripherals/touch.c
262262
ifeq ($(IDF_TARGET),esp32s2)
263263
SRC_C += \
264-
cam.c \
265264
i2s_lcd_esp32s2_driver.c
266265
endif
267266
endif
@@ -283,6 +282,15 @@ endif
283282

284283
SRC_C += $(wildcard common-hal/espidf/*.c)
285284

285+
ifneq ($(CIRCUITPY_ESP32_CAMERA),0)
286+
SRC_CAMERA := \
287+
$(wildcard common-hal/esp32_camera/*.c) \
288+
$(wildcard bindings/esp32_camera/*.c)
289+
SRC_C += $(SRC_CAMERA)
290+
CFLAGS += -isystem esp32-camera/driver/include
291+
CFLAGS += -isystem esp32-camera/conversions/include
292+
endif
293+
286294
SRC_COMMON_HAL_EXPANDED = \
287295
$(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
288296
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
@@ -341,8 +349,10 @@ ifneq ($(CIRCUITPY_BLEIO),0)
341349
SDKCONFIGS := esp-idf-config/sdkconfig-ble.defaults;$(SDKCONFIGS)
342350
endif
343351
# create the config headers
344-
$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig | $(BUILD)/esp-idf
345-
IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja
352+
.PHONY: do-sdkconfig
353+
do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h
354+
$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf
355+
IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA)
346356

347357
# build a lib
348358
# Adding -d explain -j 1 -v to the ninja line will output debug info
@@ -391,6 +401,11 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
391401
ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
392402
endif
393403

404+
ifneq ($(CIRCUITPY_ESP32_CAMERA),0)
405+
ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp32-camera/libesp32-camera.a
406+
#$(error $(ESP_IDF_COMPONENTS_EXPANDED))
407+
endif
408+
394409
# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable.
395410
ifeq ($(IDF_TARGET),esp32)
396411
BOOTLOADER_OFFSET = 0x1000

0 commit comments

Comments
 (0)