Skip to content

Commit 14fd1e3

Browse files
committed
Tweak documentation
1 parent 43caca4 commit 14fd1e3

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

esp-hal/src/gpio/interconnect.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,22 @@
5353
//! [split](AnyPin::split) into signals. In this case you need to carefully
5454
//! ensure that only a single driver configures the split pin, by selectively
5555
//! [freezing](`InputSignal::freeze`) the signals.
56-
//!
57-
//! For example, if you want to route GPIO3 to both a Pulse Counter
58-
//! input and a [UART](crate::uart::Uart) RX line, you will need to make sure
59-
//! one of the signals is frozen, otherwise the driver that is configured later
60-
//! will overwrite the other driver's configuration. Configuring the signals on
61-
//! multiple cores is undefined behaviour unless you ensure the configuration
62-
//! does not happen at the same time.
63-
//!
56+
#![cfg_attr(
57+
uart_driver_supported,
58+
doc = "\n\nFor example, if you want to route GPIO3 to both a Pulse Counter
59+
input and a [UART](crate::uart::Uart) RX line, you will need to make sure
60+
one of the signals is frozen, otherwise the driver that is configured later
61+
will overwrite the other driver's configuration. Configuring the signals on
62+
multiple cores is undefined behaviour unless you ensure the configuration
63+
does not happen at the same time."
64+
)]
6465
//! ### Using pins and signals
6566
//!
6667
//! A GPIO pin can be configured either with a GPIO driver such as [`Input`], or
6768
//! by a peripheral driver using a pin assignment method such as
68-
//! [`Spi::with_mosi`]. The peripheral drivers' preferences can be overridden by
69+
#![cfg_attr(spi_master_driver_supported, doc = "[`Spi::with_mosi`].")]
70+
#![cfg_attr(not(spi_master_driver_supported), doc = "`Spi::with_mosi`.")]
71+
//! The peripheral drivers' preferences can be overridden by
6972
//! passing a pin driver to the peripheral driver. When converting a driver to
7073
//! signals, the underlying signals will be initially
7174
//! [frozen](InputSignal::freeze) to support this use case.
@@ -93,7 +96,10 @@
9396
//! - A GPIO output can be driven by only one peripheral output.
9497
//!
9598
//! [`GPIO0`]: crate::peripherals::GPIO0
96-
//! [`Spi::with_mosi`]: crate::spi::master::Spi::with_mosi
99+
#![cfg_attr(
100+
spi_master_driver_supported,
101+
doc = "[`Spi::with_mosi`]: crate::spi::master::Spi::with_mosi"
102+
)]
97103

98104
#[cfg(feature = "unstable")]
99105
use crate::gpio::{Input, Output};

0 commit comments

Comments
 (0)