-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cherryusb): add cherryusb library
Signed-off-by: sakumisu <1203593632@qq.com>
- Loading branch information
Showing
7 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
if (DEFINED ENV{PICO_CHERRYUSB_PATH} AND (NOT PICO_CHERRYUSB_PATH)) | ||
set(PICO_CHERRYUSB_PATH $ENV{PICO_CHERRYUSB_PATH}) | ||
message("Using PICO_CHERRYUSB_PATH from environment ('${PICO_CHERRYUSB_PATH}')") | ||
endif () | ||
|
||
set(CHERRYUSB_TEST_PATH "port/rp2040") | ||
if (NOT PICO_CHERRYUSB_PATH) | ||
set(PICO_CHERRYUSB_PATH ${PROJECT_SOURCE_DIR}/lib/cherryusb) | ||
if (NOT EXISTS ${PICO_CHERRYUSB_PATH}/${CHERRYUSB_TEST_PATH}) | ||
message(WARNING "CherryUSB submodule has not been initialized; USB support will be unavailable | ||
hint: try 'git submodule update --init' from your SDK directory (${PICO_SDK_PATH}).") | ||
endif() | ||
elseif (NOT EXISTS ${PICO_CHERRYUSB_PATH}/${CHERRYUSB_TEST_PATH}) | ||
message(WARNING "PICO_CHERRYUSB_PATH specified but content not present.") | ||
endif() | ||
|
||
if (EXISTS ${PICO_CHERRYUSB_PATH}/${CHERRYUSB_TEST_PATH}) | ||
message("CherryUSB available at ${PICO_CHERRYUSB_PATH}; enabling build support for USB.") | ||
pico_register_common_scope_var(PICO_CHERRYUSB_PATH) | ||
|
||
set(CONFIG_CHERRYUSB_DEVICE 1) | ||
set(CONFIG_CHERRYUSB_DEVICE_CDC_ACM 1) | ||
set(CONFIG_CHERRYUSB_DEVICE_HID 1) | ||
set(CONFIG_CHERRYUSB_DEVICE_MSC 1) | ||
set(CONFIG_CHERRYUSB_DEVICE_AUDIO 1) | ||
set(CONFIG_CHERRYUSB_DEVICE_VIDEO 1) | ||
set(CONFIG_CHERRYUSB_DEVICE_DCD "rp2040") | ||
include(${PICO_CHERRYUSB_PATH}/cherryusb.cmake) | ||
pico_add_library(cherryusb_device NOFLAG) | ||
target_include_directories(cherryusb_device_headers SYSTEM INTERFACE ${cherryusb_incs}) | ||
target_include_directories(cherryusb_device_headers SYSTEM INTERFACE ${PICO_CHERRYUSB_PATH}/demo) | ||
target_sources(cherryusb_device INTERFACE ${cherryusb_srcs}) | ||
|
||
set(CONFIG_CHERRYUSB_HOST 1) | ||
set(CONFIG_CHERRYUSB_HOST_CDC_ACM 1) | ||
set(CONFIG_CHERRYUSB_HOST_HID 1) | ||
set(CONFIG_CHERRYUSB_HOST_MSC 1) | ||
set(CONFIG_CHERRYUSB_OSAL "freertos") | ||
set(CONFIG_CHERRYUSB_HOST_HCD "rp2040") | ||
|
||
include(${PICO_CHERRYUSB_PATH}/cherryusb.cmake) | ||
pico_add_library(cherryusb_host NOFLAG) | ||
target_include_directories(cherryusb_host_headers SYSTEM INTERFACE ${cherryusb_incs}) | ||
target_include_directories(cherryusb_host_headers SYSTEM INTERFACE ${PICO_CHERRYUSB_PATH}/demo) | ||
target_sources(cherryusb_host INTERFACE ${cherryusb_srcs}) | ||
|
||
pico_promote_common_scope_vars() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters