feat(conditions): use if let ... conditions instead match
This commit is contained in:
parent
18a3368565
commit
b1dd7eea9d
|
@ -169,8 +169,11 @@ impl<const L: usize> UsbDevice<L> {
|
||||||
let usb = self.usb.borrow(cs);
|
let usb = self.usb.borrow(cs);
|
||||||
let current_endpoint = self.ep_table[endpoint_index];
|
let current_endpoint = self.ep_table[endpoint_index];
|
||||||
|
|
||||||
match self.select_endpoint(cs, endpoint_index) {
|
let select_endpoint_result = self.select_endpoint(cs, endpoint_index);
|
||||||
Ok(_) => {
|
|
||||||
|
if select_endpoint_result.is_err() {
|
||||||
|
select_endpoint_result
|
||||||
|
} else {
|
||||||
// Enable endpoint. //
|
// Enable endpoint. //
|
||||||
|
|
||||||
usb.ueconx.modify(|_, w| w.epen().set_bit());
|
usb.ueconx.modify(|_, w| w.epen().set_bit());
|
||||||
|
@ -200,10 +203,8 @@ impl<const L: usize> UsbDevice<L> {
|
||||||
usb.ueienx
|
usb.ueienx
|
||||||
.modify(|_, w| w.rxoute().set_bit().rxstpe().set_bit());
|
.modify(|_, w| w.rxoute().set_bit().rxstpe().set_bit());
|
||||||
|
|
||||||
Ok(())
|
select_endpoint_result
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Err(exception) => Err(exception),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue