forked from M-Labs/kirdy
Add high level ld_drive mod
- Use current_source driver to interface with the board
This commit is contained in:
parent
0807f66b3c
commit
590ba8171c
|
@ -0,0 +1,51 @@
|
|||
use miniconf::Miniconf;
|
||||
use crate::laser_diode::current_sources::CurrentSource;
|
||||
|
||||
use uom::si::{
|
||||
electric_current::{milliampere},
|
||||
f64::ElectricCurrent,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Miniconf)]
|
||||
pub struct Settings {
|
||||
pub ld_drive_current: ElectricCurrent,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
ld_drive_current: ElectricCurrent::new::<milliampere>(0.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LD_Drive{
|
||||
ctrl: CurrentSource,
|
||||
settings: Settings,
|
||||
}
|
||||
|
||||
impl LD_Drive{
|
||||
pub fn new(current_source: CurrentSource)-> Self{
|
||||
LD_Drive {
|
||||
ctrl: current_source,
|
||||
settings: Settings::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn power_up(&mut self){
|
||||
self.ctrl.power_up();
|
||||
}
|
||||
|
||||
pub fn power_down(&mut self){
|
||||
self.ctrl.power_down();
|
||||
}
|
||||
|
||||
pub fn ld_short(&mut self) {
|
||||
self.ctrl.ld_short_enable();
|
||||
}
|
||||
|
||||
pub fn ld_open(&mut self) {
|
||||
self.ctrl.ld_short_disable();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,2 +1,3 @@
|
|||
pub mod current_sources;
|
||||
pub mod max5719;
|
||||
pub mod max5719;
|
||||
pub mod ld_drive;
|
Loading…
Reference in New Issue