parent
76193cee11
commit
51ea3e94f9
11
src/lib.rs
11
src/lib.rs
|
@ -57,11 +57,6 @@ impl<const L: usize> UsbBus for UsbDevice<L> {
|
|||
|
||||
let target_endpoint = &mut self.ep_table[address.index()];
|
||||
|
||||
// Set endpoint parameters. //
|
||||
|
||||
target_endpoint.set_dir(ep_dir);
|
||||
target_endpoint.set_type(ep_type);
|
||||
|
||||
// Get power of two number of endpoint size. //
|
||||
|
||||
let ep_size = max(8, max_packet_size.next_power_of_two());
|
||||
|
@ -71,10 +66,14 @@ impl<const L: usize> UsbBus for UsbDevice<L> {
|
|||
if DPRAM_SIZE - self.dpram_already_used < ep_size {
|
||||
Err(UsbError::EndpointMemoryOverflow)
|
||||
} else {
|
||||
// Add used dpram memory. //
|
||||
// Set endpoint parameters. //
|
||||
|
||||
target_endpoint.set_dir(ep_dir);
|
||||
target_endpoint.set_type(ep_type);
|
||||
target_endpoint.set_size(ep_size)?;
|
||||
|
||||
// Add used dpram memory. //
|
||||
|
||||
target_endpoint.is_allocated = true;
|
||||
self.dpram_already_used += ep_size;
|
||||
|
||||
|
|
Loading…
Reference in New Issue