Add a cores::current module for getting the current microcontroller

This commit is contained in:
Dylan McKay 2017-09-23 17:09:48 +12:00
parent 5d65ad4efd
commit 190a3ec8f1
1 changed files with 5 additions and 1 deletions

View File

@ -44,8 +44,12 @@ fn generate_cores_mod_rs(mcus: &[Mcu]) -> Result<(), io::Error> {
writeln!(w, "//! Cores")?;
writeln!(w)?;
for mcu in mcus {
let module_name = core_module_name(mcu);
writeln!(w, "/// The {}.", mcu.device.name)?;
writeln!(w, "pub mod {};", core_module_name(mcu))?;
writeln!(w, "pub mod {};", module_name)?;
writeln!(w, "#[cfg(all(target_arch = \"avr\", target_cpu = \"{}\"))]", module_name)?;
writeln!(w, "pub use self::{} as current;", module_name)?;
}
writeln!(w)
}