@@ -25,11 +25,22 @@ impl<const P: char, const N: u8, MODE> Pin<P, N, MODE> {
25
25
26
26
/// External Interrupt Pin
27
27
pub trait ExtiPin {
28
+ /// Make corresponding EXTI line sensitive to this pin
28
29
fn make_interrupt_source ( & mut self , syscfg : & mut SysCfg ) ;
30
+
31
+ /// Generate interrupt on rising edge, falling edge or both
29
32
fn trigger_on_edge ( & mut self , exti : & mut EXTI , level : Edge ) ;
33
+
34
+ /// Enable external interrupts from this pin.
30
35
fn enable_interrupt ( & mut self , exti : & mut EXTI ) ;
36
+
37
+ /// Disable external interrupts from this pin
31
38
fn disable_interrupt ( & mut self , exti : & mut EXTI ) ;
39
+
40
+ /// Clear the interrupt pending bit for this pin
32
41
fn clear_interrupt_pending_bit ( & mut self ) ;
42
+
43
+ /// Reads the interrupt pending bit for this pin
33
44
fn check_interrupt ( & self ) -> bool ;
34
45
}
35
46
38
49
PIN : PinExt ,
39
50
PIN :: Mode : marker:: Interruptable ,
40
51
{
41
- /// Make corresponding EXTI line sensitive to this pin
42
52
#[ inline( always) ]
43
53
fn make_interrupt_source ( & mut self , syscfg : & mut SysCfg ) {
44
54
let i = self . pin_id ( ) ;
69
79
}
70
80
}
71
81
72
- /// Generate interrupt on rising edge, falling edge or both
73
82
#[ inline( always) ]
74
83
fn trigger_on_edge ( & mut self , exti : & mut EXTI , edge : Edge ) {
75
84
let i = self . pin_id ( ) ;
@@ -95,27 +104,23 @@ where
95
104
}
96
105
}
97
106
98
- /// Enable external interrupts from this pin.
99
107
#[ inline( always) ]
100
108
fn enable_interrupt ( & mut self , exti : & mut EXTI ) {
101
109
exti. imr
102
110
. modify ( |r, w| unsafe { w. bits ( r. bits ( ) | ( 1 << self . pin_id ( ) ) ) } ) ;
103
111
}
104
112
105
- /// Disable external interrupts from this pin
106
113
#[ inline( always) ]
107
114
fn disable_interrupt ( & mut self , exti : & mut EXTI ) {
108
115
exti. imr
109
116
. modify ( |r, w| unsafe { w. bits ( r. bits ( ) & !( 1 << self . pin_id ( ) ) ) } ) ;
110
117
}
111
118
112
- /// Clear the interrupt pending bit for this pin
113
119
#[ inline( always) ]
114
120
fn clear_interrupt_pending_bit ( & mut self ) {
115
121
unsafe { ( * EXTI :: ptr ( ) ) . pr . write ( |w| w. bits ( 1 << self . pin_id ( ) ) ) } ;
116
122
}
117
123
118
- /// Reads the interrupt pending bit for this pin
119
124
#[ inline( always) ]
120
125
fn check_interrupt ( & self ) -> bool {
121
126
unsafe { ( ( * EXTI :: ptr ( ) ) . pr . read ( ) . bits ( ) & ( 1 << self . pin_id ( ) ) ) != 0 }
0 commit comments