Skip to content

Commit 7ab776b

Browse files
committed
Update docs
1 parent a6f3a91 commit 7ab776b

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

src/gpio.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//! let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
1111
//! ```
1212
//!
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.
1515
//!
1616
//! To use a pin, first use the relevant `into_...` method of the [pin](Pin).
1717
//!
@@ -24,6 +24,32 @@
2424
//!
2525
//! For a complete example, see [examples/toggle.rs]
2626
//!
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+
//!
2753
//! [InputPin]: embedded_hal::digital::v2::InputPin
2854
//! [OutputPin]: embedded_hal::digital::v2::OutputPin
2955
//! [examples/toggle.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.1/examples/toggle.rs

src/syscfg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ impl SysCfgExt for SYSCFG {
2626
///
2727
/// ```
2828
/// let dp = pac::Peripherals::take().unwrap();
29-
/// let syscfg = dp.SYSCFG.constrain();
29+
/// let mut rcc = dp.RCC.constrain();
30+
/// let syscfg = dp.SYSCFG.constrain(&mut rcc.apb2);
3031
/// ```
3132
pub struct SysCfg(SYSCFG);
3233

0 commit comments

Comments
 (0)