Skip to content

Commit b56b140

Browse files
committed
feat/csi_camera: Support CSI camera on ESP32-P4-Function-EV-Board
1 parent 0ff244c commit b56b140

File tree

14 files changed

+247
-34
lines changed

14 files changed

+247
-34
lines changed

.github/ci/update_readme_dependencies.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def get_capabilities_table(header_path, main_path, manifest):
132132
"""
133133
Get markdown formatted table of manifest's capabilities
134134
"""
135+
with open(header_path, 'r') as f:
136+
h_code = f.read()
135137
with open(header_path, 'r') as f:
136138
content = f.readlines()
137139
table_data = []
@@ -181,6 +183,12 @@ def get_capabilities_table(header_path, main_path, manifest):
181183
matches = re.findall(r"([a-z0-9_]+)_codec_new", mic_code_section)
182184
additional_info = [m for m in matches if not m.startswith("audio")]
183185

186+
# CAMERA SENSOR
187+
if capability == "CAMERA":
188+
cam_match = re.search(r"Supported camera sensors:\s*(.*)", h_code)
189+
if cam_match:
190+
additional_info = re.findall(r"[A-Z0-9_]+", cam_match.group(1))
191+
184192
components = []
185193
versions = []
186194
if component_versions is not None:

.github/ci/update_supported_boards.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def extract_board_info(board_path):
7171
touch_types = []
7272
speaker_codec = []
7373
mic_codec = []
74+
cam_sensor = []
7475
for line in lines:
7576
match = re.match(r"#define\s+BSP_CAPS_([A-Z0-9_]+)\s+1\b", line)
7677
if match:
@@ -92,6 +93,12 @@ def extract_board_info(board_path):
9293
# TOUCH: esp_lcd_touch_new_i2c_*
9394
touch_types = re.findall(r"esp_lcd_touch_new_i2c_([a-z0-9_]+)\s*\(", c_code)
9495

96+
# CAMERA: find camera sensors
97+
if "CAMERA" in features:
98+
match = re.search(r"Supported camera sensors:\s*(.*)", content)
99+
if match:
100+
cam_sensor = re.findall(r"[A-Z0-9_]+", match.group(1))
101+
95102
# AUDIO_SPEAKER
96103
if "AUDIO_SPEAKER" in features:
97104
speaker_code_section = extract_function_body(c_code, 'bsp_audio_codec_speaker_init')
@@ -173,6 +180,8 @@ def extract_board_info(board_path):
173180
f_suffix = f" ({', '.join(speaker_codec)})" if speaker_codec else ""
174181
elif f == "AUDIO_MIC":
175182
f_suffix = f" ({', '.join(mic_codec)})" if mic_codec else ""
183+
elif f == "CAMERA":
184+
f_suffix = f" ({', '.join(cam_sensor)})" if cam_sensor else ""
176185

177186
feature_list += f"{f_emoji} {f_name} {f_suffix}<br/>"
178187
feature_list += ""

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ The following table shows the compatibility of this BSP with different ESP-IDF v
3030
| [ESP-BOX-3](bsp/esp-box-3) | esp32s3 | :musical_note: Audio <br/>:microphone: Audio Microphone (es7210)<br/>:speaker: Audio Speaker (es8311)<br/>:radio_button: Button <br/>:pager: LCD Display (st7789, ili9341)<br/>:video_game: IMU <br/>:floppy_disk: uSD Card <br/>:point_up: Display Touch (tt21100, gt911)<br/> | <img src="bsp/esp-box-3/doc/esp-box-3.webp" width="150"> |
3131
| [ESP32-C3-LCDKit](bsp/esp32_c3_lcdkit) | esp32c3 | :musical_note: Audio <br/>:speaker: Audio Speaker <br/>:pager: LCD Display (gc9a01)<br/>:white_circle: Knob <br/>:bulb: LED <br/> | <img src="bsp/esp32_c3_lcdkit/doc/esp32_c3_lcdkit.webp" width="150"> |
3232
| [ESP32-LyraT](bsp/esp32_lyrat) | esp32 | :musical_note: Audio <br/>:microphone: Audio Microphone (es8388)<br/>:speaker: Audio Speaker (es8388)<br/>:radio_button: Button <br/>:bulb: LED <br/>:floppy_disk: uSD Card <br/> | <img src="bsp/esp32_lyrat/doc/esp32_lyrat.webp" width="150"> |
33-
| [ESP32-P4-EYE](bsp/esp32_p4_eye) | esp32p4 | :musical_note: Audio <br/>:microphone: Audio Microphone <br/>:battery: Battery <br/>:radio_button: Button <br/>:camera: Camera <br/>:pager: LCD Display (st7789)<br/>:white_circle: Knob <br/>:bulb: LED <br/>:floppy_disk: uSD Card <br/> | <img src="bsp/esp32_p4_eye/doc/esp32_p4_eye.webp" width="150"> |
34-
| [ESP32-P4 Function EV Board](bsp/esp32_p4_function_ev_board) | esp32p4 | :musical_note: Audio <br/>:microphone: Audio Microphone (es8311)<br/>:speaker: Audio Speaker (es8311)<br/>:pager: LCD Display (ek79007, ili9881c, lt8912b)<br/>:floppy_disk: uSD Card <br/>:point_up: Display Touch (gt911)<br/> | <img src="bsp/esp32_p4_function_ev_board/doc/esp32_p4_function_ev_board.webp" width="150"> |
33+
| [ESP32-P4-EYE](bsp/esp32_p4_eye) | esp32p4 | :musical_note: Audio <br/>:microphone: Audio Microphone <br/>:battery: Battery <br/>:radio_button: Button <br/>:camera: Camera (OV2710)<br/>:pager: LCD Display (st7789)<br/>:white_circle: Knob <br/>:bulb: LED <br/>:floppy_disk: uSD Card <br/> | <img src="bsp/esp32_p4_eye/doc/esp32_p4_eye.webp" width="150"> |
34+
| [ESP32-P4 Function EV Board](bsp/esp32_p4_function_ev_board) | esp32p4 | :musical_note: Audio <br/>:microphone: Audio Microphone (es8311)<br/>:speaker: Audio Speaker (es8311)<br/>:camera: Camera (OV5647, SC2336)<br/>:pager: LCD Display (ek79007, ili9881c, lt8912b)<br/>:floppy_disk: uSD Card <br/>:point_up: Display Touch (gt911)<br/> | <img src="bsp/esp32_p4_function_ev_board/doc/esp32_p4_function_ev_board.webp" width="150"> |
3535
| [ESP32-S3-EYE](bsp/esp32_s3_eye) | esp32s3 | :musical_note: Audio <br/>:microphone: Audio Microphone <br/>:radio_button: Button <br/>:camera: Camera <br/>:pager: LCD Display (st7789)<br/>:video_game: IMU <br/>:floppy_disk: uSD Card <br/> | <img src="bsp/esp32_s3_eye/doc/esp32_s3_eye.webp" width="150"> |
3636
| [ESP32-S3-KORVO-1](bsp/esp32_s3_korvo_1) | esp32s3 | :musical_note: Audio <br/>:microphone: Audio Microphone (es7210)<br/>:speaker: Audio Speaker (es8311)<br/>:radio_button: Button <br/>:bulb: LED <br/>:floppy_disk: uSD Card <br/> | <img src="bsp/esp32_s3_korvo_1/doc/esp32_s3_korvo_1.webp" width="150"> |
3737
| [ESP32-S3-Korvo-2](bsp/esp32_s3_korvo_2) | esp32s3 | :musical_note: Audio <br/>:microphone: Audio Microphone (es7210)<br/>:speaker: Audio Speaker (es8311)<br/>:radio_button: Button <br/>:camera: Camera <br/>:pager: LCD Display (ili9341)<br/>:bulb: LED <br/>:floppy_disk: uSD Card <br/>:point_up: Display Touch (tt21100)<br/> | <img src="bsp/esp32_s3_korvo_2/doc/esp32_s3_korvo_2.webp" width="150"> |
@@ -72,7 +72,7 @@ Here is a summary of the available examples:
7272
| [Display Example](examples/display) | Show an image on the screen with a simple startup animation (LVGL) | <details><summary>17 boards</summary>[esp-box](bsp/esp-box)<br/>[esp-box-3](bsp/esp-box-3)<br/>[esp-box-lite](bsp/esp-box-lite)<br/>[esp32_c3_lcdkit](bsp/esp32_c3_lcdkit)<br/>[esp32_p4_eye](bsp/esp32_p4_eye)<br/>[esp32_p4_function_ev_board](bsp/esp32_p4_function_ev_board)<br/>[esp32_s2_kaluga_kit](bsp/esp32_s2_kaluga_kit)<br/>[esp32_s3_eye](bsp/esp32_s3_eye)<br/>[esp32_s3_korvo_2](bsp/esp32_s3_korvo_2)<br/>[esp32_s3_lcd_ev_board](bsp/esp32_s3_lcd_ev_board)<br/>[esp32_s3_usb_otg](bsp/esp32_s3_usb_otg)<br/>[esp_wrover_kit](bsp/esp_wrover_kit)<br/>[m5_atom_s3](bsp/m5_atom_s3)<br/>[m5dial](bsp/m5dial)<br/>[m5stack_core](bsp/m5stack_core)<br/>[m5stack_core_2](bsp/m5stack_core_2)<br/>[m5stack_core_s3](bsp/m5stack_core_s3)</details> | [Flash Example](https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-bsp/config.toml&app=display-) |
7373
| [Display, Audio and Photo Example](examples/display_audio_photo) | Complex demo: browse files from filesystem and play/display JPEG, WAV, or TXT files (LVGL) | <details><summary>7 boards</summary>[esp-box](bsp/esp-box)<br/>[esp-box-3](bsp/esp-box-3)<br/>[esp-box-lite](bsp/esp-box-lite)<br/>[esp32_s3_korvo_2](bsp/esp32_s3_korvo_2)<br/>[esp32_s3_lcd_ev_board](bsp/esp32_s3_lcd_ev_board)<br/>[m5stack_core_2](bsp/m5stack_core_2)<br/>[m5stack_core_s3](bsp/m5stack_core_s3)</details> | [Flash Example](https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-bsp/config.toml&app=display_audio_photo-) |
7474
| [Camera Example](examples/display_camera) | Stream camera output to display (LVGL) | <details><summary>4 boards</summary>[esp32_s2_kaluga_kit](bsp/esp32_s2_kaluga_kit)<br/>[esp32_s3_eye](bsp/esp32_s3_eye)<br/>[esp32_s3_korvo_2](bsp/esp32_s3_korvo_2)<br/>[m5stack_core_s3](bsp/m5stack_core_s3)</details> | [Flash Example](https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-bsp/config.toml&app=display_camera-) |
75-
| [Camera Example (MIPI-CSI)](examples/display_camera_csi) | Stream camera (MIPI-CSI) output to display (LVGL) | <details><summary>1 board</summary>[esp32_p4_eye](bsp/esp32_p4_eye)</details> | [Flash Example](https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-bsp/config.toml&app=display_camera-) |
75+
| [Camera Example (MIPI-CSI)](examples/display_camera_csi) | Stream camera (MIPI-CSI) output to display (LVGL) | <details><summary>2 boards</summary>[esp32_p4_eye](bsp/esp32_p4_eye)<br/>[esp32_p4_function_ev_board](bsp/esp32_p4_function_ev_board)</details> | [Flash Example](https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-bsp/config.toml&app=display_camera-) |
7676
| [LVGL Benchmark Example](examples/display_lvgl_benchmark) | Run LVGL benchmark tests | <details><summary>10 boards</summary>[esp-box](bsp/esp-box)<br/>[esp-box-3](bsp/esp-box-3)<br/>[esp-box-lite](bsp/esp-box-lite)<br/>[esp32_p4_function_ev_board](bsp/esp32_p4_function_ev_board)<br/>[esp32_s2_kaluga_kit](bsp/esp32_s2_kaluga_kit)<br/>[esp32_s3_eye](bsp/esp32_s3_eye)<br/>[esp32_s3_korvo_2](bsp/esp32_s3_korvo_2)<br/>[esp32_s3_lcd_ev_board](bsp/esp32_s3_lcd_ev_board)<br/>[m5dial](bsp/m5dial)<br/>[m5stack_core_s3](bsp/m5stack_core_s3)</details> | - |
7777
| [LVGL Demos Example](examples/display_lvgl_demos) | Run the LVGL demo player - all LVGL examples are included (LVGL) | <details><summary>11 boards</summary>[esp-box](bsp/esp-box)<br/>[esp-box-3](bsp/esp-box-3)<br/>[esp-box-lite](bsp/esp-box-lite)<br/>[esp32_p4_eye](bsp/esp32_p4_eye)<br/>[esp32_p4_function_ev_board](bsp/esp32_p4_function_ev_board)<br/>[esp32_s2_kaluga_kit](bsp/esp32_s2_kaluga_kit)<br/>[esp32_s3_eye](bsp/esp32_s3_eye)<br/>[esp32_s3_korvo_2](bsp/esp32_s3_korvo_2)<br/>[esp32_s3_lcd_ev_board](bsp/esp32_s3_lcd_ev_board)<br/>[m5dial](bsp/m5dial)<br/>[m5stack_core_s3](bsp/m5stack_core_s3)</details> | [Flash Example](https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-bsp/config.toml&app=display_lvgl_demos-) |
7878
| [Display Rotation Example](examples/display_rotation) | Rotate screen using buttons or an accelerometer (`BSP_CAPS_IMU`, if available) | <details><summary>10 boards</summary>[esp-box](bsp/esp-box)<br/>[esp-box-3](bsp/esp-box-3)<br/>[esp-box-lite](bsp/esp-box-lite)<br/>[esp32_p4_eye](bsp/esp32_p4_eye)<br/>[esp32_p4_function_ev_board](bsp/esp32_p4_function_ev_board)<br/>[esp32_s3_korvo_2](bsp/esp32_s3_korvo_2)<br/>[esp32_s3_lcd_ev_board](bsp/esp32_s3_lcd_ev_board)<br/>[m5dial](bsp/m5dial)<br/>[m5stack_core](bsp/m5stack_core)<br/>[m5stack_core_s3](bsp/m5stack_core_s3)</details> | [Flash Example](https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-bsp/config.toml&app=display_rotation-) |

bsp/esp32_p4_eye/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ESP32-P4-EYE is a vision development board based on the ESP32-P4 chip, mainly ta
4040
|:heavy_check_mark:| :microphone: AUDIO_MIC | | | |
4141
|:heavy_check_mark:| :floppy_disk: SDCARD | | idf | >=5.4 |
4242
|:heavy_check_mark:| :bulb: LED | |idf<br/>[espressif/led_indicator](https://components.espressif.com/components/espressif/led_indicator)|>=5.4<br/>^2|
43-
|:heavy_check_mark:| :camera: CAMERA | | | |
43+
|:heavy_check_mark:| :camera: CAMERA | OV2710 | | |
4444
|:heavy_check_mark:| :battery: BAT | | idf | >=5.4 |
4545
| :x: | :video_game: IMU | | | |
4646

@@ -61,4 +61,3 @@ ESP32-P4-EYE is a vision development board based on the ESP32-P4 chip, mainly ta
6161

6262
<!-- END_EXAMPLES -->
6363
</div>
64-

bsp/esp32_p4_eye/idf_component.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
version: "1.0.0"
2+
version: "1.0.0~1"
33
description: Board Support Package (BSP) for ESP32-P4-EYE
44
url: https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_p4_eye
55

@@ -11,28 +11,34 @@ tags:
1111

1212
dependencies:
1313
idf: ">=5.4"
14-
14+
1515
esp_codec_dev:
1616
version: "~1.5"
1717
public: true
18-
18+
1919
espressif/esp_lvgl_port:
2020
version: "^2"
2121
public: true
22-
22+
2323
knob:
2424
version: "^1"
2525
public: true
26-
26+
2727
button:
2828
version: "^4"
2929
public: true
30-
30+
3131
esp_video:
3232
version: "~1.3"
3333
public: true
34-
34+
3535
led_indicator:
3636
version: "^2"
3737
public: true
38-
38+
39+
examples:
40+
- path: ../../examples/display
41+
- path: ../../examples/display_rotation
42+
- path: ../../examples/display_lvgl_demos
43+
- path: ../../examples/display_camera_csi
44+

bsp/esp32_p4_eye/include/bsp/esp32_p4_eye.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,8 @@ void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation);
564564
/**************************************************************************************************
565565
*
566566
* Camera interface
567+
* Supported camera sensors: OV2710
568+
* More information in display_camera_csi example
567569
*
568570
**************************************************************************************************/
569571

bsp/esp32_p4_function_ev_board/API.md

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66

77

8-
| :1234: [CAPABILITIES](#1234-capabilities) | :floppy_disk: [SD CARD AND SPIFFS](#floppy_disk-sd-card-and-spiffs) | :musical_note: [AUDIO](#musical_note-audio) | :pager: [DISPLAY AND TOUCH](#pager-display-and-touch) | :electric_plug: [USB](#electric_plug-usb) |
9-
| :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: |
8+
| :1234: [CAPABILITIES](#1234-capabilities) | :floppy_disk: [SD CARD AND SPIFFS](#floppy_disk-sd-card-and-spiffs) | :musical_note: [AUDIO](#musical_note-audio) | :pager: [DISPLAY AND TOUCH](#pager-display-and-touch) | :electric_plug: [USB](#electric_plug-usb) | :camera: [CAMERA](#camera-camera) |
9+
| :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: |
1010

1111
</div>
1212

@@ -148,6 +148,7 @@ You can use these macros to conditionally compile code depending on feature avai
148148
| define | [**BSP\_CAPS\_AUDIO\_MIC**](#define-bsp_caps_audio_mic) 1<br> |
149149
| define | [**BSP\_CAPS\_AUDIO\_SPEAKER**](#define-bsp_caps_audio_speaker) 1<br> |
150150
| define | [**BSP\_CAPS\_BUTTONS**](#define-bsp_caps_buttons) 0<br> |
151+
| define | [**BSP\_CAPS\_CAMERA**](#define-bsp_caps_camera) 1<br> |
151152
| define | [**BSP\_CAPS\_DISPLAY**](#define-bsp_caps_display) 1<br> |
152153
| define | [**BSP\_CAPS\_IMU**](#define-bsp_caps_imu) 0<br> |
153154
| define | [**BSP\_CAPS\_SDCARD**](#define-bsp_caps_sdcard) 1<br> |
@@ -1474,3 +1475,78 @@ USB Host lib will be uninstalled and power from connector removed.
14741475

14751476

14761477

1478+
1479+
1480+
1481+
## :camera: Camera
1482+
1483+
There is no dedicated BSP API for camera functionality. Instead, the BSP provides default configuration macros:
1484+
- `BSP_CAMERA_DEFAULT_CONFIG`
1485+
- `BSP_CAMERA_VFLIP`
1486+
- `BSP_CAMERA_HMIRROR`
1487+
1488+
These macros are designed for use with the [esp32-camera](https://components.espressif.com/components/espressif/esp32-camera) component.
1489+
1490+
> [!NOTE]
1491+
> Don't forget to initialize I2C (`bsp_i2c_init()`) before using the camera, as some camera modules require I2C for configuration.
1492+
1493+
### Example Usage
1494+
1495+
```
1496+
/* Initialize I2C bus (required by camera module) */
1497+
bsp_i2c_init();
1498+
1499+
/* Initialize the camera using BSP default config */
1500+
const camera_config_t camera_config = BSP_CAMERA_DEFAULT_CONFIG;
1501+
esp_camera_init(&camera_config);
1502+
1503+
/* Optional: Set camera orientation */
1504+
sensor_t *s = esp_camera_sensor_get();
1505+
s->set_vflip(s, BSP_CAMERA_VFLIP); // Vertical flip
1506+
s->set_hmirror(s, BSP_CAMERA_HMIRROR); // Horizontal mirror
1507+
1508+
...
1509+
1510+
/* Capture a frame */
1511+
camera_fb_t * pic = esp_camera_fb_get();
1512+
if (pic) {
1513+
/* Access raw image data in pic->buf with size pic->len */
1514+
process_image(pic->buf, pic->len); // Replace with your function
1515+
esp_camera_fb_return(pic);
1516+
}
1517+
```
1518+
1519+
### Camera API Reference
1520+
1521+
1522+
## Functions
1523+
1524+
| Type | Name |
1525+
| ---: | :--- |
1526+
| esp\_err\_t | [**bsp\_camera\_start**](#function-bsp_camera_start) (void) <br>_Initialize camera._ |
1527+
1528+
## Macros
1529+
1530+
| Type | Name |
1531+
| ---: | :--- |
1532+
| define | [**BSP\_CAMERA\_GPIO\_XCLK**](#define-bsp_camera_gpio_xclk) (GPIO\_NUM\_NC)<br> |
1533+
| define | [**BSP\_CAMERA\_RST**](#define-bsp_camera_rst) (GPIO\_NUM\_NC)<br> |
1534+
1535+
1536+
1537+
## Functions Documentation
1538+
1539+
### function `bsp_camera_start`
1540+
1541+
_Initialize camera._
1542+
```c
1543+
esp_err_t bsp_camera_start (
1544+
void
1545+
)
1546+
```
1547+
1548+
1549+
Camera sensor initialization.
1550+
1551+
1552+

0 commit comments

Comments
 (0)