diff options
| author | Jacob Rosenthal <[email protected]> | 2021-12-13 17:50:08 -0700 |
|---|---|---|
| committer | Jacob Rosenthal <[email protected]> | 2021-12-13 18:04:54 -0700 |
| commit | 83a1237ea3f8b164749cb895b7bdb7a5696107f6 (patch) | |
| tree | 93b4a873ebcaf88eadc35fd33e39c3b4f1817845 /embassy-nrf/src/lib.rs | |
| parent | e5dc63e8e99d1d818ed7ab3b13ffff3ee2c40a3d (diff) | |
stub out the embassy registers for usbd
Diffstat (limited to 'embassy-nrf/src/lib.rs')
| -rw-r--r-- | embassy-nrf/src/lib.rs | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 13e7803a8..7434905e6 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -48,6 +48,9 @@ pub mod temp; | |||
| 48 | pub mod timer; | 48 | pub mod timer; |
| 49 | pub mod twim; | 49 | pub mod twim; |
| 50 | pub mod uarte; | 50 | pub mod uarte; |
| 51 | //todo add nrf52833 nrf52840 | ||
| 52 | #[cfg(feature = "nrf52840")] | ||
| 53 | pub mod usb; | ||
| 51 | #[cfg(not(feature = "_nrf5340"))] | 54 | #[cfg(not(feature = "_nrf5340"))] |
| 52 | pub mod wdt; | 55 | pub mod wdt; |
| 53 | 56 | ||
| @@ -73,26 +76,6 @@ pub(crate) use chip::pac; | |||
| 73 | 76 | ||
| 74 | pub use chip::{peripherals, Peripherals}; | 77 | pub use chip::{peripherals, Peripherals}; |
| 75 | 78 | ||
| 76 | #[cfg(any(feature = "nrf52820", feature = "nrf52833", feature = "nrf52840"))] | ||
| 77 | pub mod usb { | ||
| 78 | |||
| 79 | use nrf_usbd::{UsbPeripheral, Usbd}; | ||
| 80 | use usb_device::bus::UsbBusAllocator; | ||
| 81 | |||
| 82 | pub struct UsbBus; | ||
| 83 | unsafe impl UsbPeripheral for 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 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | unsafe impl embassy_hal_common::usb::USBInterrupt for crate::interrupt::USBD {} | ||
| 94 | } | ||
| 95 | |||
| 96 | pub mod interrupt { | 79 | pub mod interrupt { |
| 97 | pub use crate::chip::irqs::*; | 80 | pub use crate::chip::irqs::*; |
| 98 | pub use cortex_m::interrupt::{CriticalSection, Mutex}; | 81 | pub use cortex_m::interrupt::{CriticalSection, Mutex}; |
