Skip to content

Commit

Permalink
pkg/tinyusb: provide common tusb_config.h
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Nov 2, 2022
1 parent 6ee212d commit 8e3f40e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
* @author Gunar Schorcht <[email protected]>
*/

#ifndef TINYUSB_CONFIG_H
#define TINYUSB_CONFIG_H
#ifndef TUSB_CONFIG_H
#define TUSB_CONFIG_H

#include "tusb_config.h" /* defined by the application */
/* defined by the application */
#if __has_include("tinyusb_app_config.h")
#include "tinyusb_app_config.h"
#endif
#include "tinyusb.h"

#if !DOXYGEN
Expand Down Expand Up @@ -298,5 +301,5 @@ extern "C" {
#endif

#endif /* !DOXYGEN */
#endif /* TINYUSB_CONFIG_H */
#endif /* TUSB_CONFIG_H */
/** @} */
22 changes: 14 additions & 8 deletions pkg/tinyusb/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,27 @@
* }
* ```
*
* Create a file `tusb_config.h` in your application directory which includes
* at least the file `tinyusb_config.h` from the tinyUSB package. This file is
* required by the tinyUSB stack and can be used to override the default
* configuration defined in `tinyusb_config.h`.
* Create a file `tinyusb_app_config.h` in your application directory.
* This file is can be used to override the default configuration defined
* in `tusb_config.h`.
* ```c
* #define CFG_TUD_CDC 2
* #define CFG_TUD_CDC_EP_BUFSIZE 128
*
* #include "tinyusb_config.h"
* ```
*
* By default, the number of `CFG_TUD_*` device class and `CFG_TUH_*`
* 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, `CFG_TUD_CDC` is defined to 1 by default. The number of all other
* `CFG_TUD_*` device class interfaces are 0.
*
* 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 `tusb_config.h` from your application directory and thus the
* file `tinyusb_config.h` from the tinyUSB package.
* 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
Expand Down
2 changes: 0 additions & 2 deletions tests/pkg_tinyusb_cdc_msc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ USEMODULE += tinyusb_class_msc
USEMODULE += tinyusb_device

include $(RIOTBASE)/Makefile.include

INCLUDES += -I$(APPDIR)
41 changes: 0 additions & 41 deletions tests/pkg_tinyusb_cdc_msc/tusb_config.h

This file was deleted.

0 comments on commit 8e3f40e

Please sign in to comment.