use Instance regs
This commit is contained in:
parent
cd356896ee
commit
50f151e6bc
@ -20,15 +20,15 @@ unsafe impl<'d, T: Instance> UsbPeripheral for UsbBus<'d, T> {
|
|||||||
|
|
||||||
impl<'d, T: Instance> UsbBus<'d, T> {
|
impl<'d, T: Instance> UsbBus<'d, T> {
|
||||||
pub fn new(_usb: impl Unborrow<Target = T> + 'd) -> UsbBusAllocator<Usbd<UsbBus<'d, T>>> {
|
pub fn new(_usb: impl Unborrow<Target = T> + 'd) -> UsbBusAllocator<Usbd<UsbBus<'d, T>>> {
|
||||||
unsafe {
|
let r = T::regs();
|
||||||
(*pac::USBD::ptr()).intenset.write(|w| {
|
|
||||||
|
r.intenset.write(|w| {
|
||||||
w.sof().set_bit();
|
w.sof().set_bit();
|
||||||
w.usbevent().set_bit();
|
w.usbevent().set_bit();
|
||||||
w.ep0datadone().set_bit();
|
w.ep0datadone().set_bit();
|
||||||
w.ep0setup().set_bit();
|
w.ep0setup().set_bit();
|
||||||
w.usbreset().set_bit()
|
w.usbreset().set_bit()
|
||||||
})
|
});
|
||||||
};
|
|
||||||
|
|
||||||
Usbd::new(UsbBus {
|
Usbd::new(UsbBus {
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
|
Loading…
Reference in New Issue
Block a user