Skip to content

Commit 3f49a46

Browse files
Move docs from impl to ExtiExt trait
They're easy to find there
1 parent 794acf1 commit 3f49a46

File tree

1 file changed

+36
-29
lines changed

1 file changed

+36
-29
lines changed

src/exti.rs

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,57 @@ pub enum TriggerEdge {
2222

2323
/// Extension trait providing a high-level API for the EXTI controller.
2424
pub trait ExtiExt {
25+
/// Starts listening to a GPIO interrupt line.
26+
///
27+
/// GPIO interrupt lines are "configurable" lines, meaning that the edges
28+
/// that should trigger the interrupt can be configured. However, they
29+
/// require more setup than ordinary "configurable" lines, which requires
30+
/// access to the `SYSCFG` peripheral.
2531
fn listen_gpio(&mut self, syscfg: &mut SYSCFG, port: gpio::Port, line: GpioLine, edge: TriggerEdge);
32+
33+
/// Starts listening to a configurable interrupt line.
34+
///
35+
/// The edges that should trigger the interrupt can be configured with
36+
/// `edge`.
2637
fn listen_configurable(&mut self, line: ConfigurableLine, edge: TriggerEdge);
38+
39+
/// Starts listening to a "direct" interrupt line.
2740
fn listen_direct(&mut self, line: DirectLine);
2841

42+
/// Disables the interrupt on `line`.
2943
fn unlisten<L: ExtiLine>(&mut self, line: L);
3044

45+
/// Marks `line` as "pending".
46+
///
47+
/// This will cause an interrupt if the EXTI was previously configured to
48+
/// listen on `line`.
49+
///
50+
/// If `line` is already pending, this does nothing.
3151
fn pend<L: ExtiLine>(line: L);
52+
53+
/// Marks `line` as "not pending".
54+
///
55+
/// This should be called from an interrupt handler to ensure that the
56+
/// interrupt doesn't continuously fire.
3257
fn unpend<L: ExtiLine>(line: L);
58+
59+
/// Returns whether `line` is currently marked as pending.
3360
fn is_pending<L: ExtiLine>(line: L) -> bool;
3461

62+
/// Enters a low-power mode until an EXTI interrupt occurs.
63+
///
64+
/// Please note that this method will return after _any_ interrupt that can
65+
/// wake up the microcontroller from the given power mode.
66+
///
67+
/// # Panics
68+
///
69+
/// Panics, if `line` is an invalid EXTI line (reserved or not defined).
70+
/// Check the Reference Manual for a list of valid lines.
3571
fn wait_for_irq<L, M>(&mut self, line: L, power_mode: M)
3672
where L: ExtiLine, M: PowerMode;
3773
}
3874

3975
impl ExtiExt for EXTI {
40-
/// Starts listening to a GPIO interrupt line.
41-
///
42-
/// GPIO interrupt lines are "configurable" lines, meaning that the edges
43-
/// that should trigger the interrupt can be configured. However, they
44-
/// require more setup than ordinary "configurable" lines, which requires
45-
/// access to the `SYSCFG` peripheral.
4676
// `port` and `line` are almost always constants, so make sure they can get constant-propagated
4777
// by inlining the method. Saves ~600 Bytes in the `lptim.rs` example.
4878
#[inline]
@@ -122,10 +152,6 @@ impl ExtiExt for EXTI {
122152
}
123153
}
124154

125-
/// Starts listening to a configurable interrupt line.
126-
///
127-
/// The edges that should trigger the interrupt can be configured with
128-
/// `edge`.
129155
#[inline]
130156
fn listen_configurable(&mut self, line: ConfigurableLine, edge: TriggerEdge) {
131157
let bm: u32 = 1 << line.raw_line();
@@ -144,7 +170,6 @@ impl ExtiExt for EXTI {
144170
}
145171
}
146172

147-
/// Starts listening to a "direct" interrupt line.
148173
#[inline]
149174
fn listen_direct(&mut self, line: DirectLine) {
150175
let bm: u32 = 1 << line.raw_line();
@@ -154,7 +179,6 @@ impl ExtiExt for EXTI {
154179
}
155180
}
156181

157-
/// Disables the interrupt on `line`.
158182
fn unlisten<L: ExtiLine>(&mut self, line: L) {
159183
let bm = 1 << line.raw_line();
160184

@@ -166,12 +190,6 @@ impl ExtiExt for EXTI {
166190
}
167191
}
168192

169-
/// Marks `line` as "pending".
170-
///
171-
/// This will cause an interrupt if the EXTI was previously configured to
172-
/// listen on `line`.
173-
///
174-
/// If `line` is already pending, this does nothing.
175193
fn pend<L: ExtiLine>(line: L) {
176194
let line = line.raw_line();
177195

@@ -186,7 +204,6 @@ impl ExtiExt for EXTI {
186204
}
187205
}
188206

189-
/// Marks `line` as "not pending".
190207
fn unpend<L: ExtiLine>(line: L) {
191208
let line = line.raw_line();
192209

@@ -201,7 +218,6 @@ impl ExtiExt for EXTI {
201218
}
202219
}
203220

204-
/// Returns whether `line` is currently marked as pending.
205221
fn is_pending<L: ExtiLine>(line: L) -> bool {
206222
let bm: u32 = 1 << line.raw_line();
207223

@@ -212,15 +228,6 @@ impl ExtiExt for EXTI {
212228
pr & bm != 0
213229
}
214230

215-
/// Enters a low-power mode until an interrupt occurs.
216-
///
217-
/// Please note that this method will return after _any_ interrupt that can
218-
/// wake up the microcontroller from the given power mode.
219-
///
220-
/// # Panics
221-
///
222-
/// Panics, if `line` is an invalid EXTI line (reserved or not defined).
223-
/// Check the Reference Manual for a list of valid lines.
224231
fn wait_for_irq<L, M>(&mut self, line: L, mut power_mode: M)
225232
where L: ExtiLine, M: PowerMode,
226233
{

0 commit comments

Comments
 (0)