aboutsummaryrefslogtreecommitdiff
path: root/examples/blink-blocking.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/blink-blocking.rs')
-rw-r--r--examples/blink-blocking.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/blink-blocking.rs b/examples/blink-blocking.rs
new file mode 100644
index 0000000..a3a71b9
--- /dev/null
+++ b/examples/blink-blocking.rs
@@ -0,0 +1,18 @@
+//! Slowly blink an LED while blocking on a timer.
+//!
+//! Use this as the minimum-viable runtime support. You don't
+//! need interrupts for this example.
+
+#![no_std]
+#![no_main]
+
+const PIT_PERIOD_US: u32 = 1_000_000;
+
+#[imxrt_rt::entry]
+fn main() -> ! {
+ let board::Resources { mut pit, led, .. } = board::prepare(PIT_PERIOD_US).unwrap();
+ loop {
+ led.toggle();
+ pit.blocking_delay();
+ }
+}