diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-04-14 20:14:46 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-04-14 20:14:46 +0000 |
| commit | 87b79d449916b26d0d29b6247ae366a80c02cfa5 (patch) | |
| tree | 2933b89d7298100c10a2d50670c2116104434d5e | |
| parent | b6d06661bdb924951ded57db007460cebcc7849a (diff) | |
| parent | 64b806db0bb6a3ae507330ddd3dc8c815e3b1563 (diff) | |
Merge pull request #2807 from chemicstry/rcc_methods
Expose RCC enable and disable methods
| -rw-r--r-- | embassy-stm32/src/rcc/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index c328344aa..5497bba07 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs | |||
| @@ -119,3 +119,21 @@ mod util { | |||
| 119 | pub fn frequency<T: RccPeripheral>() -> Hertz { | 119 | pub fn frequency<T: RccPeripheral>() -> Hertz { |
| 120 | T::frequency() | 120 | T::frequency() |
| 121 | } | 121 | } |
| 122 | |||
| 123 | /// Enables and resets peripheral `T`. | ||
| 124 | /// | ||
| 125 | /// # Safety | ||
| 126 | /// | ||
| 127 | /// Peripheral must not be in use. | ||
| 128 | pub unsafe fn enable_and_reset<T: RccPeripheral>() { | ||
| 129 | T::enable_and_reset(); | ||
| 130 | } | ||
| 131 | |||
| 132 | /// Disables peripheral `T`. | ||
| 133 | /// | ||
| 134 | /// # Safety | ||
| 135 | /// | ||
| 136 | /// Peripheral must not be in use. | ||
| 137 | pub unsafe fn disable<T: RccPeripheral>() { | ||
| 138 | T::disable(); | ||
| 139 | } | ||
