1
0
forked from M-Labs/kirdy

boot: init analog wdg & power up laser after cfg

- Verified to be boot-able on Rev0_3 board
This commit is contained in:
linuswck 2024-01-24 12:14:11 +08:00
parent af283b17ac
commit 5bea3f0e5f

View File

@ -1,8 +1,7 @@
use core::marker::PhantomData;
use super::{gpio, sys_timer, usb};
use crate::device::flash_store::{self, FlashStore};
use crate::laser_diode::ld_ctrl::{*};
use crate::laser_diode::laser_diode::{self, LdDrive};
use crate::laser_diode::laser_diode::LdDrive;
use crate::thermostat::max1968::MAX1968;
use crate::thermostat::thermostat::Thermostat;
use fugit::ExtU32;
@ -41,7 +40,7 @@ pub fn bootup(
sys_timer::setup(core_perif.SYST, clocks);
let (_eth_pins, usb, current_source_phy, ad7172_phy, max1968_phy) = gpio::setup(
let (_eth_pins, usb, current_source_phy, ad7172_phy, max1968_phy, pd_mon_phy) = gpio::setup(
clocks,
perif.TIM4,
perif.GPIOA,
@ -59,17 +58,14 @@ pub fn bootup(
usb::State::setup(usb);
let current_source = LdCtrl::new(current_source_phy, perif.ADC2);
let current_source = LdCtrl::new(current_source_phy);
let mut laser = LdDrive::new(current_source);
let mut laser = LdDrive::new(current_source, perif.ADC2, pd_mon_phy);
laser.setup();
laser.ld_open();
laser.power_up();
laser.set_ld_drive_current_limit(ElectricCurrent::new::<ampere>(0.2));
laser.ld_set_i(ElectricCurrent::new::<ampere>(0.15));
// Set a non-zero value so that there is a non NAN power reading
laser.set_pd_i_to_out_pwr(laser_diode::IToPowerUnit {dimension: PhantomData, units: PhantomData, value: 0.001});
laser.power_up();
let tec_driver = MAX1968::new(max1968_phy, perif.ADC1);