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

Method read

rpi/src/gpio.rs:99–111  ·  view source on GitHub ↗
(&mut self, pin: Pin)

Source from the content-addressed store, hash-verified

97 }
98
99 fn read(&mut self, pin: Pin) -> io::Result<bool> {
100 if !self.inputs.contains_key(&pin) || self.outputs.contains_key(&pin) {
101 return Err(io::Error::new(
102 io::ErrorKind::AlreadyExists,
103 "Pin not configured for read; use GPIO_SETUP first",
104 ));
105 }
106 let pin = self.inputs.get(&pin).unwrap();
107 match pin.read() {
108 gpio::Level::High => Ok(true),
109 gpio::Level::Low => Ok(false),
110 }
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) {

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected