mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-01-14 01:07:30 +08:00
Add Camera support for Waveshare's ESP32-P4 series development board (#1459)
* Add Camera support to Waveshare's ESP32-P4 series development board * Fix i2c handle error
This commit is contained in:
parent
908c9d5708
commit
c87b1eabf4
@ -5,7 +5,11 @@
|
||||
"name": "waveshare-p4-nano-10.1-a",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_USE_WECHAT_MESSAGE_STYLE=y",
|
||||
"CONFIG_LCD_TYPE_800_1280_10_1_INCH_A=y"
|
||||
"CONFIG_LCD_TYPE_800_1280_10_1_INCH_A=y",
|
||||
"CONFIG_CAMERA_OV5647=y",
|
||||
"CONFIG_CAMERA_OV5647_AUTO_DETECT_MIPI_INTERFACE_SENSOR=y",
|
||||
"CONFIG_CAMERA_OV5647_MIPI_RAW8_800X800_50FPS=y",
|
||||
"CONFIG_XIAOZHI_ENABLE_CAMERA_ENDIANNESS_SWAP=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
#include "button.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "esp32_camera.h"
|
||||
#include "esp_video_init.h"
|
||||
#include "esp_cam_sensor_xclk.h"
|
||||
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "esp_lcd_mipi_dsi.h"
|
||||
#include "esp_ldo_regulator.h"
|
||||
@ -66,6 +70,7 @@ private:
|
||||
i2c_master_bus_handle_t codec_i2c_bus_;
|
||||
Button boot_button_;
|
||||
LcdDisplay *display__;
|
||||
Esp32Camera* camera_ = nullptr;
|
||||
CustomBacklight *backlight_;
|
||||
|
||||
void InitializeCodecI2c() {
|
||||
@ -196,6 +201,23 @@ private:
|
||||
lvgl_port_add_touch(&touch_cfg);
|
||||
ESP_LOGI(TAG, "Touch panel initialized successfully");
|
||||
}
|
||||
void InitializeCamera() {
|
||||
esp_video_init_csi_config_t base_csi_config = {
|
||||
.sccb_config = {
|
||||
.init_sccb = false,
|
||||
.i2c_handle = codec_i2c_bus_,
|
||||
.freq = 400000,
|
||||
},
|
||||
.reset_pin = GPIO_NUM_NC,
|
||||
.pwdn_pin = GPIO_NUM_NC,
|
||||
};
|
||||
|
||||
esp_video_init_config_t cam_config = {
|
||||
.csi = &base_csi_config,
|
||||
};
|
||||
|
||||
camera_ = new Esp32Camera(cam_config);
|
||||
}
|
||||
void InitializeButtons() {
|
||||
boot_button_.OnClick([this]() {
|
||||
auto& app = Application::GetInstance();
|
||||
@ -211,6 +233,7 @@ public:
|
||||
InitializeCodecI2c();
|
||||
InitializeLCD();
|
||||
InitializeTouch();
|
||||
InitializeCamera();
|
||||
InitializeButtons();
|
||||
}
|
||||
|
||||
@ -225,6 +248,10 @@ public:
|
||||
return display__;
|
||||
}
|
||||
|
||||
virtual Camera* GetCamera() override {
|
||||
return camera_;
|
||||
}
|
||||
|
||||
virtual Backlight *GetBacklight() override {
|
||||
return backlight_;
|
||||
}
|
||||
|
||||
@ -5,7 +5,11 @@
|
||||
"name": "waveshare-p4-wifi6-touch-lcd-4b",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_USE_WECHAT_MESSAGE_STYLE=n",
|
||||
"CONFIG_USE_DEVICE_AEC=y"
|
||||
"CONFIG_USE_DEVICE_AEC=y",
|
||||
"CONFIG_CAMERA_OV5647=y",
|
||||
"CONFIG_CAMERA_OV5647_AUTO_DETECT_MIPI_INTERFACE_SENSOR=y",
|
||||
"CONFIG_CAMERA_OV5647_MIPI_RAW8_800X800_50FPS=y",
|
||||
"CONFIG_XIAOZHI_ENABLE_CAMERA_ENDIANNESS_SWAP=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
#include "button.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "esp32_camera.h"
|
||||
#include "esp_video_init.h"
|
||||
#include "esp_cam_sensor_xclk.h"
|
||||
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "esp_lcd_mipi_dsi.h"
|
||||
#include "esp_ldo_regulator.h"
|
||||
@ -24,6 +28,7 @@ private:
|
||||
i2c_master_bus_handle_t i2c_bus_;
|
||||
Button boot_button_;
|
||||
LcdDisplay *display_;
|
||||
Esp32Camera* camera_ = nullptr;
|
||||
|
||||
void InitializeCodecI2c() {
|
||||
// Initialize I2C peripheral
|
||||
@ -149,6 +154,23 @@ private:
|
||||
lvgl_port_add_touch(&touch_cfg);
|
||||
ESP_LOGI(TAG, "Touch panel initialized successfully");
|
||||
}
|
||||
void InitializeCamera() {
|
||||
esp_video_init_csi_config_t base_csi_config = {
|
||||
.sccb_config = {
|
||||
.init_sccb = false,
|
||||
.i2c_handle = i2c_bus_,
|
||||
.freq = 400000,
|
||||
},
|
||||
.reset_pin = GPIO_NUM_NC,
|
||||
.pwdn_pin = GPIO_NUM_NC,
|
||||
};
|
||||
|
||||
esp_video_init_config_t cam_config = {
|
||||
.csi = &base_csi_config,
|
||||
};
|
||||
|
||||
camera_ = new Esp32Camera(cam_config);
|
||||
}
|
||||
void InitializeButtons() {
|
||||
boot_button_.OnClick([this]() {
|
||||
auto& app = Application::GetInstance();
|
||||
@ -164,6 +186,7 @@ public:
|
||||
InitializeCodecI2c();
|
||||
InitializeLCD();
|
||||
InitializeTouch();
|
||||
InitializeCamera();
|
||||
InitializeButtons();
|
||||
GetBacklight()->RestoreBrightness();
|
||||
}
|
||||
@ -189,6 +212,10 @@ public:
|
||||
return display_;
|
||||
}
|
||||
|
||||
virtual Camera* GetCamera() override {
|
||||
return camera_;
|
||||
}
|
||||
|
||||
virtual Backlight* GetBacklight() override {
|
||||
static PwmBacklight backlight(DISPLAY_BACKLIGHT_PIN, DISPLAY_BACKLIGHT_OUTPUT_INVERT);
|
||||
return &backlight;
|
||||
|
||||
@ -5,7 +5,11 @@
|
||||
"name": "waveshare-p4-wifi6-touch-lcd-7b",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_USE_WECHAT_MESSAGE_STYLE=n",
|
||||
"CONFIG_USE_DEVICE_AEC=y"
|
||||
"CONFIG_USE_DEVICE_AEC=y",
|
||||
"CONFIG_CAMERA_OV5647=y",
|
||||
"CONFIG_CAMERA_OV5647_AUTO_DETECT_MIPI_INTERFACE_SENSOR=y",
|
||||
"CONFIG_CAMERA_OV5647_MIPI_RAW8_800X800_50FPS=y",
|
||||
"CONFIG_XIAOZHI_ENABLE_CAMERA_ENDIANNESS_SWAP=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
#include "button.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "esp32_camera.h"
|
||||
#include "esp_video_init.h"
|
||||
#include "esp_cam_sensor_xclk.h"
|
||||
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "esp_lcd_mipi_dsi.h"
|
||||
#include "esp_ldo_regulator.h"
|
||||
@ -24,6 +28,7 @@ private:
|
||||
i2c_master_bus_handle_t i2c_bus_;
|
||||
Button boot_button_;
|
||||
LcdDisplay *display_;
|
||||
Esp32Camera* camera_ = nullptr;
|
||||
|
||||
void InitializeCodecI2c() {
|
||||
// Initialize I2C peripheral
|
||||
@ -153,6 +158,23 @@ private:
|
||||
lvgl_port_add_touch(&touch_cfg);
|
||||
ESP_LOGI(TAG, "Touch panel initialized successfully");
|
||||
}
|
||||
void InitializeCamera() {
|
||||
esp_video_init_csi_config_t base_csi_config = {
|
||||
.sccb_config = {
|
||||
.init_sccb = false,
|
||||
.i2c_handle = i2c_bus_,
|
||||
.freq = 400000,
|
||||
},
|
||||
.reset_pin = GPIO_NUM_NC,
|
||||
.pwdn_pin = GPIO_NUM_NC,
|
||||
};
|
||||
|
||||
esp_video_init_config_t cam_config = {
|
||||
.csi = &base_csi_config,
|
||||
};
|
||||
|
||||
camera_ = new Esp32Camera(cam_config);
|
||||
}
|
||||
void InitializeButtons() {
|
||||
boot_button_.OnClick([this]() {
|
||||
auto& app = Application::GetInstance();
|
||||
@ -168,6 +190,7 @@ public:
|
||||
InitializeCodecI2c();
|
||||
InitializeLCD();
|
||||
InitializeTouch();
|
||||
InitializeCamera();
|
||||
InitializeButtons();
|
||||
GetBacklight()->RestoreBrightness();
|
||||
}
|
||||
@ -193,6 +216,10 @@ public:
|
||||
return display_;
|
||||
}
|
||||
|
||||
virtual Camera* GetCamera() override {
|
||||
return camera_;
|
||||
}
|
||||
|
||||
virtual Backlight* GetBacklight() override {
|
||||
static PwmBacklight backlight(DISPLAY_BACKLIGHT_PIN, DISPLAY_BACKLIGHT_OUTPUT_INVERT);
|
||||
return &backlight;
|
||||
|
||||
@ -6,7 +6,11 @@
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_USE_WECHAT_MESSAGE_STYLE=n",
|
||||
"CONFIG_USE_DEVICE_AEC=y",
|
||||
"CONFIG_LCD_TYPE_800_800_3_4_INCH=y"
|
||||
"CONFIG_LCD_TYPE_800_800_3_4_INCH=y",
|
||||
"CONFIG_CAMERA_OV5647=y",
|
||||
"CONFIG_CAMERA_OV5647_AUTO_DETECT_MIPI_INTERFACE_SENSOR=y",
|
||||
"CONFIG_CAMERA_OV5647_MIPI_RAW8_800X800_50FPS=y",
|
||||
"CONFIG_XIAOZHI_ENABLE_CAMERA_ENDIANNESS_SWAP=y"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -14,7 +18,11 @@
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_USE_WECHAT_MESSAGE_STYLE=n",
|
||||
"CONFIG_USE_DEVICE_AEC=y",
|
||||
"CONFIG_LCD_TYPE_720_720_4_INCH=y"
|
||||
"CONFIG_LCD_TYPE_720_720_4_INCH=y",
|
||||
"CONFIG_CAMERA_OV5647=y",
|
||||
"CONFIG_CAMERA_OV5647_AUTO_DETECT_MIPI_INTERFACE_SENSOR=y",
|
||||
"CONFIG_CAMERA_OV5647_MIPI_RAW8_800X800_50FPS=y",
|
||||
"CONFIG_XIAOZHI_ENABLE_CAMERA_ENDIANNESS_SWAP=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -5,6 +5,10 @@
|
||||
// #include "display/no_display.h"
|
||||
#include "button.h"
|
||||
|
||||
#include "esp32_camera.h"
|
||||
#include "esp_video_init.h"
|
||||
#include "esp_cam_sensor_xclk.h"
|
||||
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "esp_lcd_mipi_dsi.h"
|
||||
#include "esp_ldo_regulator.h"
|
||||
@ -24,6 +28,7 @@ private:
|
||||
i2c_master_bus_handle_t i2c_bus_;
|
||||
Button boot_button_;
|
||||
LcdDisplay *display_;
|
||||
Esp32Camera* camera_ = nullptr;
|
||||
|
||||
void InitializeCodecI2c() {
|
||||
// Initialize I2C peripheral
|
||||
@ -151,6 +156,23 @@ private:
|
||||
lvgl_port_add_touch(&touch_cfg);
|
||||
ESP_LOGI(TAG, "Touch panel initialized successfully");
|
||||
}
|
||||
void InitializeCamera() {
|
||||
esp_video_init_csi_config_t base_csi_config = {
|
||||
.sccb_config = {
|
||||
.init_sccb = false,
|
||||
.i2c_handle = i2c_bus_,
|
||||
.freq = 400000,
|
||||
},
|
||||
.reset_pin = GPIO_NUM_NC,
|
||||
.pwdn_pin = GPIO_NUM_NC,
|
||||
};
|
||||
|
||||
esp_video_init_config_t cam_config = {
|
||||
.csi = &base_csi_config,
|
||||
};
|
||||
|
||||
camera_ = new Esp32Camera(cam_config);
|
||||
}
|
||||
void InitializeButtons() {
|
||||
boot_button_.OnClick([this]() {
|
||||
auto& app = Application::GetInstance();
|
||||
@ -166,6 +188,7 @@ public:
|
||||
InitializeCodecI2c();
|
||||
InitializeLCD();
|
||||
InitializeTouch();
|
||||
InitializeCamera();
|
||||
InitializeButtons();
|
||||
GetBacklight()->RestoreBrightness();
|
||||
}
|
||||
@ -191,6 +214,10 @@ public:
|
||||
return display_;
|
||||
}
|
||||
|
||||
virtual Camera* GetCamera() override {
|
||||
return camera_;
|
||||
}
|
||||
|
||||
virtual Backlight* GetBacklight() override {
|
||||
static PwmBacklight backlight(DISPLAY_BACKLIGHT_PIN, DISPLAY_BACKLIGHT_OUTPUT_INVERT);
|
||||
return &backlight;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user