USB WebUSB

/arduino/web

Header File

Enumerations

enum [anonymous]

Values:

enumerator VENDOR_REQUEST_WEBUSB
enumerator VENDOR_REQUEST_MICROSOFT

Classes

class esptinyusb::USBWebSerial : public esptinyusb::BaseDevice

WebUSB class.

Public Functions

virtual bool begin(uint8_t _eps = 1)

begin should add device descriptor and initialize interfaces

Parameters

_eps

Returns

true

Returns

false

virtual int available(void)

Checks if any bytes are available to read from fifo.

Returns

int number of bytes in fifo

virtual int peek(void)

Read one byte from fifo without removing it.

Returns

int return read byte or -1 if failed

virtual int read(void)

Read 1 byte from fifo.

Returns

int

virtual size_t read(uint8_t *buffer, size_t size)

Read number of bytes from fifo.

Parameters
  • buffer[in] buffer to read bytes into

  • size[in] size of buffer

Returns

size_t number of read bytes

virtual void flush(void)

Flush all remaining bytes from read fifo.

virtual size_t write(uint8_t)

Write one byte to fifo.

Returns

size_t

virtual size_t write(const uint8_t *buffer, size_t size)

Write number of bytes to fifo.

Parameters
  • buffer

  • size

Returns

size_t

inline virtual void onData(read_cb_t cb)

Add callback which will be called when data is received from host.

Parameters

cb

inline virtual void onConnect(connect_cb_t cb)

Adds callback which will be called when connection or disconnection with host is detected.

Parameters

cb

virtual void landingPageURI(const char *url, bool ssl = true)

Set landing page for webUSB protocol.

Parameters
  • url – landing page url

  • ssl – use landing page with http or https protocol