Skip to content

Commit

Permalink
update docs, remove uses.rst, structure.rst. Refactor docs, use READM…
Browse files Browse the repository at this point in the history
…E.rst for docs index.rst
  • Loading branch information
hathach committed Dec 27, 2024
1 parent 29f226c commit 172f1d8
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 174 deletions.
22 changes: 5 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ 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
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 <https://docs.tinyusb.org/>`__ for more details.

.. figure:: /docs/assets/stack.svg
.. figure:: docs/assets/stack.svg
:width: 500px
:alt: stackup

Expand All @@ -43,12 +43,12 @@ Getting started

See the `online documentation <https://docs.tinyusb.org>`_ 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 <https://github.com/hathach/tinyusb/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 <https://github.com/hathach/tinyusb/issues>`_ 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
Expand Down Expand Up @@ -241,15 +241,6 @@ Table Legend
\[empty\] Unknown
========= =========================

License
=======

All TinyUSB files in the ``src`` folder are licensed under the `MIT
license <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
Expand All @@ -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
18 changes: 17 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'


Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion docs/contributing/code_of_conduct.rst
1 change: 0 additions & 1 deletion docs/contributing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Index
:maxdepth: 2

code_of_conduct
structure
porting
59 changes: 0 additions & 59 deletions docs/contributing/structure.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:hide-toc:

.. include:: ../README.rst
.. include:: ../README_processed.rst

.. toctree::
:caption: Index
Expand Down
2 changes: 1 addition & 1 deletion docs/info/contributors.rst
1 change: 0 additions & 1 deletion docs/info/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ Index
.. toctree::
:maxdepth: 2

uses
changelog
contributors
17 changes: 0 additions & 17 deletions docs/info/uses.rst

This file was deleted.

75 changes: 0 additions & 75 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/WICG/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 <https://github.com/raspberrypi/pico-sdk/pull/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 <https://github.com/RT-Thread/rt-thread>`_: `repo <https://github.com/RT-Thread-packages/tinyusb>`_
- **Mynewt** Due to the newt package build system, Mynewt examples are better to be on its `own repo <https://github.com/hathach/mynewt-tinyusb-example>`_

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
=====

Expand Down

0 comments on commit 172f1d8

Please sign in to comment.