diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-07-31 11:08:46 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-31 11:08:46 +0200 |
| commit | 3835278567e05014158eeede15d62a57ee105518 (patch) | |
| tree | df0617979c36f81c5f8f68d1d7244a186d8b5ce6 /examples | |
| parent | e9885a61f88e3746275297a6d0ea7f837b302757 (diff) | |
| parent | 21e3acaa00f405397811c3abf71dbb26ea932896 (diff) | |
Merge pull request #321 from thalesfragoso/f4-pll
F4 PLL
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32f4/src/bin/hello.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/stm32f4/src/bin/hello.rs b/examples/stm32f4/src/bin/hello.rs new file mode 100644 index 000000000..8ee6c1ef8 --- /dev/null +++ b/examples/stm32f4/src/bin/hello.rs | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(trait_alias)] | ||
| 4 | #![feature(min_type_alias_impl_trait)] | ||
| 5 | #![feature(impl_trait_in_bindings)] | ||
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | #![allow(incomplete_features)] | ||
| 8 | |||
| 9 | use defmt::{info, panic}; | ||
| 10 | use embassy::executor::Spawner; | ||
| 11 | use embassy::time::{Duration, Timer}; | ||
| 12 | use embassy_stm32::rcc::Config as RccConfig; | ||
| 13 | use embassy_stm32::time::Hertz; | ||
| 14 | use embassy_stm32::Config; | ||
| 15 | use embassy_stm32::Peripherals; | ||
| 16 | |||
| 17 | #[path = "../example_common.rs"] | ||
| 18 | mod example_common; | ||
| 19 | |||
| 20 | fn config() -> Config { | ||
| 21 | let mut rcc_config = RccConfig::default(); | ||
| 22 | rcc_config.sys_ck = Some(Hertz(84_000_000)); | ||
| 23 | rcc_config.enable_debug_wfe = true; | ||
| 24 | |||
| 25 | Config::default().rcc(rcc_config) | ||
| 26 | } | ||
| 27 | |||
| 28 | #[embassy::main(config = "config()")] | ||
| 29 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | ||
| 30 | loop { | ||
| 31 | info!("Hello World!"); | ||
| 32 | Timer::after(Duration::from_secs(1)).await; | ||
| 33 | } | ||
| 34 | } | ||
