File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -100,11 +100,33 @@ pub fn render(
100100 ] ;
101101
102102 /// Macro to override a device specific interrupt handler
103+ ///
104+ /// # Syntax
105+ ///
106+ /// ``` ignore
107+ /// interrupt!(
108+ /// // Name of the interrupt
109+ /// $Name:ident,
110+ ///
111+ /// // Path to the interrupt handler (a function)
112+ /// $handler:path,
113+ ///
114+ /// // Optional, state preserved across invocations of the handler
115+ /// state: $State:ty = $initial_state:expr,
116+ /// );
117+ /// ```
118+ ///
119+ /// Where `$Name` must match the name of one of the variants of the `Interrupt`
120+ /// enum.
121+ ///
122+ /// The handler must have signature `fn()` is no state was associated to it;
123+ /// otherwise its signature must be `fn(&mut $State)`.
103124 #[ cfg( feature = "rt" ) ]
104125 #[ macro_export]
105126 macro_rules! interrupt {
106127 ( $Name : ident, $handler: path, state: $State : ty = $initial_state: expr) => {
107128 #[ allow( unsafe_code) ]
129+ #[ deny( private_no_mangle_fns) ] // raise an error if this item is not accessible
108130 #[ no_mangle]
109131 pub unsafe extern "C" fn $Name ( ) {
110132 static mut STATE : $State = $initial_state;
@@ -121,6 +143,7 @@ pub fn render(
121143
122144 ( $Name : ident, $handler: path) => {
123145 #[ allow( unsafe_code) ]
146+ #[ deny( private_no_mangle_fns) ] // raise an error if this item is not accessible
124147 #[ no_mangle]
125148 pub unsafe extern "C" fn $Name ( ) {
126149 // check that this interrupt exists
You can’t perform that action at this time.
0 commit comments