Skip to content

Commit dfb5df4

Browse files
authored
Merge pull request #222 from Sh3Rm4n/stm32f303xx-hal-doc
Show feature gate on docsrs
2 parents 7a12c20 + de4c03b commit dfb5df4

File tree

7 files changed

+11
-6
lines changed

7 files changed

+11
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ exclude = [
2222
[package.metadata.docs.rs]
2323
features = ["stm32f303xc", "rt", "stm32-usbd", "can"]
2424
targets = ["thumbv7em-none-eabihf"]
25+
rustc-args = ["--cfg", "docsrs"]
2526

2627
[dependencies]
2728
cfg-if = "1"

src/adc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Analog to Digital Converter. (Requires feature `stm32f303x[bcde]`)
1+
//! Analog to Digital Converter.
22
//!
33
//! # Examples
44
//!

src/can.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Controller Area Network (Requires feature `can`)
1+
//! Controller Area Network.
22
//!
33
//! CAN is currently not enabled by default, and
44
//! can be enabled by the `can` feature.

src/dma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Direct memory access (DMA) controller. (Requires feature `stm32f303*` or `stm32f302*`)
1+
//! Direct memory access (DMA) controller.
22
//!
33
//! Currently DMA is only supported for STM32F303 or STM32F302 MCUs.
44
//!

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,14 @@ pub use stm32f3::stm32f3x4 as pac;
125125
pub use crate::pac::interrupt;
126126

127127
#[cfg(feature = "stm32f303")]
128+
#[cfg_attr(docsrs, doc(cfg(feature = "stm32f303")))]
128129
pub mod adc;
129130
#[cfg(feature = "can")]
131+
#[cfg_attr(docsrs, doc(cfg(feature = "can")))]
130132
pub mod can;
131133
pub mod delay;
132134
#[cfg(any(feature = "stm32f302", feature = "stm32f303"))]
135+
#[cfg_attr(docsrs, doc(cfg(any(feature = "stm32f302", feature = "stm32f303"))))]
133136
pub mod dma;
134137
pub mod flash;
135138
pub mod gpio;
@@ -151,6 +154,7 @@ pub mod timer;
151154
feature = "stm32f303xe",
152155
),
153156
))]
157+
#[cfg_attr(docsrs, doc(cfg(feature = "stm32-usbd")))]
154158
pub mod usb;
155159
pub mod watchdog;
156160

src/rcc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ impl CFGR {
425425
/// - Maximal supported frequency with `HSE`: 72 Mhz
426426
/// - Maximal supported frequency without `HSE`: 64 Mhz
427427
///
428-
/// If [`CFGR::hse`] is not used, therefor `HSI / 2` is used.
428+
/// If [`CFGR::use_hse`] is not set, `HSI / 2` will be used.
429429
/// Only multiples of (HSI / 2) (4 Mhz) are allowed.
430430
///
431431
/// This is true for devices **except** the following devices,
@@ -818,7 +818,7 @@ impl Clocks {
818818
/// Returns whether the USBCLK clock frequency is valid for the USB peripheral
819819
///
820820
/// If the microcontroller does support USB, 48 Mhz or 72 Mhz have to be used
821-
/// and the [`CFGR::hse`] must be used.
821+
/// and the [`CFGR::use_hse`] must be set.
822822
///
823823
/// The APB1 / [`CFGR::pclk1`] clock must have a minimum frequency of 10 MHz to avoid data
824824
/// overrun/underrun problems. [RM0316 32.5.2][RM0316]

src/usb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! USB peripheral. (Requires feature `stm32-usbd`)
1+
//! USB peripheral.
22
//!
33
//! See [examples/usb_serial.rs] for a usage example.
44
//!

0 commit comments

Comments
 (0)