1
0
forked from M-Labs/kirdy

laser_diode: Add fn to set pd_dark_i

This commit is contained in:
linuswck 2024-01-26 12:53:04 +08:00
parent ad731c2f15
commit edd30e94a0

View File

@ -16,8 +16,6 @@ use uom::{si::{ISQ, SI, Quantity}, typenum::*};
pub type TransimpedanceUnit = Quantity<ISQ<P2, P1, N3, N2, Z0, Z0, Z0>, SI<f64>, f64>;
// Ampere / Volt
type TransconductanceUnit = Quantity<ISQ<N2, N1, P3, P2, Z0, Z0, Z0>, SI<f64>, f64>;
// Watt / Ampere
pub type IToPowerUnit = Quantity<ISQ<P2, P1, N3, N1, Z0, Z0, Z0>, SI<f64>, f64>;
impl Settings{
pub const DAC_OUT_V_MAX: ElectricPotential = ElectricPotential {
@ -131,6 +129,10 @@ impl LdDrive{
self.settings.pd_responsitivity.responsitivity = responsitivity;
}
pub fn set_pd_dark_current(&mut self, i_dark: ElectricCurrent){
self.settings.pd_responsitivity.i_dark = i_dark;
}
pub fn set_ld_power_limit(&mut self, pwr_limit: Power){
LdPwrExcProtector::set_trigger_threshold_v(self.settings.pd_responsitivity
.get_ld_i_from_ld_pwr(pwr_limit) / Settings::PD_MON_TRANSCONDUCTANCE