Skip to content

Commit c969c7c

Browse files
Mark EXTI::listen as #[inline]
1 parent 7acca3e commit c969c7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/exti.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ pub fn line_is_triggered(reg: u32, line: u8) -> bool {
3434
}
3535

3636
impl ExtiExt for EXTI {
37+
// `port`, `line` and `edge` are almost always constants, so make sure they can be
38+
// constant-propagated by marking the function as `#[inline]`. This saves ~600 Bytes in some
39+
// simple apps (eg. the `pwr.rs` example).
40+
#[inline]
3741
fn listen(&self, syscfg: &mut SYSCFG, port: gpio::Port, line: u8, edge: TriggerEdge) {
3842
assert!(line <= 22);
3943
assert_ne!(line, 18);

0 commit comments

Comments
 (0)