1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/tinyusb: provide common tusb_config.h

This commit is contained in:
Benjamin Valentin 2022-10-26 21:20:12 +02:00 committed by Benjamin Valentin
parent 0bd67d98d9
commit 5938bd815a
4 changed files with 22 additions and 55 deletions

View File

@ -31,10 +31,13 @@
* @author Gunar Schorcht <gunar@schorcht.net>
*/
#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
@ -425,5 +428,5 @@ extern "C" {
#endif
#endif /* !DOXYGEN */
#endif /* TINYUSB_CONFIG_H */
#endif /* TUSB_CONFIG_H */
/** @} */

View File

@ -51,20 +51,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 CONFIG_TUSBD_CDC_NUMOF 2
*
* #include "tinyusb_config.h"
* ```
*
* 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.
*
* 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

View File

@ -9,5 +9,3 @@ USEMODULE += tinyusb_class_msc
USEMODULE += tinyusb_device
include $(RIOTBASE)/Makefile.include
INCLUDES += -I$(APPDIR)

View File

@ -1,41 +0,0 @@
/*
* Copyright (C) 2022 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
#ifndef TUSB_CONFIG_H
#define TUSB_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* By default, the number of `CFG_TUD_*` device class and `CFG_TUH_*`
* host class interfaces is 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.
*
* To define a different number of device class or host class interfaces,
* just define them here to override these default values, for example:
* ```c
* #define CFG_TUD_CDC 2
* #define CFG_TUD_HID 3
* ```
*/
/* Default configuration defined by RIOT package tinyUSB has to be included last */
#include "tinyusb_config.h"
#ifdef __cplusplus
}
#endif
#endif /* TUSB_CONFIG_H */