Skip to content

Commit e05211f

Browse files
authored
Merge pull request #182 from Sh3Rm4n/doc
Improve rcc doc
2 parents 7d9954e + df2b8ac commit e05211f

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/rcc.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ fn into_pre_div(div: u8) -> cfgr2::PREDIV_A {
330330

331331
impl CFGR {
332332
/// Uses `HSE` (external oscillator) instead of `HSI` (internal RC oscillator) as the clock source.
333-
/// Will result in a hang if an external oscillator is not connected or it fails to start.
333+
///
334+
/// Will result in a hang if an external oscillator is not connected or it fails to start,
335+
/// unless [css](CFGR::enable_css) is enabled.
334336
pub fn use_hse<F>(mut self, freq: F) -> Self
335337
where
336338
F: Into<Hertz>,
@@ -343,15 +345,18 @@ impl CFGR {
343345
///
344346
/// Uses user provided clock signal instead of an external oscillator.
345347
/// `OSC_OUT` pin is free and can be used as GPIO.
348+
///
346349
/// No effect if `HSE` is not enabled.
347350
pub fn bypass_hse(mut self) -> Self {
348351
self.hse_bypass = true;
349352
self
350353
}
351354

352355
/// Enable `CSS` (Clock Security System).
356+
///
353357
/// System clock is automatically switched to `HSI` and an interrupt (`CSSI`) is generated
354358
/// when `HSE` clock failure is detected.
359+
///
355360
/// No effect if `HSE` is not enabled.
356361
pub fn enable_css(mut self) -> Self {
357362
self.css = true;
@@ -385,13 +390,15 @@ impl CFGR {
385390
///
386391
/// # Resolution and Limits
387392
///
388-
/// Following is true for devices **except**, as these allow finer resolutions
393+
/// - Maximal supported frequency with HSE: 72 Mhz
394+
/// - Maximal supported frequency without HSE: 64 Mhz
395+
///
396+
/// This is true for devices **except** the following devices,
397+
/// as these allow finer resolutions
389398
/// even when using the internal oscillator:
390399
///
391400
/// [stm32f302xd,stm32f302xe,stm32f303xd,stm32f303xe,stm32f398]
392401
///
393-
/// - Maximal supported frequency with HSE: 72 Mhz
394-
/// - Maximal supported frequency without HSE: 64 Mhz
395402
pub fn pclk2<F>(mut self, freq: F) -> Self
396403
where
397404
F: Into<Hertz>,
@@ -404,16 +411,17 @@ impl CFGR {
404411
///
405412
/// # Resolution and Limits
406413
///
407-
/// Following is true for devices **except**, as these allow finer resolutions
408-
/// even when using the internal oscillator:
409-
///
410-
/// [stm32f302xd,stm32f302xe,stm32f303xd,stm32f303xe,stm32f398]
411-
///
412414
/// - Maximal supported frequency with `HSE`: 72 Mhz
413415
/// - Maximal supported frequency without `HSE`: 64 Mhz
414416
///
415417
/// If [`CFGR::hse`] is not used, therefor `HSI / 2` is used.
416418
/// Only multiples of (HSI / 2) (4 Mhz) are allowed.
419+
///
420+
/// This is true for devices **except** the following devices,
421+
/// as these allow finer resolutions
422+
/// even when using the internal oscillator:
423+
///
424+
/// [stm32f302xd,stm32f302xe,stm32f303xd,stm32f303xe,stm32f398]
417425
pub fn sysclk<F>(mut self, freq: F) -> Self
418426
where
419427
F: Into<Hertz>,
@@ -796,11 +804,11 @@ impl Clocks {
796804

797805
/// Returns whether the USBCLK clock frequency is valid for the USB peripheral
798806
///
799-
/// If the micrcontroller does support USB, 48 Mhz or 72 Mhz have to be used
807+
/// If the microcontroller does support USB, 48 Mhz or 72 Mhz have to be used
800808
/// and the [`CFGR::hse`] must be used.
801809
///
802-
/// The APB1 / [`CFGR::pclk1`] clock must have a minimum frequency of 10 MHz to avoid data
803-
/// overrun/underrun problems. [RM0316 32.5.2][RM0316]
810+
/// The APB1 / [`CFGR::pclk1`] clock must have a minimum frequency of 10 MHz to avoid data
811+
/// overrun/underrun problems. [RM0316 32.5.2][RM0316]
804812
///
805813
/// [RM0316]: https://www.st.com/resource/en/reference_manual/dm00043574.pdf
806814
pub fn usbclk_valid(&self) -> bool {

0 commit comments

Comments
 (0)