1
0
forked from M-Labs/kirdy

rename current_source -> ld_ctrl

This commit is contained in:
linuswck 2024-01-18 16:13:08 +08:00
parent 5f582be143
commit 3cfdee917a
5 changed files with 15 additions and 15 deletions

View File

@ -1,7 +1,7 @@
use core::marker::PhantomData;
use super::{gpio, sys_timer, usb};
use crate::device::flash_store::{self, FlashStore};
use crate::laser_diode::current_sources::{*};
use crate::laser_diode::ld_ctrl::{*};
use crate::laser_diode::laser_diode::{self, LdDrive};
use crate::thermostat::max1968::MAX1968;
use crate::thermostat::thermostat::Thermostat;
@ -59,7 +59,7 @@ pub fn bootup(
usb::State::setup(usb);
let current_source = CurrentSource::new(current_source_phy, perif.ADC2);
let current_source = LdCtrl::new(current_source_phy, perif.ADC2);
let mut laser = LdDrive::new(current_source);
laser.setup();

View File

@ -1,4 +1,4 @@
use crate::laser_diode::current_sources::{self, CurrentSourcePhy};
use crate::laser_diode::ld_ctrl::{self, LdCtrlPhy};
use crate::laser_diode::max5719;
use crate::thermostat::ad5680;
use crate::thermostat::max1968::{self, MAX1968PinSet, MAX1968Phy, PWM_FREQ_KHZ};
@ -36,7 +36,7 @@ pub fn setup(
) -> (
EthernetPins,
USB,
CurrentSourcePhy<current_sources::Channel0>,
LdCtrlPhy<ld_ctrl::Channel0>,
ad7172::AdcPhy,
MAX1968Phy<max1968::Channel0>,
// thermostat_phy
@ -66,7 +66,7 @@ pub fn setup(
rx_d1: gpioc.pc5,
};
let current_source_phy = CurrentSourcePhy {
let current_source_phy = LdCtrlPhy {
dac: max5719::Dac::new(Spi::new(
spi2,
(

View File

@ -1,5 +1,5 @@
use miniconf::Miniconf;
use crate::laser_diode::current_sources::CurrentSource;
use crate::laser_diode::ld_ctrl::LdCtrl;
use core::{marker::PhantomData, f64::NAN};
use uom::si::{
@ -55,12 +55,12 @@ impl Default for Settings {
}
pub struct LdDrive{
ctrl: CurrentSource,
ctrl: LdCtrl,
settings: Settings,
}
impl LdDrive{
pub fn new(current_source: CurrentSource)-> Self{
pub fn new(current_source: LdCtrl)-> Self{
LdDrive {
ctrl: current_source,
settings: Settings::default()

View File

@ -27,7 +27,7 @@ pub trait ChannelPins {
type Max5719Spi: Transfer<u8>;
}
pub struct CurrentSourcePhy<C: ChannelPins> {
pub struct LdCtrlPhy<C: ChannelPins> {
pub dac: Dac<C::Max5719Spi, C::Max5719Cs, C::Max5719Load>,
pub current_source_ldo_en_pin: C::CurrentSourceLdoEn,
pub current_source_short_pin: C::CurrentSourceShort,
@ -49,20 +49,20 @@ type DacCs = PD8<Output<PushPull>>;
type DacLoad = PB14<Output<PushPull>>;
pub struct CurrentSource{
pub phy: CurrentSourcePhy<Channel0>,
pub struct LdCtrl{
pub phy: LdCtrlPhy<Channel0>,
pub pins_adc: Adc<ADC2>
}
impl CurrentSource {
pub fn new(phy_ch0: CurrentSourcePhy<Channel0>, adc2: ADC2) -> Self {
impl LdCtrl {
pub fn new(phy_ch0: LdCtrlPhy<Channel0>, adc2: ADC2) -> Self {
let config = AdcConfig::default()
.clock(config::Clock::Pclk2_div_2)
.default_sample_time(config::SampleTime::Cycles_480);
let pins_adc = Adc::adc2(adc2, true, config);
CurrentSource {
LdCtrl {
phy: phy_ch0,
pins_adc: pins_adc,
}

View File

@ -1,3 +1,3 @@
pub mod current_sources;
pub mod ld_ctrl;
pub mod max5719;
pub mod laser_diode;