Enhance Rcc configuration to be more fluentish.
Clean up H7 examples to remove all vegan HALs and PACs.
This commit is contained in:
parent
ad62900a40
commit
d7409d63e8
@ -70,6 +70,84 @@ pub struct Config {
|
|||||||
pub pll3: PllConfig,
|
pub pll3: PllConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Config {
|
||||||
|
pub fn sys_ck<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.sys_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn per_ck<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.per_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pclk1<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pclk1 = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pclk2<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pclk2 = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pclk3<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pclk3 = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pclk4<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pclk4 = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll1_p<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll1.p_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll1_q<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll1.q_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll1_r<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll1.r_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll2_p<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll2.p_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll2_q<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll2.q_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll2_r<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll2.r_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll3_p<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll3.p_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll3_q<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll3.q_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pll3_r<T:Into<Hertz>>(mut self, freq: T) -> Self {
|
||||||
|
self.pll3.r_ck = Some(freq.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Rcc<'d> {
|
pub struct Rcc<'d> {
|
||||||
inner: PhantomData<&'d ()>,
|
inner: PhantomData<&'d ()>,
|
||||||
config: Config,
|
config: Config,
|
||||||
|
@ -24,8 +24,8 @@ embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" }
|
|||||||
embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt-debug", "defmt", "tcp", "medium-ethernet", "pool-16"] }
|
embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt-debug", "defmt", "tcp", "medium-ethernet", "pool-16"] }
|
||||||
stm32-metapac = { path = "../../stm32-metapac", features = ["stm32h743zi"] }
|
stm32-metapac = { path = "../../stm32-metapac", features = ["stm32h743zi"] }
|
||||||
embassy-macros = { path = "../../embassy-macros" }
|
embassy-macros = { path = "../../embassy-macros" }
|
||||||
stm32h7 = { version = "0.13", features = ["stm32h743"]}
|
#stm32h7 = { version = "0.13", features = ["stm32h743"]}
|
||||||
stm32h7xx-hal = { version = "0.9.0", features = ["stm32h743"] }
|
#stm32h7xx-hal = { version = "0.9.0", features = ["stm32h743"] }
|
||||||
|
|
||||||
defmt = "0.2.0"
|
defmt = "0.2.0"
|
||||||
defmt-rtt = "0.2.0"
|
defmt-rtt = "0.2.0"
|
||||||
|
@ -13,38 +13,13 @@ use embedded_hal::digital::v2::OutputPin;
|
|||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use stm32h7::stm32h743 as pac;
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
|
|
||||||
use hal::prelude::*;
|
|
||||||
use stm32h7xx_hal as hal;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let pp = pac::Peripherals::take().unwrap();
|
unsafe { Dbgmcu::enable_all() };
|
||||||
|
|
||||||
let pwrcfg = pp.PWR.constrain().freeze();
|
|
||||||
|
|
||||||
let rcc = pp.RCC.constrain();
|
|
||||||
|
|
||||||
rcc.sys_ck(96.mhz())
|
|
||||||
.pclk1(48.mhz())
|
|
||||||
.pclk2(48.mhz())
|
|
||||||
.pclk3(48.mhz())
|
|
||||||
.pclk4(48.mhz())
|
|
||||||
.pll1_q_ck(48.mhz())
|
|
||||||
.freeze(pwrcfg, &pp.SYSCFG);
|
|
||||||
|
|
||||||
let pp = unsafe { pac::Peripherals::steal() };
|
|
||||||
|
|
||||||
pp.DBGMCU.cr.modify(|_, w| {
|
|
||||||
w.dbgsleep_d1().set_bit();
|
|
||||||
w.dbgstby_d1().set_bit();
|
|
||||||
w.dbgstop_d1().set_bit();
|
|
||||||
w.d1dbgcken().set_bit();
|
|
||||||
w
|
|
||||||
});
|
|
||||||
|
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
|
|
||||||
|
@ -13,44 +13,24 @@ use embassy_stm32::gpio::NoPin;
|
|||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
|
use embassy_stm32::Config;
|
||||||
|
use embassy_stm32::rcc;
|
||||||
use embassy_stm32::dac::{Channel, Dac, Value};
|
use embassy_stm32::dac::{Channel, Dac, Value};
|
||||||
use stm32h7::stm32h743 as pac;
|
use embassy_stm32::time::U32Ext;
|
||||||
use stm32h7xx_hal::prelude::*;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World, dude!");
|
info!("Hello World, dude!");
|
||||||
|
|
||||||
let pp = pac::Peripherals::take().unwrap();
|
let p = embassy_stm32::init(Config::default().rcc(
|
||||||
|
rcc::Config::default()
|
||||||
|
.sys_ck(400.mhz())
|
||||||
|
.pll1_q(100.mhz())
|
||||||
|
));
|
||||||
|
|
||||||
let pwrcfg = pp.PWR.constrain().freeze();
|
unsafe {
|
||||||
|
Dbgmcu::enable_all();
|
||||||
let rcc = pp.RCC.constrain();
|
}
|
||||||
|
|
||||||
rcc.sys_ck(96.mhz())
|
|
||||||
.pclk1(48.mhz())
|
|
||||||
.pclk2(48.mhz())
|
|
||||||
.pclk3(48.mhz())
|
|
||||||
.pclk4(48.mhz())
|
|
||||||
.pll1_q_ck(48.mhz())
|
|
||||||
.freeze(pwrcfg, &pp.SYSCFG);
|
|
||||||
|
|
||||||
let pp = unsafe { pac::Peripherals::steal() };
|
|
||||||
|
|
||||||
pp.DBGMCU.cr.modify(|_, w| {
|
|
||||||
w.dbgsleep_d1().set_bit();
|
|
||||||
w.dbgstby_d1().set_bit();
|
|
||||||
w.dbgstop_d1().set_bit();
|
|
||||||
w.d1dbgcken().set_bit();
|
|
||||||
w
|
|
||||||
});
|
|
||||||
|
|
||||||
pp.RCC.apb1lenr.modify(|_, w| {
|
|
||||||
w.dac12en().set_bit();
|
|
||||||
w
|
|
||||||
});
|
|
||||||
|
|
||||||
let p = embassy_stm32::init(Default::default());
|
|
||||||
|
|
||||||
let mut dac = Dac::new(p.DAC1, p.PA4, NoPin);
|
let mut dac = Dac::new(p.DAC1, p.PA4, NoPin);
|
||||||
|
|
||||||
@ -63,6 +43,7 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
use micromath::F32Ext;
|
use micromath::F32Ext;
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
|
|
||||||
fn to_sine_wave(v: u8) -> u8 {
|
fn to_sine_wave(v: u8) -> u8 {
|
||||||
if v >= 128 {
|
if v >= 128 {
|
||||||
|
@ -12,35 +12,23 @@ mod example_common;
|
|||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use embassy::executor::Executor;
|
use embassy::executor::Executor;
|
||||||
use embassy::time::Clock;
|
use embassy::time::Clock;
|
||||||
|
use embassy_stm32::Config;
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
use embassy_stm32::dma::NoDma;
|
use embassy_stm32::dma::NoDma;
|
||||||
|
use embassy_stm32::spi;
|
||||||
|
use embassy_stm32::rcc;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
use embedded_hal::blocking::spi::Transfer;
|
use embedded_hal::blocking::spi::Transfer;
|
||||||
|
|
||||||
use hal::prelude::*;
|
|
||||||
use stm32h7xx_hal as hal;
|
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use stm32h7::stm32h743 as pac;
|
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
use embassy_stm32::spi::{Spi, Config};
|
use embassy_stm32::time::U32Ext;
|
||||||
use embassy_stm32::time::Hertz;
|
use embassy_stm32::peripherals::SPI3;
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
|
use core::str::from_utf8;
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::task]
|
||||||
async fn main_task() {
|
async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
|
||||||
|
|
||||||
let mut spi = Spi::new(
|
|
||||||
p.SPI3,
|
|
||||||
p.PB3,
|
|
||||||
p.PB5,
|
|
||||||
p.PB4,
|
|
||||||
NoDma,
|
|
||||||
NoDma,
|
|
||||||
Hertz(1_000_000),
|
|
||||||
Config::default(),
|
|
||||||
);
|
|
||||||
|
|
||||||
for n in 0u32.. {
|
for n in 0u32.. {
|
||||||
let mut write: String<128> = String::new();
|
let mut write: String<128> = String::new();
|
||||||
core::write!(&mut write, "Hello DMA World {}!\r\n", n).unwrap();
|
core::write!(&mut write, "Hello DMA World {}!\r\n", n).unwrap();
|
||||||
@ -50,7 +38,7 @@ async fn main_task() {
|
|||||||
defmt::panic!("crap");
|
defmt::panic!("crap");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info!("read via spi: {}", write.as_bytes());
|
info!("read via spi: {}", from_utf8(write.as_bytes()).unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,45 +56,31 @@ static EXECUTOR: Forever<Executor> = Forever::new();
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let pp = pac::Peripherals::take().unwrap();
|
unsafe {
|
||||||
|
Dbgmcu::enable_all();
|
||||||
|
}
|
||||||
|
|
||||||
let pwrcfg = pp.PWR.constrain().freeze();
|
let p = embassy_stm32::init(Config::default().rcc(
|
||||||
|
rcc::Config::default()
|
||||||
|
.sys_ck(400.mhz())
|
||||||
|
.pll1_q(100.mhz())
|
||||||
|
));
|
||||||
|
|
||||||
let rcc = pp.RCC.constrain();
|
let spi = spi::Spi::new(
|
||||||
|
p.SPI3,
|
||||||
rcc.sys_ck(96.mhz())
|
p.PB3,
|
||||||
.pclk1(48.mhz())
|
p.PB5,
|
||||||
.pclk2(48.mhz())
|
p.PB4,
|
||||||
.pclk3(48.mhz())
|
NoDma,
|
||||||
.pclk4(48.mhz())
|
NoDma,
|
||||||
.pll1_q_ck(48.mhz())
|
1.mhz(),
|
||||||
.freeze(pwrcfg, &pp.SYSCFG);
|
spi::Config::default(),
|
||||||
|
);
|
||||||
let pp = unsafe { pac::Peripherals::steal() };
|
|
||||||
|
|
||||||
pp.DBGMCU.cr.modify(|_, w| {
|
|
||||||
w.dbgsleep_d1().set_bit();
|
|
||||||
w.dbgstby_d1().set_bit();
|
|
||||||
w.dbgstop_d1().set_bit();
|
|
||||||
w.d1dbgcken().set_bit();
|
|
||||||
w
|
|
||||||
});
|
|
||||||
|
|
||||||
pp.RCC.ahb4enr.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
|
|
||||||
});
|
|
||||||
|
|
||||||
unsafe { embassy::time::set_clock(&ZeroClock) };
|
unsafe { embassy::time::set_clock(&ZeroClock) };
|
||||||
|
|
||||||
let executor = EXECUTOR.put(Executor::new());
|
let executor = EXECUTOR.put(Executor::new());
|
||||||
|
|
||||||
executor.run(|spawner| {
|
executor.run(|spawner| {
|
||||||
unwrap!(spawner.spawn(main_task()));
|
unwrap!(spawner.spawn(main_task(spi)));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -11,34 +11,22 @@ mod example_common;
|
|||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use embassy::executor::Executor;
|
use embassy::executor::Executor;
|
||||||
use embassy::time::Clock;
|
use embassy::time::Clock;
|
||||||
|
use embassy_stm32::time::U32Ext;
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
use embassy_traits::spi::FullDuplex;
|
use embassy_traits::spi::FullDuplex;
|
||||||
|
|
||||||
use hal::prelude::*;
|
|
||||||
use stm32h7xx_hal as hal;
|
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use stm32h7::stm32h743 as pac;
|
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
use embassy_stm32::spi::{Spi, Config};
|
use embassy_stm32::spi;
|
||||||
use embassy_stm32::time::Hertz;
|
use embassy_stm32::Config;
|
||||||
use core::str::from_utf8;
|
use core::str::from_utf8;
|
||||||
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
|
use embassy_stm32::rcc;
|
||||||
|
use embassy_stm32::peripherals::{DMA1_CH4, DMA1_CH3, SPI3};
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::task]
|
||||||
async fn main_task() {
|
async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
|
||||||
|
|
||||||
let mut spi = Spi::new(
|
|
||||||
p.SPI3,
|
|
||||||
p.PB3,
|
|
||||||
p.PB5,
|
|
||||||
p.PB4,
|
|
||||||
p.DMA1_CH3,
|
|
||||||
p.DMA1_CH4,
|
|
||||||
Hertz(1_000_000),
|
|
||||||
Config::default(),
|
|
||||||
);
|
|
||||||
|
|
||||||
for n in 0u32.. {
|
for n in 0u32.. {
|
||||||
let mut write: String<128> = String::new();
|
let mut write: String<128> = String::new();
|
||||||
@ -61,49 +49,36 @@ impl Clock for ZeroClock {
|
|||||||
|
|
||||||
static EXECUTOR: Forever<Executor> = Forever::new();
|
static EXECUTOR: Forever<Executor> = Forever::new();
|
||||||
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let pp = pac::Peripherals::take().unwrap();
|
unsafe {
|
||||||
|
Dbgmcu::enable_all();
|
||||||
|
}
|
||||||
|
|
||||||
let pwrcfg = pp.PWR.constrain().freeze();
|
let p = embassy_stm32::init(Config::default().rcc(
|
||||||
|
rcc::Config::default()
|
||||||
|
.sys_ck(400.mhz())
|
||||||
|
.pll1_q(100.mhz())
|
||||||
|
));
|
||||||
|
|
||||||
let rcc = pp.RCC.constrain();
|
let spi = spi::Spi::new(
|
||||||
|
p.SPI3,
|
||||||
rcc.sys_ck(96.mhz())
|
p.PB3,
|
||||||
.pclk1(48.mhz())
|
p.PB5,
|
||||||
.pclk2(48.mhz())
|
p.PB4,
|
||||||
.pclk3(48.mhz())
|
p.DMA1_CH3,
|
||||||
.pclk4(48.mhz())
|
p.DMA1_CH4,
|
||||||
.pll1_q_ck(48.mhz())
|
1.mhz(),
|
||||||
.freeze(pwrcfg, &pp.SYSCFG);
|
spi::Config::default(),
|
||||||
|
);
|
||||||
let pp = unsafe { pac::Peripherals::steal() };
|
|
||||||
|
|
||||||
pp.DBGMCU.cr.modify(|_, w| {
|
|
||||||
w.dbgsleep_d1().set_bit();
|
|
||||||
w.dbgstby_d1().set_bit();
|
|
||||||
w.dbgstop_d1().set_bit();
|
|
||||||
w.d1dbgcken().set_bit();
|
|
||||||
w
|
|
||||||
});
|
|
||||||
|
|
||||||
pp.RCC.ahb4enr.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
|
|
||||||
});
|
|
||||||
|
|
||||||
unsafe { embassy::time::set_clock(&ZeroClock) };
|
unsafe { embassy::time::set_clock(&ZeroClock) };
|
||||||
|
|
||||||
let executor = EXECUTOR.put(Executor::new());
|
let executor = EXECUTOR.put(Executor::new());
|
||||||
|
|
||||||
executor.run(|spawner| {
|
executor.run(|spawner| {
|
||||||
unwrap!(spawner.spawn(main_task()));
|
unwrap!(spawner.spawn(main_task(spi)));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,8 @@ use embassy_stm32::dma::NoDma;
|
|||||||
use embassy_stm32::usart::{Config, Uart};
|
use embassy_stm32::usart::{Config, Uart};
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use hal::prelude::*;
|
|
||||||
use stm32h7xx_hal as hal;
|
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use stm32h7::stm32h743 as pac;
|
use embassy_stm32::dbgmcu::Dbgmcu;
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::task]
|
||||||
async fn main_task() {
|
async fn main_task() {
|
||||||
@ -53,29 +50,9 @@ static EXECUTOR: Forever<Executor> = Forever::new();
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let pp = pac::Peripherals::take().unwrap();
|
unsafe {
|
||||||
|
Dbgmcu::enable_all();
|
||||||
let pwrcfg = pp.PWR.constrain().freeze();
|
}
|
||||||
|
|
||||||
let rcc = pp.RCC.constrain();
|
|
||||||
|
|
||||||
rcc.sys_ck(96.mhz())
|
|
||||||
.pclk1(48.mhz())
|
|
||||||
.pclk2(48.mhz())
|
|
||||||
.pclk3(48.mhz())
|
|
||||||
.pclk4(48.mhz())
|
|
||||||
.pll1_q_ck(48.mhz())
|
|
||||||
.freeze(pwrcfg, &pp.SYSCFG);
|
|
||||||
|
|
||||||
let pp = unsafe { pac::Peripherals::steal() };
|
|
||||||
|
|
||||||
pp.DBGMCU.cr.modify(|_, w| {
|
|
||||||
w.dbgsleep_d1().set_bit();
|
|
||||||
w.dbgstby_d1().set_bit();
|
|
||||||
w.dbgstop_d1().set_bit();
|
|
||||||
w.d1dbgcken().set_bit();
|
|
||||||
w
|
|
||||||
});
|
|
||||||
|
|
||||||
unsafe { embassy::time::set_clock(&ZeroClock) };
|
unsafe { embassy::time::set_clock(&ZeroClock) };
|
||||||
|
|
||||||
|
@ -18,12 +18,8 @@ use embassy_stm32::usart::{Config, Uart};
|
|||||||
use embassy_traits::uart::Write as _Write;
|
use embassy_traits::uart::Write as _Write;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use hal::prelude::*;
|
|
||||||
use stm32h7xx_hal as hal;
|
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
use stm32h7::stm32h743 as pac;
|
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::task]
|
||||||
async fn main_task() {
|
async fn main_task() {
|
||||||
@ -56,20 +52,6 @@ static EXECUTOR: Forever<Executor> = Forever::new();
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let pp = pac::Peripherals::take().unwrap();
|
|
||||||
|
|
||||||
let pwrcfg = pp.PWR.constrain().freeze();
|
|
||||||
|
|
||||||
let rcc = pp.RCC.constrain();
|
|
||||||
|
|
||||||
rcc.sys_ck(96.mhz())
|
|
||||||
.pclk1(48.mhz())
|
|
||||||
.pclk2(48.mhz())
|
|
||||||
.pclk3(48.mhz())
|
|
||||||
.pclk4(48.mhz())
|
|
||||||
.pll1_q_ck(48.mhz())
|
|
||||||
.freeze(pwrcfg, &pp.SYSCFG);
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
Dbgmcu::enable_all();
|
Dbgmcu::enable_all();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user