Struct DynamicPin

Source
pub struct DynamicPin<const P: char, const N: u8> { /* private fields */ }
Expand description

Pin type with dynamic mode

  • P is port name: A for GPIOA, B for GPIOB, etc.
  • N is pin number: from 0 to 15.

Implementations§

Source§

impl<const P: char, const N: u8> DynamicPin<P, N>

Source

pub fn make_pull_up_input(&mut self)

Switch pin into pull-up input

Source

pub fn make_pull_down_input(&mut self)

Switch pin into pull-down input

Source

pub fn make_floating_input(&mut self)

Switch pin into floating input

Source

pub fn make_push_pull_output(&mut self)

Switch pin into push-pull output

Source

pub fn make_push_pull_output_in_state(&mut self, state: PinState)

Switch pin into push-pull output with required voltage state

Source

pub fn make_open_drain_output(&mut self)

Switch pin into open-drain output

Source

pub fn make_open_drain_output_in_state(&mut self, state: PinState)

Switch pin into open-drain output with required voltage state

Source

pub fn set_high(&mut self) -> Result<(), PinModeError>

Drives the pin high

Source

pub fn set_low(&mut self) -> Result<(), PinModeError>

Drives the pin low

Source

pub fn is_high(&self) -> Result<bool, PinModeError>

Is the input pin high?

Source

pub fn is_low(&self) -> Result<bool, PinModeError>

Is the input pin low?

Trait Implementations§

Source§

impl<const P: char, const N: u8> ErrorType for DynamicPin<P, N>

Source§

type Error = PinModeError

Error type
Source§

impl<const P: char, const N: u8> InputPin for DynamicPin<P, N>

Source§

type Error = PinModeError

Error type
Source§

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

Is the input pin high?
Source§

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

Is the input pin low?
Source§

impl<const P: char, const N: u8> InputPin for DynamicPin<P, N>

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?
Source§

impl<const P: char, const N: u8> OutputPin for DynamicPin<P, N>

Source§

type Error = PinModeError

Error type
Source§

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

Drives the pin high Read more
Source§

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

Drives the pin low 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<const P: char, const N: u8> OutputPin for DynamicPin<P, N>

Source§

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

Drives the pin high. Read more
Source§

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

Drives the pin low. 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

Auto Trait Implementations§

§

impl<const P: char, const N: u8> Freeze for DynamicPin<P, N>

§

impl<const P: char, const N: u8> RefUnwindSafe for DynamicPin<P, N>

§

impl<const P: char, const N: u8> Send for DynamicPin<P, N>

§

impl<const P: char, const N: u8> Sync for DynamicPin<P, N>

§

impl<const P: char, const N: u8> Unpin for DynamicPin<P, N>

§

impl<const P: char, const N: u8> UnwindSafe for DynamicPin<P, N>

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 = Infallible

The type returned in the event of a conversion error.
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>,

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.