diff options
| author | Timo Kröger <[email protected]> | 2021-07-23 17:49:53 +0200 |
|---|---|---|
| committer | Timo Kröger <[email protected]> | 2021-07-23 17:54:14 +0200 |
| commit | 57eecd42926e917a55798c4a0fa463b45053687d (patch) | |
| tree | f419ff9149dd4e4b3262e6a88db35cf345459391 /examples/stm32f4 | |
| parent | 5ac91933ff0e4643823c77b357d90e82007fc9fb (diff) | |
Use `Dbgmcu::enable_all()` in stm32f4 examples
Diffstat (limited to 'examples/stm32f4')
| -rw-r--r-- | examples/stm32f4/src/bin/blinky.rs | 8 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/button.rs | 8 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/button_exti.rs | 7 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/spi.rs | 1 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/usart.rs | 8 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/usart_dma.rs | 17 |
6 files changed, 10 insertions, 39 deletions
diff --git a/examples/stm32f4/src/bin/blinky.rs b/examples/stm32f4/src/bin/blinky.rs index da512dcec..9e50c95c8 100644 --- a/examples/stm32f4/src/bin/blinky.rs +++ b/examples/stm32f4/src/bin/blinky.rs | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | 8 | ||
| 9 | #[path = "../example_common.rs"] | 9 | #[path = "../example_common.rs"] |
| 10 | mod example_common; | 10 | mod example_common; |
| 11 | use embassy_stm32::dbgmcu::Dbgmcu; | ||
| 11 | use embassy_stm32::gpio::{Level, Output, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 12 | use embassy_stm32::pac; | ||
| 13 | use embedded_hal::digital::v2::OutputPin; | 13 | use embedded_hal::digital::v2::OutputPin; |
| 14 | use example_common::*; | 14 | use example_common::*; |
| 15 | 15 | ||
| @@ -20,11 +20,7 @@ fn main() -> ! { | |||
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | 21 | ||
| 22 | unsafe { | 22 | unsafe { |
| 23 | pac::DBGMCU.cr().modify(|w| { | 23 | Dbgmcu::enable_all(); |
| 24 | w.set_dbg_sleep(true); | ||
| 25 | w.set_dbg_standby(true); | ||
| 26 | w.set_dbg_stop(true); | ||
| 27 | }); | ||
| 28 | } | 24 | } |
| 29 | 25 | ||
| 30 | let p = embassy_stm32::init(Default::default()); | 26 | let p = embassy_stm32::init(Default::default()); |
diff --git a/examples/stm32f4/src/bin/button.rs b/examples/stm32f4/src/bin/button.rs index 395ec4847..c61e85f09 100644 --- a/examples/stm32f4/src/bin/button.rs +++ b/examples/stm32f4/src/bin/button.rs | |||
| @@ -9,8 +9,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 cortex_m_rt::entry; |
| 12 | use embassy_stm32::dbgmcu::Dbgmcu; | ||
| 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 13 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 13 | use embassy_stm32::pac; | ||
| 14 | use embedded_hal::digital::v2::{InputPin, OutputPin}; | 14 | use embedded_hal::digital::v2::{InputPin, OutputPin}; |
| 15 | use example_common::*; | 15 | use example_common::*; |
| 16 | 16 | ||
| @@ -19,11 +19,7 @@ fn main() -> ! { | |||
| 19 | info!("Hello World!"); | 19 | info!("Hello World!"); |
| 20 | 20 | ||
| 21 | unsafe { | 21 | unsafe { |
| 22 | pac::DBGMCU.cr().modify(|w| { | 22 | Dbgmcu::enable_all(); |
| 23 | w.set_dbg_sleep(true); | ||
| 24 | w.set_dbg_standby(true); | ||
| 25 | w.set_dbg_stop(true); | ||
| 26 | }); | ||
| 27 | } | 23 | } |
| 28 | 24 | ||
| 29 | let p = embassy_stm32::init(Default::default()); | 25 | let p = embassy_stm32::init(Default::default()); |
diff --git a/examples/stm32f4/src/bin/button_exti.rs b/examples/stm32f4/src/bin/button_exti.rs index bccd3870d..6c51095eb 100644 --- a/examples/stm32f4/src/bin/button_exti.rs +++ b/examples/stm32f4/src/bin/button_exti.rs | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | mod example_common; | 10 | mod example_common; |
| 11 | use embassy::executor::Executor; | 11 | use embassy::executor::Executor; |
| 12 | use embassy::util::Forever; | 12 | use embassy::util::Forever; |
| 13 | use embassy_stm32::dbgmcu::Dbgmcu; | ||
| 13 | use embassy_stm32::exti::ExtiInput; | 14 | use embassy_stm32::exti::ExtiInput; |
| 14 | use embassy_stm32::gpio::{Input, Pull}; | 15 | use embassy_stm32::gpio::{Input, Pull}; |
| 15 | use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; | 16 | use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; |
| @@ -42,11 +43,7 @@ fn main() -> ! { | |||
| 42 | info!("Hello World!"); | 43 | info!("Hello World!"); |
| 43 | 44 | ||
| 44 | unsafe { | 45 | unsafe { |
| 45 | pac::DBGMCU.cr().modify(|w| { | 46 | Dbgmcu::enable_all(); |
| 46 | w.set_dbg_sleep(true); | ||
| 47 | w.set_dbg_standby(true); | ||
| 48 | w.set_dbg_stop(true); | ||
| 49 | }); | ||
| 50 | 47 | ||
| 51 | // EXTI clock | 48 | // EXTI clock |
| 52 | pac::RCC.apb2enr().modify(|w| { | 49 | pac::RCC.apb2enr().modify(|w| { |
diff --git a/examples/stm32f4/src/bin/spi.rs b/examples/stm32f4/src/bin/spi.rs index 40b0748d7..88fc84bc0 100644 --- a/examples/stm32f4/src/bin/spi.rs +++ b/examples/stm32f4/src/bin/spi.rs | |||
| @@ -15,7 +15,6 @@ use example_common::*; | |||
| 15 | 15 | ||
| 16 | use cortex_m_rt::entry; | 16 | use cortex_m_rt::entry; |
| 17 | use embassy_stm32::dbgmcu::Dbgmcu; | 17 | use embassy_stm32::dbgmcu::Dbgmcu; |
| 18 | use embassy_stm32::pac; | ||
| 19 | use embassy_stm32::spi::{Config, Spi}; | 18 | use embassy_stm32::spi::{Config, Spi}; |
| 20 | use embassy_stm32::time::Hertz; | 19 | use embassy_stm32::time::Hertz; |
| 21 | use embedded_hal::blocking::spi::Transfer; | 20 | use embedded_hal::blocking::spi::Transfer; |
diff --git a/examples/stm32f4/src/bin/usart.rs b/examples/stm32f4/src/bin/usart.rs index 51a2e0fd0..7cac33e9c 100644 --- a/examples/stm32f4/src/bin/usart.rs +++ b/examples/stm32f4/src/bin/usart.rs | |||
| @@ -11,12 +11,12 @@ mod example_common; | |||
| 11 | use cortex_m::prelude::_embedded_hal_blocking_serial_Write; | 11 | use cortex_m::prelude::_embedded_hal_blocking_serial_Write; |
| 12 | use embassy::executor::Executor; | 12 | use embassy::executor::Executor; |
| 13 | use embassy::util::Forever; | 13 | use embassy::util::Forever; |
| 14 | use embassy_stm32::dbgmcu::Dbgmcu; | ||
| 14 | use embassy_stm32::dma::NoDma; | 15 | use embassy_stm32::dma::NoDma; |
| 15 | use embassy_stm32::usart::{Config, Uart}; | 16 | use embassy_stm32::usart::{Config, Uart}; |
| 16 | use example_common::*; | 17 | use example_common::*; |
| 17 | 18 | ||
| 18 | use cortex_m_rt::entry; | 19 | use cortex_m_rt::entry; |
| 19 | use embassy_stm32::pac; | ||
| 20 | 20 | ||
| 21 | #[embassy::task] | 21 | #[embassy::task] |
| 22 | async fn main_task() { | 22 | async fn main_task() { |
| @@ -42,11 +42,7 @@ fn main() -> ! { | |||
| 42 | info!("Hello World!"); | 42 | info!("Hello World!"); |
| 43 | 43 | ||
| 44 | unsafe { | 44 | unsafe { |
| 45 | pac::DBGMCU.cr().modify(|w| { | 45 | Dbgmcu::enable_all(); |
| 46 | w.set_dbg_sleep(true); | ||
| 47 | w.set_dbg_standby(true); | ||
| 48 | w.set_dbg_stop(true); | ||
| 49 | }); | ||
| 50 | } | 46 | } |
| 51 | 47 | ||
| 52 | let executor = EXECUTOR.put(Executor::new()); | 48 | let executor = EXECUTOR.put(Executor::new()); |
diff --git a/examples/stm32f4/src/bin/usart_dma.rs b/examples/stm32f4/src/bin/usart_dma.rs index 9de46375e..552f8367d 100644 --- a/examples/stm32f4/src/bin/usart_dma.rs +++ b/examples/stm32f4/src/bin/usart_dma.rs | |||
| @@ -12,8 +12,8 @@ use core::fmt::Write; | |||
| 12 | use cortex_m_rt::entry; | 12 | use cortex_m_rt::entry; |
| 13 | use embassy::executor::Executor; | 13 | use embassy::executor::Executor; |
| 14 | use embassy::util::Forever; | 14 | use embassy::util::Forever; |
| 15 | use embassy_stm32::dbgmcu::Dbgmcu; | ||
| 15 | use embassy_stm32::dma::NoDma; | 16 | use embassy_stm32::dma::NoDma; |
| 16 | use embassy_stm32::pac; | ||
| 17 | use embassy_stm32::usart::{Config, Uart}; | 17 | use embassy_stm32::usart::{Config, Uart}; |
| 18 | use embassy_traits::uart::Write as _; | 18 | use embassy_traits::uart::Write as _; |
| 19 | use example_common::*; | 19 | use example_common::*; |
| @@ -42,20 +42,7 @@ fn main() -> ! { | |||
| 42 | info!("Hello World!"); | 42 | info!("Hello World!"); |
| 43 | 43 | ||
| 44 | unsafe { | 44 | unsafe { |
| 45 | pac::DBGMCU.cr().modify(|w| { | 45 | Dbgmcu::enable_all(); |
| 46 | w.set_dbg_sleep(true); | ||
| 47 | w.set_dbg_standby(true); | ||
| 48 | w.set_dbg_stop(true); | ||
| 49 | }); | ||
| 50 | |||
| 51 | pac::RCC.ahb1enr().modify(|w| { | ||
| 52 | w.set_gpioaen(true); | ||
| 53 | w.set_gpioben(true); | ||
| 54 | w.set_gpiocen(true); | ||
| 55 | w.set_gpioden(true); | ||
| 56 | w.set_gpioeen(true); | ||
| 57 | w.set_gpiofen(true); | ||
| 58 | }); | ||
| 59 | } | 46 | } |
| 60 | 47 | ||
| 61 | let executor = EXECUTOR.put(Executor::new()); | 48 | let executor = EXECUTOR.put(Executor::new()); |
