Skip to content

Commit 49534cd

Browse files
committed
stm32: more docs.
1 parent 138318f commit 49534cd

File tree

23 files changed

+55
-6
lines changed

23 files changed

+55
-6
lines changed

embassy-nrf/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,11 @@ unsafe fn uicr_write_masked(address: *mut u32, value: u32, mask: u32) -> WriteRe
354354
WriteResult::Written
355355
}
356356

357-
/// Initialize peripherals with the provided configuration. This should only be called once at startup.
357+
/// Initialize the `embassy-nrf` HAL with the provided configuration.
358+
///
359+
/// This returns the peripheral singletons that can be used for creating drivers.
360+
///
361+
/// This should only be called once at startup, otherwise it panics.
358362
pub fn init(config: config::Config) -> Peripherals {
359363
// Do this first, so that it panics if user is calling `init` a second time
360364
// before doing anything important.

embassy-stm32/src/adc/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//! Analog to Digital (ADC) converter driver.
1+
//! Analog to Digital Converter (ADC)
2+
23
#![macro_use]
34
#![allow(missing_docs)] // TODO
45

embassy-stm32/src/can/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Controller Area Network (CAN)
12
#![macro_use]
23

34
#[cfg_attr(can_bxcan, path = "bxcan.rs")]

embassy-stm32/src/crc/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Cyclic Redundancy Check (CRC)
12
#[cfg_attr(crc_v1, path = "v1.rs")]
23
#[cfg_attr(crc_v2, path = "v2v3.rs")]
34
#[cfg_attr(crc_v3, path = "v2v3.rs")]

embassy-stm32/src/dac/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Provide access to the STM32 digital-to-analog converter (DAC).
1+
//! Digital to Analog Converter (DAC)
22
#![macro_use]
33

44
use core::marker::PhantomData;

embassy-stm32/src/dcmi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Digital Camera Interface (DCMI)
12
use core::future::poll_fn;
23
use core::marker::PhantomData;
34
use core::task::Poll;

embassy-stm32/src/eth/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Ethernet (ETH)
12
#![macro_use]
23

34
#[cfg_attr(any(eth_v1a, eth_v1b, eth_v1c), path = "v1/mod.rs")]

embassy-stm32/src/exti.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! External Interrupts (EXTI)
12
use core::convert::Infallible;
23
use core::future::Future;
34
use core::marker::PhantomData;

embassy-stm32/src/flash/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Flash memory (FLASH)
12
use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind};
23

34
#[cfg(flash_f4)]

embassy-stm32/src/fmc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Flexible Memory Controller (FMC) / Flexible Static Memory Controller (FSMC)
12
use core::marker::PhantomData;
23

34
use embassy_hal_internal::into_ref;

embassy-stm32/src/hrtim/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! High Resolution Timer (HRTIM)
2+
13
mod traits;
24

35
use core::marker::PhantomData;

embassy-stm32/src/i2c/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Inter-Integrated-Circuit (I2C)
12
#![macro_use]
23

34
#[cfg_attr(i2c_v1, path = "v1.rs")]

embassy-stm32/src/i2s.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Inter-IC Sound (I2S)
12
use embassy_hal_internal::into_ref;
23

34
use crate::gpio::sealed::{AFType, Pin as _};

embassy-stm32/src/lib.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,33 @@ use crate::interrupt::Priority;
149149
pub use crate::pac::NVIC_PRIO_BITS;
150150
use crate::rcc::sealed::RccPeripheral;
151151

152+
/// `embassy-stm32` global configuration.
152153
#[non_exhaustive]
153154
pub struct Config {
155+
/// RCC config.
154156
pub rcc: rcc::Config,
157+
158+
/// Enable debug during sleep.
159+
///
160+
/// May incrase power consumption. Defaults to true.
155161
#[cfg(dbgmcu)]
156162
pub enable_debug_during_sleep: bool,
163+
164+
/// BDMA interrupt priority.
165+
///
166+
/// Defaults to P0 (highest).
157167
#[cfg(bdma)]
158168
pub bdma_interrupt_priority: Priority,
169+
170+
/// DMA interrupt priority.
171+
///
172+
/// Defaults to P0 (highest).
159173
#[cfg(dma)]
160174
pub dma_interrupt_priority: Priority,
175+
176+
/// GPDMA interrupt priority.
177+
///
178+
/// Defaults to P0 (highest).
161179
#[cfg(gpdma)]
162180
pub gpdma_interrupt_priority: Priority,
163181
}
@@ -178,7 +196,11 @@ impl Default for Config {
178196
}
179197
}
180198

181-
/// Initialize embassy.
199+
/// Initialize the `embassy-stm32` HAL with the provided configuration.
200+
///
201+
/// This returns the peripheral singletons that can be used for creating drivers.
202+
///
203+
/// This should only be called once at startup, otherwise it panics.
182204
pub fn init(config: Config) -> Peripherals {
183205
critical_section::with(|cs| {
184206
let p = Peripherals::take_with_cs(cs);

embassy-stm32/src/qspi/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Quad Serial Peripheral Interface (QSPI)
2+
13
#![macro_use]
24

35
pub mod enums;

embassy-stm32/src/rng.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Random Number Generator (RNG)
12
#![macro_use]
23

34
use core::future::poll_fn;

embassy-stm32/src/rtc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! RTC peripheral abstraction
1+
//! Real Time Clock (RTC)
22
mod datetime;
33

44
#[cfg(feature = "low-power")]
@@ -163,7 +163,7 @@ impl RtcTimeProvider {
163163
}
164164
}
165165

166-
/// RTC Abstraction
166+
/// RTC driver.
167167
pub struct Rtc {
168168
#[cfg(feature = "low-power")]
169169
stop_time: Mutex<CriticalSectionRawMutex, Cell<Option<RtcInstant>>>,

embassy-stm32/src/sdmmc/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Secure Digital / MultiMedia Card (SDMMC)
12
#![macro_use]
23

34
use core::default::Default;

embassy-stm32/src/spi/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Serial Peripheral Interface (SPI)
12
#![macro_use]
23

34
use core::ptr;

embassy-stm32/src/uid.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Unique ID (UID)
2+
13
/// Get this device's unique 96-bit ID.
24
pub fn uid() -> &'static [u8; 12] {
35
unsafe { &*crate::pac::UID.uid(0).as_ptr().cast::<[u8; 12]>() }

embassy-stm32/src/usart/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Universal Synchronous/Asynchronous Receiver Transmitter (USART, UART, LPUART)
12
#![macro_use]
23

34
use core::future::poll_fn;

embassy-stm32/src/usb_otg/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! USB On The Go (OTG)
2+
13
use crate::rcc::RccPeripheral;
24
use crate::{interrupt, peripherals};
35

embassy-stm32/src/wdg/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Watchdog Timer (IWDG, WWDG)
12
use core::marker::PhantomData;
23

34
use embassy_hal_internal::{into_ref, Peripheral};

0 commit comments

Comments
 (0)