use probe_rs_target::ChipFamily;
use crate::{flashing::ImageFormat, probe::ProbeFactory, vendor::Vendor};
#[derive(Clone, Default)]
pub struct Plugin<'p> {
pub vendors: &'p [&'static dyn Vendor],
pub image_formats: &'p [&'static dyn ImageFormat],
pub targets: &'p [ChipFamily],
pub probe_drivers: &'p [&'static dyn ProbeFactory],
}
pub fn register_plugin(plugin: Plugin<'_>) {
for vendor in plugin.vendors {
crate::vendor::register_vendor(*vendor);
}
for image_format in plugin.image_formats {
crate::flashing::register_image_format(*image_format);
}
for target in plugin.targets {
crate::config::registry::add_builtin_target(target.clone());
}
for probe_driver in plugin.probe_drivers {
crate::probe::register_probe_factory(*probe_driver);
}
}