From 0bc0af74877dfd46eb019350c1b9318ab8dfce80 Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 17 May 2020 02:18:25 +0200 Subject: [PATCH] rename dac_loopback to dac_feedback --- src/channel.rs | 4 ++-- src/channels.rs | 6 +++--- src/main.rs | 8 ++++---- src/pins.rs | 16 ++++++++-------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index c35d31f..ab17a2c 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -21,7 +21,7 @@ pub struct Channel { pub adc: C::Adc, pub itec_pin: C::ItecPin, /// feedback from `dac` output - pub dac_loopback_pin: C::DacLoopbackPin, + pub dac_feedback_pin: C::DacFeedbackPin, } impl Channel { @@ -36,7 +36,7 @@ impl Channel { shdn: pins.shdn, adc: pins.adc, itec_pin: pins.itec_pin, - dac_loopback_pin: pins.dac_loopback_pin, + dac_feedback_pin: pins.dac_feedback_pin, } } } diff --git a/src/channels.rs b/src/channels.rs index c504b41..a6d5e84 100644 --- a/src/channels.rs +++ b/src/channels.rs @@ -95,11 +95,11 @@ impl Channels { } } - pub fn read_dac_loopback(&mut self, channel: usize) -> Volts { + pub fn read_dac_feedback(&mut self, channel: usize) -> Volts { match channel { 0 => { let sample = self.channel0.adc.convert( - &self.channel0.dac_loopback_pin, + &self.channel0.dac_feedback_pin, stm32f4xx_hal::adc::config::SampleTime::Cycles_480 ); let mv = self.channel0.adc.sample_to_millivolts(sample); @@ -107,7 +107,7 @@ impl Channels { } 1 => { let sample = self.channel1.adc.convert( - &self.channel1.dac_loopback_pin, + &self.channel1.dac_feedback_pin, stm32f4xx_hal::adc::config::SampleTime::Cycles_480 ); let mv = self.channel1.adc.sample_to_millivolts(sample); diff --git a/src/main.rs b/src/main.rs index b6f44f7..249caf6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -143,17 +143,17 @@ fn main() -> ! { Command::Show(ShowCommand::Input) => { for channel in 0..CHANNELS { if let Some(adc_data) = channels.channel_state(channel).adc_data { - let dac_loopback = channels.read_dac_loopback(channel); - let dac_i = dac_loopback / Ohms(5.0); + let dac_feedback = channels.read_dac_feedback(channel); + let dac_i = dac_feedback / Ohms(5.0); let itec = channels.read_itec(channel); let tec_i = Amps((itec.0 - 1.5) / 8.0); let state = channels.channel_state(channel); let _ = writeln!( - socket, "t={} raw{}=0x{:06X} dac_loopback={}/{} itec={} tec={}", + socket, "t={} raw{}=0x{:06X} dac_feedback={}/{} itec={} tec={}", state.adc_time, channel, adc_data, - dac_loopback, dac_i, + dac_feedback, dac_i, itec, tec_i, ); } diff --git a/src/pins.rs b/src/pins.rs index 169a94e..cdf5a07 100644 --- a/src/pins.rs +++ b/src/pins.rs @@ -28,7 +28,7 @@ pub trait ChannelPins { type Shdn: OutputPin; type Adc; type ItecPin; - type DacLoopbackPin; + type DacFeedbackPin; } impl ChannelPins for Channel0 { @@ -37,7 +37,7 @@ impl ChannelPins for Channel0 { type Shdn = PE10>; type Adc = Adc; type ItecPin = PA6; - type DacLoopbackPin = PA4; + type DacFeedbackPin = PA4; } impl ChannelPins for Channel1 { @@ -46,7 +46,7 @@ impl ChannelPins for Channel1 { type Shdn = PE15>; type Adc = Adc; type ItecPin = PB0; - type DacLoopbackPin = PA5; + type DacFeedbackPin = PA5; } /// SPI peripheral used for communication with the ADC @@ -62,7 +62,7 @@ pub struct ChannelPinSet { pub shdn: C::Shdn, pub adc: C::Adc, pub itec_pin: C::ItecPin, - pub dac_loopback_pin: C::DacLoopbackPin, + pub dac_feedback_pin: C::DacFeedbackPin, } pub struct Pins { @@ -113,14 +113,14 @@ impl Pins { let mut adc0 = Adc::adc1(adc1, true, Default::default()); adc0.enable(); let itec0_pin = gpioa.pa6.into_analog(); - let dac_loopback0_pin = gpioa.pa4.into_analog(); + let dac_feedback0_pin = gpioa.pa4.into_analog(); let channel0 = ChannelPinSet { dac_spi: dac0_spi, dac_sync: dac0_sync, shdn: shdn0, adc: adc0, itec_pin: itec0_pin, - dac_loopback_pin: dac_loopback0_pin, + dac_feedback_pin: dac_feedback0_pin, }; let (dac1_spi, dac1_sync) = Self::setup_dac1( @@ -132,14 +132,14 @@ impl Pins { let mut adc1 = Adc::adc2(adc2, true, Default::default()); adc1.enable(); let itec1_pin = gpiob.pb0.into_analog(); - let dac_loopback1_pin = gpioa.pa5.into_analog(); + let dac_feedback1_pin = gpioa.pa5.into_analog(); let channel1 = ChannelPinSet { dac_spi: dac1_spi, dac_sync: dac1_sync, shdn: shdn1, adc: adc1, itec_pin: itec1_pin, - dac_loopback_pin: dac_loopback1_pin, + dac_feedback_pin: dac_feedback1_pin, }; Pins {