Trait kernel::hil::gpio::Configure

source ·
pub trait Configure {
    // Required methods
    fn configuration(&self) -> Configuration;
    fn make_output(&self) -> Configuration;
    fn disable_output(&self) -> Configuration;
    fn make_input(&self) -> Configuration;
    fn disable_input(&self) -> Configuration;
    fn deactivate_to_low_power(&self);
    fn set_floating_state(&self, state: FloatingState);
    fn floating_state(&self) -> FloatingState;

    // Provided methods
    fn is_input(&self) -> bool { ... }
    fn is_output(&self) -> bool { ... }
}
Expand description

Control and configure a GPIO pin.

Required Methods§

source

fn configuration(&self) -> Configuration

Return the current pin configuration.

source

fn make_output(&self) -> Configuration

Make the pin an output, returning the current configuration, which should be either Configuration::Output or Configuration::InputOutput.

source

fn disable_output(&self) -> Configuration

Disable the pin as an output, returning the current configuration.

source

fn make_input(&self) -> Configuration

Make the pin an input, returning the current configuration, which should be ither Configuration::Input or Configuration::InputOutput.

source

fn disable_input(&self) -> Configuration

Disable the pin as an input, returning the current configuration.

source

fn deactivate_to_low_power(&self)

Put a pin into its lowest power state, with no guarantees on if it is enabled or not. Implementations are free to use any state (e.g. input, output, disable, etc.) the hardware pin supports to ensure the pin is as low power as possible. Re-enabling the pin requires reconfiguring it (i.e. the state of its enabled configuration is not stored).

source

fn set_floating_state(&self, state: FloatingState)

Set the floating state of the pin.

source

fn floating_state(&self) -> FloatingState

Return the current floating state of the pin.

Provided Methods§

source

fn is_input(&self) -> bool

Return whether the pin is an input (reading from the Input trait will return valid results). Returns true if the pin is in Configuration::Input or Configuration::InputOutput.

source

fn is_output(&self) -> bool

Return whether the pin is an output (writing to the Output trait will change the output of the pin). Returns true if the pin is in Configuration::Output or Configuration::InputOutput.

Implementors§