mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
ad65ed6830
With PR #18804 the approach to override the default tinyUSB configuration was changed. The update of the documentation was forgotten.
95 lines
3.2 KiB
Plaintext
95 lines
3.2 KiB
Plaintext
/**
|
|
* @defgroup pkg_tinyusb TinyUSB package
|
|
* @ingroup pkg
|
|
* @brief Provides the tinyUSB stack as package
|
|
* @author Gunar Schorcht <gunar@schorcht.net>
|
|
* @see https://github.com/hathach/tinyusb
|
|
*
|
|
* # TinyUSB
|
|
*
|
|
* tinyUSB is an open-source cross-platform USB Host/Device stack for
|
|
* embedded systems.
|
|
*
|
|
* @note This package is distinct from (and incompatible with) the USB stack
|
|
* provided around USBUS in RIOT (see @ref usb). They differ in the level of
|
|
* abstraction and in the set of supported devices.
|
|
*
|
|
* # Usage
|
|
*
|
|
* Add the following entries to your application makefile:
|
|
* - Enable tinyUSB package
|
|
* ```makefile
|
|
* USEPKG += tinyusb
|
|
* ```
|
|
* - Select whether to use the tinyUSB device stack or the tinyUSB host stack or both:
|
|
* ```makefile
|
|
* USEMODULE += tinyusb_device
|
|
* ```
|
|
* - Select the device/host classes to be used, for example:
|
|
* ```makefile
|
|
* USEMODULE += tinyusb_class_cdc tinyusb_class_msc
|
|
* ```
|
|
*
|
|
* Either add `tinyusb_setup()` to your main function to explicitly initialize
|
|
* the tinyUSB stack including the used peripherals and start the tinyUSB
|
|
* thread, or use the `auto_init` module (**default**).
|
|
*
|
|
* ```c
|
|
* int main(void)
|
|
* {
|
|
* ...
|
|
* // If auto-initialization is not used (module `auto_init`),
|
|
* // initialize the tinyUSB stack including used peripherals and
|
|
* // start the tinyUSB thread. Auto-initialization is used by default.
|
|
* tinyusb_setup();
|
|
*
|
|
* while (1) {
|
|
* ...
|
|
* }
|
|
*
|
|
* return 0;
|
|
* }
|
|
* ```
|
|
*
|
|
* If it is necessary to override the default configuration defined in
|
|
* `tusb_config.h`, create a file `tinyusb_app_config.h` in your application
|
|
* directory and override the configuration to be changed.
|
|
* ```c
|
|
* #define CONFIG_TUSBD_CDC_NUMOF 2
|
|
* ```
|
|
*
|
|
* By default, the number of `CONFIG_TUSBD_*_NUMOF` device class and
|
|
* `CONFIG_TUSBH_*_NUMOF` host class interfaces are defined to 1 if the
|
|
* corresponding `tinyusb_class_*` and `tinyusb_device`/`tinyusb_host`
|
|
* module are enabled, and 0 otherwise.
|
|
* That is, there is one interface of each class.
|
|
*
|
|
* For example, if the `tinyusb_device` and `tinyusb_class_cdc` modules are
|
|
* enabled, `CONFIG_TUSBD_CDC_NUMOF` is defined to 1 by default. The number of
|
|
* all other `CONFIG_TUSBD_*_NUMOF` device class interfaces are 0.
|
|
*
|
|
* If you add the `tinyusb_app_config.h` file in your application directory
|
|
* to override the default configuration, add the application path to the
|
|
* include paths at the end of your
|
|
* application's Makefile. This is necessary so that the tinyUSB stack
|
|
* uses the file `tinyusb_app_config.h` from your application directory
|
|
* and thus the file `tusb_config.h` from the tinyUSB package.
|
|
* ```makefile
|
|
* USEPKG += tinyusb
|
|
* USEMODULE += tinyusb_class_cdc
|
|
* USEMODULE += tinyusb_class_msc
|
|
* USEMODULE += tinyusb_device
|
|
*
|
|
* include $(RIOTBASE)/Makefile.include
|
|
*
|
|
* INCLUDES += -I$(APPDIR)
|
|
* ```
|
|
*
|
|
* Implement required device descriptors and descriptor callbacks as well as
|
|
* the callbacks of the enabled classes.
|
|
*
|
|
* Please refer `$RIOTBASE/tests/pkg_tinyusb_cdc_msc` and the
|
|
* [tinyUSB documentation](https://docs.tinyusb.org/en/latest/reference/getting_started.html)
|
|
* for details.
|
|
*/
|