We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 99367b5 + fa83b86 commit 0554f17Copy full SHA for 0554f17
src/endpoint_memory.rs
@@ -152,11 +152,9 @@ impl<USB: UsbPeripheral> EndpointMemoryAllocator<USB> {
152
return Err(UsbError::InvalidEndpoint)
153
}
154
155
- let mut used = self.total_rx_buffer_size_words() as usize + 30;
156
- for sz in &self.tx_fifo_size_words[0..ep_number] {
157
- used += core::cmp::max(*sz as usize, 16);
158
- }
159
- used -= 16;
+ let used = 30
+ + self.total_rx_buffer_size_words() as usize
+ + self.tx_fifo_size_words.iter().sum::<u16>() as usize;
160
161
let size_words = core::cmp::max((size + 3) / 4, 16);
162
if (used + size_words) > USB::FIFO_DEPTH_WORDS {
0 commit comments