Struct embedded_c_sdk_bind_hal::gpio::Pin

source ·
pub struct Pin<MODE> { /* private fields */ }

Implementations§

source§

impl Pin<Input>

source

pub fn exti_config(&self, mode: ExtiMode)

Configures the EXTI (External Interrupt) mode for the pin.

§Arguments
  • mode - The EXTI mode to set. This can be rising edge, falling edge, both edges, etc.
source

pub fn enable_interrupt(&self)

Enables the interrupt for the pin.

This function can be reenabled after disabling it.

source

pub fn disable_interrupt(&self)

Disables the interrupt for the pin.

This function can be used to temporarily disable the interrupt without changing the EXTI mode.

source§

impl Pin<()>

source

pub const fn new(port: PortNum, pin: PinNum) -> Pin<()>

Creates a new GPIO pin instance.

§Arguments
  • port - The port number where the pin resides.
  • pin - The pin number on the specified port.
§Returns

A new Pin instance with uninitialized mode.

source

pub fn into_input(&self, mode: PinModeInput) -> Pin<Input>

Converts the pin to an input mode.

§Arguments
  • mode - The input mode configuration.
§Returns

A new Pin instance configured as an input pin.

source

pub fn into_output(&self, mode: PinModeOutput) -> Pin<Output>

Converts the pin to an output mode.

§Arguments
  • mode - The output mode configuration.
§Returns

A new Pin instance configured as an output pin.

source

pub fn into_alternate(&self, mode: PinModeAlternate) -> Pin<Alternate>

Converts the pin to an alternate function mode.

§Arguments
  • mode - The alternate function mode configuration.
§Returns

A new Pin instance configured as an alternate function pin.

source

pub fn into_analog(&self, mode: PinModeAnalog) -> Pin<Analog>

Converts the pin to an analog mode.

§Arguments
  • mode - The analog mode configuration.
§Returns

A new Pin instance configured as an analog pin.

Trait Implementations§

source§

impl<MODE> ErrorType for Pin<MODE>

§

type Error = Infallible

Error type
source§

impl InputPin for Pin<Input>

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 OutputPin for Pin<Output>

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 StatefulOutputPin for Pin<Output>

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<MODE> Freeze for Pin<MODE>

§

impl<MODE> RefUnwindSafe for Pin<MODE>
where MODE: RefUnwindSafe,

§

impl<MODE> Send for Pin<MODE>
where MODE: Send,

§

impl<MODE> Sync for Pin<MODE>
where MODE: Sync,

§

impl<MODE> Unpin for Pin<MODE>
where MODE: Unpin,

§

impl<MODE> UnwindSafe for Pin<MODE>
where 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<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.