stm32: No need to enable GPIO clocks manually
This commit is contained in:
@ -11,11 +11,10 @@ mod example_common;
|
||||
|
||||
use example_common::*;
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
//use stm32f4::stm32f429 as pac;
|
||||
use cortex_m::delay::Delay;
|
||||
use cortex_m_rt::entry;
|
||||
use embassy_stm32::adc::{Adc, Resolution};
|
||||
use stm32l4::stm32l4x5 as pac;
|
||||
use embassy_stm32::pac;
|
||||
use stm32l4xx_hal::prelude::*;
|
||||
use stm32l4xx_hal::rcc::PllSource;
|
||||
|
||||
@ -40,31 +39,16 @@ fn main() -> ! {
|
||||
.pll_source(PllSource::HSI16)
|
||||
.freeze(&mut flash.acr, &mut pwr);
|
||||
|
||||
let pp = unsafe { pac::Peripherals::steal() };
|
||||
|
||||
pp.RCC.ccipr.modify(|_, w| {
|
||||
unsafe {
|
||||
w.adcsel().bits(0b11);
|
||||
}
|
||||
w
|
||||
});
|
||||
|
||||
pp.DBGMCU.cr.modify(|_, w| {
|
||||
w.dbg_sleep().set_bit();
|
||||
w.dbg_standby().set_bit();
|
||||
w.dbg_stop().set_bit()
|
||||
});
|
||||
|
||||
pp.RCC.ahb2enr.modify(|_, w| {
|
||||
w.adcen().set_bit();
|
||||
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 {
|
||||
pac::RCC.ccipr().modify(|w| {
|
||||
w.set_adcsel(0b11);
|
||||
});
|
||||
pac::DBGMCU.cr().modify(|w| {
|
||||
w.set_dbg_sleep(true);
|
||||
w.set_dbg_standby(true);
|
||||
w.set_dbg_stop(true);
|
||||
});
|
||||
}
|
||||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
|
@ -24,15 +24,6 @@ fn main() -> ! {
|
||||
w.set_dbg_standby(true);
|
||||
w.set_dbg_stop(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);
|
||||
});
|
||||
}
|
||||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
@ -28,15 +28,6 @@ fn main() -> ! {
|
||||
pac::RCC.apb2enr().modify(|w| {
|
||||
w.set_syscfgen(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);
|
||||
});
|
||||
}
|
||||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
@ -59,15 +59,6 @@ fn main() -> ! {
|
||||
pac::RCC.apb2enr().modify(|w| {
|
||||
w.set_syscfgen(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) };
|
||||
|
@ -13,11 +13,10 @@ use embassy_stm32::gpio::NoPin;
|
||||
use example_common::*;
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
//use stm32f4::stm32f429 as pac;
|
||||
use embassy_stm32::dac::{Channel, Dac, Value};
|
||||
use stm32l4::stm32l4x5 as pac;
|
||||
use embassy_stm32::pac;
|
||||
use stm32l4xx_hal::prelude::*;
|
||||
use stm32l4xx_hal::rcc::PllSource;
|
||||
use stm32l4xx_hal::{prelude::*};
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
@ -30,36 +29,23 @@ fn main() -> ! {
|
||||
|
||||
// TRY the other clock configuration
|
||||
// let clocks = rcc.cfgr.freeze(&mut flash.acr);
|
||||
rcc
|
||||
.cfgr
|
||||
rcc.cfgr
|
||||
.sysclk(80.mhz())
|
||||
.pclk1(80.mhz())
|
||||
.pclk2(80.mhz())
|
||||
.pll_source(PllSource::HSI16)
|
||||
.freeze(&mut flash.acr, &mut pwr);
|
||||
|
||||
let pp = unsafe { pac::Peripherals::steal() };
|
||||
|
||||
pp.DBGMCU.cr.modify(|_, w| {
|
||||
w.dbg_sleep().set_bit();
|
||||
w.dbg_standby().set_bit();
|
||||
w.dbg_stop().set_bit()
|
||||
});
|
||||
|
||||
pp.RCC.apb1enr1.modify(|_, w| {
|
||||
w.dac1en().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
|
||||
});
|
||||
unsafe {
|
||||
pac::DBGMCU.cr().modify(|w| {
|
||||
w.set_dbg_sleep(true);
|
||||
w.set_dbg_standby(true);
|
||||
w.set_dbg_stop(true);
|
||||
});
|
||||
pac::RCC.apb1enr1().modify(|w| {
|
||||
w.set_dac1en(true);
|
||||
});
|
||||
}
|
||||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
|
@ -32,15 +32,6 @@ fn main() -> ! {
|
||||
pac::RCC.apb2enr().modify(|w| {
|
||||
w.set_syscfgen(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);
|
||||
});
|
||||
}
|
||||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
@ -60,15 +60,6 @@ fn main() -> ! {
|
||||
w.set_dma1en(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);
|
||||
});
|
||||
|
||||
pac::RCC.apb1enr1().modify(|w| {
|
||||
w.set_uart4en(true);
|
||||
});
|
||||
|
@ -67,15 +67,6 @@ fn main() -> ! {
|
||||
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