/// Renders the menu to configure the entire memory map, consisting of a mandatory internal
/// flash (and its bank distribution, which must contain a bootable bank) and an optional
/// external flash.
Renders the menu to configure the entire memory map, consisting of a mandatory internal
flash (and its bank distribution, which must contain a bootable bank) and an optional
external flash.
Renders the menu to configure the entire memory map consisting of a mandatory internal flash ( and its bank distribution which must contain a bootable bank ) and an optional external flash .
pub fn configure_memory_map(
    ui: &mut egui::Ui,
    internal_memory_map: &mut InternalMemoryMap,
    external_memory_map: &mut ExternalMemoryMap,
    external_flash: &mut Option<FlashChip>,
    golden_index: &mut Option<usize>,
    port: &Port,
) {
    let internal_flash = memory::internal_flash(port);
    normalize(
        internal_memory_map,
        external_memory_map,
        &internal_flash,
        external_flash,
        golden_index,
        port,
    );
    ui.group(|ui| {
        ui.horizontal_wrapped(|ui| {
            ui.add(Label::new("Internal flash chip: ").heading());
            ui.add(
                Label::new(internal_flash.name.clone()).heading().text_color(Color32::LIGHT_BLUE),
            );
        });
        ui.separator();
        ui.label("Bootloader:");
        select_bootloader_location(ui, internal_memory_map, &internal_flash);
        select_bootloader_length(ui, internal_memory_map, &internal_flash);
        ui.label("Banks:");
        ui.separator();
        configure_internal_banks(ui, internal_memory_map, &internal_flash, golden_index);
    });
    ui.separator();
    ui.group(|ui| {
        ui.horizontal_wrapped(|ui| {
            ui.set_enabled(memory::external_flash(port).count() > 0);
            ui.add(Label::new("External flash chip:").heading());
            egui::ComboBox::from_id_source("external_flash_chip")
                .selected_text(match external_flash {
                    Some(map) => &map.name,
                    None => "Select external flash (optional)",
                })
                .show_ui(ui, |ui| {
                    ui.selectable_value(external_flash, None, "None");
                    for chip in memory::external_flash(port) {
                        ui.selectable_value(external_flash, Some(chip.clone()), chip.name);
                    }
                });
        });
        ui.separator();
        if let Some(external_flash) = external_flash {
            ui.label("Banks:");
            ui.separator();
            configure_external_banks(
                ui,
                external_memory_map,
                internal_memory_map,
                external_flash,
                golden_index,
            );
        }
    });
}
pub fn configure_memory_map ( ui : & mut egui :: Ui , internal_memory_map : & mut InternalMemoryMap , external_memory_map : & mut ExternalMemoryMap , external_flash : & mut Option < FlashChip > , golden_index : & mut Option < usize > , port : & Port , ) { let internal_flash = memory :: internal_flash ( port ) ; normalize ( internal_memory_map , external_memory_map , & internal_flash , external_flash , golden_index , port , ) ; ui . group ( | ui | { ui . horizontal_wrapped ( | ui | { ui . add ( Label :: new ( " " ) . heading ( ) ) ; ui . add ( Label :: new ( internal_flash . name . clone ( ) ) . heading ( ) . text_color ( Color32 :: LIGHT_BLUE ) , ) ; } ) ; ui . separator ( ) ; ui . label ( " " ) ; select_bootloader_location ( ui , internal_memory_map , & internal_flash ) ; select_bootloader_length ( ui , internal_memory_map , & internal_flash ) ; ui . label ( " " ) ; ui . separator ( ) ; configure_internal_banks ( ui , internal_memory_map , & internal_flash , golden_index ) ; } ) ; ui . separator ( ) ; ui . group ( | ui | { ui . horizontal_wrapped ( | ui | { ui . set_enabled ( memory :: external_flash ( port ) . count ( ) > 0 ) ; ui . add ( Label :: new ( " " ) . heading ( ) ) ; egui :: ComboBox :: from_id_source ( " " ) . selected_text ( match external_flash { Some ( map ) => & map . name , None => " " , } ) . show_ui ( ui , | ui | { ui . selectable_value ( external_flash , None , " " ) ; for chip in memory :: external_flash ( port ) { ui . selectable_value ( external_flash , Some ( chip . clone ( ) ) , chip . name ) ; } } ) ; } ) ; ui . separator ( ) ; if let Some ( external_flash ) = external_flash { ui . label ( " " ) ; ui . separator ( ) ; configure_external_banks ( ui , external_memory_map , internal_memory_map , external_flash , golden_index , ) ; } } ) ; }
Renders the menu to configure the entire memory map, consisting of a mandatory internal
flash (and its bank distribution, which must contain a bootable bank) and an optional
external flash.
Renders the menu to configure the entire memory map consisting of a mandatory internal flash ( and its bank distribution which must contain a bootable bank ) and an optional external flash .
ui
&mut egui::Ui
internal_memory_map
&mut InternalMemoryMap
external_memory_map
&mut ExternalMemoryMap
external_flash
&mut Option<FlashChip>
golden_index
&mut Option<usize>
port
&Port