Skip to content

USB- data transfer#2

Draft
AnonymousBit0111 wants to merge 3 commits intomainfrom
feature/usb-data-transfer
Draft

USB- data transfer#2
AnonymousBit0111 wants to merge 3 commits intomainfrom
feature/usb-data-transfer

Conversation

@AnonymousBit0111
Copy link
Copy Markdown
Contributor

issues are in the comments of the code @PegasisForever

let mut alt = interface.alt_setting(0xFF, 0, 0, None);

let ep_in: <Driver<'_, USB_OTG_FS> as embassy_usb::driver::Driver<'_>>::EndpointIn =
alt.endpoint_bulk_in(Some(EndpointAddress::from(1)), 10); // I cannot tell you for the life of me what type this variable is meant to have
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put the types in, you have to read the source code for this, vscode is not very helpful


handler.interface_num = interface.interface_number();

drop(function); // why??
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some weird lifetime lol, if you comment this line you'll see

// The rust compiler keeps complaining about EndpointIn<'static> and its messages arent very helpful.

#[embassy_executor::task]
async fn send_data_task(mut ep: <Driver<'static, USB_OTG_FS> as embassy_usb::driver::Driver<'static>>::EndpointIn, send_signal: SendDataSignal) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an embassy task requires all the parameters having a static lifetime, currently the ep in setup_usb_handler does not have a static lifetime.

Take a look at the pattern from https://github.com/McMaster-Rocketry-Team/ICARUS/blob/4afbc1ca998ca76e05bfc59c94b1f2dbc421e82c/firmware/src/usb.rs

@PegasisForever PegasisForever marked this pull request as draft November 5, 2025 17:16
}

// The plan is to add this task in low_prio_main and have it wait on two signals, one which contains whether it should write or not
// and another that tells it what files to write over the endpoint (this one could be a watch)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a channel for file content for buffering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants