diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-12-19 00:05:54 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-12-19 00:10:36 +0100 |
| commit | 49534cd4056f20bdf5fa6058b0865afc5fcf38ee (patch) | |
| tree | c70844cbd6201ea4ded266d53fc6ebd79931659a /embassy-stm32/src/lib.rs | |
| parent | 138318f6118322af199888bcbd53ef49114f89bd (diff) | |
stm32: more docs.
Diffstat (limited to 'embassy-stm32/src/lib.rs')
| -rw-r--r-- | embassy-stm32/src/lib.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 5d9b4e6a0..fd691a732 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -149,15 +149,33 @@ use crate::interrupt::Priority; | |||
| 149 | pub use crate::pac::NVIC_PRIO_BITS; | 149 | pub use crate::pac::NVIC_PRIO_BITS; |
| 150 | use crate::rcc::sealed::RccPeripheral; | 150 | use crate::rcc::sealed::RccPeripheral; |
| 151 | 151 | ||
| 152 | /// `embassy-stm32` global configuration. | ||
| 152 | #[non_exhaustive] | 153 | #[non_exhaustive] |
| 153 | pub struct Config { | 154 | pub struct Config { |
| 155 | /// RCC config. | ||
| 154 | pub rcc: rcc::Config, | 156 | pub rcc: rcc::Config, |
| 157 | |||
| 158 | /// Enable debug during sleep. | ||
| 159 | /// | ||
| 160 | /// May incrase power consumption. Defaults to true. | ||
| 155 | #[cfg(dbgmcu)] | 161 | #[cfg(dbgmcu)] |
| 156 | pub enable_debug_during_sleep: bool, | 162 | pub enable_debug_during_sleep: bool, |
| 163 | |||
| 164 | /// BDMA interrupt priority. | ||
| 165 | /// | ||
| 166 | /// Defaults to P0 (highest). | ||
| 157 | #[cfg(bdma)] | 167 | #[cfg(bdma)] |
| 158 | pub bdma_interrupt_priority: Priority, | 168 | pub bdma_interrupt_priority: Priority, |
| 169 | |||
| 170 | /// DMA interrupt priority. | ||
| 171 | /// | ||
| 172 | /// Defaults to P0 (highest). | ||
| 159 | #[cfg(dma)] | 173 | #[cfg(dma)] |
| 160 | pub dma_interrupt_priority: Priority, | 174 | pub dma_interrupt_priority: Priority, |
| 175 | |||
| 176 | /// GPDMA interrupt priority. | ||
| 177 | /// | ||
| 178 | /// Defaults to P0 (highest). | ||
| 161 | #[cfg(gpdma)] | 179 | #[cfg(gpdma)] |
| 162 | pub gpdma_interrupt_priority: Priority, | 180 | pub gpdma_interrupt_priority: Priority, |
| 163 | } | 181 | } |
| @@ -178,7 +196,11 @@ impl Default for Config { | |||
| 178 | } | 196 | } |
| 179 | } | 197 | } |
| 180 | 198 | ||
| 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. | ||
| 182 | pub fn init(config: Config) -> Peripherals { | 204 | pub fn init(config: Config) -> Peripherals { |
| 183 | critical_section::with(|cs| { | 205 | critical_section::with(|cs| { |
| 184 | let p = Peripherals::take_with_cs(cs); | 206 | let p = Peripherals::take_with_cs(cs); |
