TinyUVC 0.1.0
Header-only USB Video Class (UVC) device: turn an MCU into a USB webcam
Loading...
Searching...
No Matches
Namespaces | Functions
UVCPlatformESP32.h File Reference

ESP32-S2/S3/P4 with the TinyUSB stack of the arduino-esp32 core (Tools > USB Mode > "USB-OTG (TinyUSB)"). More...

#include <Arduino.h>
#include <USB.h>
#include <esp_heap_caps.h>
#include "../UVCDevice.h"
#include "esp32-hal-tinyusb.h"
Include dependency graph for UVCPlatformESP32.h:

Go to the source code of this file.

Namespaces

namespace  tinyuvc
 TinyUVC: USB Video Class (UVC) device for Arduino and the desktop.
 
namespace  tinyuvc::platform
 Functions every platform layer (platform/UVCPlatform*.h) implements.
 

Functions

uint16_t tinyuvc::platform::maxPacketSize ()
 Max packet size of the bulk endpoint (64 full speed, 512 high speed)
 
uint16_t tinyuvc::platform::esp32LoadDescriptor (uint8_t *dst, uint8_t *itf)
 Descriptor callback of the core (called from USB.begin())
 
bool tinyuvc::platform::begin (UVCDevice &dev)
 Registers the UVC function with the USB stack (and starts it if needed)
 
void tinyuvc::platform::end (UVCDevice &dev)
 Unregisters the UVC function, where the USB stack supports that.
 
void tinyuvc::platform::idle ()
 Called while waiting: lets the USB stack make progress.
 
uint32_t tinyuvc::platform::millis ()
 
uint32_t tinyuvc::platform::micros ()
 
uint8_t * tinyuvc::platform::allocBuffer (size_t size)
 Allocates the transfer buffer (DMA capable, aligned)
 
void tinyuvc::platform::freeBuffer (uint8_t *buf)
 

Detailed Description

ESP32-S2/S3/P4 with the TinyUSB stack of the arduino-esp32 core (Tools > USB Mode > "USB-OTG (TinyUSB)").

The core builds the configuration descriptor from the interfaces enabled before USB.begin(). UVCDevice::begin() enables the camera and calls USB.begin(); it therefore fails if USB was already started - which the core does before setup() when "USB CDC On Boot" is enabled. Use "USB CDC On Boot: Disabled" (Serial is then UART0), and if you want a USB serial port in addition, declare a USBCDC object (see the examples).