summaryrefslogtreecommitdiff
path: root/examples/device/hid_multiple_interface
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-01-25 13:28:23 +0700
committerhathach <[email protected]>2021-01-25 13:28:23 +0700
commit83614418b588464873ccbd3fcaeef3d03917bd0e (patch)
tree445306f0440a097ff32e625a659d7e45fe155a2f /examples/device/hid_multiple_interface
parentec458292fecbf16be425e5497722f647911de969 (diff)
get all device example build with rp2040 (except freeRTOS)
Diffstat (limited to 'examples/device/hid_multiple_interface')
-rw-r--r--examples/device/hid_multiple_interface/CMakeLists.txt40
-rw-r--r--examples/device/hid_multiple_interface/src/tusb_config.h3
2 files changed, 42 insertions, 1 deletions
diff --git a/examples/device/hid_multiple_interface/CMakeLists.txt b/examples/device/hid_multiple_interface/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/hid_multiple_interface/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/hid_multiple_interface/src/tusb_config.h b/examples/device/hid_multiple_interface/src/tusb_config.h
index 412f9b004..a0aa17a90 100644
--- a/examples/device/hid_multiple_interface/src/tusb_config.h
+++ b/examples/device/hid_multiple_interface/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0