forked from M-Labs/kirdy
ld_drive: Add fns to get pd current & cal ld pwr
This commit is contained in:
parent
707fac0775
commit
b1123047c7
|
@ -4,7 +4,7 @@ use core::{marker::PhantomData, f64::NAN};
|
||||||
|
|
||||||
use uom::si::{
|
use uom::si::{
|
||||||
electric_current::{milliampere},
|
electric_current::{milliampere},
|
||||||
f64::{ElectricPotential, ElectricCurrent, ElectricalResistance},
|
f64::{ElectricPotential, ElectricCurrent, ElectricalResistance, Power},
|
||||||
};
|
};
|
||||||
|
|
||||||
use uom::{si::{ISQ, SI, Quantity}, typenum::*};
|
use uom::{si::{ISQ, SI, Quantity}, typenum::*};
|
||||||
|
@ -87,6 +87,15 @@ impl LD_Drive{
|
||||||
self.ctrl.ld_short_disable();
|
self.ctrl.ld_short_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_ld_power_output(&mut self) -> Power {
|
||||||
|
let pd_i = self.get_pd_i();
|
||||||
|
pd_i * self.settings.pd_i_to_out_pwr
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_pd_i(&mut self) -> ElectricCurrent {
|
||||||
|
self.ctrl.get_pd_mon_v() * Settings::PD_MON_TRANSCONDUCTANCE
|
||||||
|
}
|
||||||
|
|
||||||
pub fn ld_set_i(&mut self, i: ElectricCurrent) -> ElectricCurrent {
|
pub fn ld_set_i(&mut self, i: ElectricCurrent) -> ElectricCurrent {
|
||||||
let ld_i_set = self.ctrl.set_i(i, Settings::LD_DRIVE_TRANSIMPEDANCE, Settings::DAC_OUT_V_MAX);
|
let ld_i_set = self.ctrl.set_i(i, Settings::LD_DRIVE_TRANSIMPEDANCE, Settings::DAC_OUT_V_MAX);
|
||||||
self.settings.ld_drive_current = ld_i_set;
|
self.settings.ld_drive_current = ld_i_set;
|
||||||
|
|
Loading…
Reference in New Issue