diff options
| -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 | } | ||
