pub trait IoPin<TInput, TOutput>where
TInput: InputPin + IoPin<TInput, TOutput>,
TOutput: OutputPin + IoPin<TInput, TOutput>,{
type Error;
fn into_input_pin(self) -> Result<TInput, Self::Error>;
fn into_output_pin(self, state: PinState) -> Result<TOutput, Self::Error>;
}
Expand description
Single pin that can switch from input to output mode, and vice-versa.
Example use (assumes the Error
type is the same for the IoPin
,
InputPin
, and OutputPin
):
This trait is available if embedded-hal is built with the "unproven"
feature.
Required Associated Types
Required Methods
sourcefn into_input_pin(self) -> Result<TInput, Self::Error>
fn into_input_pin(self) -> Result<TInput, Self::Error>
Tries to convert this pin to input mode.
If the pin is already in input mode, this method should succeed.
sourcefn into_output_pin(self, state: PinState) -> Result<TOutput, Self::Error>
fn into_output_pin(self, state: PinState) -> Result<TOutput, Self::Error>
Tries to convert this pin to output mode with the given initial state.
If the pin is already in the requested state, this method should succeed.