MCPcopy Index your code
hub / github.com/endbasic/endbasic / write

Method write

rpi/src/gpio.rs:113–127  ·  view source on GitHub ↗
(&mut self, pin: Pin, v: bool)

Source from the content-addressed store, hash-verified

111 }
112
113 fn write(&mut self, pin: Pin, v: bool) -> io::Result<()> {
114 if self.inputs.contains_key(&pin) || !self.outputs.contains_key(&pin) {
115 return Err(io::Error::new(
116 io::ErrorKind::AlreadyExists,
117 "Pin not configured for write; use GPIO_SETUP first",
118 ));
119 }
120 let pin = self.outputs.get_mut(&pin).unwrap();
121 if v {
122 pin.write(gpio::Level::High);
123 } else {
124 pin.write(gpio::Level::Low);
125 }
126 Ok(())
127 }
128}

Callers

nothing calls this directly

Calls 1

get_mutMethod · 0.45

Tested by

no test coverage detected