Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Piroro-hs committed Feb 13, 2021
1 parent 0d3e982 commit 584f11d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
30 changes: 28 additions & 2 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
//! let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
//! ```
//!
//! The resulting [Parts](gpioa::Parts) struct contains one field for each
//! pin, as well as some shared registers.
//! The resulting [Parts](gpioa::Parts) struct contains one field for each pin, as well as some
//! shared registers. Every pin type is a specialized version of generic [pin](Pin) struct.
//!
//! To use a pin, first use the relevant `into_...` method of the [pin](Pin).
//!
Expand All @@ -24,6 +24,32 @@
//!
//! For a complete example, see [examples/toggle.rs]
//!
//! ## Pin Configuration
//!
//! ### Mode
//!
//! Each GPIO pin can be set to various modes by corresponding `into_...` method:
//!
//! - **Input**: The output buffer is disabled and the schmitt trigger input is activated
//! - **Output**: Both the output buffer and the schmitt trigger input is enabled
//! - **PushPull**: Output which either drives the pin high or low
//! - **OpenDrain**: Output which leaves the gate floating, or pulls it to ground in drain
//! mode. Can be used as an input in the `open` configuration
//! - **Alternate**: Pin mode required when the pin is driven by other peripherals. The schmitt
//! trigger input is activated. The Output buffer is automatically enabled and disabled by
//! peripherals. Output behavior is same as the output mode
//! - **PushPull**: Output which either drives the pin high or low
//! - **OpenDrain**: Output which leaves the gate floating, or pulls it to ground in drain
//! mode
//! - **Analog**: Pin mode required for ADC, DAC, OPAMP, and COMP peripherals. It is also suitable
//! for minimize energy consumption as the output buffer and the schmitt trigger input is disabled
//!
//! ### Internal Resistor
//!
//! Weak internal pull-up and pull-down resistors are configurable by calling
//! [`set_internal_resistor`](Pin::set_internal_resistor) method. `into_..._input` methods are also
//! available for convenience.
//!
//! [InputPin]: embedded_hal::digital::v2::InputPin
//! [OutputPin]: embedded_hal::digital::v2::OutputPin
//! [examples/toggle.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/toggle.rs
Expand Down
3 changes: 2 additions & 1 deletion src/syscfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl SysCfgExt for SYSCFG {
///
/// ```
/// let dp = pac::Peripherals::take().unwrap();
/// let syscfg = dp.SYSCFG.constrain();
/// let mut rcc = dp.RCC.constrain();
/// let syscfg = dp.SYSCFG.constrain(&mut rcc.apb2);
/// ```
pub struct SysCfg(SYSCFG);

Expand Down

0 comments on commit 584f11d

Please sign in to comment.