Skip to main content

Input

Struct Input 

Source
pub struct Input<'d, C: ControlKind> { /* private fields */ }
Expand description

GPIO input driver

Implementations§

Source§

impl<'d> Input<'d, Basic>

Source

pub fn new_basic(pin: Peri<'d, impl Pin>) -> Self

Create GPIO input driver for a Pin without pull-up capabilities.

§Arguments
Source§

impl<'d> Input<'d, WithPullUp>

Source

pub fn new_with_pull_up(pin: Peri<'d, impl Pin>, pull_up: bool) -> Self

Create GPIO input driver for a Pin with the ability to toggle an internal pull-up resistor.

§Arguments
  • pin suitable input pin
  • pull_up enable the internal pull-up resistor
Source

pub fn set_pull_up(&mut self, pull_up: bool)

Enable the internal pull-up resistor?

§Notes

This is ignored by the MCU unless the pin is configured for input.

Source§

impl<'d, C: ControlKind> Input<'d, C>

Source

pub fn new(pin: Peri<'d, impl Pin>) -> Self

Create GPIO input driver for a Pin.

§Arguments
  • pin suitable input pin
Source

pub fn is_low(&mut self) -> bool

Is the input level low?

Source

pub fn is_high(&mut self) -> bool

Is the input level high?

Source

pub fn level(&mut self) -> Level

Input level

Trait Implementations§

Source§

impl<'d, C: ControlKind> ErrorType for Input<'d, C>

Source§

type Error = !

Error type
Source§

impl<'d, C: ControlKind> InputPin for Input<'d, C>

Source§

fn is_high(&mut self) -> Result<bool, Self::Error>

Is the input pin high?
Source§

fn is_low(&mut self) -> Result<bool, Self::Error>

Is the input pin low?

Auto Trait Implementations§

§

impl<'d, C> !UnwindSafe for Input<'d, C>

§

impl<'d, C> Forget for Input<'d, C>

§

impl<'d, C> Freeze for Input<'d, C>
where Flex<'d, C>: Freeze,

§

impl<'d, C> Move for Input<'d, C>

§

impl<'d, C> RefUnwindSafe for Input<'d, C>
where Flex<'d, C>: RefUnwindSafe,

§

impl<'d, C> Send for Input<'d, C>
where Flex<'d, C>: Send,

§

impl<'d, C> Sync for Input<'d, C>
where Flex<'d, C>: Sync,

§

impl<'d, C> Unpin for Input<'d, C>
where Flex<'d, C>: Unpin,

§

impl<'d, C> UnsafeUnpin for Input<'d, C>
where Flex<'d, C>: UnsafeUnpin,

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,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.