Skip to content

Commit a360c73

Browse files
committed
Merge branch 'docs/update_app_examples_to_usb_host_device' into 'master'
docs: Add or update application examples for usb_host and usb_device See merge request espressif/esp-idf!33275
2 parents 40892b6 + 27a88b8 commit a360c73

File tree

4 files changed

+36
-52
lines changed

4 files changed

+36
-52
lines changed

docs/en/api-reference/peripherals/usb_device.rst

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -270,23 +270,15 @@ If the MSC ``CONFIG_TINYUSB_MSC_ENABLED`` option is enabled in Menuconfig, the E
270270
Application Examples
271271
--------------------
272272

273-
The table below describes the code examples available in the directory :example:`peripherals/usb/device`:
274-
275-
.. list-table::
276-
:widths: 35 65
277-
:header-rows: 1
278-
279-
* - Code Example
280-
- Description
281-
* - :example:`peripherals/usb/device/tusb_console`
282-
- How to set up {IDF_TARGET_NAME} chip to get log output via Serial Device connection
283-
* - :example:`peripherals/usb/device/tusb_serial_device`
284-
- How to set up {IDF_TARGET_NAME} chip to work as a USB Serial Device
285-
* - :example:`peripherals/usb/device/tusb_midi`
286-
- How to set up {IDF_TARGET_NAME} chip to work as a USB MIDI Device
287-
* - :example:`peripherals/usb/device/tusb_hid`
288-
- How to set up {IDF_TARGET_NAME} chip to work as a USB Human Interface Device
289-
* - :example:`peripherals/usb/device/tusb_msc`
290-
- How to set up {IDF_TARGET_NAME} chip to work as a USB Mass Storage Device
291-
* - :example:`peripherals/usb/device/tusb_composite_msc_serialdevice`
292-
- How to set up {IDF_TARGET_NAME} chip to work as a Composite USB Device (MSC + CDC)
273+
The examples can be found in the directory :example:`peripherals/usb/device`.
274+
275+
- :example:`peripherals/usb/device/tusb_console` demonstrates how to set up {IDF_TARGET_NAME} to get log output via a Serial Device connection using the TinyUSB component, applicable for any Espressif boards that support USB-OTG.
276+
- :example:`peripherals/usb/device/tusb_serial_device` demonstrates how to set up {IDF_TARGET_NAME} to function as a USB Serial Device using the TinyUSB component, with the ability to be configured as a double serial device.
277+
- :example:`peripherals/usb/device/tusb_midi` demonstrates how to set up {IDF_TARGET_NAME} to function as a USB MIDI Device, outputting a MIDI note sequence via the native USB port using the TinyUSB component.
278+
- :example:`peripherals/usb/device/tusb_hid` demonstrates how to implement a USB keyboard and mouse using the TinyUSB component, which sends 'key a/A pressed & released' events and moves the mouse in a square trajectory upon connection to a USB host.
279+
- :example:`peripherals/usb/device/tusb_msc` demonstrates how to use the USB capabilities to create a Mass Storage Device that can be recognized by USB-hosts, allowing access to its internal data storage, with support for SPI Flash and SD MMC Card storage media.
280+
- :example:`peripherals/usb/device/tusb_composite_msc_serialdevice` demonstrates how to set up {IDF_TARGET_NAME} to function simultaneously as both a USB Serial Device and an MSC device (SPI-Flash as the storage media) using the TinyUSB component.
281+
282+
.. only:: not esp32p4
283+
284+
- :example:`peripherals/usb/device/tusb_ncm` demonstrates how to transmit Wi-Fi data to a Linux or Windows host via USB using the Network Control Model (NCM), a sub-class of Communication Device Class (CDC) USB Device for Ethernet-over-USB applications, with the help of a TinyUSB component.

docs/en/api-reference/peripherals/usb_host.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ Examples
365365
Host Library Examples
366366
^^^^^^^^^^^^^^^^^^^^^
367367

368-
The :example:`peripherals/usb/host/usb_host_lib` demonstrates basic usage of the USB Host Library's API to implement a pseudo-class driver.
368+
- :example:`peripherals/usb/host/usb_host_lib` demonstrates how to use the USB Host Library API to install and register a client, wait for a device connection, print the device's information, handle disconnection, and repeat these steps until a user quits the application.
369369

370370
Class Driver Examples
371371
^^^^^^^^^^^^^^^^^^^^^
@@ -376,27 +376,27 @@ CDC-ACM
376376
"""""""
377377

378378
* A host class driver for the Communication Device Class (Abstract Control Model) is distributed as a managed component via the `ESP Component Registry <https://components.espressif.com/component/espressif/usb_host_cdc_acm>`__.
379-
* The :example:`peripherals/usb/host/cdc/cdc_acm_host` example uses the CDC-ACM host driver component to communicate with CDC-ACM devices.
380-
* The :example:`peripherals/usb/host/cdc/cdc_acm_vcp` example shows how can you extend the CDC-ACM host driver to interface Virtual COM Port devices.
379+
* :example:`peripherals/usb/host/cdc/cdc_acm_host` demonstrates how to use the CDC-ACM Host Driver to enable communication between {IDF_TARGET_NAME} and a USB CDC-ACM device.
380+
* :example:`peripherals/usb/host/cdc/cdc_acm_vcp` demonstrates how to extend the CDC-ACM driver for Virtual Communication Port (VCP) devices like CP210x, FTDI FT23x or CH34x devices, and how to control the device and send data using the CDC-ACM API.
381381
* The CDC-ACM driver is also used in `esp_modem examples <https://github.com/espressif/esp-protocols/tree/master/components/esp_modem/examples>`__, where it is used for communication with cellular modems.
382382

383383
MSC
384384
"""
385385

386386
* A host class driver for the Mass Storage Class (Bulk-Only Transport) is deployed to `ESP Component Registry <https://components.espressif.com/component/espressif/usb_host_msc>`__.
387-
* The :example:`peripherals/usb/host/msc` example demonstrates the usage of the MSC host driver to read and write to a USB flash drive.
387+
* :example:`peripherals/usb/host/msc` demonstrates how to use USB Mass Storage Class to access, read, write, and perform operations on a USB flash drive, including handling USB reconnections and deinitializing the USB Host Stack.
388388

389389
HID
390390
"""
391391

392392
* A host class driver for the HID (Human interface device) is distributed as a managed component via the `ESP Component Registry <https://components.espressif.com/components/espressif/usb_host_hid>`__.
393-
* The :example:`peripherals/usb/host/hid` example demonstrates the possibility to receive reports from a USB HID device with several interfaces.
393+
* :example:`peripherals/usb/host/hid` demonstrates how to implement a basic USB Host HID Class Driver on {IDF_TARGET_NAME}, enabling communication with USB HID devices like keyboards and mice, and continuously scans for their connection, fetching HID reports once connected.
394394

395395
UVC
396396
"""
397397

398398
* A host class driver for the USB Video Device Class is distributed as a managed component via the `ESP Component Registry <https://components.espressif.com/component/espressif/usb_host_uvc>`__.
399-
* The :example:`peripherals/usb/host/uvc` example demonstrates the usage of the UVC host driver to receive a video stream from a USB camera and optionally forward that stream over Wi-Fi.
399+
* :example:`peripherals/usb/host/uvc` demonstrates how to capture video from a USB camera using the `libuvc` library and stream the video over Wi-Fi by hosting a TCP server, with the option to visualize the captured video on a PC using the provided `player.py` script.
400400

401401
.. ---------------------------------------------- USB Host Menuconfig --------------------------------------------------
402402

docs/zh_CN/api-reference/peripherals/usb_device.rst

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -270,23 +270,15 @@ USB 大容量存储设备 (MSC)
270270
应用示例
271271
--------------------
272272

273-
下表列出了 :example:`peripherals/usb/device` 目录下的代码示例:
274-
275-
.. list-table::
276-
:widths: 35 65
277-
:header-rows: 1
278-
279-
* - 代码示例
280-
- 描述
281-
* - :example:`peripherals/usb/device/tusb_console`
282-
- 设置 {IDF_TARGET_NAME} 芯片,通过串行设备连接获取日志输出
283-
* - :example:`peripherals/usb/device/tusb_serial_device`
284-
- 设置 {IDF_TARGET_NAME} 芯片,将其作为 USB 串行设备使用
285-
* - :example:`peripherals/usb/device/tusb_midi`
286-
- 设置 {IDF_TARGET_NAME} 芯片,将其作为 USB MIDI 设备使用
287-
* - :example:`peripherals/usb/device/tusb_hid`
288-
- 设置 {IDF_TARGET_NAME} 芯片,将其作为 USB 人机界面设备使用
289-
* - :example:`peripherals/usb/device/tusb_msc`
290-
- 设置 {IDF_TARGET_NAME} 芯片,将其作为 USB 大容量存储设备使用
291-
* - :example:`peripherals/usb/device/tusb_composite_msc_serialdevice`
292-
- 设置 {IDF_TARGET_NAME} 芯片,将其作为复合 USB 设备使用 (MSC + CDC)
273+
如需查看相关示例,请前往目录 :example:`peripherals/usb/device`。
274+
275+
- :example:`peripherals/usb/device/tusb_console` 演示了如何使用 TinyUSB 组件配置 {IDF_TARGET_NAME},以通过串行设备连接获取和输出日志,适用于任何支持 USB-OTG 的乐鑫开发板。
276+
- :example:`peripherals/usb/device/tusb_serial_device` 演示了如何使用 TinyUSB 组件将 {IDF_TARGET_NAME} 配置为 USB 串行设备,还支持配置为双串行设备。
277+
- :example:`peripherals/usb/device/tusb_midi` 演示了如何使用 TinyUSB 组件将 {IDF_TARGET_NAME} 配置为 USB MIDI 设备,从而通过本地 USB 端口输出 MIDI 音符序列。
278+
- :example:`peripherals/usb/device/tusb_hid` 演示了如何使用 TinyUSB 组件实现 USB 键盘和鼠标,在连接到 USB 主机时发送 “按下和释放 key a/A” 事件,并使鼠标沿方形轨迹移动。
279+
- :example:`peripherals/usb/device/tusb_msc` 演示了如何使用 USB 功能创建一个可以被 USB 主机识别的大容量存储设备,允许访问其内部数据存储,支持 SPI Flash 和 SD MMC 卡存储介质。
280+
- :example:`peripherals/usb/device/tusb_composite_msc_serialdevice` 演示了如何使用 TinyUSB 组件将 {IDF_TARGET_NAME} 同时配置为 USB 串行设备和 MSC 设备(存储介质为 SPI-Flash)运行。
281+
282+
.. only:: not esp32p4
283+
284+
- :example:`peripherals/usb/device/tusb_ncm` 演示了使用 TinyUSB 组件,借助网络控制模型 (NCM) 将 Wi-Fi 数据通过 USB 传输到 Linux 或 Windows 主机。NCM 是通信设备类 (CDC) USB 设备的一个子类,专用于 Ethernet-over-USB 应用。

docs/zh_CN/api-reference/peripherals/usb_host.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ USB 主机库(以下简称主机库)是 USB 主机栈的最底层,提供
365365
主机库示例
366366
^^^^^^^^^^^^^^^^^^^^^
367367

368-
:example:`peripherals/usb/host/usb_host_lib` 展示了 USB 主机库 API 的基本用法,用于创建伪 Class 驱动程序
368+
:example:`peripherals/usb/host/usb_host_lib` 演示了如何使用 USB 主机库 API 来安装和注册客户端、等待设备连接、打印设备信息和处理断开连接,并重复这些步骤,直到退出应用程序
369369

370370
Class 驱动程序示例
371371
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -376,27 +376,27 @@ CDC-ACM
376376
"""""""
377377

378378
* 通信设备 Class(抽象控制模型)的主机 Class 驱动程序通过 `乐鑫组件注册表 <https://components.espressif.com/component/espressif/usb_host_cdc_acm>`__ 作为受管理的组件分发。
379-
* 示例 :example:`peripherals/usb/host/cdc/cdc_acm_host` 使用 CDC-ACM 主机驱动程序组件,CDC-ACM 设备通信
380-
* 示例 :example:`peripherals/usb/host/cdc/cdc_acm_vcp` 展示了如何扩展 CDC-ACM 主机驱动程序,与虚拟串口设备交互
379+
* 示例 :example:`peripherals/usb/host/cdc/cdc_acm_host` 演示了使用 CDC-ACM 主机驱动程序组件,实现 {IDF_TARGET_NAME} 与 USB CDC-ACM 设备的通信
380+
* 示例 :example:`peripherals/usb/host/cdc/cdc_acm_vcp` 演示了如何扩展 CDC-ACM 的主机驱动程序,以支持 VCP 设备(即虚拟通信端口设备,如 CP210x、FTDI FT23x 或 CH34x),以及如何使用 CDC-ACM API 控制设备并发送数据
381381
* 示例 `esp_modem <https://github.com/espressif/esp-protocols/tree/master/components/esp_modem/examples>`__ 中也使用了 CDC-ACM 驱动程序,该程序在这些示例中与蜂窝模块通信。
382382

383383
MSC
384384
"""
385385

386386
* 大容量存储 Class(仅支持批量传输)的主机 Class 驱动程序已部署到 `乐鑫组件注册表 <https://components.espressif.com/component/espressif/usb_host_msc>`__。
387-
* 示例 :example:`peripherals/usb/host/msc` 展示了如何使用 MSC 主机驱动程序读写 USB flash 驱动
387+
* 示例 :example:`peripherals/usb/host/msc` 演示了如何使用 USB 大容量存储类来访问、读取、写入和操作 USB 闪存驱动器,包括处理 USB 重新连接和反初始化 USB 主机堆栈
388388

389389
HID
390390
"""
391391

392392
* HID(人机接口设备)的主机 class 驱动作为托管组件通过 `乐鑫组件注册表 <https://components.espressif.com/components/espressif/usb_host_hid>`__ 分发。
393-
* 示例 :example:`peripherals/usb/host/hid` 展示了从具有多个接口的 USB HID 设备接收报告的可能性
393+
* 示例 :example:`peripherals/usb/host/hid` 演示了如何在 {IDF_TARGET_NAME} 上实现基本的 USB 主机 HID 类驱动,以便与 USB HID 设备(如键盘和鼠标)进行通信,并持续扫描设备的连接状态。一旦连接成功,即获取 HID 报告
394394

395395
UVC
396396
"""
397397

398398
* USB 视频设备 Class 的主机 Class 驱动程序作为托管组件通过 `乐鑫组件注册表 <https://components.espressif.com/component/espressif/usb_host_uvc>`__ 分发。
399-
* 示例 :example:`peripherals/usb/host/uvc` 展示了如何使用 UVC 主机驱动程序接收来自 USB 摄像头的视频流,并可选择将该流通过 Wi-Fi 转发
399+
* 示例 :example:`peripherals/usb/host/uvc` 演示了如何使用 `libuvc` 库从 USB 摄像头捕获视频,并通过托管 TCP 服务器将视频流通过 Wi-Fi 传输,同时提供了使用 ``player.py`` 脚本在 PC 上查看捕获视频的选项
400400

401401
.. ---------------------------------------------- USB Host Menuconfig --------------------------------------------------
402402

0 commit comments

Comments
 (0)