File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -20,4 +20,4 @@ volatile-register = "0.2.0"
20
20
[features ]
21
21
cm7-r0p1 = []
22
22
const-fn = [" bare-metal/const-fn" ]
23
- inline-asm = []
23
+ inline-asm = []
Original file line number Diff line number Diff line change 2
2
3
3
#[ cfg( not( armv6m) ) ]
4
4
use volatile_register:: RO ;
5
- use volatile_register:: RW ;
5
+ use volatile_register:: { RW , WO } ;
6
6
7
7
use interrupt:: Nr ;
8
8
use peripheral:: NVIC ;
@@ -65,9 +65,35 @@ pub struct RegisterBlock {
65
65
/// so convenient byte-sized representation wouldn't work on that
66
66
/// architecture.
67
67
pub ipr : [ RW < u32 > ; 8 ] ,
68
+
69
+ #[ cfg( not( armv6m) ) ]
70
+ reserved5 : [ u32 ; 208 ] ,
71
+
72
+ #[ cfg( armv6m) ]
73
+ reserved5 : [ u32 ; 696 ] ,
74
+
75
+ #[ cfg( not( armv6m) ) ]
76
+ /// Software Trigger Interrupt
77
+ pub stir : WO < u32 > ,
68
78
}
69
79
70
80
impl NVIC {
81
+ /// Request an IRQ in software
82
+ ///
83
+ /// Writing a value to the INTID field is the same as manually pending an interrupt by setting
84
+ /// the corresponding interrupt bit in an Interrupt Set Pending Register. This is similar to
85
+ /// `set_pending`.
86
+ pub fn request < I > ( & mut self , interrupt : I )
87
+ where
88
+ I : Nr ,
89
+ {
90
+ let nr = interrupt. nr ( ) ;
91
+
92
+ unsafe {
93
+ self . stir . write ( nr as u32 ) ;
94
+ }
95
+ }
96
+
71
97
/// Clears `interrupt`'s pending state
72
98
pub fn clear_pending < I > ( & mut self , interrupt : I )
73
99
where
You can’t perform that action at this time.
0 commit comments