forked from M-Labs/thermostat
keep shdn high all the time
This commit is contained in:
parent
d326517453
commit
cca0a77657
|
@ -28,10 +28,12 @@ pub struct Channel<C: ChannelPins> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C: ChannelPins> Channel<C> {
|
impl<C: ChannelPins> Channel<C> {
|
||||||
pub fn new(pins: ChannelPinSet<C>) -> Self {
|
pub fn new(mut pins: ChannelPinSet<C>) -> Self {
|
||||||
let state = ChannelState::default();
|
let state = ChannelState::default();
|
||||||
let mut dac = ad5680::Dac::new(pins.dac_spi, pins.dac_sync);
|
let mut dac = ad5680::Dac::new(pins.dac_spi, pins.dac_sync);
|
||||||
let _ = dac.set(0);
|
let _ = dac.set(0);
|
||||||
|
// power up TEC
|
||||||
|
let _ = pins.shdn.set_high();
|
||||||
// sensible dummy preset. calibrate_i_set() must be used.
|
// sensible dummy preset. calibrate_i_set() must be used.
|
||||||
let dac_factor = ad5680::MAX_VALUE as f64 / 5.0;
|
let dac_factor = ad5680::MAX_VALUE as f64 / 5.0;
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,10 @@ impl Channels {
|
||||||
0 => {
|
0 => {
|
||||||
self.channel0.dac.set(value).unwrap();
|
self.channel0.dac.set(value).unwrap();
|
||||||
self.channel0.state.dac_value = voltage;
|
self.channel0.state.dac_value = voltage;
|
||||||
self.channel0.shdn.set_high().unwrap();
|
|
||||||
}
|
}
|
||||||
1 => {
|
1 => {
|
||||||
self.channel1.dac.set(value).unwrap();
|
self.channel1.dac.set(value).unwrap();
|
||||||
self.channel1.state.dac_value = voltage;
|
self.channel1.state.dac_value = voltage;
|
||||||
self.channel1.shdn.set_high().unwrap();
|
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue