summaryrefslogtreecommitdiff
path: root/examples/host/cdc_msc_hid
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2022-11-21 17:22:52 +0700
committerGitHub <[email protected]>2022-11-21 17:22:52 +0700
commit4a2e424103b0a2626a6cb464a350c68ae109cc7e (patch)
tree4a46f70fc34bc477b5c742b6f5a103322b7753f1 /examples/host/cdc_msc_hid
parent95fb11fcffd27a055561d2171aa99199982bb563 (diff)
parenta394273ed28bdbd9ed5cf4ba94a99204bdd841e9 (diff)
Merge pull request #1746 from hathach/host-msc-example
Add host msc explorer example
Diffstat (limited to 'examples/host/cdc_msc_hid')
-rw-r--r--examples/host/cdc_msc_hid/CMakeLists.txt14
-rw-r--r--examples/host/cdc_msc_hid/Makefile9
-rw-r--r--examples/host/cdc_msc_hid/src/main.c8
-rw-r--r--examples/host/cdc_msc_hid/src/msc_app.c3
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h6
5 files changed, 24 insertions, 16 deletions
diff --git a/examples/host/cdc_msc_hid/CMakeLists.txt b/examples/host/cdc_msc_hid/CMakeLists.txt
index c4a4d8e63..5b44ef217 100644
--- a/examples/host/cdc_msc_hid/CMakeLists.txt
+++ b/examples/host/cdc_msc_hid/CMakeLists.txt
@@ -29,4 +29,16 @@ target_include_directories(${PROJECT} PUBLIC
family_configure_host_example(${PROJECT})
# For rp2040, un-comment to enable pico-pio-usb
-# family_add_pico_pio_usb(${PROJECT})
+family_add_pico_pio_usb(${PROJECT})
+
+# due to warnings from Pico-PIO-USB
+target_compile_options(${PROJECT} PUBLIC
+ -Wno-error=shadow
+ -Wno-error=cast-align
+ -Wno-error=cast-qual
+ -Wno-error=redundant-decls
+ -Wno-error=sign-conversion
+ -Wno-error=conversion
+ -Wno-error=sign-compare
+ -Wno-error=unused-function
+ )
diff --git a/examples/host/cdc_msc_hid/Makefile b/examples/host/cdc_msc_hid/Makefile
index 272acbac8..ad28076a0 100644
--- a/examples/host/cdc_msc_hid/Makefile
+++ b/examples/host/cdc_msc_hid/Makefile
@@ -6,11 +6,12 @@ INC += \
$(TOP)/hw \
# Example source
-EXAMPLE_SOURCE += $(wildcard src/*.c)
-SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
+EXAMPLE_SOURCE = \
+ src/hid_app.c \
+ src/main.c \
+ src/msc_app.c \
-# TODO: suppress warning caused by host stack
-CFLAGS += -Wno-error=cast-align -Wno-error=null-dereference
+SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
# TinyUSB Host Stack source
SRC_C += \
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c
index 664cbf035..d26e41e8d 100644
--- a/examples/host/cdc_msc_hid/src/main.c
+++ b/examples/host/cdc_msc_hid/src/main.c
@@ -54,13 +54,8 @@ int main(void)
tuh_task();
led_blinking_task();
-#if CFG_TUH_CDC
cdc_task();
-#endif
-
-#if CFG_TUH_HID
hid_app_task();
-#endif
}
return 0;
@@ -69,7 +64,6 @@ int main(void)
//--------------------------------------------------------------------+
// USB CDC
//--------------------------------------------------------------------+
-#if CFG_TUH_CDC
CFG_TUSB_MEM_SECTION static char serial_in_buffer[64] = { 0 };
// invoked ISR context
@@ -90,8 +84,6 @@ void cdc_task(void)
}
-#endif
-
//--------------------------------------------------------------------+
// TinyUSB Callbacks
//--------------------------------------------------------------------+
diff --git a/examples/host/cdc_msc_hid/src/msc_app.c b/examples/host/cdc_msc_hid/src/msc_app.c
index 77a72052d..80a5eab6f 100644
--- a/examples/host/cdc_msc_hid/src/msc_app.c
+++ b/examples/host/cdc_msc_hid/src/msc_app.c
@@ -25,8 +25,6 @@
#include "tusb.h"
-#if CFG_TUH_MSC
-
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
@@ -103,4 +101,3 @@ void tuh_msc_umount_cb(uint8_t dev_addr)
// }
}
-#endif
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index 33f34315b..c515405cb 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -34,6 +34,12 @@
// Board Specific Configuration
//--------------------------------------------------------------------+
+#if CFG_TUSB_MCU == OPT_MCU_RP2040
+// change to 1 if using pico-pio-usb as host controller for raspberry rp2040
+#define CFG_TUH_RPI_PIO_USB 0
+#define BOARD_TUH_RHPORT CFG_TUH_RPI_PIO_USB
+#endif
+
// RHPort number used for host can be defined by board.mk, default to port 0
#ifndef BOARD_TUH_RHPORT
#define BOARD_TUH_RHPORT 0