|
10 | 10 | //! let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
|
11 | 11 | //! ```
|
12 | 12 | //!
|
13 |
| -//! The resulting [Parts](gpioa::Parts) struct contains one field for each |
14 |
| -//! pin, as well as some shared registers. |
| 13 | +//! The resulting [Parts](gpioa::Parts) struct contains one field for each pin, as well as some |
| 14 | +//! shared registers. Every pin type is a specialized version of generic [pin](Pin) struct. |
15 | 15 | //!
|
16 | 16 | //! To use a pin, first use the relevant `into_...` method of the [pin](Pin).
|
17 | 17 | //!
|
|
24 | 24 | //!
|
25 | 25 | //! For a complete example, see [examples/toggle.rs]
|
26 | 26 | //!
|
| 27 | +//! ## Pin Configuration |
| 28 | +//! |
| 29 | +//! ### Mode |
| 30 | +//! |
| 31 | +//! Each GPIO pin can be set to various modes by corresponding `into_...` method: |
| 32 | +//! |
| 33 | +//! - **Input**: The output buffer is disabled and the schmitt trigger input is activated |
| 34 | +//! - **Output**: Both the output buffer and the schmitt trigger input is enabled |
| 35 | +//! - **PushPull**: Output which either drives the pin high or low |
| 36 | +//! - **OpenDrain**: Output which leaves the gate floating, or pulls it to ground in drain |
| 37 | +//! mode. Can be used as an input in the `open` configuration |
| 38 | +//! - **Alternate**: Pin mode required when the pin is driven by other peripherals. The schmitt |
| 39 | +//! trigger input is activated. The Output buffer is automatically enabled and disabled by |
| 40 | +//! peripherals. Output behavior is same as the output mode |
| 41 | +//! - **PushPull**: Output which either drives the pin high or low |
| 42 | +//! - **OpenDrain**: Output which leaves the gate floating, or pulls it to ground in drain |
| 43 | +//! mode |
| 44 | +//! - **Analog**: Pin mode required for ADC, DAC, OPAMP, and COMP peripherals. It is also suitable |
| 45 | +//! for minimize energy consumption as the output buffer and the schmitt trigger input is disabled |
| 46 | +//! |
| 47 | +//! ### Internal Resistor |
| 48 | +//! |
| 49 | +//! Weak internal pull-up and pull-down resistors are configurable by calling |
| 50 | +//! [`set_internal_resistor`](Pin::set_internal_resistor) method. `into_..._input` methods are also |
| 51 | +//! available for convenience. |
| 52 | +//! |
27 | 53 | //! [InputPin]: embedded_hal::digital::v2::InputPin
|
28 | 54 | //! [OutputPin]: embedded_hal::digital::v2::OutputPin
|
29 | 55 | //! [examples/toggle.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.1/examples/toggle.rs
|
|
0 commit comments