test
This commit is contained in:
parent
ae466a8aad
commit
3ddf928152
13
src/lib.rs
13
src/lib.rs
|
@ -57,6 +57,11 @@ 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());
|
||||
|
@ -66,14 +71,10 @@ impl<const L: usize> UsbBus for UsbDevice<L> {
|
|||
if DPRAM_SIZE - self.dpram_already_used < ep_size {
|
||||
Err(UsbError::EndpointMemoryOverflow)
|
||||
} else {
|
||||
// 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.set_size(ep_size)?;
|
||||
|
||||
target_endpoint.is_allocated = true;
|
||||
self.dpram_already_used += ep_size;
|
||||
|
||||
|
|
Loading…
Reference in New Issue