summaryrefslogtreecommitdiff
path: root/examples/stm32f3/src/bin/hello.rs
diff options
context:
space:
mode:
authorVasanthakumarV <vasanth260m12@gmail.com>2021-12-11 21:51:14 +0530
committerVasanthakumarV <vasanth260m12@gmail.com>2021-12-13 14:50:13 +0530
commita65c2bc2b43d82d5c0b5c192d68ef10f63901750 (patch)
tree1e7c2894dec0c7d03c4c841c4fc9ed90456824c0 /examples/stm32f3/src/bin/hello.rs
parent3f33d307ffc6c122abfa113e6c72a9f7acda40e5 (diff)
downloadembassy-a65c2bc2b43d82d5c0b5c192d68ef10f63901750.zip
[examples] Add examples for STM32F3
Diffstat (limited to 'examples/stm32f3/src/bin/hello.rs')
-rw-r--r--examples/stm32f3/src/bin/hello.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/stm32f3/src/bin/hello.rs b/examples/stm32f3/src/bin/hello.rs
new file mode 100644
index 00000000..9a67419f
--- /dev/null
+++ b/examples/stm32f3/src/bin/hello.rs
@@ -0,0 +1,28 @@
+#![no_std]
+#![no_main]
+#![feature(type_alias_impl_trait)]
+
+use defmt::info;
+use embassy::executor::Spawner;
+use embassy::time::{Duration, Timer};
+use embassy_stm32::time::Hertz;
+use embassy_stm32::Config;
+use embassy_stm32::Peripherals;
+
+#[path = "../example_common.rs"]
+mod example_common;
+
+fn config() -> Config {
+ let mut config = Config::default();
+ config.rcc.hse = Some(Hertz(8_000_000));
+ config.rcc.sysclk = Some(Hertz(16_000_000));
+ config
+}
+
+#[embassy::main(config = "config()")]
+async fn main(_spawner: Spawner, _p: Peripherals) -> ! {
+ loop {
+ info!("Hello World!");
+ Timer::after(Duration::from_secs(1)).await;
+ }
+}