Skip to content

Commit 7f14dda

Browse files
committed
Merge branch 'feature/add_esp32s3_support' into 'master'
feat(esp_video): Add ESP32-S3 support Closes AEG-2484 See merge request espressif/esp-video-components!291
2 parents e40b705 + b0a3207 commit 7f14dda

File tree

82 files changed

+1371
-542
lines changed

Some content is hidden

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

82 files changed

+1371
-542
lines changed

esp_cam_sensor/Kconfig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,36 @@ menu "Espressif Camera Sensors Configurations"
1515
rsource "sensors/sc101iot/Kconfig.sc101iot"
1616
rsource "sensors/sc202cs/Kconfig.sc202cs"
1717
rsource "sensors/sc2336/Kconfig.sc2336"
18+
19+
config CAMERA_SENSOR_SWAP_PIXEL_BYTE_ORDER
20+
bool "Swap Pixel Byte Order"
21+
default y if IDF_TARGET_ESP32P4
22+
default n if IDF_TARGET_ESP32S3
23+
depends on CAMERA_OV2640 || CAMERA_BF3901
24+
help
25+
If enabled, the pixel byte order will be swapped, for example:
26+
27+
Original RGB565 byte order:
28+
0x00 0x01 0x02 0x03 0x04 0x05
29+
B G R B G R B G R
30+
31+
Swapped RGB565 byte order:
32+
0x00 0x01 0x02 0x03 0x04 0x05
33+
R G B R G B R G B
34+
35+
Original YUYV byte order:
36+
0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
37+
Y U Y V Y U Y V
38+
39+
Swapped YUYV byte order:
40+
0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
41+
U Y V Y U Y V Y
42+
43+
Please note that this option is only valid for OV2640 and BF3901.
44+
45+
If you want to swap the pixel byte order of other sensors,
46+
please use ESP_VIDEO_ENABLE_SWAP_BYTE. Only ESP32-P4 is supported;
47+
other platforms are not supported.
1848
endmenu
1949

2050
menu "Camera XCLK generator Configuration"

esp_cam_sensor/sensors/bf3901/private_include/bf3901_settings.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414

1515
#define G3LB5 0x05
1616
#define RGB 0x04
17+
18+
#if CONFIG_CAMERA_SENSOR_SWAP_PIXEL_BYTE_ORDER
1719
#define YUV422 0x02
20+
#else
21+
#define YUV422 0x00
22+
#endif
1823

1924
#ifdef __cplusplus
2025
extern "C" {

esp_cam_sensor/sensors/ov2640/private_include/ov2640_regs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ extern "C" {
8383
#define IMAGE_MODE_Y8_DVP_EN 0x40
8484
#define IMAGE_MODE_JPEG_EN 0x10
8585

86-
#if CONFIG_IDF_TARGET_ESP32S3
87-
#define IMAGE_MODE_YUV422 0x00 // YUV422 format
88-
#define IMAGE_MODE_RGB565 0x08 // RGB565 format
89-
#else
90-
#define IMAGE_MODE_YUV422 0x01 // YUV422 format and byte swap enabled
86+
#if CONFIG_CAMERA_SENSOR_SWAP_PIXEL_BYTE_ORDER
9187
#define IMAGE_MODE_RGB565 0x09 // RGB565 format and byte swap enabled
88+
#define IMAGE_MODE_YUV422 0x01 // YUV422 format and byte swap enabled
89+
#else
90+
#define IMAGE_MODE_RGB565 0x08 // RGB565 format
91+
#define IMAGE_MODE_YUV422 0x00 // YUV422 format
9292
#endif
9393

9494
#define IMAGE_MODE_RAW10 0x04

esp_cam_sensor/sensors/sc2336/sc2336.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <string.h>
8+
#include <sys/param.h>
89
#include <freertos/FreeRTOS.h>
910
#include <freertos/task.h>
1011
#include "driver/gpio.h"

esp_cam_sensor/src/driver_cam/esp_cam_ctlr_spi_cam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ esp_err_t esp_cam_new_spi_ctlr(const esp_cam_ctlr_spi_config_t *config, esp_cam_
555555
uint32_t heap_cap = MALLOC_CAP_8BIT | MALLOC_CAP_CACHE_ALIGNED;
556556

557557
#if CONFIG_SPIRAM
558-
if (config->bk_buffer_sram) {
558+
if (!config->bk_buffer_sram) {
559559
heap_cap |= MALLOC_CAP_SPIRAM;
560560
} else {
561561
heap_cap |= MALLOC_CAP_INTERNAL;

esp_video/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Unreleased
22

33
- Add SPI video device and board-level configuration
4+
- Add ESP32-S3 platform
45
- Fix open function crashes after failing to initialize the video device
56

67
## 1.0.0

esp_video/CMakeLists.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(srcs "src/esp_video_buffer.c"
99
set(include_dirs "include")
1010
set(priv_include_dirs "private_include")
1111
set(priv_requires "vfs")
12-
set(requires "esp_driver_cam" "esp_driver_isp" "esp_cam_sensor" "esp_h264" "esp_driver_jpeg")
12+
set(requires "esp_driver_cam" "esp_cam_sensor")
1313

1414
if(CONFIG_IDF_TARGET_ESP32P4)
1515
if(CONFIG_ESP_VIDEO_ENABLE_SWAP_SHORT)
@@ -63,7 +63,21 @@ if(CONFIG_ESP_VIDEO_ENABLE_ISP_PIPELINE_CONTROLLER)
6363
idf_component_optional_requires(PRIVATE "esp_ipa")
6464
endif()
6565

66-
if(CONFIG_IDF_TARGET_ESP32P4)
66+
if(CONFIG_IDF_TARGET_ESP32P4)
67+
if(CONFIG_ESP_VIDEO_ENABLE_ISP)
68+
# Supply the header files to applications
69+
idf_component_optional_requires(PUBLIC "esp_driver_isp")
70+
endif()
71+
72+
if(CONFIG_ESP_VIDEO_ENABLE_HW_JPEG_VIDEO_DEVICE)
73+
# Supply the header files to applications
74+
idf_component_optional_requires(PUBLIC "esp_driver_jpeg")
75+
endif()
76+
77+
if(CONFIG_ESP_VIDEO_ENABLE_H264_VIDEO_DEVICE)
78+
idf_component_optional_requires(PRIVATE "esp_h264")
79+
endif()
80+
6781
if(CONFIG_ESP_VIDEO_ENABLE_SWAP_SHORT_PERF_LOG)
6882
idf_component_optional_requires(PRIVATE "esp_timer")
6983
endif()

esp_video/Kconfig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ menu "Espressif Video Configuration"
7474

7575
menuconfig ESP_VIDEO_ENABLE_HW_JPEG_VIDEO_DEVICE
7676
bool "Enable Hardware JPEG based Video Device"
77-
depends on IDF_TARGET_ESP32P4
77+
depends on SOC_JPEG_CODEC_SUPPORTED
7878
select ESP_VIDEO_ENABLE_JPEG_VIDEO_DEVICE
7979
default n
8080
help
@@ -128,7 +128,5 @@ menu "Espressif Video Configuration"
128128
help
129129
Select this option, enable camera motor controller to set the focus of the camera.
130130

131-
if IDF_TARGET_ESP32P4
132-
rsource "./src/data_reprocessing/$IDF_TARGET/Kconfig.data_reprocessing"
133-
endif
131+
rsource "./src/data_reprocessing/Kconfig.data_reprocessing"
134132
endmenu

esp_video/examples/capture_stream/.build-test-rules.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
esp_video/examples/capture_stream:
22
enable:
3-
- if: IDF_TARGET == "esp32p4"
4-
reason: only support on esp32p4
3+
- if: IDF_TARGET in ["esp32p4", "esp32s3"]
4+
reason: only support on esp32p4 and esp32s3
55
depends_components:
66
- esp_video
77
- esp_cam_sensor

esp_video/examples/capture_stream/README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
| Supported Targets | ESP32-P4 | ESP32-S3 |
2+
| ----------------- | -------- | -------- |
3+
4+
15
# Capture Stream Example
26

37
(See the [README.md](../README.md) file in the upper level [examples](../) directory for more information about examples.)
@@ -33,6 +37,16 @@ Component config --->
3337
[ ] SC2336 ----
3438
```
3539

40+
#### SPI Development Kit
41+
42+
```
43+
Component config --->
44+
Espressif Camera Sensors Configurations --->
45+
[*] BF3901 --->
46+
Auto detect BF3901 --->
47+
[*] Detect for SPI interface sensor
48+
```
49+
3650
### Build and Flash
3751
Build the project and flash it to the board, then run monitor tool to view serial output:
3852

@@ -124,4 +138,30 @@ I (4367) example: size: 614400
124138
I (4367) example: FPS: 6
125139
I (4367) main_task: Returned from app_main()
126140
...
127-
```
141+
```
142+
143+
#### SPI Development Kit
144+
145+
```
146+
...
147+
I (1483) main_task: Calling app_main()
148+
I (1483) example_init_video: SPI camera sensor I2C port=1, scl_pin=8, sda_pin=7, freq=100000
149+
I (1513) bf3901: Detected Camera sensor PID=0x3901
150+
I (1573) example: version: 1.0.0
151+
I (1573) example: driver: SPI
152+
I (1573) example: card: SPI
153+
I (1573) example: bus: esp32p4:SPI
154+
I (1573) example: capabilities:
155+
I (1573) example: VIDEO_CAPTURE
156+
I (1573) example: STREAMING
157+
I (1583) example: device capabilities:
158+
I (1583) example: VIDEO_CAPTURE
159+
I (1583) example: STREAMING
160+
I (1593) example: Capture YVU 4:2:2 planar format frames for 3 seconds:
161+
I (4613) example: width: 240
162+
I (4613) example: height: 320
163+
I (4613) example: size: 153600
164+
I (4613) example: FPS: 10
165+
I (4613) main_task: Returned from app_main()
166+
...
167+
```

0 commit comments

Comments
 (0)