diff options
| author | Mariusz Ryndzionek <[email protected]> | 2021-09-26 17:08:22 +0200 |
|---|---|---|
| committer | Mariusz Ryndzionek <[email protected]> | 2021-09-28 18:31:04 +0200 |
| commit | bce909ec1eea95f93a6887aae5aa0b37d953ec85 (patch) | |
| tree | d22557144ceab9172e8b1d4784fab870d48b9816 /examples/stm32f1/src/bin/hello.rs | |
| parent | 1650983e463e5f237d68957b0de1537f807cbc63 (diff) | |
Initial STM32F1 family support with two examples for STM32F103C8 (Blue Pill)
Diffstat (limited to 'examples/stm32f1/src/bin/hello.rs')
| -rw-r--r-- | examples/stm32f1/src/bin/hello.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/stm32f1/src/bin/hello.rs b/examples/stm32f1/src/bin/hello.rs new file mode 100644 index 000000000..efcb9a244 --- /dev/null +++ b/examples/stm32f1/src/bin/hello.rs | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::info; | ||
| 6 | use embassy::executor::Spawner; | ||
| 7 | use embassy::time::{Duration, Timer}; | ||
| 8 | use embassy_stm32::time::Hertz; | ||
| 9 | use embassy_stm32::Config; | ||
| 10 | use embassy_stm32::Peripherals; | ||
| 11 | |||
| 12 | #[path = "../example_common.rs"] | ||
| 13 | mod example_common; | ||
| 14 | |||
| 15 | fn config() -> Config { | ||
| 16 | let mut config = Config::default(); | ||
| 17 | config.rcc.sys_ck = Some(Hertz(36_000_000)); | ||
| 18 | config | ||
| 19 | } | ||
| 20 | |||
| 21 | #[embassy::main(config = "config()")] | ||
| 22 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | ||
| 23 | loop { | ||
| 24 | info!("Hello World!"); | ||
| 25 | Timer::after(Duration::from_secs(1)).await; | ||
| 26 | } | ||
| 27 | } | ||
