[−][src]Module stm32f3xx_hal_v2::gpio
General Purpose Input / Output
To use the GPIO pins, you first need to configure the GPIO bank (GPIOA, GPIOB, ...) that you
are interested in. This is done using the GpioExt::split
function.
let dp = pac::Peripherals::take().unwrap(); let rcc = dp.RCC.constrain(); let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
The resulting Parts struct contains one field for each pin, as well as some shared registers.
To use a pin, first use the relevant into_...
method of the pin.
let pa0 = gpioa.pa0.into_push_pull_output(&mut gpioa.moder, &mut gpioa.otyper);
And finally, you can use the functions from the InputPin or OutputPin traits in
embedded_hal
For a complete example, see examples/toggle.rs
Modules
gpioa | All Pins and associated functions for GPIO Bank: GPIOA |
gpiob | All Pins and associated functions for GPIO Bank: GPIOB |
gpioc | All Pins and associated functions for GPIO Bank: GPIOC |
gpiod | All Pins and associated functions for GPIO Bank: GPIOD |
gpioe | All Pins and associated functions for GPIO Bank: GPIOE |
gpiof | All Pins and associated functions for GPIO Bank: GPIOF |
Structs
AF0 | Alternate function 0 (type state) |
AF1 | Alternate function 1 (type state) |
AF2 | Alternate function 2 (type state) |
AF3 | Alternate function 3 (type state) |
AF4 | Alternate function 4 (type state) |
AF5 | Alternate function 5 (type state) |
AF6 | Alternate function 6 (type state) |
AF7 | Alternate function 7 (type state) |
AF8 | Alternate function 8 (type state) |
AF9 | Alternate function 9 (type state) |
AF10 | Alternate function 10 (type state) |
AF11 | Alternate function 11 (type state) |
AF12 | Alternate function 12 (type state) |
AF13 | Alternate function 13 (type state) |
AF14 | Alternate function 14 (type state) |
AF15 | Alternate function 15 (type state) |
Analog | Analog mode (type state) |
Floating | Floating input (type state) |
Input | Input mode (type state) |
OpenDrain | Open drain output (type state) |
Output | Output mode (type state) |
PXx | Fully erased pin |
PullDown | Pulled down input (type state) |
PullUp | Pulled up input (type state) |
PushPull | Push pull output (type state) |
Enums
Gpio | GPIO discriminator enum. |
Traits
GpioExt | Extension trait to split a GPIO peripheral in independent pins and registers |