aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/timer/one_pulse.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/embassy-stm32/src/timer/one_pulse.rs b/embassy-stm32/src/timer/one_pulse.rs
index 43ba3dedf..933165ef9 100644
--- a/embassy-stm32/src/timer/one_pulse.rs
+++ b/embassy-stm32/src/timer/one_pulse.rs
@@ -17,7 +17,7 @@ use crate::gpio::{AfType, AnyPin, Pull};
17use crate::interrupt::typelevel::{Binding, Interrupt}; 17use crate::interrupt::typelevel::{Binding, Interrupt};
18use crate::pac::timer::vals::Etp; 18use crate::pac::timer::vals::Etp;
19use crate::time::Hertz; 19use crate::time::Hertz;
20use crate::{into_ref, Peripheral, PeripheralRef}; 20use crate::Peri;
21 21
22/// External input marker type. 22/// External input marker type.
23pub enum Ext {} 23pub enum Ext {}
@@ -44,7 +44,7 @@ impl From<ExternalTriggerPolarity> for Etp {
44/// 44///
45/// This wraps a pin to make it usable as a timer trigger. 45/// This wraps a pin to make it usable as a timer trigger.
46pub struct TriggerPin<'d, T, C> { 46pub struct TriggerPin<'d, T, C> {
47 _pin: PeripheralRef<'d, AnyPin>, 47 _pin: Peri<'d, AnyPin>,
48 phantom: PhantomData<(T, C)>, 48 phantom: PhantomData<(T, C)>,
49} 49}
50 50
@@ -52,11 +52,10 @@ macro_rules! channel_impl {
52 ($new_chx:ident, $channel:ident, $pin_trait:ident) => { 52 ($new_chx:ident, $channel:ident, $pin_trait:ident) => {
53 impl<'d, T: GeneralInstance4Channel> TriggerPin<'d, T, $channel> { 53 impl<'d, T: GeneralInstance4Channel> TriggerPin<'d, T, $channel> {
54 #[doc = concat!("Create a new ", stringify!($channel), " trigger pin instance.")] 54 #[doc = concat!("Create a new ", stringify!($channel), " trigger pin instance.")]
55 pub fn $new_chx(pin: impl Peripheral<P = impl $pin_trait<T>> + 'd, pull: Pull) -> Self { 55 pub fn $new_chx(pin: Peri<'d, impl $pin_trait<T>>, pull: Pull) -> Self {
56 into_ref!(pin);
57 pin.set_as_af(pin.af_num(), AfType::input(pull)); 56 pin.set_as_af(pin.af_num(), AfType::input(pull));
58 TriggerPin { 57 TriggerPin {
59 _pin: pin.map_into(), 58 _pin: pin.into(),
60 phantom: PhantomData, 59 phantom: PhantomData,
61 } 60 }
62 } 61 }
@@ -81,7 +80,7 @@ impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T> {
81 /// The pulse is triggered by a channel 1 input pin on both rising and 80 /// The pulse is triggered by a channel 1 input pin on both rising and
82 /// falling edges. Channel 1 will unusable as an output. 81 /// falling edges. Channel 1 will unusable as an output.
83 pub fn new_ch1_edge_detect( 82 pub fn new_ch1_edge_detect(
84 tim: impl Peripheral<P = T> + 'd, 83 tim: Peri<'d, T>,
85 _pin: TriggerPin<'d, T, Ch1>, 84 _pin: TriggerPin<'d, T, Ch1>,
86 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, 85 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
87 freq: Hertz, 86 freq: Hertz,
@@ -105,7 +104,7 @@ impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T> {
105 /// The pulse is triggered by a channel 1 input pin. Channel 1 will unusable 104 /// The pulse is triggered by a channel 1 input pin. Channel 1 will unusable
106 /// as an output. 105 /// as an output.
107 pub fn new_ch1( 106 pub fn new_ch1(
108 tim: impl Peripheral<P = T> + 'd, 107 tim: Peri<'d, T>,
109 _pin: TriggerPin<'d, T, Ch1>, 108 _pin: TriggerPin<'d, T, Ch1>,
110 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, 109 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
111 freq: Hertz, 110 freq: Hertz,
@@ -131,7 +130,7 @@ impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T> {
131 /// The pulse is triggered by a channel 2 input pin. Channel 2 will unusable 130 /// The pulse is triggered by a channel 2 input pin. Channel 2 will unusable
132 /// as an output. 131 /// as an output.
133 pub fn new_ch2( 132 pub fn new_ch2(
134 tim: impl Peripheral<P = T> + 'd, 133 tim: Peri<'d, T>,
135 _pin: TriggerPin<'d, T, Ch1>, 134 _pin: TriggerPin<'d, T, Ch1>,
136 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, 135 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
137 freq: Hertz, 136 freq: Hertz,
@@ -156,7 +155,7 @@ impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T> {
156 /// 155 ///
157 /// The pulse is triggered by a external trigger input pin. 156 /// The pulse is triggered by a external trigger input pin.
158 pub fn new_ext( 157 pub fn new_ext(
159 tim: impl Peripheral<P = T> + 'd, 158 tim: Peri<'d, T>,
160 _pin: TriggerPin<'d, T, Ext>, 159 _pin: TriggerPin<'d, T, Ext>,
161 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, 160 _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
162 freq: Hertz, 161 freq: Hertz,