diff options
| author | Timo Kröger <[email protected]> | 2021-07-21 23:12:36 +0200 |
|---|---|---|
| committer | Timo Kröger <[email protected]> | 2021-07-21 23:12:36 +0200 |
| commit | 5e998d1a6c2a3307faae6b3a2f55d6712a394d59 (patch) | |
| tree | 4d56cffd2a40930c2c91b605b5adbaacaf970531 /examples/stm32f4/src/bin/button.rs | |
| parent | 40ea8298eedbe2430b647ab969d4a2e627b6ece8 (diff) | |
Cleanup stm32f4 examples
* Remove dependency on stm32f4 pac crate
* Remove unused `ZeroClock`
Diffstat (limited to 'examples/stm32f4/src/bin/button.rs')
| -rw-r--r-- | examples/stm32f4/src/bin/button.rs | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/examples/stm32f4/src/bin/button.rs b/examples/stm32f4/src/bin/button.rs index c7160d219..901fce418 100644 --- a/examples/stm32f4/src/bin/button.rs +++ b/examples/stm32f4/src/bin/button.rs | |||
| @@ -8,35 +8,32 @@ | |||
| 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 stm32f4::stm32f429 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 | pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); | 28 | pac::RCC.ahb1enr().modify(|w| { |
| 30 | 29 | w.set_gpioaen(true); | |
| 31 | pp.RCC.ahb1enr.modify(|_, w| { | 30 | w.set_gpioben(true); |
| 32 | w.gpioaen().enabled(); | 31 | w.set_gpiocen(true); |
| 33 | w.gpioben().enabled(); | 32 | w.set_gpioden(true); |
| 34 | w.gpiocen().enabled(); | 33 | w.set_gpioeen(true); |
| 35 | w.gpioden().enabled(); | 34 | w.set_gpiofen(true); |
| 36 | w.gpioeen().enabled(); | 35 | }); |
| 37 | w.gpiofen().enabled(); | 36 | } |
| 38 | w | ||
| 39 | }); | ||
| 40 | 37 | ||
| 41 | let p = embassy_stm32::init(Default::default()); | 38 | let p = embassy_stm32::init(Default::default()); |
| 42 | 39 | ||
