summaryrefslogtreecommitdiff
path: root/examples/device/audio_test/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-06-06 22:41:04 +0700
committerhathach <[email protected]>2022-06-06 22:41:04 +0700
commit9794a2b865df81e667b464481bb9b1c70587e64b (patch)
tree1efc9a14f8077844357e69e306bd2796d090caf0 /examples/device/audio_test/src
parentf4c80dd218240d934a28cb21d8ddd6a0e3a33fe5 (diff)
more example update
Diffstat (limited to 'examples/device/audio_test/src')
-rw-r--r--examples/device/audio_test/src/main.c3
-rw-r--r--examples/device/audio_test/src/tusb_config.h24
2 files changed, 23 insertions, 4 deletions
diff --git a/examples/device/audio_test/src/main.c b/examples/device/audio_test/src/main.c
index ed13ce993..51f55b772 100644
--- a/examples/device/audio_test/src/main.c
+++ b/examples/device/audio_test/src/main.c
@@ -82,7 +82,8 @@ int main(void)
{
board_init();
- tusb_init();
+ // init device stack on configured roothub port
+ tud_init(BOARD_TUD_RHPORT);
// Init values
sampFreq = AUDIO_SAMPLE_RATE;
diff --git a/examples/device/audio_test/src/tusb_config.h b/examples/device/audio_test/src/tusb_config.h
index 9b8514265..355ed1011 100644
--- a/examples/device/audio_test/src/tusb_config.h
+++ b/examples/device/audio_test/src/tusb_config.h
@@ -30,6 +30,20 @@
extern "C" {
#endif
+//--------------------------------------------------------------------+
+// Board Specific Configuration
+//--------------------------------------------------------------------+
+
+// RHPort number used for device can be defined by board.mk, default to port 0
+#ifndef BOARD_TUD_RHPORT
+#define BOARD_TUD_RHPORT 0
+#endif
+
+// RHPort max operational speed can defined by board.mk
+#ifndef BOARD_TUD_MAX_SPEED
+#define BOARD_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED
+#endif
+
//--------------------------------------------------------------------
// COMMON CONFIGURATION
//--------------------------------------------------------------------
@@ -39,8 +53,6 @@ extern "C" {
#error CFG_TUSB_MCU must be defined
#endif
-#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
-
#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
#endif
@@ -49,6 +61,12 @@ extern "C" {
#define CFG_TUSB_DEBUG 0
#endif
+// Enable Device stack
+#define CFG_TUD_ENABLED 1
+
+// Default is max speed that hardware controller could support with on-chip PHY
+#define CFG_TUD_MAX_SPEED BOARD_TUD_MAX_SPEED
+
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
@@ -76,11 +94,11 @@ extern "C" {
#endif
//------------- CLASS -------------//
+#define CFG_TUD_AUDIO 1
#define CFG_TUD_CDC 0
#define CFG_TUD_MSC 0
#define CFG_TUD_HID 0
#define CFG_TUD_MIDI 0
-#define CFG_TUD_AUDIO 1
#define CFG_TUD_VENDOR 0
//--------------------------------------------------------------------