diff --git a/src/laser_diode/laser_diode.rs b/src/laser_diode/laser_diode.rs index 253d4b4..fadda12 100644 --- a/src/laser_diode/laser_diode.rs +++ b/src/laser_diode/laser_diode.rs @@ -1,7 +1,7 @@ use miniconf::Tree; use stm32f4xx_hal::pac::ADC2; use uom::si::electric_current::ampere; -use crate::laser_diode::ld_ctrl::LdCtrl; +use crate::laser_diode::ld_ctrl::{LdCtrl, Impedance}; use crate::laser_diode::ld_pwr_exc_protector::{LdPwrExcProtector, self}; use crate::laser_diode::pd_responsitivity; use core::marker::PhantomData; @@ -175,7 +175,7 @@ impl LdDrive{ LdPwrExcProtector::set_trigger_threshold_v(i / Settings::PD_MON_TRANSCONDUCTANCE); } - pub fn get_term_status(&mut self)->bool{ - self.ctrl.get_term_status() + pub fn get_term_status(&mut self) -> Impedance { + self.ctrl.get_lf_mod_in_impedance() } } diff --git a/src/laser_diode/ld_ctrl.rs b/src/laser_diode/ld_ctrl.rs index 745c662..951e316 100644 --- a/src/laser_diode/ld_ctrl.rs +++ b/src/laser_diode/ld_ctrl.rs @@ -13,6 +13,12 @@ use uom::si::{ use crate::laser_diode::max5719::{self, Dac}; use crate::laser_diode::laser_diode::TransimpedanceUnit; +#[derive(Debug)] +pub enum Impedance { + Is50Ohm, + Not50Ohm, +} + pub trait ChannelPins { type CurrentSourceShort: OutputPin; type TerminationStatus: InputPin; @@ -61,8 +67,13 @@ impl LdCtrl { self.phy.current_source_short_pin.set_high(); } - pub fn get_term_status(&mut self)-> bool{ - self.phy.termination_status_pin.is_high() + pub fn get_lf_mod_in_impedance(&mut self)-> Impedance { + if self.phy.termination_status_pin.is_high() { + Impedance::Is50Ohm + } + else { + Impedance::Not50Ohm + } } pub fn set_dac(&mut self, voltage: ElectricPotential, dac_out_v_max: ElectricPotential) -> ElectricPotential {