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(
100
100
] ;
101
101
102
102
/// 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)`.
103
124
#[ cfg( feature = "rt" ) ]
104
125
#[ macro_export]
105
126
macro_rules! interrupt {
106
127
( $Name : ident, $handler: path, state: $State : ty = $initial_state: expr) => {
107
128
#[ allow( unsafe_code) ]
129
+ #[ deny( private_no_mangle_fns) ] // raise an error if this item is not accessible
108
130
#[ no_mangle]
109
131
pub unsafe extern "C" fn $Name ( ) {
110
132
static mut STATE : $State = $initial_state;
@@ -121,6 +143,7 @@ pub fn render(
121
143
122
144
( $Name : ident, $handler: path) => {
123
145
#[ allow( unsafe_code) ]
146
+ #[ deny( private_no_mangle_fns) ] // raise an error if this item is not accessible
124
147
#[ no_mangle]
125
148
pub unsafe extern "C" fn $Name ( ) {
126
149
// check that this interrupt exists
You can’t perform that action at this time.
0 commit comments