use miniconf::Miniconf; use crate::laser_diode::current_sources::CurrentSource; use uom::si::{ electric_current::{milliampere}, f64::ElectricCurrent, }; #[derive(Clone, Debug, Miniconf)] pub struct Settings { pub ld_drive_current: ElectricCurrent, } impl Default for Settings { fn default() -> Self { Self { ld_drive_current: ElectricCurrent::new::(0.0), } } } pub struct LD_Drive{ ctrl: CurrentSource, settings: Settings, } impl LD_Drive{ pub fn new(current_source: CurrentSource)-> Self{ LD_Drive { ctrl: current_source, settings: Settings::default() } } pub fn power_up(&mut self){ self.ctrl.power_up(); } pub fn power_down(&mut self){ self.ctrl.power_down(); } pub fn ld_short(&mut self) { self.ctrl.ld_short_enable(); } pub fn ld_open(&mut self) { self.ctrl.ld_short_disable(); } }