Skip to content

Commit

Permalink
add makefile, add cdc_uac2 to cmake example list, update descriptor t…
Browse files Browse the repository at this point in the history
…o build with nrf and samg/7x
  • Loading branch information
hathach committed Aug 3, 2023
1 parent 6844055 commit d89fc07
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 60 deletions.
1 change: 1 addition & 0 deletions examples/device/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ family_add_subdirectory(board_test)
family_add_subdirectory(cdc_dual_ports)
family_add_subdirectory(cdc_msc)
family_add_subdirectory(cdc_msc_freertos)
family_add_subdirectory(cdc_uac2)
family_add_subdirectory(dfu)
family_add_subdirectory(dfu_runtime)
family_add_subdirectory(dynamic_configuration)
Expand Down
16 changes: 8 additions & 8 deletions examples/device/cdc_uac2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ add_executable(${PROJECT})

# Example source
target_sources(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tusb_cdc.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tusb_uac2.c
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
)
${CMAKE_CURRENT_SOURCE_DIR}/src/cdc_app.c
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
${CMAKE_CURRENT_SOURCE_DIR}/src/uac2_app.c
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
)

# Example include
target_include_directories(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)
${CMAKE_CURRENT_SOURCE_DIR}/src
)

# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT})
family_configure_device_example(${PROJECT} noos)

# Uncomment me to enable UART based debugging
# pico_enable_stdio_uart(${PROJECT} 1)
16 changes: 16 additions & 0 deletions examples/device/cdc_uac2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include ../../make.mk

INC += \
src \
$(TOP)/hw \

# Example source
EXAMPLE_SOURCE += \
src/cdc_app.c \
src/main.c \
src/uac2_app.c \
src/usb_descriptors.c \

SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))

include ../../rules.mk
52 changes: 0 additions & 52 deletions examples/device/cdc_uac2/skip.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions examples/device/cdc_uac2/src/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,30 @@ uint8_t const * tud_descriptor_device_cb(void)
#define EPNUM_AUDIO_IN 0x08
#define EPNUM_AUDIO_OUT 0x08

#define EPNUM_CDC_NOTIF 0x81
#define EPNUM_CDC_OUT 0x02
#define EPNUM_CDC_IN 0x82

#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_AUDIO_IN 0x01
#define EPNUM_AUDIO_OUT 0x02

#define EPNUM_CDC_NOTIF 0x83
#define EPNUM_CDC_OUT 0x04
#define EPNUM_CDC_IN 0x85

#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_AUDIO_IN 0x01
#define EPNUM_AUDIO_OUT 0x02

#define EPNUM_CDC_NOTIF 0x83
#define EPNUM_CDC_OUT 0x04
#define EPNUM_CDC_IN 0x85

#else
#define EPNUM_AUDIO_IN 0x01
#define EPNUM_AUDIO_OUT 0x01
Expand Down

0 comments on commit d89fc07

Please sign in to comment.