mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Move to internal mod and re-export the enums
This commit is contained in:
parent
88e29608ed
commit
e79d2dd756
@ -601,7 +601,7 @@ fn main() {
|
||||
.iter()
|
||||
.map(|(_fieldset, fieldname, enum_name)| {
|
||||
quote! {
|
||||
pub #fieldname: Option<crate::pac::rcc::vals::#enum_name>
|
||||
pub #fieldname: Option<#enum_name>
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -627,7 +627,15 @@ fn main() {
|
||||
})
|
||||
.collect();
|
||||
|
||||
let enum_names: BTreeSet<_> = rcc_cfgr_regs
|
||||
.iter()
|
||||
.map(|(_fieldset, _fieldname, enum_name)| enum_name)
|
||||
.collect();
|
||||
|
||||
g.extend(quote! {
|
||||
pub mod mux {
|
||||
#(pub use crate::pac::rcc::vals::#enum_names as #enum_names; )*
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct ClockMux {
|
||||
#( #struct_fields, )*
|
||||
@ -646,6 +654,7 @@ fn main() {
|
||||
#( #inits )*
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -97,10 +97,9 @@ pub struct Config {
|
||||
pub adc: AdcClockSource,
|
||||
#[cfg(all(stm32f3, not(rcc_f37), adc3_common))]
|
||||
pub adc34: AdcClockSource,
|
||||
#[cfg(stm32f334)]
|
||||
pub hrtim: HrtimClockSource,
|
||||
|
||||
#[cfg(clock_mux)]
|
||||
pub mux: crate::rcc::ClockMux,
|
||||
pub mux: crate::rcc::mux::ClockMux,
|
||||
|
||||
pub ls: super::LsConfig,
|
||||
}
|
||||
@ -128,8 +127,7 @@ impl Default for Config {
|
||||
adc: AdcClockSource::Hclk(AdcHclkPrescaler::Div1),
|
||||
#[cfg(all(stm32f3, not(rcc_f37), adc3_common))]
|
||||
adc34: AdcClockSource::Hclk(AdcHclkPrescaler::Div1),
|
||||
#[cfg(stm32f334)]
|
||||
hrtim: HrtimClockSource::BusClk,
|
||||
|
||||
#[cfg(clock_mux)]
|
||||
mux: Default::default(),
|
||||
}
|
||||
@ -350,7 +348,8 @@ pub(crate) unsafe fn init(config: Config) {
|
||||
}
|
||||
};
|
||||
|
||||
#[cfg(stm32f334)]
|
||||
/*
|
||||
TODO: Maybe add something like this to clock_mux? How can we autogenerate the data for this?
|
||||
let hrtim = match config.hrtim {
|
||||
// Must be configured after the bus is ready, otherwise it won't work
|
||||
HrtimClockSource::BusClk => None,
|
||||
@ -366,6 +365,7 @@ pub(crate) unsafe fn init(config: Config) {
|
||||
Some(pll * 2u32)
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
#[cfg(clock_mux)]
|
||||
config.mux.init();
|
||||
@ -384,8 +384,6 @@ pub(crate) unsafe fn init(config: Config) {
|
||||
adc: Some(adc),
|
||||
#[cfg(all(stm32f3, not(rcc_f37), adc3_common))]
|
||||
adc34: Some(adc34),
|
||||
#[cfg(stm32f334)]
|
||||
hrtim: hrtim,
|
||||
rtc: rtc,
|
||||
hsi48: hsi48,
|
||||
#[cfg(any(rcc_f1, rcc_f1cl, stm32f3))]
|
||||
|
@ -32,7 +32,7 @@ mod _version;
|
||||
pub use _version::*;
|
||||
|
||||
#[cfg(clock_mux)]
|
||||
pub use crate::_generated::ClockMux;
|
||||
pub use crate::_generated::mux as mux;
|
||||
pub use crate::_generated::Clocks;
|
||||
|
||||
#[cfg(feature = "low-power")]
|
||||
|
@ -28,9 +28,7 @@ async fn main(_spawner: Spawner) {
|
||||
config.rcc.apb1_pre = APBPrescaler::DIV2;
|
||||
config.rcc.apb2_pre = APBPrescaler::DIV1;
|
||||
|
||||
// TODO: The two lines here do the same thing
|
||||
config.rcc.hrtim = HrtimClockSource::PllClk;
|
||||
config.rcc.mux.hrtim1sw = Some(embassy_stm32::pac::rcc::vals::Timsw::PLL1_P);
|
||||
config.rcc.mux.hrtim1sw = Some(embassy_stm32::rcc::mux::Timsw::PLL1_P);
|
||||
}
|
||||
let p = embassy_stm32::init(config);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user