boot: Add ld_drive boot sequence
This commit is contained in:
parent
be8bf0a8b6
commit
277796d2a4
|
@ -1,5 +1,6 @@
|
|||
use super::{gpio, sys_timer, usb};
|
||||
use crate::laser_diode::current_sources::*;
|
||||
use crate::laser_diode::current_sources::{*, self};
|
||||
use crate::laser_diode::ld_drive::LD_Drive;
|
||||
use crate::thermostat::max1968::{MAX1968};
|
||||
use crate::thermostat::thermostat::Thermostat;
|
||||
use fugit::ExtU32;
|
||||
|
@ -21,7 +22,7 @@ const WATCHDOG_PERIOD: u32 = 30000;
|
|||
pub fn bootup(
|
||||
mut core_perif: CorePeripherals,
|
||||
perif: Peripherals,
|
||||
) -> (IndependentWatchdog, Thermostat) {
|
||||
) -> (IndependentWatchdog, LD_Drive, Thermostat) {
|
||||
core_perif.SCB.enable_icache();
|
||||
core_perif.SCB.enable_dcache(&mut core_perif.CPUID);
|
||||
|
||||
|
@ -55,6 +56,16 @@ pub fn bootup(
|
|||
|
||||
usb::State::setup(usb);
|
||||
|
||||
let current_source = CurrentSource::new(current_source_phy, perif.ADC2);
|
||||
|
||||
let mut laser = LD_Drive::new(current_source);
|
||||
laser.setup();
|
||||
laser.ld_open();
|
||||
laser.power_up();
|
||||
|
||||
laser.ld_set_i(ElectricCurrent::new::<ampere>(0.15));
|
||||
|
||||
|
||||
let tec_driver = MAX1968::new(max1968_phy, perif.ADC1);
|
||||
|
||||
let mut thermostat = Thermostat::new(tec_driver);
|
||||
|
@ -68,5 +79,5 @@ pub fn bootup(
|
|||
|
||||
info!("Kirdy setup complete");
|
||||
|
||||
(wd, thermostat)
|
||||
(wd, laser, thermostat)
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ fn main() -> ! {
|
|||
let core_perif = CorePeripherals::take().unwrap();
|
||||
let perif = Peripherals::take().unwrap();
|
||||
|
||||
let (mut wd, mut tec_driver) = bootup(core_perif, perif);
|
||||
let (mut wd, mut tec_driver, mut laser,) = bootup(core_perif, perif);
|
||||
|
||||
loop {
|
||||
wd.feed();
|
||||
|
|
Loading…
Reference in New Issue