Struct stm32_hal2::gpio::Pin[][src]

pub struct Pin {
    pub port: Port,
    pub pin: u8,
}
Expand description

Represents a single GPIO pin. Allows configuration, and reading/setting state.

Fields

port: Portpin: u8

Implementations

Create a new pin, with a specific mode. Enables the RCC peripheral clock to the port, if not already enabled.

Set pin mode. Eg, Output, Input, Analog, or Alt. Sets the MODER register.

Set output type. Sets the OTYPER register.

Set output speed to Low, Medium, or High. Sets the OSPEEDR register.

Set internal pull resistor: Pull up, pull down, or floating. Sets the PUPDR register.

Lock or unlock a port configuration. Sets the LCKR register.

Read the input data register. Eg determine if the pin is high or low. See also is_high() and is_low(). Reads from the IDR register.

Set a pin state (ie set high or low output voltage level). See also set_high() and set_low(). Sets the BSRR register. Atomic.

Configure this pin as an interrupt source. Set the edge as Rising or Falling.

Check if the pin’s input voltage is high. Reads from the IDR register.

Check if the pin’s input voltage is low. Reads from the IDR register.

Set the pin’s output voltage to high. Sets the BSRR register. Atomic.

Set the pin’s output voltage to low. Sets the BSRR register. Atomic.

Trait Implementations

Error type

Is the input pin high?

Is the input pin low?

Error type

Drives the pin low Read more

Drives the pin high Read more

Error type

Toggle pin output.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.