summaryrefslogtreecommitdiff
path: root/examples/device/cdc_dual_ports
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-06-29 10:16:25 +0700
committerhathach <[email protected]>2026-06-29 10:16:25 +0700
commit4b1c8d16f72bb5d8f2eb8a2e8dde35abdd2f2a88 (patch)
tree3db175aa3d96c92a44fab764dba59f473096c4b4 /examples/device/cdc_dual_ports
parent0a25cc27d7d3699536f6df01e80af3eb0423ce58 (diff)
docs: add build-doc tooling and a README for every example
Documentation tooling: - Add the `build-doc` skill and `tools/build_doc.py` wrapper for local Sphinx builds (clean / -W / open). - Enable Markdown (MyST) in conf.py and auto-collect examples/{device,host,dual}/*/README.md into a 3-level Examples nav (Examples > Device/Host/Dual > example), noting each page's source location and normalizing headings to a single H1. - Remove the stale `.claude/commands/build-doc.md`; point the AGENTS.md Documentation section at the skill. Example docs: - Add a README.md for every device/host/dual example: what it does, USB interface table, notable tusb_config.h settings, generic CMake + Make build steps, and how to try it. - Fold each *_freertos variant into its base README, noting the FreeRTOS source path and any RTOS-specific behavior. Generated docs/examples/ output is git-ignored. Builds clean with `sphinx-build -W`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'examples/device/cdc_dual_ports')
-rw-r--r--examples/device/cdc_dual_ports/README.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/device/cdc_dual_ports/README.md b/examples/device/cdc_dual_ports/README.md
new file mode 100644
index 000000000..b0d1e5d97
--- /dev/null
+++ b/examples/device/cdc_dual_ports/README.md
@@ -0,0 +1,48 @@
+# CDC Dual Ports
+
+Enumerates as a USB device with two independent CDC virtual serial ports.
+
+## What it does
+
+- Exposes two CDC virtual COM ports.
+- Echoes back any data received on either port to **both** ports: the first port echoes as lower case, the second as upper case.
+- Sends a UART state notification (toggles the DSR line) on each press of the on-board button.
+- Resets the board into the bootloader when the first port is opened at 1200 bps and then disconnected (touch-1200 trigger).
+- Blinks the on-board LED: 250 ms when unmounted, 1000 ms when mounted.
+
+## USB Descriptors
+
+| Interface | Class driver |
+|-----------|--------------|
+| 0–1 | CDC (virtual serial port 1) |
+| 2–3 | CDC (virtual serial port 2) |
+
+## Configuration
+
+Notable `tusb_config.h` settings:
+
+```c
+#define CFG_TUD_CDC 2 // two CDC ports
+#define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+```
+
+## Building
+
+CMake:
+
+```bash
+mkdir build && cd build
+cmake -DBOARD=raspberry_pi_pico ..
+cmake --build .
+```
+
+Make:
+
+```bash
+make BOARD=raspberry_pi_pico all
+```
+
+## Try it
+
+After flashing, two serial ports appear on the host (e.g. `/dev/ttyACM0` and `/dev/ttyACM1` on Linux). Open either one in a terminal and type: characters come back lower-cased on the first port and upper-cased on the second.