Merge pull request #293 from embassy-rs/pac-reexport
all hals: reexport PAC if `unstable-pac` feature is set.
This commit is contained in:
		
						commit
						d71be45a91
					
				@ -5,6 +5,13 @@ authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
 | 
				
			|||||||
edition = "2018"
 | 
					edition = "2018"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[features]
 | 
					[features]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Reexport the PAC for the currently enabled chip at `embassy_nrf::pac`.
 | 
				
			||||||
 | 
					# This is unstable because semver-minor (non-breaking) releases of embassy-nrf may major-bump (breaking) the PAC version.
 | 
				
			||||||
 | 
					# If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC.
 | 
				
			||||||
 | 
					# There are no plans to make this stable.
 | 
				
			||||||
 | 
					unstable-pac = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
defmt-trace = [ ]
 | 
					defmt-trace = [ ]
 | 
				
			||||||
defmt-debug = [ ]
 | 
					defmt-debug = [ ]
 | 
				
			||||||
defmt-info = [ ]
 | 
					defmt-info = [ ]
 | 
				
			||||||
 | 
				
			|||||||
@ -65,7 +65,11 @@ mod chip;
 | 
				
			|||||||
#[path = "chips/nrf52840.rs"]
 | 
					#[path = "chips/nrf52840.rs"]
 | 
				
			||||||
mod chip;
 | 
					mod chip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(feature = "unstable-pac")]
 | 
				
			||||||
 | 
					pub use chip::pac;
 | 
				
			||||||
 | 
					#[cfg(not(feature = "unstable-pac"))]
 | 
				
			||||||
pub(crate) use chip::pac;
 | 
					pub(crate) use chip::pac;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub use chip::{peripherals, Peripherals};
 | 
					pub use chip::{peripherals, Peripherals};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub mod interrupt {
 | 
					pub mod interrupt {
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,13 @@ authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
 | 
				
			|||||||
edition = "2018"
 | 
					edition = "2018"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[features]
 | 
					[features]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Reexport the PAC for the currently enabled chip at `embassy_rp::pac`.
 | 
				
			||||||
 | 
					# This is unstable because semver-minor (non-breaking) releases of embassy-nrf may major-bump (breaking) the PAC version.
 | 
				
			||||||
 | 
					# If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC.
 | 
				
			||||||
 | 
					# There are no plans to make this stable.
 | 
				
			||||||
 | 
					unstable-pac = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
defmt-trace = [ ]
 | 
					defmt-trace = [ ]
 | 
				
			||||||
defmt-debug = [ ]
 | 
					defmt-debug = [ ]
 | 
				
			||||||
defmt-info = [ ]
 | 
					defmt-info = [ ]
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,10 @@
 | 
				
			|||||||
#![feature(never_type)]
 | 
					#![feature(never_type)]
 | 
				
			||||||
#![allow(incomplete_features)]
 | 
					#![allow(incomplete_features)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(feature = "unstable-pac")]
 | 
				
			||||||
pub use rp2040_pac2 as pac;
 | 
					pub use rp2040_pac2 as pac;
 | 
				
			||||||
 | 
					#[cfg(not(feature = "unstable-pac"))]
 | 
				
			||||||
 | 
					pub(crate) use rp2040_pac2 as pac;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// This mod MUST go first, so that the others see its macros.
 | 
					// This mod MUST go first, so that the others see its macros.
 | 
				
			||||||
pub(crate) mod fmt;
 | 
					pub(crate) mod fmt;
 | 
				
			||||||
 | 
				
			|||||||
@ -43,6 +43,12 @@ defmt-error = [ ]
 | 
				
			|||||||
sdmmc-rs = ["embedded-sdmmc"]
 | 
					sdmmc-rs = ["embedded-sdmmc"]
 | 
				
			||||||
net = ["embassy-net", "vcell"]
 | 
					net = ["embassy-net", "vcell"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Reexport stm32-metapac at `embassy_stm32::pac`.
 | 
				
			||||||
 | 
					# This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version.
 | 
				
			||||||
 | 
					# If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC.
 | 
				
			||||||
 | 
					# There are no plans to make this stable.
 | 
				
			||||||
 | 
					unstable-pac = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# BEGIN GENERATED FEATURES
 | 
					# BEGIN GENERATED FEATURES
 | 
				
			||||||
# Generated by gen_features.py. DO NOT EDIT.
 | 
					# Generated by gen_features.py. DO NOT EDIT.
 | 
				
			||||||
stm32f030c6 = [ "stm32-metapac/stm32f030c6",]
 | 
					stm32f030c6 = [ "stm32-metapac/stm32f030c6",]
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,9 @@
 | 
				
			|||||||
#![feature(type_alias_impl_trait)]
 | 
					#![feature(type_alias_impl_trait)]
 | 
				
			||||||
#![allow(incomplete_features)]
 | 
					#![allow(incomplete_features)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(feature = "unstable-pac")]
 | 
				
			||||||
 | 
					pub use stm32_metapac as pac;
 | 
				
			||||||
 | 
					#[cfg(not(feature = "unstable-pac"))]
 | 
				
			||||||
pub(crate) use stm32_metapac as pac;
 | 
					pub(crate) use stm32_metapac as pac;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// This must go FIRST so that all the other modules see its macros.
 | 
					// This must go FIRST so that all the other modules see its macros.
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@ defmt-error = []
 | 
				
			|||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] }
 | 
					embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] }
 | 
				
			||||||
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
 | 
					embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
 | 
				
			||||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32l4s5vi"]  }
 | 
					embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "unstable-pac", "stm32l4s5vi"]  }
 | 
				
			||||||
embassy-extras = {version = "0.1.0", path = "../../embassy-extras" }
 | 
					embassy-extras = {version = "0.1.0", path = "../../embassy-extras" }
 | 
				
			||||||
stm32l4 = { version = "0.13", features = ["stm32l4x5" ] }
 | 
					stm32l4 = { version = "0.13", features = ["stm32l4x5" ] }
 | 
				
			||||||
stm32l4xx-hal = { version = "0.6.0", features = ["stm32l4x5"] }
 | 
					stm32l4xx-hal = { version = "0.6.0", features = ["stm32l4x5"] }
 | 
				
			||||||
 | 
				
			|||||||
@ -8,34 +8,32 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[path = "../example_common.rs"]
 | 
					#[path = "../example_common.rs"]
 | 
				
			||||||
mod example_common;
 | 
					mod example_common;
 | 
				
			||||||
 | 
					use cortex_m_rt::entry;
 | 
				
			||||||
use embassy_stm32::gpio::{Level, Output, Speed};
 | 
					use embassy_stm32::gpio::{Level, Output, Speed};
 | 
				
			||||||
 | 
					use embassy_stm32::pac;
 | 
				
			||||||
use embedded_hal::digital::v2::OutputPin;
 | 
					use embedded_hal::digital::v2::OutputPin;
 | 
				
			||||||
use example_common::*;
 | 
					use example_common::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use cortex_m_rt::entry;
 | 
					 | 
				
			||||||
use stm32l4::stm32l4x5 as pac;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[entry]
 | 
					#[entry]
 | 
				
			||||||
fn main() -> ! {
 | 
					fn main() -> ! {
 | 
				
			||||||
    info!("Hello World!");
 | 
					    info!("Hello World!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let pp = pac::Peripherals::take().unwrap();
 | 
					    unsafe {
 | 
				
			||||||
 | 
					        pac::DBGMCU.cr().modify(|w| {
 | 
				
			||||||
 | 
					            w.set_dbg_sleep(true);
 | 
				
			||||||
 | 
					            w.set_dbg_standby(true);
 | 
				
			||||||
 | 
					            w.set_dbg_stop(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.DBGMCU.cr.modify(|_, w| {
 | 
					        pac::RCC.ahb2enr().modify(|w| {
 | 
				
			||||||
        w.dbg_sleep().set_bit();
 | 
					            w.set_gpioaen(true);
 | 
				
			||||||
        w.dbg_standby().set_bit();
 | 
					            w.set_gpioben(true);
 | 
				
			||||||
        w.dbg_stop().set_bit()
 | 
					            w.set_gpiocen(true);
 | 
				
			||||||
    });
 | 
					            w.set_gpioden(true);
 | 
				
			||||||
 | 
					            w.set_gpioeen(true);
 | 
				
			||||||
    pp.RCC.ahb2enr.modify(|_, w| {
 | 
					            w.set_gpiofen(true);
 | 
				
			||||||
        w.gpioaen().set_bit();
 | 
					        });
 | 
				
			||||||
        w.gpioben().set_bit();
 | 
					    }
 | 
				
			||||||
        w.gpiocen().set_bit();
 | 
					 | 
				
			||||||
        w.gpioden().set_bit();
 | 
					 | 
				
			||||||
        w.gpioeen().set_bit();
 | 
					 | 
				
			||||||
        w.gpiofen().set_bit();
 | 
					 | 
				
			||||||
        w
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let p = embassy_stm32::init(Default::default());
 | 
					    let p = embassy_stm32::init(Default::default());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,34 +8,36 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[path = "../example_common.rs"]
 | 
					#[path = "../example_common.rs"]
 | 
				
			||||||
mod example_common;
 | 
					mod example_common;
 | 
				
			||||||
 | 
					use cortex_m_rt::entry;
 | 
				
			||||||
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
 | 
					use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
 | 
				
			||||||
 | 
					use embassy_stm32::pac;
 | 
				
			||||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
 | 
					use embedded_hal::digital::v2::{InputPin, OutputPin};
 | 
				
			||||||
use example_common::*;
 | 
					use example_common::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use cortex_m_rt::entry;
 | 
					 | 
				
			||||||
use stm32l4::stm32l4x5 as pac;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[entry]
 | 
					#[entry]
 | 
				
			||||||
fn main() -> ! {
 | 
					fn main() -> ! {
 | 
				
			||||||
    info!("Hello World!");
 | 
					    info!("Hello World!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let pp = pac::Peripherals::take().unwrap();
 | 
					    unsafe {
 | 
				
			||||||
 | 
					        pac::DBGMCU.cr().modify(|w| {
 | 
				
			||||||
 | 
					            w.set_dbg_sleep(true);
 | 
				
			||||||
 | 
					            w.set_dbg_standby(true);
 | 
				
			||||||
 | 
					            w.set_dbg_stop(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.DBGMCU.cr.modify(|_, w| {
 | 
					        pac::RCC.apb2enr().modify(|w| {
 | 
				
			||||||
        w.dbg_sleep().set_bit();
 | 
					            w.set_syscfgen(true);
 | 
				
			||||||
        w.dbg_standby().set_bit();
 | 
					        });
 | 
				
			||||||
        w.dbg_stop().set_bit()
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.RCC.ahb2enr.modify(|_, w| {
 | 
					        pac::RCC.ahb2enr().modify(|w| {
 | 
				
			||||||
        w.gpioaen().set_bit();
 | 
					            w.set_gpioaen(true);
 | 
				
			||||||
        w.gpioben().set_bit();
 | 
					            w.set_gpioben(true);
 | 
				
			||||||
        w.gpiocen().set_bit();
 | 
					            w.set_gpiocen(true);
 | 
				
			||||||
        w.gpioden().set_bit();
 | 
					            w.set_gpioden(true);
 | 
				
			||||||
        w.gpioeen().set_bit();
 | 
					            w.set_gpioeen(true);
 | 
				
			||||||
        w.gpiofen().set_bit();
 | 
					            w.set_gpiofen(true);
 | 
				
			||||||
        w
 | 
					        });
 | 
				
			||||||
    });
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let p = embassy_stm32::init(Default::default());
 | 
					    let p = embassy_stm32::init(Default::default());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,17 +8,16 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[path = "../example_common.rs"]
 | 
					#[path = "../example_common.rs"]
 | 
				
			||||||
mod example_common;
 | 
					mod example_common;
 | 
				
			||||||
 | 
					use cortex_m_rt::entry;
 | 
				
			||||||
use embassy::executor::Executor;
 | 
					use embassy::executor::Executor;
 | 
				
			||||||
use embassy::time::Clock;
 | 
					use embassy::time::Clock;
 | 
				
			||||||
use embassy::util::Forever;
 | 
					use embassy::util::Forever;
 | 
				
			||||||
use embassy_stm32::exti::ExtiInput;
 | 
					use embassy_stm32::exti::ExtiInput;
 | 
				
			||||||
use embassy_stm32::gpio::{Input, Pull};
 | 
					use embassy_stm32::gpio::{Input, Pull};
 | 
				
			||||||
 | 
					use embassy_stm32::pac;
 | 
				
			||||||
use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
 | 
					use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
 | 
				
			||||||
use example_common::*;
 | 
					use example_common::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use cortex_m_rt::entry;
 | 
					 | 
				
			||||||
use stm32l4::stm32l4x5 as pac;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[embassy::task]
 | 
					#[embassy::task]
 | 
				
			||||||
async fn main_task() {
 | 
					async fn main_task() {
 | 
				
			||||||
    let p = embassy_stm32::init(Default::default());
 | 
					    let p = embassy_stm32::init(Default::default());
 | 
				
			||||||
@ -50,28 +49,26 @@ static EXECUTOR: Forever<Executor> = Forever::new();
 | 
				
			|||||||
fn main() -> ! {
 | 
					fn main() -> ! {
 | 
				
			||||||
    info!("Hello World!");
 | 
					    info!("Hello World!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let pp = pac::Peripherals::take().unwrap();
 | 
					    unsafe {
 | 
				
			||||||
 | 
					        pac::DBGMCU.cr().modify(|w| {
 | 
				
			||||||
 | 
					            w.set_dbg_sleep(true);
 | 
				
			||||||
 | 
					            w.set_dbg_standby(true);
 | 
				
			||||||
 | 
					            w.set_dbg_stop(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.DBGMCU.cr.modify(|_, w| {
 | 
					        pac::RCC.apb2enr().modify(|w| {
 | 
				
			||||||
        w.dbg_sleep().set_bit();
 | 
					            w.set_syscfgen(true);
 | 
				
			||||||
        w.dbg_standby().set_bit();
 | 
					        });
 | 
				
			||||||
        w.dbg_stop().set_bit()
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.RCC.ahb2enr.modify(|_, w| {
 | 
					        pac::RCC.ahb2enr().modify(|w| {
 | 
				
			||||||
        w.gpioaen().set_bit();
 | 
					            w.set_gpioaen(true);
 | 
				
			||||||
        w.gpioben().set_bit();
 | 
					            w.set_gpioben(true);
 | 
				
			||||||
        w.gpiocen().set_bit();
 | 
					            w.set_gpiocen(true);
 | 
				
			||||||
        w.gpioden().set_bit();
 | 
					            w.set_gpioden(true);
 | 
				
			||||||
        w.gpioeen().set_bit();
 | 
					            w.set_gpioeen(true);
 | 
				
			||||||
        w.gpiofen().set_bit();
 | 
					            w.set_gpiofen(true);
 | 
				
			||||||
        w
 | 
					        });
 | 
				
			||||||
    });
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    pp.RCC.apb2enr.modify(|_, w| {
 | 
					 | 
				
			||||||
        w.syscfgen().set_bit();
 | 
					 | 
				
			||||||
        w
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unsafe { embassy::time::set_clock(&ZeroClock) };
 | 
					    unsafe { embassy::time::set_clock(&ZeroClock) };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -9,37 +9,39 @@
 | 
				
			|||||||
#[path = "../example_common.rs"]
 | 
					#[path = "../example_common.rs"]
 | 
				
			||||||
mod example_common;
 | 
					mod example_common;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use embassy_stm32::gpio::{Level, Output, Speed};
 | 
					 | 
				
			||||||
use embedded_hal::digital::v2::OutputPin;
 | 
					 | 
				
			||||||
use example_common::*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use cortex_m_rt::entry;
 | 
					use cortex_m_rt::entry;
 | 
				
			||||||
 | 
					use embassy_stm32::gpio::{Level, Output, Speed};
 | 
				
			||||||
 | 
					use embassy_stm32::pac;
 | 
				
			||||||
use embassy_stm32::spi::{Config, Spi};
 | 
					use embassy_stm32::spi::{Config, Spi};
 | 
				
			||||||
use embassy_stm32::time::Hertz;
 | 
					use embassy_stm32::time::Hertz;
 | 
				
			||||||
use embedded_hal::blocking::spi::Transfer;
 | 
					use embedded_hal::blocking::spi::Transfer;
 | 
				
			||||||
use stm32l4::stm32l4x5 as pac;
 | 
					use embedded_hal::digital::v2::OutputPin;
 | 
				
			||||||
 | 
					use example_common::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[entry]
 | 
					#[entry]
 | 
				
			||||||
fn main() -> ! {
 | 
					fn main() -> ! {
 | 
				
			||||||
    info!("Hello World, dude!");
 | 
					    info!("Hello World, dude!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let pp = pac::Peripherals::take().unwrap();
 | 
					    unsafe {
 | 
				
			||||||
 | 
					        pac::DBGMCU.cr().modify(|w| {
 | 
				
			||||||
 | 
					            w.set_dbg_sleep(true);
 | 
				
			||||||
 | 
					            w.set_dbg_standby(true);
 | 
				
			||||||
 | 
					            w.set_dbg_stop(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.DBGMCU.cr.modify(|_, w| {
 | 
					        pac::RCC.apb2enr().modify(|w| {
 | 
				
			||||||
        w.dbg_sleep().set_bit();
 | 
					            w.set_syscfgen(true);
 | 
				
			||||||
        w.dbg_standby().set_bit();
 | 
					        });
 | 
				
			||||||
        w.dbg_stop().set_bit()
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.RCC.ahb2enr.modify(|_, w| {
 | 
					        pac::RCC.ahb2enr().modify(|w| {
 | 
				
			||||||
        w.gpioaen().set_bit();
 | 
					            w.set_gpioaen(true);
 | 
				
			||||||
        w.gpioben().set_bit();
 | 
					            w.set_gpioben(true);
 | 
				
			||||||
        w.gpiocen().set_bit();
 | 
					            w.set_gpiocen(true);
 | 
				
			||||||
        w.gpioden().set_bit();
 | 
					            w.set_gpioden(true);
 | 
				
			||||||
        w.gpioeen().set_bit();
 | 
					            w.set_gpioeen(true);
 | 
				
			||||||
        w.gpiofen().set_bit();
 | 
					            w.set_gpiofen(true);
 | 
				
			||||||
        w
 | 
					        });
 | 
				
			||||||
    });
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let p = embassy_stm32::init(Default::default());
 | 
					    let p = embassy_stm32::init(Default::default());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,3 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
#![no_std]
 | 
					#![no_std]
 | 
				
			||||||
#![no_main]
 | 
					#![no_main]
 | 
				
			||||||
#![feature(trait_alias)]
 | 
					#![feature(trait_alias)]
 | 
				
			||||||
@ -10,16 +9,15 @@
 | 
				
			|||||||
#[path = "../example_common.rs"]
 | 
					#[path = "../example_common.rs"]
 | 
				
			||||||
mod example_common;
 | 
					mod example_common;
 | 
				
			||||||
use cortex_m::prelude::_embedded_hal_blocking_serial_Write;
 | 
					use cortex_m::prelude::_embedded_hal_blocking_serial_Write;
 | 
				
			||||||
 | 
					use cortex_m_rt::entry;
 | 
				
			||||||
use embassy::executor::Executor;
 | 
					use embassy::executor::Executor;
 | 
				
			||||||
use embassy::time::Clock;
 | 
					use embassy::time::Clock;
 | 
				
			||||||
use embassy::util::Forever;
 | 
					use embassy::util::Forever;
 | 
				
			||||||
 | 
					use embassy_stm32::dma_traits::NoDma;
 | 
				
			||||||
 | 
					use embassy_stm32::pac;
 | 
				
			||||||
use embassy_stm32::usart::{Config, Uart};
 | 
					use embassy_stm32::usart::{Config, Uart};
 | 
				
			||||||
use example_common::*;
 | 
					use example_common::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use cortex_m_rt::entry;
 | 
					 | 
				
			||||||
use stm32l4::stm32l4x5 as pac;
 | 
					 | 
				
			||||||
use embassy_stm32::dma_traits::NoDma;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[embassy::task]
 | 
					#[embassy::task]
 | 
				
			||||||
async fn main_task() {
 | 
					async fn main_task() {
 | 
				
			||||||
    let p = embassy_stm32::init(Default::default());
 | 
					    let p = embassy_stm32::init(Default::default());
 | 
				
			||||||
@ -51,38 +49,34 @@ static EXECUTOR: Forever<Executor> = Forever::new();
 | 
				
			|||||||
fn main() -> ! {
 | 
					fn main() -> ! {
 | 
				
			||||||
    info!("Hello World!");
 | 
					    info!("Hello World!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let pp = pac::Peripherals::take().unwrap();
 | 
					    unsafe {
 | 
				
			||||||
 | 
					        pac::DBGMCU.cr().modify(|w| {
 | 
				
			||||||
 | 
					            w.set_dbg_sleep(true);
 | 
				
			||||||
 | 
					            w.set_dbg_standby(true);
 | 
				
			||||||
 | 
					            w.set_dbg_stop(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.DBGMCU.cr.modify(|_, w| {
 | 
					        pac::RCC.ahb1enr().modify(|w| {
 | 
				
			||||||
        w.dbg_sleep().set_bit();
 | 
					            w.set_dma1en(true);
 | 
				
			||||||
        w.dbg_standby().set_bit();
 | 
					        });
 | 
				
			||||||
        w.dbg_stop().set_bit()
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.RCC.ahb1enr.modify(|_, w| {
 | 
					        pac::RCC.ahb2enr().modify(|w| {
 | 
				
			||||||
        w.dma1en().set_bit();
 | 
					            w.set_gpioaen(true);
 | 
				
			||||||
        w
 | 
					            w.set_gpioben(true);
 | 
				
			||||||
    });
 | 
					            w.set_gpiocen(true);
 | 
				
			||||||
 | 
					            w.set_gpioden(true);
 | 
				
			||||||
 | 
					            w.set_gpioeen(true);
 | 
				
			||||||
 | 
					            w.set_gpiofen(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.RCC.ahb2enr.modify(|_, w| {
 | 
					        pac::RCC.apb1enr1().modify(|w| {
 | 
				
			||||||
        w.gpioaen().set_bit();
 | 
					            w.set_uart4en(true);
 | 
				
			||||||
        w.gpioben().set_bit();
 | 
					        });
 | 
				
			||||||
        w.gpiocen().set_bit();
 | 
					 | 
				
			||||||
        w.gpioden().set_bit();
 | 
					 | 
				
			||||||
        w.gpioeen().set_bit();
 | 
					 | 
				
			||||||
        w.gpiofen().set_bit();
 | 
					 | 
				
			||||||
        w
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.RCC.apb1enr1.modify(|_, w| {
 | 
					        pac::RCC.apb2enr().modify(|w| {
 | 
				
			||||||
        w.uart4en().set_bit();
 | 
					            w.set_syscfgen(true);
 | 
				
			||||||
        w
 | 
					        });
 | 
				
			||||||
    });
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    pp.RCC.apb2enr.modify(|_, w| {
 | 
					 | 
				
			||||||
        w.syscfgen().set_bit();
 | 
					 | 
				
			||||||
        w
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unsafe { embassy::time::set_clock(&ZeroClock) };
 | 
					    unsafe { embassy::time::set_clock(&ZeroClock) };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -91,4 +85,4 @@ fn main() -> ! {
 | 
				
			|||||||
    executor.run(|spawner| {
 | 
					    executor.run(|spawner| {
 | 
				
			||||||
        unwrap!(spawner.spawn(main_task()));
 | 
					        unwrap!(spawner.spawn(main_task()));
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -13,12 +13,12 @@ use cortex_m_rt::entry;
 | 
				
			|||||||
use embassy::executor::Executor;
 | 
					use embassy::executor::Executor;
 | 
				
			||||||
use embassy::time::Clock;
 | 
					use embassy::time::Clock;
 | 
				
			||||||
use embassy::util::Forever;
 | 
					use embassy::util::Forever;
 | 
				
			||||||
 | 
					use embassy_stm32::dma_traits::NoDma;
 | 
				
			||||||
 | 
					use embassy_stm32::pac;
 | 
				
			||||||
use embassy_stm32::usart::{Config, Uart};
 | 
					use embassy_stm32::usart::{Config, Uart};
 | 
				
			||||||
 | 
					use embassy_traits::uart::Write as _;
 | 
				
			||||||
use example_common::*;
 | 
					use example_common::*;
 | 
				
			||||||
use heapless::String;
 | 
					use heapless::String;
 | 
				
			||||||
use stm32l4::stm32l4x5 as pac;
 | 
					 | 
				
			||||||
use embassy_stm32::dma_traits::NoDma;
 | 
					 | 
				
			||||||
use embassy_traits::uart::Write as AsyncWrite;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[embassy::task]
 | 
					#[embassy::task]
 | 
				
			||||||
async fn main_task() {
 | 
					async fn main_task() {
 | 
				
			||||||
@ -31,7 +31,7 @@ async fn main_task() {
 | 
				
			|||||||
        let mut s: String<128> = String::new();
 | 
					        let mut s: String<128> = String::new();
 | 
				
			||||||
        core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap();
 | 
					        core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        usart.write( s.as_bytes() ).await.ok();
 | 
					        usart.write(s.as_bytes()).await.ok();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        info!("wrote DMA");
 | 
					        info!("wrote DMA");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -51,40 +51,32 @@ static EXECUTOR: Forever<Executor> = Forever::new();
 | 
				
			|||||||
fn main() -> ! {
 | 
					fn main() -> ! {
 | 
				
			||||||
    info!("Hello World!");
 | 
					    info!("Hello World!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let pp = pac::Peripherals::take().unwrap();
 | 
					    unsafe {
 | 
				
			||||||
 | 
					        pac::DBGMCU.cr().modify(|w| {
 | 
				
			||||||
 | 
					            w.set_dbg_sleep(true);
 | 
				
			||||||
 | 
					            w.set_dbg_standby(true);
 | 
				
			||||||
 | 
					            w.set_dbg_stop(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.DBGMCU.cr.modify(|_, w| {
 | 
					        pac::RCC.apb2enr().modify(|w| {
 | 
				
			||||||
        w.dbg_sleep().set_bit();
 | 
					            w.set_syscfgen(true);
 | 
				
			||||||
        w.dbg_standby().set_bit();
 | 
					        });
 | 
				
			||||||
        w.dbg_stop().set_bit()
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pp.RCC.ahb1enr.modify(|_, w| {
 | 
					        pac::RCC.ahb1enr().modify(|w| {
 | 
				
			||||||
        unsafe {
 | 
					            w.set_dmamux1en(true);
 | 
				
			||||||
            w.bits( 0x07 );
 | 
					            w.set_dma1en(true);
 | 
				
			||||||
        }
 | 
					            w.set_dma2en(true);
 | 
				
			||||||
        w
 | 
					        });
 | 
				
			||||||
        //w.dmamuxen().set_bit();
 | 
					 | 
				
			||||||
        //w.dma1en().set_bit();
 | 
					 | 
				
			||||||
        //w.dma2en().set_bit();
 | 
					 | 
				
			||||||
        //w
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pp.RCC.ahb2enr.modify(|_, w| {
 | 
					 | 
				
			||||||
        w.gpioaen().set_bit();
 | 
					 | 
				
			||||||
        w.gpioben().set_bit();
 | 
					 | 
				
			||||||
        w.gpiocen().set_bit();
 | 
					 | 
				
			||||||
        w.gpioden().set_bit();
 | 
					 | 
				
			||||||
        w.gpioeen().set_bit();
 | 
					 | 
				
			||||||
        w.gpiofen().set_bit();
 | 
					 | 
				
			||||||
        w
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pp.RCC.apb2enr.modify(|_, w| {
 | 
					 | 
				
			||||||
        w.syscfgen().set_bit();
 | 
					 | 
				
			||||||
        w
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        pac::RCC.ahb2enr().modify(|w| {
 | 
				
			||||||
 | 
					            w.set_gpioaen(true);
 | 
				
			||||||
 | 
					            w.set_gpioben(true);
 | 
				
			||||||
 | 
					            w.set_gpiocen(true);
 | 
				
			||||||
 | 
					            w.set_gpioden(true);
 | 
				
			||||||
 | 
					            w.set_gpioeen(true);
 | 
				
			||||||
 | 
					            w.set_gpiofen(true);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unsafe { embassy::time::set_clock(&ZeroClock) };
 | 
					    unsafe { embassy::time::set_clock(&ZeroClock) };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user