From de38e53271038d67812715a2086966ec84d6b540 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 27 Dec 2024 17:14:03 +0700 Subject: [PATCH] update docs, remove uses.rst, structure.rst. Refactor docs, use README.rst for docs index.rst --- README.rst | 22 ++------ docs/conf.py | 18 ++++++- docs/contributing/code_of_conduct.rst | 2 +- docs/contributing/index.rst | 1 - docs/contributing/structure.rst | 59 --------------------- docs/index.rst | 2 +- docs/info/contributors.rst | 2 +- docs/info/index.rst | 1 - docs/info/uses.rst | 17 ------ docs/reference/index.rst | 75 --------------------------- 10 files changed, 25 insertions(+), 174 deletions(-) delete mode 100644 docs/contributing/structure.rst delete mode 100644 docs/info/uses.rst diff --git a/README.rst b/README.rst index d2141958f7..e4ad91e473 100644 --- a/README.rst +++ b/README.rst @@ -5,14 +5,14 @@ Sponsors TinyUSB is funded by: Adafruit. Purchasing products from them helps to support this project. -.. figure:: /docs/assets/adafruit_logo.svg +.. figure:: docs/assets/adafruit_logo.svg :alt: Adafruit Logo :target: https://www.adafruit.com TinyUSB Project =============== -.. figure:: /docs/assets/logo.svg +.. figure:: docs/assets/logo.svg :alt: TinyUSB TinyUSB is an open-source cross-platform USB Host/Device stack for @@ -20,7 +20,7 @@ embedded system, designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events are deferred then handled in the non-ISR task function. Check out the online `documentation `__ for more details. -.. figure:: /docs/assets/stack.svg +.. figure:: docs/assets/stack.svg :width: 500px :alt: stackup @@ -43,12 +43,12 @@ Getting started See the `online documentation `_ for information about using TinyUSB and how it is implemented. +Check out `Getting Started`_ guide for adding TinyUSB to your project or building the examples. If you are new to TinyUSB, we recommend starting with the `cdc_msc` example. There is a handful of `Supported Boards`_ that should work out of the box. + We use `GitHub Discussions `_ as our forum. It is a great place to ask questions and advice from the community or to discuss your TinyUSB-based projects. For bugs and feature requests, please `raise an issue `_ and follow the templates there. -Check out `Getting Started`_ guide for adding TinyUSB to your project or building the examples. If you are new to TinyUSB, we recommend starting with the `cdc_msc` example. - See `Porting`_ guide for adding support for new MCUs and boards. Device Stack @@ -241,15 +241,6 @@ Table Legend \[empty\] Unknown ========= ========================= -License -======= - -All TinyUSB files in the ``src`` folder are licensed under the `MIT -license `__. while other files can be -individually licensed especially those in ``lib`` and ``hw/mcu`` folder. -Please make sure you understand all the license term for files you use -in your project. - .. |Build Status| image:: https://github.com/hathach/tinyusb/actions/workflows/build.yml/badge.svg :target: https://github.com/hathach/tinyusb/actions @@ -263,15 +254,12 @@ in your project. :target: https://opensource.org/licenses/MIT -.. _Uses: docs/info/uses.rst .. _Changelog: docs/info/changelog.rst .. _Contributors: CONTRIBUTORS.rst -.. _Reference: docs/reference/index.rst .. _Getting Started: docs/reference/getting_started.rst .. _Supported Boards: docs/reference/boards.rst .. _Dependencies: docs/reference/dependencies.rst .. _Concurrency: docs/reference/concurrency.rst .. _Contributing: docs/contributing/index.rst .. _Code of Conduct: CODE_OF_CONDUCT.rst -.. _Structure: docs/contributing/structure.rst .. _Porting: docs/contributing/porting.rst diff --git a/docs/conf.py b/docs/conf.py index af44b73391..4249d41f73 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,13 +5,16 @@ # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +import re +from pathlib import Path + # -- Path setup -------------------------------------------------------------- # -- Project information ----------------------------------------------------- project = 'TinyUSB' -copyright = '2021, Ha Thach' +copyright = '2024, Ha Thach' author = 'Ha Thach' @@ -40,3 +43,16 @@ } todo_include_todos = True + +# pre-process path in README.rst +def preprocess_readme(): + """Modify figure paths in README.rst for Sphinx builds.""" + src = Path(__file__).parent.parent / "README.rst" + tgt = Path(__file__).parent.parent / "README_processed.rst" + if src.exists(): + content = src.read_text() + content = re.sub(r"docs/", r"", content) + content = re.sub(r".rst", r".html", content) + tgt.write_text(content) + +preprocess_readme() diff --git a/docs/contributing/code_of_conduct.rst b/docs/contributing/code_of_conduct.rst index b52bf14c56..fb1859c75d 120000 --- a/docs/contributing/code_of_conduct.rst +++ b/docs/contributing/code_of_conduct.rst @@ -1 +1 @@ -../../CODE_OF_CONDUCT.rst \ No newline at end of file +.. include:: ../../CODE_OF_CONDUCT.rst \ No newline at end of file diff --git a/docs/contributing/index.rst b/docs/contributing/index.rst index 7ff79cb32f..78933a3ca5 100644 --- a/docs/contributing/index.rst +++ b/docs/contributing/index.rst @@ -19,5 +19,4 @@ Index :maxdepth: 2 code_of_conduct - structure porting diff --git a/docs/contributing/structure.rst b/docs/contributing/structure.rst deleted file mode 100644 index e8c658850d..0000000000 --- a/docs/contributing/structure.rst +++ /dev/null @@ -1,59 +0,0 @@ -********* -Structure -********* - -Tree -==== - -:: - - . - ├── docs - ├── examples - ├── hw - │   ├── bsp - │   └── mcu - ├── lib - ├── src - ├── test - └── tools - -docs ----- - -Documentation - -examples --------- - -Sample with Makefile build support - -hw/bsp ------- - -Supported boards source files - -hw/mcu ------- - -Low level mcu core & peripheral drivers - -lib ---- - -Sources from 3rd party such as freeRTOS, fatfs ... - -src ---- - -All sources files for TinyUSB stack itself. - -test ----- - -Unit tests for the stack - -tools ------ - -Files used internally diff --git a/docs/index.rst b/docs/index.rst index 0f8011e91b..c1c8e4d99c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,6 @@ :hide-toc: -.. include:: ../README.rst +.. include:: ../README_processed.rst .. toctree:: :caption: Index diff --git a/docs/info/contributors.rst b/docs/info/contributors.rst index b3748ccb56..35e0b05f5c 120000 --- a/docs/info/contributors.rst +++ b/docs/info/contributors.rst @@ -1 +1 @@ -../../CONTRIBUTORS.rst \ No newline at end of file +.. include:: ../../CONTRIBUTORS.rst \ No newline at end of file diff --git a/docs/info/index.rst b/docs/info/index.rst index fa56512b6e..a636f37dc1 100644 --- a/docs/info/index.rst +++ b/docs/info/index.rst @@ -8,6 +8,5 @@ Index .. toctree:: :maxdepth: 2 - uses changelog contributors diff --git a/docs/info/uses.rst b/docs/info/uses.rst deleted file mode 100644 index f67df49f83..0000000000 --- a/docs/info/uses.rst +++ /dev/null @@ -1,17 +0,0 @@ -**** -Uses -**** - -TinyUSB is currently used by these other projects: - -- `Adafruit nRF52 Arduino `__ -- `Adafruit nRF52 Bootloader `__ -- `Adafruit SAMD Arduino `__ -- `CircuitPython `__ -- `Espressif IDF `__ -- `MicroPython `__ -- `mynewt `__ -- `openinput `__ -- `Raspberry Pi Pico SDK `__ -- `TinyUF2 Bootloader `__ -- `TinyUSB Arduino Library `__ diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 3a55503b76..8ac3cf9240 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -1,78 +1,3 @@ -********* -Reference -********* - -.. figure:: ../assets/stack.svg - :width: 1600px - :alt: TinyUSB - -:: - - . - ├── docs # Documentation - ├── examples # Examples with make and cmake build system - ├── hw - │ ├── bsp # Supported boards source files - │ └── mcu # Low level mcu core & peripheral drivers - ├── lib # Sources from 3rd party such as freeRTOS, fatfs ... - ├── src # All sources files for TinyUSB stack itself. - ├── test # Tests: unit test, fuzzing, hardware test - └── tools # Files used internally - - -Device Stack -============ - -Supports multiple device configurations by dynamically changing USB descriptors, low power functions such like suspend, resume, and remote wakeup. The following device classes are supported: - -- Audio Class 2.0 (UAC2) -- Bluetooth Host Controller Interface (BTH HCI) -- Communication Device Class (CDC) -- Device Firmware Update (DFU): DFU mode (WIP) and Runtime -- Human Interface Device (HID): Generic (In & Out), Keyboard, Mouse, Gamepad etc ... -- Mass Storage Class (MSC): with multiple LUNs -- Musical Instrument Digital Interface (MIDI) -- Network with RNDIS, Ethernet Control Model (ECM), Network Control Model (NCM) -- Test and Measurement Class (USBTMC) -- Video class 1.5 (UVC): work in progress -- Vendor-specific class support with generic In & Out endpoints. Can be used with MS OS 2.0 compatible descriptor to load winUSB driver without INF file. -- `WebUSB `__ with vendor-specific class - -If you have a special requirement, `usbd_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Here is how the RPi team added their reset interface `raspberrypi/pico-sdk#197 `_ - -Host Stack -========== - -- Human Interface Device (HID): Keyboard, Mouse, Generic -- Mass Storage Class (MSC) -- Communication Device Class: CDC-ACM -- Vendor serial over USB: FTDI, CP210x -- Hub with multiple-level support - -Similar to the Device Stack, if you have a special requirement, `usbh_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. - -TypeC PD Stack -============== - -- Power Delivery 3.0 (PD3.0) with USB Type-C support (WIP) -- Super early stage, only for testing purpose -- Only support STM32 G4 - -OS Abstraction layer -==================== - -TinyUSB is completely thread-safe by pushing all Interrupt Service Request (ISR) events into a central queue, then processing them later in the non-ISR context task function. It also uses semaphore/mutex to access shared resources such as Communication Device Class (CDC) FIFO. Therefore the stack needs to use some of the OS's basic APIs. Following OSes are already supported out of the box. - -- **No OS** -- **FreeRTOS** -- `RT-Thread `_: `repo `_ -- **Mynewt** Due to the newt package build system, Mynewt examples are better to be on its `own repo `_ - -License -======= - -All TinyUSB sources in the `src` folder are licensed under MIT license. However, each file can be individually licensed especially those in `lib` and `hw/mcu` folder. Please make sure you understand all the license term for files you use in your project. - Index =====