Skip to content

Commit b19ce3c

Browse files
committed
regulators: update demo_mode code for the IOBus supply
The demo_mode code for the IOBus supply was not migrated when the control of the power supply moved from a GPIO to a userspace-controllable regulator. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
1 parent f18e3f0 commit b19ce3c

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/digital_io/gpio/demo_mode.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ impl LineHandle {
3939
match self.name.as_str() {
4040
"OUT_0" => iio_thread.get_channel("out0-volt").unwrap().set(val != 0),
4141
"OUT_1" => iio_thread.get_channel("out1-volt").unwrap().set(val != 0),
42-
"IOBUS_PWR_EN" => {
43-
iio_thread
44-
.clone()
45-
.get_channel("iobus-curr")
46-
.unwrap()
47-
.set(val != 0);
48-
iio_thread.get_channel("iobus-volt").unwrap().set(val != 0);
49-
}
5042
"DUT_PWR_EN" => {
5143
iio_thread
5244
.clone()

src/regulators.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@ use crate::broker::{BrokerBuilder, Topic};
2525
mod reg {
2626
use std::io::Result;
2727

28+
use async_std::task::block_on;
29+
30+
use crate::adc::IioThread;
31+
2832
pub fn regulator_set(name: &str, state: bool) -> Result<()> {
33+
if name == "output_iobus_12v" {
34+
let iio_thread = block_on(IioThread::new()).unwrap();
35+
36+
iio_thread
37+
.clone()
38+
.get_channel("iobus-curr")
39+
.unwrap()
40+
.set(state);
41+
iio_thread.get_channel("iobus-volt").unwrap().set(state);
42+
}
43+
2944
let state = if state { "enabled" } else { "disabled" };
3045
println!("Regulator: would set {name} to {state} but don't feel like it");
3146

0 commit comments

Comments
 (0)