Skip to main content

Output

Struct Output 

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

GPIO output driver

Implementations§

Source§

impl<'d> Output<'d, Basic>

Source

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

Create GPIO output driver for a Pin without pull-up or open-drain capabilities.

§Arguments
  • pin the Pin
  • initial set the initial output level to logic low or high
  • drive_capacity sets the output current, see DriveCapacity for details.
Source§

impl<'d> Output<'d, WithOpenDrain>

Source

pub fn new_with_open_drain( pin: Peri<'d, impl Pin>, initial: Level, drive_capacity: DriveCapacity, output_mode: OutputMode, ) -> Self

Create GPIO output driver for a Pin that supports open-drain output.

§Arguments
  • pin the Pin
  • initial set the initial output level to logic low or high
  • drive_capacity sets the output current, see DriveCapacity for details.
Source

pub fn set_output_mode(&mut self, output_mode: OutputMode)

Sets a pin’s output mode to either open-drain or push-pull.

Source§

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

Source

pub fn set_drive_capacity(&mut self, drive_capacity: DriveCapacity)

Sets the output drive capacity of a pin.

§Notes

Be aware of the maximum permissible combined current output for all pins, see DriveCapacity for more information.

Source

pub fn set_low(&mut self)

Set the output as low.

Source

pub fn set_high(&mut self)

Set the output as high.

Source

pub fn set_level(&mut self, level: Level)

Set the output level.

Source

pub fn toggle(&mut self)

Toggle pin output.

Source

pub fn is_set_low(&mut self) -> bool

Is the pin output set as logic low?

Source

pub fn is_set_high(&mut self) -> bool

Is the pin output set as logic high?

Source

pub fn output_level(&mut self) -> Level

What is the output level set to?

Source

pub fn print_pfs_state(&self)

Log current PFS state at debug level.

Trait Implementations§

Source§

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

Source§

type Error = !

Error type
Source§

impl<'d, C: ControlKind> OutputPin for Output<'d, C>

Source§

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

Drives the pin low. Read more
Source§

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

Drives the pin high. Read more
Source§

fn set_state(&mut self, state: PinState) -> Result<(), Self::Error>

Drives the pin high or low depending on the provided value. Read more
Source§

impl<'d, C: ControlKind> StatefulOutputPin for Output<'d, C>

Source§

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

Is the pin in drive high mode? Read more
Source§

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

Is the pin in drive low mode? Read more
Source§

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

Toggle pin output.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'d, C> UnsafeUnpin for Output<'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.