Open
Description
What the title says. The use case for this is some sort of generic charlieplexing interface / driver / library.
Alternatives
Vanilla
/// A tri-state (low, high, floating) pin
pub trait TriStatePin {
/// Drives the pin low
fn set_low(&mut self);
/// Drives the pin high
fn set_high(&mut self);
/// Puts the pin in floating mode
fn float(&mut self);
/// Checks if the pin is currently in floating mode
fn is_floating(&self) -> bool;
// plus maybe other `is_*` methods
}
Enum based
/// The states of a tri-state pin
enum State { Low, High, Floating }
/// A tri-state (low, high, floating) pin
pub trait TriStatePin {
/// Changes the state of the pin
fn set(&mut self, state: State);
/// Gets the state of the pin
fn state(&self) -> State;
}
Once we pick an alternative that we are happy with we can land it behind the "unproven" feature gate. Once someone has demonstrated that it works by actually implementing the trait and building some generic library on top of it we can un-feature gate it.
cc @therealprof