esp-arduino-libs / ESP32_USB_Stream

Arduino library of driving USB stream for the ESP32-S2 and ESP32-S3
Apache License 2.0
36 stars 4 forks source link

Arduino Lint pre-commit

ESP32_USB_STREAM

ESP32_USB_STREAM is an Arduino library designed to support USB UVC + UAC host driver for ESP32-S2/ESP32-S3. It supports read/write/control multimedia streaming from usb device. For example, at most one UVC + one Microphone + one Speaker streaming can be supported at the same time.

ESP32_USB_STREAM encapsulates the component from the Espressif Components Registry. It is developed based on arduino-esp32 and can be easily downloaded and integrated into the Arduino IDE.

Features

Supported Drivers

Driver Version
usb_stream 1.4.0

How to Use

For information on how to use the library in the Arduino IDE, please refer to the documentation for Arduino IDE v1.x.x or Arduino IDE v2.x.x.

Dependencies Version

Name Version
arduino-esp32 >= v2.0.14

Examples

Detailed Usage

#include "USB_STREAM.h"

// Instantiate a Ustream object
USB_STREAM *usb = new USB_STREAM();

// allocate memory
uint8_t *_xferBufferA = (uint8_t *)malloc(55 * 1024);
assert(_xferBufferA != NULL);
uint8_t *_xferBufferB = (uint8_t *)malloc(55 * 1024);
assert(_xferBufferB != NULL);
uint8_t *_frameBuffer = (uint8_t *)malloc(55 * 1024);
assert(_frameBuffer != NULL);

// Config the parameter
usb->uvcConfiguration(FRAME_RESOLUTION_ANY, FRAME_RESOLUTION_ANY, FRAME_INTERVAL_FPS_15, 55 * 1024, _xferBufferA, _xferBufferB, 55 * 1024, _frameBuffer);

//Register the camera frame callback function
usb->uvcCamRegisterFrameCb(&cameraFramecb, NULL);

usb->start();

/*Dont forget to free the allocated memory*/
// free(_xferBufferA);
// free(_xferBufferB);
// free(_frameBuffer);

Note: For additional details and information about the usb_stream functionality, please refer to the documentation provided by ESP-IOT Solutions.