diff options
| author | goueslati <[email protected]> | 2023-06-12 14:27:53 +0100 |
|---|---|---|
| committer | goueslati <[email protected]> | 2023-06-12 14:27:53 +0100 |
| commit | 2d89cfb18f00aefbfa108728dfea3398e80ea3e4 (patch) | |
| tree | 6485dacac7e61c4378ac522e709edb0a86bd7523 /embassy-nrf/src/lib.rs | |
| parent | 2dd5ce83ec0421564e85b667f5dabd592f313e5c (diff) | |
| parent | ab86b060500ceda1c80e39f35af69cb08a7b63a2 (diff) | |
fix merge conflict
Diffstat (limited to 'embassy-nrf/src/lib.rs')
| -rw-r--r-- | embassy-nrf/src/lib.rs | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 6b57c2545..691545662 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -93,21 +93,14 @@ 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 | /// Macro to bind interrupts to handlers. |
| 97 | //! Interrupt definitions and macros to bind them. | 97 | /// |
| 98 | pub use cortex_m::interrupt::{CriticalSection, Mutex}; | 98 | /// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`) |
| 99 | pub use embassy_cortex_m::interrupt::{Binding, Handler, Interrupt, Priority}; | 99 | /// and implements the right [`Binding`]s for it. You can pass this struct to drivers to |
| 100 | 100 | /// prove at compile-time that the right interrupts have been bound. | |
| 101 | pub use crate::chip::irqs::*; | 101 | // developer note: this macro can't be in `embassy-hal-common` due to the use of `$crate`. |
| 102 | 102 | #[macro_export] | |
| 103 | /// Macro to bind interrupts to handlers. | 103 | macro_rules! bind_interrupts { |
| 104 | /// | ||
| 105 | /// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`) | ||
| 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),*;)* }) => { | 104 | ($vis:vis struct $name:ident { $($irq:ident => $($handler:ty),*;)* }) => { |
| 112 | $vis struct $name; | 105 | $vis struct $name; |
| 113 | 106 | ||
| @@ -116,17 +109,16 @@ pub mod interrupt { | |||
| 116 | #[no_mangle] | 109 | #[no_mangle] |
| 117 | unsafe extern "C" fn $irq() { | 110 | unsafe extern "C" fn $irq() { |
| 118 | $( | 111 | $( |
| 119 | <$handler as $crate::interrupt::Handler<$crate::interrupt::$irq>>::on_interrupt(); | 112 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); |
| 120 | )* | 113 | )* |
| 121 | } | 114 | } |
| 122 | 115 | ||
| 123 | $( | 116 | $( |
| 124 | unsafe impl $crate::interrupt::Binding<$crate::interrupt::$irq, $handler> for $name {} | 117 | unsafe impl $crate::interrupt::typelevel::Binding<$crate::interrupt::typelevel::$irq, $handler> for $name {} |
| 125 | )* | 118 | )* |
| 126 | )* | 119 | )* |
| 127 | }; | 120 | }; |
| 128 | } | 121 | } |
| 129 | } | ||
| 130 | 122 | ||
| 131 | // Reexports | 123 | // Reexports |
| 132 | 124 | ||
| @@ -135,10 +127,11 @@ pub use chip::pac; | |||
| 135 | #[cfg(not(feature = "unstable-pac"))] | 127 | #[cfg(not(feature = "unstable-pac"))] |
| 136 | pub(crate) use chip::pac; | 128 | pub(crate) use chip::pac; |
| 137 | pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE}; | 129 | pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE}; |
| 138 | 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}; | 130 | pub use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; |
| 141 | 131 | ||
| 132 | pub use crate::chip::interrupt; | ||
| 133 | pub use crate::pac::NVIC_PRIO_BITS; | ||
| 134 | |||
| 142 | pub mod config { | 135 | pub mod config { |
| 143 | //! Configuration options used when initializing the HAL. | 136 | //! Configuration options used when initializing the HAL. |
| 144 | 137 | ||
