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

Function setup_gpio_pins

cli/src/gpio.rs:38–46  ·  view source on GitHub ↗

Parses the `--gpio-pins` flag value and constructs the pins backend.

(spec: Option<&str>)

Source from the content-addressed store, hash-verified

36
37/// Parses the `--gpio-pins` flag value and constructs the pins backend.
38pub(crate) fn setup_gpio_pins(spec: Option<&str>) -> Result<Rc<RefCell<dyn gpio::Pins>>> {
39 let spec = if cfg!(feature = "rpi") { spec.unwrap_or("rppal") } else { spec.unwrap_or("noop") };
40 match spec {
41 "mock" => Ok(Rc::new(RefCell::new(gpio::MockPins::default()))),
42 "noop" => Ok(Rc::new(RefCell::new(gpio::NoopPins::default()))),
43 "rppal" => setup_gpio_pins_rppal(),
44 other => Err(bad_usage!(format!("Unknown --gpio-pins backend: {}", other)).into()),
45 }
46}

Callers 1

new_machine_builderFunction · 0.85

Calls 1

setup_gpio_pins_rppalFunction · 0.85

Tested by

no test coverage detected