@@ -100,64 +100,6 @@ pub fn render(
100100 pub static __INTERRUPTS: [ Vector ; #n] = [
101101 #( #elements, ) *
102102 ] ;
103-
104- /// Macro to override a device specific interrupt handler
105- ///
106- /// # Syntax
107- ///
108- /// ``` ignore
109- /// interrupt!(
110- /// // Name of the interrupt
111- /// $Name:ident,
112- ///
113- /// // Path to the interrupt handler (a function)
114- /// $handler:path,
115- ///
116- /// // Optional, state preserved across invocations of the handler
117- /// state: $State:ty = $initial_state:expr,
118- /// );
119- /// ```
120- ///
121- /// Where `$Name` must match the name of one of the variants of the `Interrupt`
122- /// enum.
123- ///
124- /// The handler must have signature `fn()` is no state was associated to it;
125- /// otherwise its signature must be `fn(&mut $State)`.
126- #[ cfg( feature = "rt" ) ]
127- #[ macro_export]
128- macro_rules! interrupt {
129- ( $Name : ident, $handler: path, state: $State : ty = $initial_state: expr) => {
130- #[ allow( unsafe_code) ]
131- #[ deny( private_no_mangle_fns) ] // raise an error if this item is not accessible
132- #[ no_mangle]
133- pub unsafe extern "C" fn $Name ( ) {
134- static mut STATE : $State = $initial_state;
135-
136- // check that this interrupt exists
137- let _ = $crate :: Interrupt :: $Name ;
138-
139- // validate the signature of the user provided handler
140- let f: fn ( & mut $State ) = $handler;
141-
142- f( & mut STATE )
143- }
144- } ;
145-
146- ( $Name : ident, $handler: path) => {
147- #[ allow( unsafe_code) ]
148- #[ deny( private_no_mangle_fns) ] // raise an error if this item is not accessible
149- #[ no_mangle]
150- pub unsafe extern "C" fn $Name ( ) {
151- // check that this interrupt exists
152- let _ = $crate :: Interrupt :: $Name ;
153-
154- // validate the signature of the user provided handler
155- let f: fn ( ) = $handler;
156-
157- f( )
158- }
159- } ;
160- }
161103 } ) ;
162104 }
163105 Target :: Msp430 => {
@@ -313,16 +255,16 @@ pub fn render(
313255 }
314256
315257 if !interrupts. is_empty ( ) {
316- root. push ( quote ! {
317- #[ doc( hidden) ]
318- pub mod interrupt {
319- #( #mod_items) *
320- }
321- } ) ;
322-
323258 if * target != Target :: CortexM {
324259 root. push ( quote ! {
325- pub use self :: interrupt:: Interrupt ;
260+ #[ doc( hidden) ]
261+ pub mod interrupt {
262+ #( #mod_items) *
263+ }
264+ } ) ;
265+
266+ root. push ( quote ! {
267+ pub use interrupt:: Interrupt ;
326268 } ) ;
327269 }
328270 }
0 commit comments