diff options
| author | Ulf Lilleengen <[email protected]> | 2022-02-23 09:48:32 +0100 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2022-02-23 09:48:32 +0100 |
| commit | 092eef3ae7f90e33564f09fa6a887e8fc9ed88b8 (patch) | |
| tree | 547db6b7241e749f1cad0285c12124d26de37639 /docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src | |
| parent | 4c6e61b3b1a82212510695b0d202bc8612b16b6c (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/src')
| -rw-r--r-- | docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs | 23 |
1 files changed, 23 insertions, 0 deletions
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 | |||
| 4 | use cortex_m_rt::entry; | ||
| 5 | use defmt_rtt as _; | ||
| 6 | use panic_probe as _; | ||
| 7 | |||
| 8 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | ||
| 9 | |||
| 10 | #[entry] | ||
| 11 | fn 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 | } | ||
