feat: support USB Camera (#1519)

This commit is contained in:
laride
2025-12-11 07:10:12 +08:00
committed by GitHub
parent 1f0d2e993b
commit 4b582f8074
4 changed files with 113 additions and 5 deletions

View File

@@ -5,6 +5,7 @@
#include "button.h"
#include "led/single_led.h"
#include "pin_config.h"
#include "esp32_camera.h"
#include "config.h"
@@ -24,6 +25,7 @@ private:
i2c_master_bus_handle_t codec_i2c_bus_;
Button boot_button_;
LcdDisplay* display_;
Esp32Camera* camera_;
//add support ev board lcd
esp_io_expander_handle_t expander = NULL;
@@ -165,11 +167,39 @@ private:
});
}
#ifdef CONFIG_ESP_VIDEO_ENABLE_USB_UVC_VIDEO_DEVICE
void InitializeCamera() {
esp_video_init_usb_uvc_config_t usb_uvc_config = {
.uvc = {
.uvc_dev_num = 1,
.task_stack = 4096,
.task_priority = 5,
.task_affinity = -1,
},
.usb = {
.init_usb_host_lib = true,
.task_stack = 4096,
.task_priority = 5,
.task_affinity = -1,
},
};
esp_video_init_config_t video_config = {
.usb_uvc = &usb_uvc_config,
};
camera_ = new Esp32Camera(video_config);
}
#endif // CONFIG_ESP_VIDEO_ENABLE_USB_UVC_VIDEO_DEVICE
public:
ESP_S3_LCD_EV_Board() : boot_button_(BOOT_BUTTON_GPIO) {
InitializeCodecI2c();
InitializeButtons();
InitializeRGB_GC9503V_Display();
#ifdef CONFIG_ESP_VIDEO_ENABLE_USB_UVC_VIDEO_DEVICE
InitializeCamera();
#endif // CONFIG_ESP_VIDEO_ENABLE_USB_UVC_VIDEO_DEVICE
}
virtual AudioCodec* GetAudioCodec() override {
@@ -199,6 +229,12 @@ public:
return &led;
}
#ifdef CONFIG_ESP_VIDEO_ENABLE_USB_UVC_VIDEO_DEVICE
virtual Camera* GetCamera() override {
return camera_;
}
#endif // CONFIG_ESP_VIDEO_ENABLE_USB_UVC_VIDEO_DEVICE
};
DECLARE_BOARD(ESP_S3_LCD_EV_Board);