-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Move to tinyusb 0.9.0 #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,10 @@ static uint16_t resetd_open(uint8_t __unused rhport, tusb_desc_interface_t const | |
} | ||
|
||
// Support for parameterized reset via vendor interface control request | ||
static bool resetd_control_request_cb(uint8_t __unused rhport, tusb_control_request_t const *request) { | ||
static bool resetd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request) { | ||
// nothing to do with DATA & ACK stage | ||
if (stage != CONTROL_STAGE_SETUP) return true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you are reset mcu, it should be better to reset when https://github.com/hathach/tinyusb/blob/master/src/class/cdc/cdc_device.c#L354 case CDC_REQUEST_SET_LINE_CODING:
if (stage == CONTROL_STAGE_SETUP)
{
TU_LOG2(" Set Line Coding\r\n");
tud_control_xfer(rhport, request, &p_cdc->line_coding, sizeof(cdc_line_coding_t));
}
else if ( stage == CONTROL_STAGE_ACK)
{
if ( tud_cdc_line_coding_cb ) tud_cdc_line_coding_cb(itf, &p_cdc->line_coding);
}
break; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah; good point thanks |
||
|
||
if (request->wIndex == itf_num) { | ||
|
||
#if PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL | ||
|
@@ -69,10 +72,6 @@ static bool resetd_control_request_cb(uint8_t __unused rhport, tusb_control_requ | |
return false; | ||
} | ||
|
||
static bool resetd_control_complete_cb(uint8_t __unused rhport, tusb_control_request_t __unused const *request) { | ||
return true; | ||
} | ||
|
||
static bool resetd_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes) { | ||
return true; | ||
} | ||
|
@@ -85,8 +84,7 @@ static usbd_class_driver_t const _resetd_driver = | |
.init = resetd_init, | ||
.reset = resetd_reset, | ||
.open = resetd_open, | ||
.control_request = resetd_control_request_cb, | ||
.control_complete = resetd_control_complete_cb, | ||
.control_xfer_cb = resetd_control_xfer_cb, | ||
.xfer_cb = resetd_xfer_cb, | ||
.sof = NULL | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,8 +104,46 @@ if (EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH}) | |
|
||
add_library(tinyusb_board INTERFACE) | ||
target_sources(tinyusb_board INTERFACE | ||
${PICO_TINYUSB_PATH}/hw/bsp/raspberry_pi_pico/board_raspberry_pi_pico.c | ||
${PICO_TINYUSB_PATH}/hw/bsp/rp2040/family.c | ||
) | ||
target_include_directories(tinyusb_board INTERFACE ${PICO_TINYUSB_PATH}/hw/bsp/rp2040/boards/sdk_selected) | ||
|
||
set(PICO_TINYUSB_PATH_INTERNAL ${PICO_TINYUSB_PATH} CACHE INTERNAL "") | ||
add_library(tinyusb_example_support INTERFACE) | ||
target_compile_definitions(tinyusb_example_support INTERFACE | ||
CFG_TUSB_OS=OPT_OS_PICO | ||
BOARD=pants | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👖 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops - i was checking something by deliberately using an invalid board ;-) that ain't gonna compile There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
) | ||
target_link_libraries(tinyusb_example_support INTERFACE tinyusb_board) | ||
endif() | ||
|
||
# SHORT_TYPE is 'dev' or 'host'; LONG_TYPE is 'device' or 'host' | ||
macro(internal_add_tinyusb_example SHORT_TYPE LONG_TYPE NAME ) | ||
if (TARGET tinyusb_${LONG_TYPE}) | ||
set(TARGET_NAME "usb_${SHORT_TYPE}_${NAME}") | ||
# todo we ought to be able to include the examples, but we can't because they are very standalone | ||
# todo maybe allow passing file names if necessary - doesn't seem to be right now | ||
set(EXAMPLE_SOURCE_PATH ${PICO_TINYUSB_PATH_INTERNAL}/examples/${LONG_TYPE}/${NAME}/src) | ||
file(GLOB EXAMPLE_SOURCE ${EXAMPLE_SOURCE_PATH}/*.c) | ||
add_executable(${TARGET_NAME} | ||
${EXAMPLE_SOURCE} | ||
) | ||
|
||
target_include_directories(${TARGET_NAME} PRIVATE ${EXAMPLE_SOURCE_PATH}) | ||
target_link_libraries(${TARGET_NAME} PRIVATE pico_stdlib tinyusb_${LONG_TYPE} tinyusb_example_support) | ||
pico_add_extra_outputs(${TARGET_NAME}) | ||
|
||
# add url via pico_set_program_url | ||
# todo lets point at the right place | ||
#example_auto_set_url(${NAME}) | ||
endif() | ||
endmacro() | ||
|
||
function(add_tinyusb_device_example NAME) | ||
internal_add_tinyusb_example(dev device ${NAME}) | ||
endfunction() | ||
|
||
function(add_tinyusb_host_example NAME) | ||
internal_add_tinyusb_example(host host ${NAME}) | ||
endfunction() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change needed by this PR, or was it just pulled in coincidentally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed