From 50f151e6bcf484735e2b8cd70196c72b038f3bc6 Mon Sep 17 00:00:00 2001 From: Jacob Rosenthal Date: Wed, 15 Dec 2021 10:29:19 -0700 Subject: [PATCH] use Instance regs --- embassy-nrf/src/usb.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs index d0944b7f0..b110258c5 100644 --- a/embassy-nrf/src/usb.rs +++ b/embassy-nrf/src/usb.rs @@ -20,15 +20,15 @@ unsafe impl<'d, T: Instance> UsbPeripheral for UsbBus<'d, T> { impl<'d, T: Instance> UsbBus<'d, T> { pub fn new(_usb: impl Unborrow + 'd) -> UsbBusAllocator>> { - unsafe { - (*pac::USBD::ptr()).intenset.write(|w| { - w.sof().set_bit(); - w.usbevent().set_bit(); - w.ep0datadone().set_bit(); - w.ep0setup().set_bit(); - w.usbreset().set_bit() - }) - }; + let r = T::regs(); + + r.intenset.write(|w| { + w.sof().set_bit(); + w.usbevent().set_bit(); + w.ep0datadone().set_bit(); + w.ep0setup().set_bit(); + w.usbreset().set_bit() + }); Usbd::new(UsbBus { phantom: PhantomData,