From d3f3608136d269b72dc50dc02d0674391b67b31e Mon Sep 17 00:00:00 2001 From: linuswck Date: Thu, 21 Dec 2023 16:37:53 +0800 Subject: [PATCH] DacVFb is changed to PC3 for rev0_2 prototype - This requires a circuit change to connect it to the PoE_PWR_SRC through a 1.6k Ohm and 100nF LPF --- src/device/gpio.rs | 4 +++- src/thermostat/max1968.rs | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/device/gpio.rs b/src/device/gpio.rs index 49b73a9..90380d1 100644 --- a/src/device/gpio.rs +++ b/src/device/gpio.rs @@ -112,7 +112,9 @@ pub fn setup( shdn: gpioa.pa5.into_push_pull_output(), vref_pin: gpioa.pa6.into_analog(), itec_pin: gpiob.pb1.into_analog(), - dac_feedback_pin: gpioc.pc0.into_analog(), + // Fixme: Flywire is added to Rev0_2 prototype. In Rev0_3, it is connected to PC0 + //dac_feedback_pin: gpioc.pc0.into_analog(), + dac_feedback_pin: gpioc.pc3.into_analog(), vtec_pin: gpiob.pb0.into_analog(), max_v: max_v0, max_i_pos: max_i_pos0, diff --git a/src/thermostat/max1968.rs b/src/thermostat/max1968.rs index 85d7bea..e84242a 100644 --- a/src/thermostat/max1968.rs +++ b/src/thermostat/max1968.rs @@ -96,7 +96,9 @@ impl ChannelPins for Channel0 { type ShdnPin = PA5>; type VRefPin = PA6; type ItecPin = PB1; - type DacFeedbackPin = PC0; + // Fixme: Flywire is added to Rev0_2 prototype. In Rev0_3, it is connected to PC0 + //type DacFeedbackPin = PC0; + type DacFeedbackPin = PC3; type VTecPin = PB0; type MaxVPin = PwmChannel; type MaxIPosPin = PwmChannel; @@ -315,9 +317,7 @@ impl MAX1968 { } pub fn get_dac_vfb(&mut self) -> ElectricPotential { - // Fixme: Rev0_2 does not have this feature - unimplemented!() - //self.adc_read(AdcReadTarget:: DacVfb, 1) + self.adc_read(AdcReadTarget:: DacVfb, 1) } pub fn get_tec_i(&mut self) -> ElectricCurrent {