pub struct Pin<const P: char, const N: u8, MODE = Input<Floating>> { /* private fields */ }
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>
impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>
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>
impl<const P: char, const N: u8, MODE> Pin<P, N, MODE>
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.