1
0
Fork 0

rename get_term_status -> get_lf_mod_in_impedance

This commit is contained in:
linuswck 2024-02-07 17:18:00 +08:00
parent b0edd3dba2
commit 60a79d1780
2 changed files with 16 additions and 5 deletions

View File

@ -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()
}
}

View File

@ -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 {