# Gpio in k210_hal::gpio - Rust
GPIO wrapper struct
Keywords: rust, rustlang, rust-lang, Gpio

# Struct k210_hal::gpio::Gpio

source · [−]

    pub struct Gpio<GPIO, PIN, MODE> { /* private fields */ }

Expand description

GPIO wrapper struct

## Implementations

source

### impl<GPIO: GpioIndex, PIN: Mode<GPIO::FUNC>> Gpio<GPIO, PIN, Unknown>

source

#### pub fn new(gpio: GPIO, pin: PIN) -> Gpio<GPIO, PIN, Unknown>

source

### impl<GPIO, PIN, MODE> Gpio<GPIO, PIN, MODE>

source

#### pub fn free(self) -> (GPIO, PIN)

source

### impl<GPIO: GpioIndex, PIN: IoPin, MODE: Active> Gpio<GPIO, PIN, MODE>

source

#### pub fn into_floating_input(self) -> Gpio<GPIO, PIN, Input<Floating>>

source

#### pub fn into_pull_up_input(self) -> Gpio<GPIO, PIN, Input<PullUp>>

source

#### pub fn into_pull_down_input(self) -> Gpio<GPIO, PIN, Input<PullDown>>

source

#### pub fn into_push_pull_output(self) -> Gpio<GPIO, PIN, Output>

## Trait Implementations

source

### impl<GPIO: GpioIndex, PIN, MODE> InputPin for Gpio<GPIO, PIN, Input<MODE>>

#### type Error = Infallible

Error type

source

#### fn try_is_high(&self) -> Result<bool, Self::Error>

Is the input pin high?

source

#### fn try_is_low(&self) -> Result<bool, Self::Error>

Is the input pin low?

source

### impl<GPIO: GpioIndex, PIN> OutputPin for Gpio<GPIO, PIN, Output>

#### type Error = Infallible

Error type

source

#### fn try_set_high(&mut self) -> Result<(), Self::Error>

Drives the pin high Read more

source

#### fn try_set_low(&mut self) -> Result<(), Self::Error>

Drives the pin low Read more

source

### impl<GPIO: GpioIndex, PIN> StatefulOutputPin for Gpio<GPIO, PIN, Output>

source

#### fn try_is_set_high(&self) -> Result<bool, Self::Error>

Is the pin in drive high mode? Read more

source

#### fn try_is_set_low(&self) -> Result<bool, Self::Error>

Is the pin in drive low mode? Read more

source

### impl<GPIO: GpioIndex, PIN> ToggleableOutputPin for Gpio<GPIO, PIN, Output>

#### type Error = Infallible

Error type

source

#### fn try_toggle(&mut self) -> Result<(), Self::Error>

Toggle pin output.

## Auto Trait Implementations

### impl<GPIO, PIN, MODE> RefUnwindSafe for Gpio<GPIO, PIN, MODE> where
GPIO: RefUnwindSafe,
MODE: RefUnwindSafe,
PIN: RefUnwindSafe,

### impl<GPIO, PIN, MODE> Send for Gpio<GPIO, PIN, MODE> where
GPIO: Send,
MODE: Send,
PIN: Send,

### impl<GPIO, PIN, MODE> Sync for Gpio<GPIO, PIN, MODE> where
GPIO: Sync,
MODE: Sync,
PIN: Sync,

### impl<GPIO, PIN, MODE> Unpin for Gpio<GPIO, PIN, MODE> where
GPIO: Unpin,
MODE: Unpin,
PIN: Unpin,

### impl<GPIO, PIN, MODE> UnwindSafe for Gpio<GPIO, PIN, MODE> where
GPIO: UnwindSafe,
MODE: UnwindSafe,
PIN: UnwindSafe,

## Blanket Implementations

source

### impl<T> Any for T where
T: 'static + ?Sized,

source

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more

source

### impl<T> Borrow<T> for T where
T: ?Sized,

const: unstable · source

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

source

### impl<T> BorrowMut<T> for T where
T: ?Sized,

const: unstable · source

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

source

### impl<T> From<T> for T

const: unstable · source

#### fn from(t: T) -> T

Returns the argument unchanged.

source

### impl<T, U> Into<U> for T where
U: From<T>,

const: unstable · source

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

source

### impl<T, U> TryFrom<U> for T where
U: Into<T>,

#### type Error = Infallible

The type returned in the event of a conversion error.

const: unstable · source

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.

source

### impl<T, U> TryInto<U> for T where
U: TryFrom<T>,

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

const: unstable · source

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.