Skip to content

Commit 06c1dfe

Browse files
committed
tests: drivers: gpio-async: Test the wait for high
Enhance the test to use the wait_for_high so that we don't poll while waiting for the key to be pressed. Signed-off-by: David Brown <[email protected]>
1 parent eb962b1 commit 06c1dfe

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

tests/drivers/gpio-async/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ license = "Apache-2.0 or MIT"
1313
crate-type = ["staticlib"]
1414

1515
[dependencies]
16-
zephyr = { version = "0.1.0", features = ["time-driver", "executor-zephyr"] }
16+
zephyr = { version = "0.1.0", features = ["time-driver", "executor-zephyr", "async-drivers"] }
1717
log = "0.4.22"
1818
static_cell = "2.1"
1919
heapless = "0.8"

tests/drivers/gpio-async/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ CONFIG_RUST=y
1111
CONFIG_RUST_ALLOC=y
1212
# CONFIG_LOG=y
1313
CONFIG_GPIO=y
14+
CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT=y
1415

1516
CONFIG_LOG_BACKEND_RTT=n

tests/drivers/gpio-async/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ async fn main(spawner: Spawner) {
5050
if current {
5151
info!("Pressed");
5252
} else {
53-
info!("Released");
53+
info!("Released: Waiting for high");
54+
unsafe { row0.wait_for_high(&mut gpio_token).await };
5455
}
5556
last = current;
5657
}

0 commit comments

Comments
 (0)