Struct stm32f1xx_hal::gpio::Pin
source · Expand description
Generic pin type
P
is port name:A
for GPIOA,B
for GPIOB, etc.N
is pin number: from0
to15
.MODE
is one of the pin modes (see Modes section).
Implementations§
source§impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>where
MODE: Active,
impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>where
MODE: Active,
sourcepub fn erase_number(self) -> PartiallyErasedPin<P, MODE>
pub fn erase_number(self) -> PartiallyErasedPin<P, MODE>
Erases the pin number from the type
source§impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>where
MODE: Active,
Self: HL,
impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>where
MODE: Active,
Self: HL,
sourcepub fn into_alternate_push_pull(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Alternate<PushPull>>
pub fn into_alternate_push_pull(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Alternate<PushPull>>
Configures the pin to operate as an alternate function push-pull output pin.
sourcepub fn into_alternate_open_drain(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Alternate<OpenDrain>>
pub fn into_alternate_open_drain(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Alternate<OpenDrain>>
Configures the pin to operate as an alternate function open-drain output pin.
sourcepub fn into_floating_input(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Input<Floating>>
pub fn into_floating_input(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Input<Floating>>
Configures the pin to operate as a floating input pin
sourcepub fn into_pull_down_input(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Input<PullDown>>
pub fn into_pull_down_input(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Input<PullDown>>
Configures the pin to operate as a pulled down input pin
sourcepub fn into_pull_up_input(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Input<PullUp>>
pub fn into_pull_up_input(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Input<PullUp>>
Configures the pin to operate as a pulled up input pin
sourcepub fn into_open_drain_output(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Output<OpenDrain>>
pub fn into_open_drain_output(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Output<OpenDrain>>
Configures the pin to operate as an open-drain output pin. Initial state will be low.
sourcepub fn into_open_drain_output_with_state(
self,
cr: &mut <Self as HL>::Cr,
initial_state: PinState
) -> Pin<P, N, Output<OpenDrain>>
pub fn into_open_drain_output_with_state(
self,
cr: &mut <Self as HL>::Cr,
initial_state: PinState
) -> Pin<P, N, Output<OpenDrain>>
Configures the pin to operate as an open-drain output pin.
initial_state
specifies whether the pin should be initially high or low.
sourcepub fn into_push_pull_output(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Output<PushPull>>
pub fn into_push_pull_output(
self,
cr: &mut <Self as HL>::Cr
) -> Pin<P, N, Output<PushPull>>
Configures the pin to operate as an push-pull output pin. Initial state will be low.
sourcepub fn into_push_pull_output_with_state(
self,
cr: &mut <Self as HL>::Cr,
initial_state: PinState
) -> Pin<P, N, Output<PushPull>>
pub fn into_push_pull_output_with_state(
self,
cr: &mut <Self as HL>::Cr,
initial_state: PinState
) -> Pin<P, N, Output<PushPull>>
Configures the pin to operate as an push-pull output pin.
initial_state
specifies whether the pin should be initially high or low.
source§impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>where
MODE: Active + PinMode,
Self: HL,
impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>where
MODE: Active + PinMode,
Self: HL,
sourcepub fn as_push_pull_output(
&mut self,
cr: &mut <Self as HL>::Cr,
f: impl FnMut(&mut Pin<P, N, Output<PushPull>>)
)
pub fn as_push_pull_output(
&mut self,
cr: &mut <Self as HL>::Cr,
f: impl FnMut(&mut Pin<P, N, Output<PushPull>>)
)
Temporarily change the mode of the pin.
The value of the pin after conversion is undefined. If you
want to control it, use $stateful_fn_name
sourcepub fn as_push_pull_output_with_state(
&mut self,
cr: &mut <Self as HL>::Cr,
state: PinState,
f: impl FnMut(&mut Pin<P, N, Output<PushPull>>)
)
pub fn as_push_pull_output_with_state(
&mut self,
cr: &mut <Self as HL>::Cr,
state: PinState,
f: impl FnMut(&mut Pin<P, N, Output<PushPull>>)
)
Temporarily change the mode of the pin.
Note that the new state is set slightly before conversion happens. This can cause a short output glitch if switching between output modes
sourcepub fn as_open_drain_output(
&mut self,
cr: &mut <Self as HL>::Cr,
f: impl FnMut(&mut Pin<P, N, Output<OpenDrain>>)
)
pub fn as_open_drain_output(
&mut self,
cr: &mut <Self as HL>::Cr,
f: impl FnMut(&mut Pin<P, N, Output<OpenDrain>>)
)
Temporarily change the mode of the pin.
The value of the pin after conversion is undefined. If you
want to control it, use $stateful_fn_name
sourcepub fn as_open_drain_output_with_state(
&mut self,
cr: &mut <Self as HL>::Cr,
state: PinState,
f: impl FnMut(&mut Pin<P, N, Output<OpenDrain>>)
)
pub fn as_open_drain_output_with_state(
&mut self,
cr: &mut <Self as HL>::Cr,
state: PinState,
f: impl FnMut(&mut Pin<P, N, Output<OpenDrain>>)
)
Temporarily change the mode of the pin.
Note that the new state is set slightly before conversion happens. This can cause a short output glitch if switching between output modes
sourcepub fn as_floating_input(
&mut self,
cr: &mut <Self as HL>::Cr,
f: impl FnMut(&mut Pin<P, N, Input<Floating>>)
)
pub fn as_floating_input(
&mut self,
cr: &mut <Self as HL>::Cr,
f: impl FnMut(&mut Pin<P, N, Input<Floating>>)
)
Temporarily change the mode of the pin.