Skip to content

Commit

Permalink
sample: video: esp32s3: add support for xiao_esp32s3
Browse files Browse the repository at this point in the history
adding xiao_esp32s3 support to video capture sample

Signed-off-by: Armin Kessler [email protected]
  • Loading branch information
epc-ake committed Aug 5, 2024
1 parent c4e5d10 commit 8a742c3
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/subsys/video/capture/boards/xiao_esp32s3_procpu.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIG_DMA=y
CONFIG_VIDEO_ESP32S3=y
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=3
CONFIG_CLOCK_CONTROL_ESP32_CAM=y
85 changes: 85 additions & 0 deletions samples/subsys/video/capture/boards/xiao_esp32s3_procpu.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#include <zephyr/dt-bindings/led/led.h>
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
#include <zephyr/dt-bindings/pwm/pwm.h>

/ {
chosen {
zephyr_camera = &camera0;
};
};

&dma {
status = "okay";
};

&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
ov2640: ov2640@30 {
compatible = "ovti,ov2640";
reg = <0x30>;
status = "okay";
clock-rate-control = <0x80>;
port {
ov2640_ep_out: endpoint {
remote-endpoint = <&dvp_ep_in>;
};
};
};
};

&lcd_cam {
status = "okay";
cam_clk = < 10000000 >;
pinctrl-0 = <&lcd_cam_default>;
pinctrl-names = "default";
};

&camera0 {
status = "okay";
pinctrl-0 = <&cam_default>;
pinctrl-names = "default";
source = <&ov2640>;
port {
dvp_ep_in: endpoint {
remote-endpoint = <&ov2640_ep_out>;
};
};
};

&pinctrl {
lcd_cam_default: lcd_cam_default{
group1 {
pinmux = <ESP32_PINMUX(10, ESP_NOSIG, ESP_CAM_CLK)>;
output-enable;
};
};
cam_default: cam_default {
group1 {
pinmux = <ESP32_PINMUX(38, ESP_CAM_V_SYNC, ESP_NOSIG)>,
<ESP32_PINMUX(47, ESP_CAM_H_ENABLE, ESP_NOSIG)>,
<ESP32_PINMUX(13, ESP_CAM_PCLK, ESP_NOSIG)>,
<ESP32_PINMUX(15, ESP_CAM_DATA_IN0, ESP_NOSIG)>,
<ESP32_PINMUX(17, ESP_CAM_DATA_IN1, ESP_NOSIG)>,
<ESP32_PINMUX(18, ESP_CAM_DATA_IN2, ESP_NOSIG)>,
<ESP32_PINMUX(16, ESP_CAM_DATA_IN3, ESP_NOSIG)>,
<ESP32_PINMUX(14, ESP_CAM_DATA_IN4, ESP_NOSIG)>,
<ESP32_PINMUX(12, ESP_CAM_DATA_IN5, ESP_NOSIG)>,
<ESP32_PINMUX(11, ESP_CAM_DATA_IN6, ESP_NOSIG)>,
<ESP32_PINMUX(48, ESP_CAM_DATA_IN7, ESP_NOSIG)>;
input-enable;
bias-disable;
};
};
i2c1_default: i2c1_default {
group1 {
pinmux = <I2C1_SDA_GPIO40>,
<I2C1_SCL_GPIO39>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
};
14 changes: 14 additions & 0 deletions samples/subsys/video/capture/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ int main(void)
}
#endif

fmt.width = 160;
fmt.height = 120;
fmt.pitch = fmt.width * 2;
fmt.pixelformat = VIDEO_PIX_FMT_RGB565;

if(video_set_format(video_dev, VIDEO_EP_OUT, &fmt)){
LOG_ERR("Unable to set format");
return 0;
}

printk("- Set format: %c%c%c%c %ux%u\n", (char)fmt.pixelformat,
(char)(fmt.pixelformat >> 8), (char)(fmt.pixelformat >> 16),
(char)(fmt.pixelformat >> 24), fmt.width, fmt.height);

/* Size to allocate for each buffer */
bsize = fmt.pitch * fmt.height;

Expand Down

0 comments on commit 8a742c3

Please sign in to comment.