/// Generates the `devices.rs` module, which contains type definitions and
/// initialisation functions for bootloader features such as serial and external
/// flash.
Generates the `devices.rs` module, which contains type definitions and
initialisation functions for bootloader features such as serial and external
flash.
Generates the ` devices . rs ` module which contains type definitions and initialisation functions for bootloader features such as serial and external flash .
pub fn generate<P: AsRef<Path>>(
    autogenerated_folder_path: P,
    configuration: &Configuration,
) -> Result<()> {
    let filename = autogenerated_folder_path.as_ref().join("devices.rs");
    let mut file = OpenOptions::new().write(true).create(true).truncate(true).open(&filename)?;
    let mut code = quote! {};
    match configuration.port {
        crate::port::Port::Stm32F412 => {
            generate_serial_stm32(configuration, &mut code)?;
            generate_flash_stm32(configuration, &mut code)?;
        }
        crate::port::Port::Wgm160P => {}
    }
    file.write_all(format!("{}", code).as_bytes())?;
    prettify_file(filename).ok();
    Ok(())
}
pub fn generate < P : AsRef < Path > > ( autogenerated_folder_path : P , configuration : & Configuration , ) -> Result < ( ) > { let filename = autogenerated_folder_path . as_ref ( ) . join ( " " ) ; let mut file = OpenOptions :: new ( ) . write ( true ) . create ( true ) . truncate ( true ) . open ( & filename ) ? ; let mut code = quote ! { } ; match configuration . port { crate :: port :: Port :: Stm32F412 => { generate_serial_stm32 ( configuration , & mut code ) ? ; generate_flash_stm32 ( configuration , & mut code ) ? ; } crate :: port :: Port :: Wgm160P => { } } file . write_all ( format ! ( " " code ) . as_bytes ( ) ) ? ; prettify_file ( filename ) . ok ( ) ; Ok ( ( ) ) }
Generates the `devices.rs` module, which contains type definitions and
initialisation functions for bootloader features such as serial and external
flash.
Generates the ` devices . rs ` module which contains type definitions and initialisation functions for bootloader features such as serial and external flash .
autogenerated_folder_path
P
configuration
&Configuration