diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-01-04 23:58:13 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-01-05 00:00:44 +0100 |
| commit | 2eb0cc5df78b2abd38228ee1f07b7c446e17d362 (patch) | |
| tree | a9df2ed2c0acc481e19275473f981da098b541f1 /examples/stm32l0/src/bin/button_exti.rs | |
| parent | c3fd9a0f44ae898c5cf1272dab6b8f46e119fab3 (diff) | |
stm32/rcc: remove Rcc struct, RccExt trait.
All the RCC configuration is executed in init().
Diffstat (limited to 'examples/stm32l0/src/bin/button_exti.rs')
| -rw-r--r-- | examples/stm32l0/src/bin/button_exti.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/stm32l0/src/bin/button_exti.rs b/examples/stm32l0/src/bin/button_exti.rs index 20d6f5555..88c75ce6d 100644 --- a/examples/stm32l0/src/bin/button_exti.rs +++ b/examples/stm32l0/src/bin/button_exti.rs | |||
| @@ -8,16 +8,18 @@ mod example_common; | |||
| 8 | use embassy::executor::Spawner; | 8 | use embassy::executor::Spawner; |
| 9 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| 10 | use embassy_stm32::gpio::{Input, Pull}; | 10 | use embassy_stm32::gpio::{Input, Pull}; |
| 11 | use embassy_stm32::{rcc, Peripherals}; | 11 | use embassy_stm32::Peripherals; |
| 12 | use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; | 12 | use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; |
| 13 | use example_common::*; | 13 | use example_common::*; |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | fn config() -> embassy_stm32::Config { |
| 16 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 16 | let mut config = embassy_stm32::Config::default(); |
| 17 | let mut rcc = rcc::Rcc::new(p.RCC); | 17 | config.rcc.enable_hsi48 = true; |
| 18 | // Enables SYSCFG | 18 | config |
| 19 | let _ = rcc.enable_hsi48(&mut p.SYSCFG, p.CRS); | 19 | } |
| 20 | 20 | ||
| 21 | #[embassy::main(config = "config()")] | ||
| 22 | async fn main(_spawner: Spawner, p: Peripherals) { | ||
| 21 | let button = Input::new(p.PB2, Pull::Up); | 23 | let button = Input::new(p.PB2, Pull::Up); |
| 22 | let mut button = ExtiInput::new(button, p.EXTI2); | 24 | let mut button = ExtiInput::new(button, p.EXTI2); |
| 23 | 25 | ||
