Re-adds embassy macros for stm32
* Hook RCC config into chip config and use chip-specific RCC init function * RTC/clock setup is ignored for now
This commit is contained in:
@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
embassy = { version = "0.1.0", path = "../embassy" }
|
||||
embassy-macros = { version = "0.1.0", path = "../embassy-macros" }
|
||||
embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["stm32"] }
|
||||
embassy-extras = {version = "0.1.0", path = "../embassy-extras" }
|
||||
embassy-traits = {version = "0.1.0", path = "../embassy-traits" }
|
||||
|
||||
@ -23,6 +23,8 @@ critical-section = "0.2.1"
|
||||
bare-metal = "1.0.0"
|
||||
atomic-polyfill = "0.1.2"
|
||||
|
||||
cfg-if = "1.0.0"
|
||||
|
||||
[build-dependencies]
|
||||
regex = "1.4.6"
|
||||
|
||||
|
@ -42,22 +42,25 @@ pub(crate) use pac::regs::generic;
|
||||
|
||||
#[non_exhaustive]
|
||||
pub struct Config {
|
||||
_private: (),
|
||||
rcc: rcc::Config,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self { _private: () }
|
||||
Self {
|
||||
rcc: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Initialize embassy.
|
||||
pub fn init(_config: Config) -> Peripherals {
|
||||
pub fn init(config: Config) -> Peripherals {
|
||||
let p = Peripherals::take();
|
||||
|
||||
unsafe {
|
||||
dma::init();
|
||||
pac::init_exti();
|
||||
rcc::init(config.rcc);
|
||||
}
|
||||
|
||||
p
|
||||
|
@ -527,3 +527,7 @@ impl<'d> Rcc<'d> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn init(config: Config) {
|
||||
// TODO
|
||||
}
|
||||
|
@ -1,4 +1,13 @@
|
||||
#[cfg(feature = "_stm32h7")]
|
||||
mod h7;
|
||||
#[cfg(feature = "_stm32h7")]
|
||||
pub use h7::*;
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "_stm32h7")] {
|
||||
mod h7;
|
||||
pub use h7::*;
|
||||
} else if #[cfg(feature = "_stm32l0")] {
|
||||
mod l0;
|
||||
pub use l0::*;
|
||||
} else {
|
||||
#[derive(Default)]
|
||||
pub struct Config {}
|
||||
pub fn init(_config: Config) {}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user