diff options
Diffstat (limited to 'embassy-nrf/src/lib.rs')
| -rw-r--r-- | embassy-nrf/src/lib.rs | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 6b57c2545..a73d22a63 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -93,21 +93,16 @@ pub mod wdt; | |||
| 93 | #[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] | 93 | #[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] |
| 94 | mod chip; | 94 | mod chip; |
| 95 | 95 | ||
| 96 | pub mod interrupt { | 96 | pub use crate::chip::interrupt; |
| 97 | //! Interrupt definitions and macros to bind them. | 97 | |
| 98 | pub use cortex_m::interrupt::{CriticalSection, Mutex}; | 98 | /// Macro to bind interrupts to handlers. |
| 99 | pub use embassy_cortex_m::interrupt::{Binding, Handler, Interrupt, Priority}; | 99 | /// |
| 100 | 100 | /// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`) | |
| 101 | pub use crate::chip::irqs::*; | 101 | /// and implements the right [`Binding`]s for it. You can pass this struct to drivers to |
| 102 | 102 | /// prove at compile-time that the right interrupts have been bound. | |
| 103 | /// Macro to bind interrupts to handlers. | 103 | // developer note: this macro can't be in `embassy-cortex-m` due to the use of `$crate`. |
| 104 | /// | 104 | #[macro_export] |
| 105 | /// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`) | 105 | macro_rules! bind_interrupts { |
| 106 | /// and implements the right [`Binding`]s for it. You can pass this struct to drivers to | ||
| 107 | /// prove at compile-time that the right interrupts have been bound. | ||
| 108 | // developer note: this macro can't be in `embassy-cortex-m` due to the use of `$crate`. | ||
| 109 | #[macro_export] | ||
| 110 | macro_rules! bind_interrupts { | ||
| 111 | ($vis:vis struct $name:ident { $($irq:ident => $($handler:ty),*;)* }) => { | 106 | ($vis:vis struct $name:ident { $($irq:ident => $($handler:ty),*;)* }) => { |
| 112 | $vis struct $name; | 107 | $vis struct $name; |
| 113 | 108 | ||
| @@ -116,17 +111,16 @@ pub mod interrupt { | |||
| 116 | #[no_mangle] | 111 | #[no_mangle] |
| 117 | unsafe extern "C" fn $irq() { | 112 | unsafe extern "C" fn $irq() { |
| 118 | $( | 113 | $( |
| 119 | <$handler as $crate::interrupt::Handler<$crate::interrupt::$irq>>::on_interrupt(); | 114 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); |
| 120 | )* | 115 | )* |
| 121 | } | 116 | } |
| 122 | 117 | ||
| 123 | $( | 118 | $( |
| 124 | unsafe impl $crate::interrupt::Binding<$crate::interrupt::$irq, $handler> for $name {} | 119 | unsafe impl $crate::interrupt::typelevel::Binding<$crate::interrupt::typelevel::$irq, $handler> for $name {} |
| 125 | )* | 120 | )* |
| 126 | )* | 121 | )* |
| 127 | }; | 122 | }; |
| 128 | } | 123 | } |
| 129 | } | ||
| 130 | 124 | ||
| 131 | // Reexports | 125 | // Reexports |
| 132 | 126 | ||
| @@ -136,7 +130,6 @@ pub use chip::pac; | |||
| 136 | pub(crate) use chip::pac; | 130 | pub(crate) use chip::pac; |
| 137 | pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE}; | 131 | pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE}; |
| 138 | pub use embassy_cortex_m::executor; | 132 | pub use embassy_cortex_m::executor; |
| 139 | pub use embassy_cortex_m::interrupt::_export::interrupt; | ||
| 140 | pub use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; | 133 | pub use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; |
| 141 | 134 | ||
| 142 | pub mod config { | 135 | pub mod config { |
