diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-07-15 00:30:31 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-07-15 00:37:00 +0200 |
| commit | 71c8d7aa7d84175810b6495c72d3767179d6b341 (patch) | |
| tree | 4540627162f510fed391a82f691a05d932e91756 /examples/stm32l4/src/bin/button.rs | |
| parent | f916fe54760b51a12876b8d060531aa773a75e6d (diff) | |
stm32l4/examples: remove old-pac uses.
Diffstat (limited to 'examples/stm32l4/src/bin/button.rs')
| -rw-r--r-- | examples/stm32l4/src/bin/button.rs | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/examples/stm32l4/src/bin/button.rs b/examples/stm32l4/src/bin/button.rs index 3efeee20f..c72463605 100644 --- a/examples/stm32l4/src/bin/button.rs +++ b/examples/stm32l4/src/bin/button.rs | |||
| @@ -8,34 +8,36 @@ | |||
| 8 | 8 | ||
| 9 | #[path = "../example_common.rs"] | 9 | #[path = "../example_common.rs"] |
| 10 | mod example_common; | 10 | mod example_common; |
| 11 | use cortex_m_rt::entry; | ||
| 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 13 | use embassy_stm32::pac; | ||
| 12 | use embedded_hal::digital::v2::{InputPin, OutputPin}; | 14 | use embedded_hal::digital::v2::{InputPin, OutputPin}; |
| 13 | use example_common::*; | 15 | use example_common::*; |
| 14 | 16 | ||
| 15 | use cortex_m_rt::entry; | ||
| 16 | use stm32l4::stm32l4x5 as pac; | ||
| 17 | |||
| 18 | #[entry] | 17 | #[entry] |
| 19 | fn main() -> ! { | 18 | fn main() -> ! { |
| 20 | info!("Hello World!"); | 19 | info!("Hello World!"); |
| 21 | 20 | ||
| 22 | let pp = pac::Peripherals::take().unwrap(); | 21 | unsafe { |
| 23 | 22 | pac::DBGMCU.cr().modify(|w| { | |
| 24 | pp.DBGMCU.cr.modify(|_, w| { | 23 | w.set_dbg_sleep(true); |
| 25 | w.dbg_sleep().set_bit(); | 24 | w.set_dbg_standby(true); |
| 26 | w.dbg_standby().set_bit(); | 25 | w.set_dbg_stop(true); |
| 27 | w.dbg_stop().set_bit() | 26 | }); |
| 28 | }); | 27 | |
| 29 | 28 | pac::RCC.apb2enr().modify(|w| { | |
| 30 | pp.RCC.ahb2enr.modify(|_, w| { | 29 | w.set_syscfgen(true); |
| 31 | w.gpioaen().set_bit(); | 30 | }); |
| 32 | w.gpioben().set_bit(); | 31 | |
| 33 | w.gpiocen().set_bit(); | 32 | pac::RCC.ahb2enr().modify(|w| { |
| 34 | w.gpioden().set_bit(); | 33 | w.set_gpioaen(true); |
| 35 | w.gpioeen().set_bit(); | 34 | w.set_gpioben(true); |
| 36 | w.gpiofen().set_bit(); | 35 | w.set_gpiocen(true); |
| 37 | w | 36 | w.set_gpioden(true); |
| 38 | }); | 37 | w.set_gpioeen(true); |
| 38 | w.set_gpiofen(true); | ||
| 39 | }); | ||
| 40 | } | ||
| 39 | 41 | ||
| 40 | let p = embassy_stm32::init(Default::default()); | 42 | let p = embassy_stm32::init(Default::default()); |
| 41 | 43 | ||
