stm32l4/examples: remove old-pac uses.
This commit is contained in:
@ -13,12 +13,12 @@ use cortex_m_rt::entry;
|
||||
use embassy::executor::Executor;
|
||||
use embassy::time::Clock;
|
||||
use embassy::util::Forever;
|
||||
use embassy_stm32::dma_traits::NoDma;
|
||||
use embassy_stm32::pac;
|
||||
use embassy_stm32::usart::{Config, Uart};
|
||||
use embassy_traits::uart::Write as _;
|
||||
use example_common::*;
|
||||
use heapless::String;
|
||||
use stm32l4::stm32l4x5 as pac;
|
||||
use embassy_stm32::dma_traits::NoDma;
|
||||
use embassy_traits::uart::Write as AsyncWrite;
|
||||
|
||||
#[embassy::task]
|
||||
async fn main_task() {
|
||||
@ -31,7 +31,7 @@ async fn main_task() {
|
||||
let mut s: String<128> = String::new();
|
||||
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");
|
||||
}
|
||||
@ -51,40 +51,32 @@ static EXECUTOR: Forever<Executor> = Forever::new();
|
||||
fn main() -> ! {
|
||||
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| {
|
||||
w.dbg_sleep().set_bit();
|
||||
w.dbg_standby().set_bit();
|
||||
w.dbg_stop().set_bit()
|
||||
});
|
||||
pac::RCC.apb2enr().modify(|w| {
|
||||
w.set_syscfgen(true);
|
||||
});
|
||||
|
||||
pp.RCC.ahb1enr.modify(|_, w| {
|
||||
unsafe {
|
||||
w.bits( 0x07 );
|
||||
}
|
||||
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.ahb1enr().modify(|w| {
|
||||
w.set_dmamux1en(true);
|
||||
w.set_dma1en(true);
|
||||
w.set_dma2en(true);
|
||||
});
|
||||
|
||||
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) };
|
||||
|
||||
|
Reference in New Issue
Block a user