aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/layer-by-layer/blinky-hal
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-05-18 10:17:03 +0200
committerUlf Lilleengen <[email protected]>2024-05-21 10:05:21 +0200
commit739e5861c2e47db251725163fcd91cd822cf97b7 (patch)
tree947dc7961ca7c42ec216056fc2adf616ab812b10 /docs/examples/layer-by-layer/blinky-hal
parent51d553092550059afb22b2620cea14bbed21abff (diff)
convert from antora to asciidoctor
Diffstat (limited to 'docs/examples/layer-by-layer/blinky-hal')
-rw-r--r--docs/examples/layer-by-layer/blinky-hal/Cargo.toml14
-rw-r--r--docs/examples/layer-by-layer/blinky-hal/src/main.rs21
2 files changed, 35 insertions, 0 deletions
diff --git a/docs/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
new file mode 100644
index 000000000..c15de2db2
--- /dev/null
+++ b/docs/examples/layer-by-layer/blinky-hal/Cargo.toml
@@ -0,0 +1,14 @@
1[package]
2name = "blinky-hal"
3version = "0.1.0"
4edition = "2021"
5license = "MIT OR Apache-2.0"
6
7[dependencies]
8cortex-m = "0.7"
9cortex-m-rt = "0.7"
10embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] }
11
12defmt = "0.3.0"
13defmt-rtt = "0.3.0"
14panic-probe = { version = "0.3.0", features = ["print-defmt"] }
diff --git a/docs/examples/layer-by-layer/blinky-hal/src/main.rs b/docs/examples/layer-by-layer/blinky-hal/src/main.rs
new file mode 100644
index 000000000..d0c9f4907
--- /dev/null
+++ b/docs/examples/layer-by-layer/blinky-hal/src/main.rs
@@ -0,0 +1,21 @@
1#![no_std]
2#![no_main]
3
4use cortex_m_rt::entry;
5use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
6use {defmt_rtt as _, panic_probe as _};
7
8#[entry]
9fn main() -> ! {
10 let p = embassy_stm32::init(Default::default());
11 let mut led = Output::new(p.PB14, Level::High, Speed::VeryHigh);
12 let button = Input::new(p.PC13, Pull::Up);
13
14 loop {
15 if button.is_low() {
16 led.set_high();
17 } else {
18 led.set_low();
19 }
20 }
21}