From 59f2385ecf1019b1fbaa2a2e07fd7324bd078526 Mon Sep 17 00:00:00 2001 From: linuswck Date: Tue, 9 Jan 2024 16:31:58 +0800 Subject: [PATCH] ld_drive: make settings private & add set & get fn --- src/laser_diode/ld_drive.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/laser_diode/ld_drive.rs b/src/laser_diode/ld_drive.rs index d472344..546325c 100644 --- a/src/laser_diode/ld_drive.rs +++ b/src/laser_diode/ld_drive.rs @@ -45,8 +45,8 @@ impl Settings{ #[derive(Clone, Debug, Miniconf)] pub struct Settings { - pub ld_drive_current: ElectricCurrent, - pub pd_i_to_out_pwr: i_to_power_unit, + ld_drive_current: ElectricCurrent, + pd_i_to_out_pwr: i_to_power_unit, } impl Default for Settings { @@ -85,6 +85,14 @@ impl LD_Drive{ self.ctrl.power_down(); } + pub fn get_ld_drive_current(&mut self) -> ElectricCurrent{ + self.settings.ld_drive_current + } + + pub fn set_pd_i_to_out_pwr(&mut self, val: i_to_power_unit){ + self.settings.pd_i_to_out_pwr = val; + } + pub fn ld_short(&mut self) { self.ctrl.ld_short_enable(); }