Struct nrf9160_hal::gpio::Pin

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

Generic $PX pin

Implementations§

source§

impl<MODE> Pin<MODE>

source

pub unsafe fn from_psel_bits(psel_bits: u32) -> Pin<MODE>

source

pub fn pin(&self) -> u8

source

pub fn port(&self) -> Port

source

pub fn psel_bits(&self) -> u32

source

pub fn into_floating_input(self) -> Pin<Input<Floating>>

Convert the pin to be a floating input

source

pub fn into_pullup_input(self) -> Pin<Input<PullUp>>

source

pub fn into_pulldown_input(self) -> Pin<Input<PullDown>>

source

pub fn into_push_pull_output_drive( self, initial_output: Level, drive: DriveConfig ) -> Pin<Output<PushPull>>

Convert the pin to be a push-pull output with specified drive.

source

pub fn into_push_pull_output( self, initial_output: Level ) -> Pin<Output<PushPull>>

Convert the pin to be a push-pull output with specified initial output level.

source

pub fn into_open_drain_output( self, config: OpenDrainConfig, initial_output: Level ) -> Pin<Output<OpenDrain>>

Convert the pin to be an open-drain output.

This method currently does not support configuring an internal pull-up or pull-down resistor.

source

pub fn into_open_drain_input_output( self, config: OpenDrainConfig, initial_output: Level ) -> Pin<Output<OpenDrainIO>>

Convert the pin to be an open-drain input/output.

Similar to into_open_drain_output, but can also be read from.

This method currently does not support configuring an internal pull-up or pull-down resistor.

source

pub fn into_disconnected(self) -> Pin<Disconnected>

Disconnects the pin.

In disconnected mode the pin cannot be used as input or output. It is primarily useful to reduce power usage.

Trait Implementations§

source§

impl<MODE> ErrorType for Pin<MODE>

§

type Error = Infallible

Error type
source§

impl<MODE> From<P0_00<MODE>> for Pin<MODE>

source§

fn from(value: P0_00<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_01<MODE>> for Pin<MODE>

source§

fn from(value: P0_01<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_02<MODE>> for Pin<MODE>

source§

fn from(value: P0_02<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_03<MODE>> for Pin<MODE>

source§

fn from(value: P0_03<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_04<MODE>> for Pin<MODE>

source§

fn from(value: P0_04<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_05<MODE>> for Pin<MODE>

source§

fn from(value: P0_05<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_06<MODE>> for Pin<MODE>

source§

fn from(value: P0_06<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_07<MODE>> for Pin<MODE>

source§

fn from(value: P0_07<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_08<MODE>> for Pin<MODE>

source§

fn from(value: P0_08<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_09<MODE>> for Pin<MODE>

source§

fn from(value: P0_09<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_10<MODE>> for Pin<MODE>

source§

fn from(value: P0_10<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_11<MODE>> for Pin<MODE>

source§

fn from(value: P0_11<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_12<MODE>> for Pin<MODE>

source§

fn from(value: P0_12<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_13<MODE>> for Pin<MODE>

source§

fn from(value: P0_13<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_14<MODE>> for Pin<MODE>

source§

fn from(value: P0_14<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_15<MODE>> for Pin<MODE>

source§

fn from(value: P0_15<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_16<MODE>> for Pin<MODE>

source§

fn from(value: P0_16<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_17<MODE>> for Pin<MODE>

source§

fn from(value: P0_17<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_18<MODE>> for Pin<MODE>

source§

fn from(value: P0_18<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_19<MODE>> for Pin<MODE>

source§

fn from(value: P0_19<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_20<MODE>> for Pin<MODE>

source§

fn from(value: P0_20<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_21<MODE>> for Pin<MODE>

source§

fn from(value: P0_21<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_22<MODE>> for Pin<MODE>

source§

fn from(value: P0_22<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_23<MODE>> for Pin<MODE>

source§

fn from(value: P0_23<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_24<MODE>> for Pin<MODE>

source§

fn from(value: P0_24<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_25<MODE>> for Pin<MODE>

source§

fn from(value: P0_25<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_26<MODE>> for Pin<MODE>

source§

fn from(value: P0_26<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_27<MODE>> for Pin<MODE>

source§

fn from(value: P0_27<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_28<MODE>> for Pin<MODE>

source§

fn from(value: P0_28<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_29<MODE>> for Pin<MODE>

source§

fn from(value: P0_29<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_30<MODE>> for Pin<MODE>

source§

fn from(value: P0_30<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl<MODE> From<P0_31<MODE>> for Pin<MODE>

source§

fn from(value: P0_31<MODE>) -> Pin<MODE>

Converts to this type from the input type.
source§

impl GpioteInputPin for Pin<Input<Floating>>

source§

fn pin(&self) -> u8

source§

fn port(&self) -> Port

source§

impl GpioteInputPin for Pin<Input<PullDown>>

source§

fn pin(&self) -> u8

source§

fn port(&self) -> Port

source§

impl GpioteInputPin for Pin<Input<PullUp>>

source§

fn pin(&self) -> u8

source§

fn port(&self) -> Port

source§

impl GpioteOutputPin for Pin<Output<OpenDrain>>

source§

fn pin(&self) -> u8

source§

fn port(&self) -> Port

source§

impl GpioteOutputPin for Pin<Output<PushPull>>

source§

fn pin(&self) -> u8

source§

fn port(&self) -> Port

source§

impl<MODE> InputPin for Pin<Input<MODE>>

§

type Error = Void

Error type
source§

fn is_high(&self) -> Result<bool, <Pin<Input<MODE>> as InputPin>::Error>

Is the input pin high?
source§

fn is_low(&self) -> Result<bool, <Pin<Input<MODE>> as InputPin>::Error>

Is the input pin low?
source§

impl<MODE> InputPin for Pin<Input<MODE>>

source§

fn is_high(&mut self) -> Result<bool, <Pin<Input<MODE>> as ErrorType>::Error>

Is the input pin high?
source§

fn is_low(&mut self) -> Result<bool, <Pin<Input<MODE>> as ErrorType>::Error>

Is the input pin low?
source§

impl InputPin for Pin<Output<OpenDrainIO>>

§

type Error = Void

Error type
source§

fn is_high(&self) -> Result<bool, <Pin<Output<OpenDrainIO>> as InputPin>::Error>

Is the input pin high?
source§

fn is_low(&self) -> Result<bool, <Pin<Output<OpenDrainIO>> as InputPin>::Error>

Is the input pin low?
source§

impl InputPin for Pin<Output<OpenDrainIO>>

source§

fn is_high( &mut self ) -> Result<bool, <Pin<Output<OpenDrainIO>> as ErrorType>::Error>

Is the input pin high?
source§

fn is_low( &mut self ) -> Result<bool, <Pin<Output<OpenDrainIO>> as ErrorType>::Error>

Is the input pin low?
source§

impl<MODE> OutputPin for Pin<Output<MODE>>

source§

fn set_high(&mut self) -> Result<(), <Pin<Output<MODE>> as OutputPin>::Error>

Set the output as high.

source§

fn set_low(&mut self) -> Result<(), <Pin<Output<MODE>> as OutputPin>::Error>

Set the output as low.

§

type Error = Void

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

source§

fn set_high(&mut self) -> Result<(), <Pin<Output<MODE>> as ErrorType>::Error>

Drives the pin high. Read more
source§

fn set_low(&mut self) -> Result<(), <Pin<Output<MODE>> as ErrorType>::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<MODE> StatefulOutputPin for Pin<Output<MODE>>

source§

fn is_set_high( &mut self ) -> Result<bool, <Pin<Output<MODE>> as ErrorType>::Error>

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

fn is_set_low( &mut self ) -> Result<bool, <Pin<Output<MODE>> as ErrorType>::Error>

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

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

Toggle pin output.
source§

impl<MODE> StatefulOutputPin for Pin<Output<MODE>>

source§

fn is_set_high(&self) -> Result<bool, <Pin<Output<MODE>> as OutputPin>::Error>

Is the output pin set as high?

source§

fn is_set_low(&self) -> Result<bool, <Pin<Output<MODE>> as OutputPin>::Error>

Is the output pin set as low?

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.