Expand description
General-purpose I/O.
A pin’s port, number and mode all live in its type.
Pins are handed out by GpioExt::split. Modes are changed with the
into_* methods, each returning a new type.
ⓘ
let parts = dp.gpioa.split(&mut rcu);
let mut led = parts.pa5.into_output();
led.set_high().unwrap();
let tx = parts.pa9.into_alternate::<1>();Two modes are special. PA13/PA14 start as Debugger, since after
reset they really are wired to SWD; leaving that goes through the separate
activate_into_*() family. Pin::lock freezes a configuration until the
next chip reset, which the type reflects as Locked — with no way back,
since the hardware has none either.
Structs§
- Alternate
- Mode: alternate function
AF, routing the pin to a peripheral, driven asOTYPE(PushPullorOpenDrain). - Analog
- Mode: analog, the input mode the ADC requires.
- Debugger
- Mode: serial-wire debug, the reset state of
PA13/PA14. - Erased
Pin - A pin whose identity has moved into runtime values, keeping its mode.
- Input
- Mode: digital input.
- Locked
- Mode: configuration frozen until the next chip reset, wrapping the mode it was locked in.
- Open
Drain - Output type: driven low, released high — needs a pull-up to reach a high level.
- Output
- Mode: digital output, of type
OTYPE(PushPullorOpenDrain). - PartsA
- The pins of this port, in their reset modes.
- PartsB
- The pins of this port, in their reset modes.
- PartsC
- The pins of this port, in their reset modes.
- PartsF
- The pins of this port, in their reset modes.
- Pin
- A single pin:
Pis the port ('A','B','C'or'F'),Nthe pin number. - Push
Pull - Output type: driven both high and low.
Enums§
- Port
- Which port an
ErasedPincame from. - Pull
- Internal pull resistor.
- Speed
- Output slew rate. Slower edges radiate less; faster ones are needed for high-speed peripherals.