diff options
| author | Mathieu Dupont <[email protected]> | 2023-04-03 16:41:25 +0200 |
|---|---|---|
| committer | Mathieu Dupont <[email protected]> | 2023-04-03 16:41:25 +0200 |
| commit | 4ce1c5f27dbb06641abddd2b10aebae1511a894b (patch) | |
| tree | e966a938f732b8aa9a0ee88aa9d6397d192183aa /examples/stm32l4/src/bin | |
| parent | 0909a6cd3ff6fb953aa2d83fb5da37384ad7dae2 (diff) | |
Add MCO support for L4 and F4 families
Diffstat (limited to 'examples/stm32l4/src/bin')
| -rw-r--r-- | examples/stm32l4/src/bin/mco.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/stm32l4/src/bin/mco.rs b/examples/stm32l4/src/bin/mco.rs new file mode 100644 index 000000000..dea0c66e0 --- /dev/null +++ b/examples/stm32l4/src/bin/mco.rs | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::*; | ||
| 6 | use embassy_executor::Spawner; | ||
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | ||
| 8 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; | ||
| 9 | use embassy_time::{Duration, Timer}; | ||
| 10 | use {defmt_rtt as _, panic_probe as _}; | ||
| 11 | |||
| 12 | #[embassy_executor::main] | ||
| 13 | async fn main(_spawner: Spawner) { | ||
| 14 | let p = embassy_stm32::init(Default::default()); | ||
| 15 | info!("Hello World!"); | ||
| 16 | |||
| 17 | let _mco = Mco::new(p.MCO, p.PA8, Mco1Source::Hsi16, McoClock::DIV1); | ||
| 18 | |||
| 19 | let mut led = Output::new(p.PB14, Level::High, Speed::Low); | ||
| 20 | |||
| 21 | loop { | ||
| 22 | led.set_high(); | ||
| 23 | Timer::after(Duration::from_millis(300)).await; | ||
| 24 | led.set_low(); | ||
| 25 | Timer::after(Duration::from_millis(300)).await; | ||
| 26 | } | ||
| 27 | } | ||
