aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/lib.rs
diff options
context:
space:
mode:
authorGhaith Oueslati <[email protected]>2023-06-12 14:28:23 +0100
committerGitHub <[email protected]>2023-06-12 14:28:23 +0100
commitcf83f6820cf2c6ece607cd60cfdab9d5e47efd04 (patch)
tree6485dacac7e61c4378ac522e709edb0a86bd7523 /embassy-nrf/src/lib.rs
parent2dd5ce83ec0421564e85b667f5dabd592f313e5c (diff)
parent2d89cfb18f00aefbfa108728dfea3398e80ea3e4 (diff)
Merge pull request #3 from OueslatiGhaith/master
fix merge conflicts
Diffstat (limited to 'embassy-nrf/src/lib.rs')
-rw-r--r--embassy-nrf/src/lib.rs33
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")]
94mod chip; 94mod chip;
95 95
96pub 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. 103macro_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"))]
136pub(crate) use chip::pac; 128pub(crate) use chip::pac;
137pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE}; 129pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE};
138pub use embassy_cortex_m::executor;
139pub use embassy_cortex_m::interrupt::_export::interrupt;
140pub use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; 130pub use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
141 131
132pub use crate::chip::interrupt;
133pub use crate::pac::NVIC_PRIO_BITS;
134
142pub mod config { 135pub mod config {
143 //! Configuration options used when initializing the HAL. 136 //! Configuration options used when initializing the HAL.
144 137