aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/timer/one_pulse.rs
diff options
context:
space:
mode:
authorFabian Wolter <[email protected]>2025-07-21 07:57:49 +0200
committerDario Nieuwenhuis <[email protected]>2025-09-05 21:15:46 +0200
commita6562c4f033432e40970aafe82f33c5138adf84e (patch)
treeb0f9e6e624af1708ffe1b865a3db205979fe5200 /embassy-stm32/src/timer/one_pulse.rs
parent0407f7ebe8fabeb81b8a77811ec5dda0fee0b44b (diff)
Add STM32F1 AFIO remap
Diffstat (limited to 'embassy-stm32/src/timer/one_pulse.rs')
-rw-r--r--embassy-stm32/src/timer/one_pulse.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/embassy-stm32/src/timer/one_pulse.rs b/embassy-stm32/src/timer/one_pulse.rs
index 498d9c082..0267749e1 100644
--- a/embassy-stm32/src/timer/one_pulse.rs
+++ b/embassy-stm32/src/timer/one_pulse.rs
@@ -42,7 +42,8 @@ impl From<ExternalTriggerPolarity> for Etp {
42/// 42///
43/// This wraps a pin to make it usable as a timer trigger. 43/// This wraps a pin to make it usable as a timer trigger.
44pub struct TriggerPin<'d, T, C> { 44pub struct TriggerPin<'d, T, C> {
45 _pin: Peri<'d, AnyPin>, 45 #[allow(unused)]
46 pin: Peri<'d, AnyPin>,
46 phantom: PhantomData<(T, C)>, 47 phantom: PhantomData<(T, C)>,
47} 48}
48 49
@@ -113,7 +114,7 @@ impl<'d, T: GeneralInstance4Channel, C: TriggerSource> TriggerPin<'d, T, C> {
113 pub fn new(pin: Peri<'d, impl TimerTriggerPin<T, C>>, pull: Pull) -> Self { 114 pub fn new(pin: Peri<'d, impl TimerTriggerPin<T, C>>, pull: Pull) -> Self {
114 pin.set_as_af(pin.af_num(), AfType::input(pull)); 115 pin.set_as_af(pin.af_num(), AfType::input(pull));
115 TriggerPin { 116 TriggerPin {
116 _pin: pin.into(), 117 pin: pin.into(),
117 phantom: PhantomData, 118 phantom: PhantomData,
118 } 119 }
119 } 120 }
@@ -131,14 +132,17 @@ impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T> {
131 /// 132 ///
132 /// The pulse is triggered by a channel 1 input pin on both rising and 133 /// The pulse is triggered by a channel 1 input pin on both rising and
133 /// falling edges. Channel 1 will unusable as an output. 134 /// falling edges. Channel 1 will unusable as an output.
135 #[allow(unused)]
134 pub fn new_ch1_edge_detect( 136 pub fn new_ch1_edge_detect(
135 tim: Peri<'d, T>, 137 tim: Peri<'d, T>,
136 _pin: TriggerPin<'d, T, Ch1>, 138 pin: TriggerPin<'d, T, Ch1>,
137 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, 139 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
138 freq: Hertz, 140 freq: Hertz,
139 pulse_end: u32, 141 pulse_end: u32,
140 counting_mode: CountingMode, 142 counting_mode: CountingMode,
141 ) -> Self { 143 ) -> Self {
144 #[cfg(afio)]
145 super::set_afio::<T>(&[Some(pin.pin)]);
142 let mut this = Self { inner: Timer::new(tim) }; 146 let mut this = Self { inner: Timer::new(tim) };
143 147
144 this.inner.set_trigger_source(Ts::TI1F_ED); 148 this.inner.set_trigger_source(Ts::TI1F_ED);