Struct Pin

Source
pub struct Pin<'a, MODE, MUTEX> { /* private fields */ }
Expand description

Pin

Implementations§

Source§

impl<'a, MODE, MUTEX, I2C, ERROR> Pin<'a, MODE, MUTEX>
where I2C: WriteRead<Error = ERROR> + Write<Error = ERROR> + Read<Error = ERROR>, MUTEX: BusMutex<Bus = Driver<I2C>>,

Source

pub fn into_input(&self) -> Result<Pin<'a, Input, MUTEX>, ERROR>

Set pin as input

Установить пин как вход

Source

pub fn into_pull_up_input(&self) -> Result<Pin<'a, Input, MUTEX>, ERROR>

Set pin as pull up input

Установить пин как Pull Up вход

Source

pub fn into_pull_down_input(&self) -> Result<Pin<'a, Input, MUTEX>, ERROR>

Set pin as pull down input

Установить пин как Pull Down вход

Source

pub fn into_output(&self) -> Result<Pin<'a, Output, MUTEX>, ERROR>

Set pin as output

Установить пин как выход

Source§

impl<'a, MUTEX, I2C, ERROR> Pin<'a, Output, MUTEX>
where I2C: WriteRead<Error = ERROR> + Write<Error = ERROR> + Read<Error = ERROR>, MUTEX: BusMutex<Bus = Driver<I2C>>,

Source

pub fn set_pwm(&mut self, value: u16) -> Result<(), ERROR>

Set pin PWM value

Установить значение ШИМ пина

Source§

impl<'a, MUTEX, I2C, ERROR> Pin<'a, Input, MUTEX>
where I2C: WriteRead<Error = ERROR> + Write<Error = ERROR> + Read<Error = ERROR>, MUTEX: BusMutex<Bus = Driver<I2C>>,

Source

pub fn get_analog(&self) -> Result<u16, ERROR>

Get the analog value of a pin

Получить аналоговое значение пина

Trait Implementations§

Source§

impl<'a, MUTEX, I2C, ERROR> InputPin for Pin<'a, Input, MUTEX>
where I2C: WriteRead<Error = ERROR> + Write<Error = ERROR> + Read<Error = ERROR>, MUTEX: BusMutex<Bus = Driver<I2C>>,

Source§

type Error = ERROR

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<'a, MUTEX, I2C, ERROR> OutputPin for Pin<'a, Output, MUTEX>
where I2C: WriteRead<Error = ERROR> + Write<Error = ERROR> + Read<Error = ERROR>, MUTEX: BusMutex<Bus = Driver<I2C>>,

Source§

type Error = ERROR

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<'a, MUTEX, I2C, ERROR> StatefulOutputPin for Pin<'a, Output, MUTEX>
where I2C: WriteRead<Error = ERROR> + Write<Error = ERROR> + Read<Error = ERROR>, MUTEX: BusMutex<Bus = Driver<I2C>>,

Source§

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

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

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

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

impl<'a, MUTEX> Default for Pin<'a, Output, MUTEX>
where Pin<'a, Output, MUTEX>: StatefulOutputPin,

Auto Trait Implementations§

§

impl<'a, MODE, MUTEX> Freeze for Pin<'a, MODE, MUTEX>

§

impl<'a, MODE, MUTEX> RefUnwindSafe for Pin<'a, MODE, MUTEX>
where MUTEX: RefUnwindSafe, MODE: RefUnwindSafe,

§

impl<'a, MODE, MUTEX> Send for Pin<'a, MODE, MUTEX>
where MUTEX: Sync, MODE: Send,

§

impl<'a, MODE, MUTEX> Sync for Pin<'a, MODE, MUTEX>
where MUTEX: Sync, MODE: Sync,

§

impl<'a, MODE, MUTEX> Unpin for Pin<'a, MODE, MUTEX>
where MODE: Unpin,

§

impl<'a, MODE, MUTEX> UnwindSafe for Pin<'a, MODE, MUTEX>
where MUTEX: RefUnwindSafe, MODE: 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,

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<P> ToggleableOutputPin for P
where P: Default,

Source§

fn toggle(&mut self) -> Result<(), <P as ToggleableOutputPin>::Error>

Toggle pin output

Source§

type Error = <P as OutputPin>::Error

Error type
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.