diff options
| author | Ulf Lilleengen <[email protected]> | 2024-05-18 10:17:03 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2024-05-21 10:05:21 +0200 |
| commit | 739e5861c2e47db251725163fcd91cd822cf97b7 (patch) | |
| tree | 947dc7961ca7c42ec216056fc2adf616ab812b10 /docs/examples/layer-by-layer/blinky-hal | |
| parent | 51d553092550059afb22b2620cea14bbed21abff (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.toml | 14 | ||||
| -rw-r--r-- | docs/examples/layer-by-layer/blinky-hal/src/main.rs | 21 |
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] | ||
| 2 | name = "blinky-hal" | ||
| 3 | version = "0.1.0" | ||
| 4 | edition = "2021" | ||
| 5 | license = "MIT OR Apache-2.0" | ||
| 6 | |||
| 7 | [dependencies] | ||
| 8 | cortex-m = "0.7" | ||
| 9 | cortex-m-rt = "0.7" | ||
| 10 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] } | ||
| 11 | |||
| 12 | defmt = "0.3.0" | ||
| 13 | defmt-rtt = "0.3.0" | ||
| 14 | panic-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 | |||
| 4 | use cortex_m_rt::entry; | ||
| 5 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | ||
| 6 | use {defmt_rtt as _, panic_probe as _}; | ||
| 7 | |||
| 8 | #[entry] | ||
| 9 | fn 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 | } | ||
