diff options
| author | Annie Ehler <[email protected]> | 2025-06-11 19:37:37 -0700 |
|---|---|---|
| committer | Annie Ehler <[email protected]> | 2025-06-11 19:37:37 -0700 |
| commit | f2266242043c0933e6d39e922400b21d726c9be3 (patch) | |
| tree | 69f8e26acc3a340e868bedc7009469549fb0f786 | |
| parent | 56572ef0adffd6258adc10fb424e37a8b4ddc19c (diff) | |
Add extra methods for the low-power interrupt timer.
| -rw-r--r-- | embassy-stm32/src/lptim/timer/mod.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/embassy-stm32/src/lptim/timer/mod.rs b/embassy-stm32/src/lptim/timer/mod.rs index a629be62b..f6abd4a74 100644 --- a/embassy-stm32/src/lptim/timer/mod.rs +++ b/embassy-stm32/src/lptim/timer/mod.rs | |||
| @@ -82,6 +82,31 @@ impl<'d, T: Instance> Timer<'d, T> { | |||
| 82 | pub fn get_max_compare_value(&self) -> u16 { | 82 | pub fn get_max_compare_value(&self) -> u16 { |
| 83 | T::regs().arr().read().arr() | 83 | T::regs().arr().read().arr() |
| 84 | } | 84 | } |
| 85 | |||
| 86 | /// Enable the timer interrupt. | ||
| 87 | pub fn enable_interrupt(&self) { | ||
| 88 | T::regs().dier().modify(|w| w.set_arrmie(true)); | ||
| 89 | } | ||
| 90 | |||
| 91 | /// Disable the timer interrupt. | ||
| 92 | pub fn disable_interrupt(&self) { | ||
| 93 | T::regs().dier().modify(|w| w.set_arrmie(false)); | ||
| 94 | } | ||
| 95 | |||
| 96 | /// Check if the timer interrupt is enabled. | ||
| 97 | pub fn is_interrupt_enabled(&self) -> bool { | ||
| 98 | T::regs().dier().read().arrmie() | ||
| 99 | } | ||
| 100 | |||
| 101 | /// Check if the timer interrupt is pending. | ||
| 102 | pub fn is_interrupt_pending(&self) -> bool { | ||
| 103 | T::regs().isr().read().arrm() | ||
| 104 | } | ||
| 105 | |||
| 106 | /// Clear the timer interrupt. | ||
| 107 | pub fn clear_interrupt(&self) { | ||
| 108 | T::regs().icr().write(|w| w.set_arrmcf(true)); | ||
| 109 | } | ||
| 85 | } | 110 | } |
| 86 | 111 | ||
| 87 | #[cfg(any(lptim_v2a, lptim_v2b))] | 112 | #[cfg(any(lptim_v2a, lptim_v2b))] |
