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 | |
| parent | f916fe54760b51a12876b8d060531aa773a75e6d (diff) | |
stm32l4/examples: remove old-pac uses.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32l4/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/blinky.rs | 38 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/button.rs | 42 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/button_exti.rs | 47 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/spi.rs | 42 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/usart.rs | 70 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/usart_dma.rs | 68 |
7 files changed, 147 insertions, 162 deletions
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index 48125c4f8..069c1434d 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml | |||
| @@ -19,7 +19,7 @@ defmt-error = [] | |||
| 19 | [dependencies] | 19 | [dependencies] |
| 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } | 20 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } |
| 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } | 21 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } |
| 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32l4s5vi"] } | 22 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "unstable-pac", "stm32l4s5vi"] } |
| 23 | embassy-extras = {version = "0.1.0", path = "../../embassy-extras" } | 23 | embassy-extras = {version = "0.1.0", path = "../../embassy-extras" } |
| 24 | stm32l4 = { version = "0.13", features = ["stm32l4x5" ] } | 24 | stm32l4 = { version = "0.13", features = ["stm32l4x5" ] } |
| 25 | stm32l4xx-hal = { version = "0.6.0", features = ["stm32l4x5"] } | 25 | stm32l4xx-hal = { version = "0.6.0", features = ["stm32l4x5"] } |
diff --git a/examples/stm32l4/src/bin/blinky.rs b/examples/stm32l4/src/bin/blinky.rs index ae4b3d1d1..0af16867f 100644 --- a/examples/stm32l4/src/bin/blinky.rs +++ b/examples/stm32l4/src/bin/blinky.rs | |||
| @@ -8,34 +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::{Level, Output, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 13 | use embassy_stm32::pac; | ||
| 12 | use embedded_hal::digital::v2::OutputPin; | 14 | use embedded_hal::digital::v2::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.ahb2enr().modify(|w| { | |
| 30 | pp.RCC.ahb2enr.modify(|_, w| { | 29 | w.set_gpioaen(true); |
| 31 | w.gpioaen().set_bit(); | 30 | w.set_gpioben(true); |
| 32 | w.gpioben().set_bit(); | 31 | w.set_gpiocen(true); |
| 33 | w.gpiocen().set_bit(); | 32 | w.set_gpioden(true); |
| 34 | w.gpioden().set_bit(); | 33 | w.set_gpioeen(true); |
| 35 | w.gpioeen().set_bit(); | 34 | w.set_gpiofen(true); |
| 36 | w.gpiofen().set_bit(); | 35 | }); |
| 37 | w | 36 | } |
| 38 | }); | ||
| 39 | 37 | ||
| 40 | let p = embassy_stm32::init(Default::default()); | 38 | let p = embassy_stm32::init(Default::default()); |
| 41 | 39 | ||
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 | ||
diff --git a/examples/stm32l4/src/bin/button_exti.rs b/examples/stm32l4/src/bin/button_exti.rs index c6b7c83ec..6a06e4370 100644 --- a/examples/stm32l4/src/bin/button_exti.rs +++ b/examples/stm32l4/src/bin/button_exti.rs | |||
| @@ -8,17 +8,16 @@ | |||
| 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::executor::Executor; | 12 | use embassy::executor::Executor; |
| 12 | use embassy::time::Clock; | 13 | use embassy::time::Clock; |
| 13 | use embassy::util::Forever; | 14 | use embassy::util::Forever; |
| 14 | use embassy_stm32::exti::ExtiInput; | 15 | use embassy_stm32::exti::ExtiInput; |
| 15 | use embassy_stm32::gpio::{Input, Pull}; | 16 | use embassy_stm32::gpio::{Input, Pull}; |
| 17 | use embassy_stm32::pac; | ||
| 16 | use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; | 18 | use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge}; |
| 17 | use example_common::*; | 19 | use example_common::*; |
| 18 | 20 | ||
| 19 | use cortex_m_rt::entry; | ||
| 20 | use stm32l4::stm32l4x5 as pac; | ||
| 21 | |||
| 22 | #[embassy::task] | 21 | #[embassy::task] |
| 23 | async fn main_task() { | 22 | async fn main_task() { |
| 24 | let p = embassy_stm32::init(Default::default()); | 23 | let p = embassy_stm32::init(Default::default()); |
| @@ -50,28 +49,26 @@ static EXECUTOR: Forever<Executor> = Forever::new(); | |||
| 50 | fn main() -> ! { | 49 | fn main() -> ! { |
| 51 | info!("Hello World!"); | 50 | info!("Hello World!"); |
| 52 | 51 | ||
| 53 | let pp = pac::Peripherals::take().unwrap(); | 52 | unsafe { |
| 54 | 53 | pac::DBGMCU.cr().modify(|w| { | |
| 55 | pp.DBGMCU.cr.modify(|_, w| { | 54 | w.set_dbg_sleep(true); |
| 56 | w.dbg_sleep().set_bit(); | 55 | w.set_dbg_standby(true); |
| 57 | w.dbg_standby().set_bit(); | 56 | w.set_dbg_stop(true); |
| 58 | w.dbg_stop().set_bit() | 57 | }); |
| 59 | }); | 58 | |
| 60 | 59 | pac::RCC.apb2enr().modify(|w| { | |
| 61 | pp.RCC.ahb2enr.modify(|_, w| { | 60 | w.set_syscfgen(true); |
| 62 | w.gpioaen().set_bit(); | 61 | }); |
| 63 | w.gpioben().set_bit(); | 62 | |
| 64 | w.gpiocen().set_bit(); | 63 | pac::RCC.ahb2enr().modify(|w| { |
| 65 | w.gpioden().set_bit(); | 64 | w.set_gpioaen(true); |
| 66 | w.gpioeen().set_bit(); | 65 | w.set_gpioben(true); |
| 67 | w.gpiofen().set_bit(); | 66 | w.set_gpiocen(true); |
| 68 | w | 67 | w.set_gpioden(true); |
| 69 | }); | 68 | w.set_gpioeen(true); |
| 70 | 69 | w.set_gpiofen(true); | |
| 71 | pp.RCC.apb2enr.modify(|_, w| { | 70 | }); |
| 72 | w.syscfgen().set_bit(); | 71 | } |
| 73 | w | ||
| 74 | }); | ||
| 75 | 72 | ||
| 76 | unsafe { embassy::time::set_clock(&ZeroClock) }; | 73 | unsafe { embassy::time::set_clock(&ZeroClock) }; |
| 77 | 74 | ||
diff --git a/examples/stm32l4/src/bin/spi.rs b/examples/stm32l4/src/bin/spi.rs index 28c563c19..45ccfcebc 100644 --- a/examples/stm32l4/src/bin/spi.rs +++ b/examples/stm32l4/src/bin/spi.rs | |||
| @@ -9,37 +9,39 @@ | |||
| 9 | #[path = "../example_common.rs"] | 9 | #[path = "../example_common.rs"] |
| 10 | mod example_common; | 10 | mod example_common; |
| 11 | 11 | ||
| 12 | use embassy_stm32::gpio::{Level, Output, Speed}; | ||
| 13 | use embedded_hal::digital::v2::OutputPin; | ||
| 14 | use example_common::*; | ||
| 15 | |||
| 16 | use cortex_m_rt::entry; | 12 | use cortex_m_rt::entry; |
| 13 | use embassy_stm32::gpio::{Level, Output, Speed}; | ||
| 14 | use embassy_stm32::pac; | ||
| 17 | use embassy_stm32::spi::{Config, Spi}; | 15 | use embassy_stm32::spi::{Config, Spi}; |
| 18 | use embassy_stm32::time::Hertz; | 16 | use embassy_stm32::time::Hertz; |
| 19 | use embedded_hal::blocking::spi::Transfer; | 17 | use embedded_hal::blocking::spi::Transfer; |
| 20 | use stm32l4::stm32l4x5 as pac; | 18 | use embedded_hal::digital::v2::OutputPin; |
| 19 | use example_common::*; | ||
| 21 | 20 | ||
| 22 | #[entry] | 21 | #[entry] |
| 23 | fn main() -> ! { | 22 | fn main() -> ! { |
| 24 | info!("Hello World, dude!"); | 23 | info!("Hello World, dude!"); |
| 25 | 24 | ||
| 26 | let pp = pac::Peripherals::take().unwrap(); | 25 | unsafe { |
| 26 | pac::DBGMCU.cr().modify(|w| { | ||
| 27 | w.set_dbg_sleep(true); | ||
| 28 | w.set_dbg_standby(true); | ||
| 29 | w.set_dbg_stop(true); | ||
| 30 | }); | ||
| 27 | 31 | ||
| 28 | pp.DBGMCU.cr.modify(|_, w| { | 32 | pac::RCC.apb2enr().modify(|w| { |
| 29 | w.dbg_sleep().set_bit(); | 33 | w.set_syscfgen(true); |
| 30 | w.dbg_standby().set_bit(); | 34 | }); |
| 31 | w.dbg_stop().set_bit() | ||
| 32 | }); | ||
| 33 | 35 | ||
| 34 | pp.RCC.ahb2enr.modify(|_, w| { | 36 | pac::RCC.ahb2enr().modify(|w| { |
| 35 | w.gpioaen().set_bit(); | 37 | w.set_gpioaen(true); |
| 36 | w.gpioben().set_bit(); | 38 | w.set_gpioben(true); |
| 37 | w.gpiocen().set_bit(); | 39 | w.set_gpiocen(true); |
| 38 | w.gpioden().set_bit(); | 40 | w.set_gpioden(true); |
| 39 | w.gpioeen().set_bit(); | 41 | w.set_gpioeen(true); |
| 40 | w.gpiofen().set_bit(); | 42 | w.set_gpiofen(true); |
| 41 | w | 43 | }); |
| 42 | }); | 44 | } |
| 43 | 45 | ||
| 44 | let p = embassy_stm32::init(Default::default()); | 46 | let p = embassy_stm32::init(Default::default()); |
| 45 | 47 | ||
diff --git a/examples/stm32l4/src/bin/usart.rs b/examples/stm32l4/src/bin/usart.rs index dc0f649b7..e9a44f151 100644 --- a/examples/stm32l4/src/bin/usart.rs +++ b/examples/stm32l4/src/bin/usart.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | #![no_std] | 1 | #![no_std] |
| 3 | #![no_main] | 2 | #![no_main] |
| 4 | #![feature(trait_alias)] | 3 | #![feature(trait_alias)] |
| @@ -10,16 +9,15 @@ | |||
| 10 | #[path = "../example_common.rs"] | 9 | #[path = "../example_common.rs"] |
| 11 | mod example_common; | 10 | mod example_common; |
| 12 | use cortex_m::prelude::_embedded_hal_blocking_serial_Write; | 11 | use cortex_m::prelude::_embedded_hal_blocking_serial_Write; |
| 12 | use cortex_m_rt::entry; | ||
| 13 | use embassy::executor::Executor; | 13 | use embassy::executor::Executor; |
| 14 | use embassy::time::Clock; | 14 | use embassy::time::Clock; |
| 15 | use embassy::util::Forever; | 15 | use embassy::util::Forever; |
| 16 | use embassy_stm32::dma_traits::NoDma; | ||
| 17 | use embassy_stm32::pac; | ||
| 16 | use embassy_stm32::usart::{Config, Uart}; | 18 | use embassy_stm32::usart::{Config, Uart}; |
| 17 | use example_common::*; | 19 | use example_common::*; |
| 18 | 20 | ||
| 19 | use cortex_m_rt::entry; | ||
| 20 | use stm32l4::stm32l4x5 as pac; | ||
| 21 | use embassy_stm32::dma_traits::NoDma; | ||
| 22 | |||
| 23 | #[embassy::task] | 21 | #[embassy::task] |
| 24 | async fn main_task() { | 22 | async fn main_task() { |
| 25 | let p = embassy_stm32::init(Default::default()); | 23 | let p = embassy_stm32::init(Default::default()); |
| @@ -51,38 +49,34 @@ static EXECUTOR: Forever<Executor> = Forever::new(); | |||
| 51 | fn main() -> ! { | 49 | fn main() -> ! { |
| 52 | info!("Hello World!"); | 50 | info!("Hello World!"); |
| 53 | 51 | ||
| 54 | let pp = pac::Peripherals::take().unwrap(); | 52 | unsafe { |
| 55 | 53 | pac::DBGMCU.cr().modify(|w| { | |
| 56 | pp.DBGMCU.cr.modify(|_, w| { | 54 | w.set_dbg_sleep(true); |
| 57 | w.dbg_sleep().set_bit(); | 55 | w.set_dbg_standby(true); |
| 58 | w.dbg_standby().set_bit(); | 56 | w.set_dbg_stop(true); |
| 59 | w.dbg_stop().set_bit() | 57 | }); |
| 60 | }); | 58 | |
| 61 | 59 | pac::RCC.ahb1enr().modify(|w| { | |
| 62 | pp.RCC.ahb1enr.modify(|_, w| { | 60 | w.set_dma1en(true); |
| 63 | w.dma1en().set_bit(); | 61 | }); |
| 64 | w | 62 | |
| 65 | }); | 63 | pac::RCC.ahb2enr().modify(|w| { |
| 66 | 64 | w.set_gpioaen(true); | |
| 67 | pp.RCC.ahb2enr.modify(|_, w| { | 65 | w.set_gpioben(true); |
| 68 | w.gpioaen().set_bit(); | 66 | w.set_gpiocen(true); |
| 69 | w.gpioben().set_bit(); | 67 | w.set_gpioden(true); |
| 70 | w.gpiocen().set_bit(); | 68 | w.set_gpioeen(true); |
| 71 | w.gpioden().set_bit(); | 69 | w.set_gpiofen(true); |
| 72 | w.gpioeen().set_bit(); | 70 | }); |
| 73 | w.gpiofen().set_bit(); | 71 | |
| 74 | w | 72 | pac::RCC.apb1enr1().modify(|w| { |
| 75 | }); | 73 | w.set_uart4en(true); |
| 76 | 74 | }); | |
| 77 | pp.RCC.apb1enr1.modify(|_, w| { | 75 | |
| 78 | w.uart4en().set_bit(); | 76 | pac::RCC.apb2enr().modify(|w| { |
| 79 | w | 77 | w.set_syscfgen(true); |
| 80 | }); | 78 | }); |
| 81 | 79 | } | |
| 82 | pp.RCC.apb2enr.modify(|_, w| { | ||
| 83 | w.syscfgen().set_bit(); | ||
| 84 | w | ||
| 85 | }); | ||
| 86 | 80 | ||
| 87 | unsafe { embassy::time::set_clock(&ZeroClock) }; | 81 | unsafe { embassy::time::set_clock(&ZeroClock) }; |
| 88 | 82 | ||
| @@ -91,4 +85,4 @@ fn main() -> ! { | |||
| 91 | executor.run(|spawner| { | 85 | executor.run(|spawner| { |
| 92 | unwrap!(spawner.spawn(main_task())); | 86 | unwrap!(spawner.spawn(main_task())); |
| 93 | }) | 87 | }) |
| 94 | } \ No newline at end of file | 88 | } |
diff --git a/examples/stm32l4/src/bin/usart_dma.rs b/examples/stm32l4/src/bin/usart_dma.rs index 6a2341859..1eadd3ad4 100644 --- a/examples/stm32l4/src/bin/usart_dma.rs +++ b/examples/stm32l4/src/bin/usart_dma.rs | |||
| @@ -13,12 +13,12 @@ use cortex_m_rt::entry; | |||
| 13 | use embassy::executor::Executor; | 13 | use embassy::executor::Executor; |
| 14 | use embassy::time::Clock; | 14 | use embassy::time::Clock; |
| 15 | use embassy::util::Forever; | 15 | use embassy::util::Forever; |
| 16 | use embassy_stm32::dma_traits::NoDma; | ||
| 17 | use embassy_stm32::pac; | ||
| 16 | use embassy_stm32::usart::{Config, Uart}; | 18 | use embassy_stm32::usart::{Config, Uart}; |
| 19 | use embassy_traits::uart::Write as _; | ||
| 17 | use example_common::*; | 20 | use example_common::*; |
| 18 | use heapless::String; | 21 | use heapless::String; |
| 19 | use stm32l4::stm32l4x5 as pac; | ||
| 20 | use embassy_stm32::dma_traits::NoDma; | ||
| 21 | use embassy_traits::uart::Write as AsyncWrite; | ||
| 22 | 22 | ||
| 23 | #[embassy::task] | 23 | #[embassy::task] |
| 24 | async fn main_task() { | 24 | async fn main_task() { |
| @@ -31,7 +31,7 @@ async fn main_task() { | |||
| 31 | let mut s: String<128> = String::new(); | 31 | let mut s: String<128> = String::new(); |
| 32 | core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap(); | 32 | core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap(); |
| 33 | 33 | ||
| 34 | usart.write( s.as_bytes() ).await.ok(); | 34 | usart.write(s.as_bytes()).await.ok(); |
| 35 | 35 | ||
| 36 | info!("wrote DMA"); | 36 | info!("wrote DMA"); |
| 37 | } | 37 | } |
| @@ -51,40 +51,32 @@ static EXECUTOR: Forever<Executor> = Forever::new(); | |||
| 51 | fn main() -> ! { | 51 | fn main() -> ! { |
| 52 | info!("Hello World!"); | 52 | info!("Hello World!"); |
| 53 | 53 | ||
| 54 | let pp = pac::Peripherals::take().unwrap(); | 54 | unsafe { |
| 55 | 55 | pac::DBGMCU.cr().modify(|w| { | |
| 56 | pp.DBGMCU.cr.modify(|_, w| { | 56 | w.set_dbg_sleep(true); |
| 57 | w.dbg_sleep().set_bit(); | 57 | w.set_dbg_standby(true); |
| 58 | w.dbg_standby().set_bit(); | 58 | w.set_dbg_stop(true); |
| 59 | w.dbg_stop().set_bit() | 59 | }); |
| 60 | }); | 60 | |
| 61 | 61 | pac::RCC.apb2enr().modify(|w| { | |
| 62 | pp.RCC.ahb1enr.modify(|_, w| { | 62 | w.set_syscfgen(true); |
| 63 | unsafe { | 63 | }); |
| 64 | w.bits( 0x07 ); | 64 | |
| 65 | } | 65 | pac::RCC.ahb1enr().modify(|w| { |
| 66 | w | 66 | w.set_dmamux1en(true); |
| 67 | //w.dmamuxen().set_bit(); | 67 | w.set_dma1en(true); |
| 68 | //w.dma1en().set_bit(); | 68 | w.set_dma2en(true); |
| 69 | //w.dma2en().set_bit(); | 69 | }); |
| 70 | //w | 70 | |
| 71 | }); | 71 | pac::RCC.ahb2enr().modify(|w| { |
| 72 | 72 | w.set_gpioaen(true); | |
| 73 | pp.RCC.ahb2enr.modify(|_, w| { | 73 | w.set_gpioben(true); |
| 74 | w.gpioaen().set_bit(); | 74 | w.set_gpiocen(true); |
| 75 | w.gpioben().set_bit(); | 75 | w.set_gpioden(true); |
| 76 | w.gpiocen().set_bit(); | 76 | w.set_gpioeen(true); |
| 77 | w.gpioden().set_bit(); | 77 | w.set_gpiofen(true); |
| 78 | w.gpioeen().set_bit(); | 78 | }); |
| 79 | w.gpiofen().set_bit(); | 79 | } |
| 80 | w | ||
| 81 | }); | ||
| 82 | |||
| 83 | pp.RCC.apb2enr.modify(|_, w| { | ||
| 84 | w.syscfgen().set_bit(); | ||
| 85 | w | ||
| 86 | }); | ||
| 87 | |||
| 88 | 80 | ||
| 89 | unsafe { embassy::time::set_clock(&ZeroClock) }; | 81 | unsafe { embassy::time::set_clock(&ZeroClock) }; |
| 90 | 82 | ||
