Skip to content

Commit

Permalink
Update usb-device implementation.
Browse files Browse the repository at this point in the history
Next usb-device release has some changes around isochronous endpoint type.
  • Loading branch information
ithinuel committed Nov 13, 2023
1 parent 7b04000 commit 0918d37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rp2040-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rp2040-pac = { version = "0.5.0", features = ["critical-section"] }
paste = "1.0"
pio = "0.2.0"
rp2040-hal-macros = { version = "0.1.0", path = "../rp2040-hal-macros" }
usb-device = "0.2.9"
usb-device = "0.3"
vcell = "0.1"
void = { version = "1.0.2", default-features = false }
rand_core = "0.6.3"
Expand Down
5 changes: 3 additions & 2 deletions rp2040-hal/src/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ impl Inner {
// Data Buffers are typically 64 bytes long as this is the max normal packet size for most FS packets.
// For Isochronous endpoints a maximum buffer size of 1023 bytes is supported.
// For other packet types the maximum size is 64 bytes per buffer.
if (ep_type != EndpointType::Isochronous && max_packet_size > 64) || max_packet_size > 1023
if (!matches!(ep_type, EndpointType::Isochronous { .. }) && max_packet_size > 64)
|| max_packet_size > 1023
{
return Err(UsbError::Unsupported);
}
Expand Down Expand Up @@ -288,7 +289,7 @@ impl Inner {
use crate::pac::usbctrl_dpram::ep_control::ENDPOINT_TYPE_A;
let ep_type = match ep.ep_type {
EndpointType::Bulk => ENDPOINT_TYPE_A::BULK,
EndpointType::Isochronous => ENDPOINT_TYPE_A::ISOCHRONOUS,
EndpointType::Isochronous { .. } => ENDPOINT_TYPE_A::ISOCHRONOUS,
EndpointType::Control => ENDPOINT_TYPE_A::CONTROL,
EndpointType::Interrupt => ENDPOINT_TYPE_A::INTERRUPT,
};
Expand Down

0 comments on commit 0918d37

Please sign in to comment.