aboutsummaryrefslogtreecommitdiff
path: root/docs/modules/ROOT/examples/layer-by-layer/blinky-hal
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2022-02-23 09:48:32 +0100
committerUlf Lilleengen <[email protected]>2022-02-23 09:48:32 +0100
commit092eef3ae7f90e33564f09fa6a887e8fc9ed88b8 (patch)
tree547db6b7241e749f1cad0285c12124d26de37639 /docs/modules/ROOT/examples/layer-by-layer/blinky-hal
parent4c6e61b3b1a82212510695b0d202bc8612b16b6c (diff)
Add documentation about the different embassy abstraction layers
The guide demonstrates the functionality offered by each layer in Embassy, using code examples.
Diffstat (limited to 'docs/modules/ROOT/examples/layer-by-layer/blinky-hal')
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml13
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs23
2 files changed, 36 insertions, 0 deletions
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
new file mode 100644
index 000000000..dbd3aba8b
--- /dev/null
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
@@ -0,0 +1,13 @@
1[package]
2name = "blinky-hal"
3version = "0.1.0"
4edition = "2021"
5
6[dependencies]
7cortex-m = "0.7"
8cortex-m-rt = "0.7"
9embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"], default-features = false }
10
11defmt = "0.3.0"
12defmt-rtt = "0.3.0"
13panic-probe = { version = "0.3.0", features = ["print-defmt"] }
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs
new file mode 100644
index 000000000..2064ea616
--- /dev/null
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs
@@ -0,0 +1,23 @@
1#![no_std]
2#![no_main]
3
4use cortex_m_rt::entry;
5use defmt_rtt as _;
6use panic_probe as _;
7
8use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
9
10#[entry]
11fn main() -> ! {
12 let p = embassy_stm32::init(Default::default());
13 let mut led = Output::new(p.PB14, Level::High, Speed::VeryHigh);
14 let button = Input::new(p.PC13, Pull::Up);
15
16 loop {
17 if button.is_low() {
18 led.set_high();
19 } else {
20 led.set_low();
21 }
22 }
23}