diff options
| author | Thales Fragoso <[email protected]> | 2021-07-28 16:02:56 -0300 |
|---|---|---|
| committer | Thales Fragoso <[email protected]> | 2021-07-29 18:43:15 -0300 |
| commit | e7714983b3f6ff5084e1cb27bc4de794f98081fd (patch) | |
| tree | ccedd3ed5d3f51627b60f1216e8da9098947e623 /examples | |
| parent | 5abaf8e9d6a673bbbf7e900b15a77d6e7d1a2962 (diff) | |
f4-rcc: Add option to enable debug_wfe and add hello example
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..8d4be7150 --- /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(32_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 | } | ||
