aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bevenius <[email protected]>2022-07-22 07:09:26 +0200
committerDaniel Bevenius <[email protected]>2022-07-22 07:24:14 +0200
commite757b1882e976bc761183b9a0b7d880836d80ae3 (patch)
tree4dd2d1a5b13d2a748b868d286437423fe97769d5
parent0f4c0311feea48323ad60efa7bac3673d412cb60 (diff)
Add inline attribute to embassy-rp async functions
This commit adds the inline attribute to the recently added async gpio functions. This is to enable cross-crate inlining and to be consistent with the other functions implemented for Input and Flex.
-rw-r--r--embassy-rp/src/gpio.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index f205063c6..53c26de1c 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -84,22 +84,27 @@ impl<'d, T: Pin> Input<'d, T> {
84 self.pin.get_level() 84 self.pin.get_level()
85 } 85 }
86 86
87 #[inline]
87 pub async fn wait_for_high<'a>(&mut self) { 88 pub async fn wait_for_high<'a>(&mut self) {
88 self.pin.wait_for_high().await; 89 self.pin.wait_for_high().await;
89 } 90 }
90 91
92 #[inline]
91 pub async fn wait_for_low<'a>(&mut self) { 93 pub async fn wait_for_low<'a>(&mut self) {
92 self.pin.wait_for_low().await; 94 self.pin.wait_for_low().await;
93 } 95 }
94 96
97 #[inline]
95 pub async fn wait_for_rising_edge<'a>(&mut self) { 98 pub async fn wait_for_rising_edge<'a>(&mut self) {
96 self.pin.wait_for_rising_edge().await; 99 self.pin.wait_for_rising_edge().await;
97 } 100 }
98 101
102 #[inline]
99 pub async fn wait_for_falling_edge<'a>(&mut self) { 103 pub async fn wait_for_falling_edge<'a>(&mut self) {
100 self.pin.wait_for_falling_edge().await; 104 self.pin.wait_for_falling_edge().await;
101 } 105 }
102 106
107 #[inline]
103 pub async fn wait_for_any_edge<'a>(&mut self) { 108 pub async fn wait_for_any_edge<'a>(&mut self) {
104 self.pin.wait_for_any_edge().await; 109 self.pin.wait_for_any_edge().await;
105 } 110 }
@@ -547,24 +552,29 @@ impl<'d, T: Pin> Flex<'d, T> {
547 unsafe { self.pin.sio_out().value_xor().write_value(self.bit()) } 552 unsafe { self.pin.sio_out().value_xor().write_value(self.bit()) }
548 } 553 }
549 554
555 #[inline]
550 pub async fn wait_for_high<'a>(&mut self) { 556 pub async fn wait_for_high<'a>(&mut self) {
551 InputFuture::new(&mut self.pin, InterruptTrigger::LevelHigh).await; 557 InputFuture::new(&mut self.pin, InterruptTrigger::LevelHigh).await;
552 } 558 }
553 559
560 #[inline]
554 pub async fn wait_for_low<'a>(&mut self) { 561 pub async fn wait_for_low<'a>(&mut self) {
555 InputFuture::new(&mut self.pin, InterruptTrigger::LevelLow).await; 562 InputFuture::new(&mut self.pin, InterruptTrigger::LevelLow).await;
556 } 563 }
557 564
565 #[inline]
558 pub async fn wait_for_rising_edge<'a>(&mut self) { 566 pub async fn wait_for_rising_edge<'a>(&mut self) {
559 self.wait_for_low().await; 567 self.wait_for_low().await;
560 self.wait_for_high().await; 568 self.wait_for_high().await;
561 } 569 }
562 570
571 #[inline]
563 pub async fn wait_for_falling_edge<'a>(&mut self) { 572 pub async fn wait_for_falling_edge<'a>(&mut self) {
564 self.wait_for_high().await; 573 self.wait_for_high().await;
565 self.wait_for_low().await; 574 self.wait_for_low().await;
566 } 575 }
567 576
577 #[inline]
568 pub async fn wait_for_any_edge<'a>(&mut self) { 578 pub async fn wait_for_any_edge<'a>(&mut self) {
569 if self.is_high() { 579 if self.is_high() {
570 self.wait_for_low().await; 580 self.wait_for_low().await;