aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src
diff options
context:
space:
mode:
authorJacob Rosenthal <[email protected]>2021-12-12 21:32:51 -0700
committerJacob Rosenthal <[email protected]>2021-12-12 21:39:59 -0700
commite5dc63e8e99d1d818ed7ab3b13ffff3ee2c40a3d (patch)
tree001cd24b366eab9d88d658d198dfdf3583db0263 /embassy-nrf/src
parentf430c0e8c2e9703220978d9976b058ecf0117c45 (diff)
usb feature gate
Diffstat (limited to 'embassy-nrf/src')
-rw-r--r--embassy-nrf/src/lib.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index 95e3b3e7b..13e7803a8 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -73,21 +73,25 @@ pub(crate) use chip::pac;
73 73
74pub use chip::{peripherals, Peripherals}; 74pub use chip::{peripherals, Peripherals};
75 75
76use nrf_usbd::{UsbPeripheral, Usbd}; 76#[cfg(any(feature = "nrf52820", feature = "nrf52833", feature = "nrf52840"))]
77use usb_device::bus::UsbBusAllocator; 77pub mod usb {
78 78
79pub struct UsbBus; 79 use nrf_usbd::{UsbPeripheral, Usbd};
80unsafe impl UsbPeripheral for UsbBus { 80 use usb_device::bus::UsbBusAllocator;
81 const REGISTERS: *const () = pac::USBD::ptr() as *const ();
82}
83 81
84impl UsbBus { 82 pub struct UsbBus;
85 pub fn new() -> UsbBusAllocator<Usbd<UsbBus>> { 83 unsafe impl UsbPeripheral for UsbBus {
86 Usbd::new(UsbBus) 84 const REGISTERS: *const () = crate::pac::USBD::ptr() as *const ();
85 }
86
87 impl UsbBus {
88 pub fn new() -> UsbBusAllocator<Usbd<UsbBus>> {
89 Usbd::new(UsbBus)
90 }
87 } 91 }
88}
89 92
90unsafe impl embassy_hal_common::usb::USBInterrupt for interrupt::USBD {} 93 unsafe impl embassy_hal_common::usb::USBInterrupt for crate::interrupt::USBD {}
94}
91 95
92pub mod interrupt { 96pub mod interrupt {
93 pub use crate::chip::irqs::*; 97 pub use crate::chip::irqs::*;