-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(arch): move arch modules to their own files
- Loading branch information
1 parent
5843680
commit a62fc5a
Showing
4 changed files
with
62 additions
and
72 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pub use embassy_nrf::interrupt; | ||
pub use embassy_nrf::interrupt::SWI0_EGU0 as SWI; | ||
pub use embassy_nrf::{init, OptionalPeripherals}; | ||
|
||
#[cfg(feature = "usb")] | ||
use embassy_nrf::{bind_interrupts, peripherals, rng, usb as nrf_usb}; | ||
|
||
#[cfg(feature = "usb")] | ||
bind_interrupts!(struct Irqs { | ||
USBD => nrf_usb::InterruptHandler<peripherals::USBD>; | ||
POWER_CLOCK => nrf_usb::vbus_detect::InterruptHandler; | ||
RNG => rng::InterruptHandler<peripherals::RNG>; | ||
}); | ||
|
||
#[interrupt] | ||
unsafe fn SWI0_EGU0() { | ||
crate::EXECUTOR.on_interrupt() | ||
} | ||
|
||
#[cfg(feature = "usb")] | ||
pub mod usb { | ||
use embassy_nrf::peripherals; | ||
use embassy_nrf::usb::{vbus_detect::HardwareVbusDetect, Driver}; | ||
pub type UsbDriver = Driver<'static, peripherals::USBD, HardwareVbusDetect>; | ||
pub fn driver(usbd: peripherals::USBD) -> UsbDriver { | ||
use super::Irqs; | ||
Driver::new(usbd, Irqs, HardwareVbusDetect::new(Irqs)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
pub use embassy_rp::interrupt; | ||
pub use embassy_rp::interrupt::SWI_IRQ_1 as SWI; | ||
pub use embassy_rp::{init, OptionalPeripherals, Peripherals}; | ||
|
||
#[cfg(feature = "usb")] | ||
use embassy_rp::{bind_interrupts, peripherals::USB, usb::InterruptHandler}; | ||
|
||
// rp2040 usb start | ||
#[cfg(feature = "usb")] | ||
bind_interrupts!(struct Irqs { | ||
USBCTRL_IRQ => InterruptHandler<USB>; | ||
}); | ||
|
||
#[interrupt] | ||
unsafe fn SWI_IRQ_1() { | ||
crate::EXECUTOR.on_interrupt() | ||
} | ||
|
||
#[cfg(feature = "usb")] | ||
pub mod usb { | ||
use embassy_rp::peripherals; | ||
use embassy_rp::usb::Driver; | ||
pub type UsbDriver = Driver<'static, peripherals::USB>; | ||
pub fn driver(usb: peripherals::USB) -> UsbDriver { | ||
Driver::new(usb, super::Irqs) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters