pub struct OnePulse<'d, T: GeneralInstance4Channel> { /* private fields */ }
Expand description
One pulse driver.
Generates a pulse after a trigger and some configurable delay.
Implementations§
Source§impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T>
impl<'d, T: GeneralInstance4Channel> OnePulse<'d, T>
Sourcepub fn new_ch1_edge_detect(
tim: Peri<'d, T>,
_pin: TriggerPin<'d, T, Ch1>,
_irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
freq: Hertz,
pulse_end: u32,
counting_mode: CountingMode,
) -> Self
pub fn new_ch1_edge_detect( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ch1>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, ) -> Self
Create a new one pulse driver.
The pulse is triggered by a channel 1 input pin on both rising and falling edges. Channel 1 will unusable as an output.
Sourcepub fn new_ch1(
tim: Peri<'d, T>,
_pin: TriggerPin<'d, T, Ch1>,
_irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
freq: Hertz,
pulse_end: u32,
counting_mode: CountingMode,
capture_mode: InputCaptureMode,
) -> Self
pub fn new_ch1( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ch1>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, capture_mode: InputCaptureMode, ) -> Self
Create a new one pulse driver.
The pulse is triggered by a channel 1 input pin. Channel 1 will unusable as an output.
Sourcepub fn new_ch2(
tim: Peri<'d, T>,
_pin: TriggerPin<'d, T, Ch1>,
_irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
freq: Hertz,
pulse_end: u32,
counting_mode: CountingMode,
capture_mode: InputCaptureMode,
) -> Self
pub fn new_ch2( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ch1>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, capture_mode: InputCaptureMode, ) -> Self
Create a new one pulse driver.
The pulse is triggered by a channel 2 input pin. Channel 2 will unusable as an output.
Sourcepub fn new_ext(
tim: Peri<'d, T>,
_pin: TriggerPin<'d, T, Ext>,
_irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd,
freq: Hertz,
pulse_end: u32,
counting_mode: CountingMode,
polarity: ExternalTriggerPolarity,
) -> Self
pub fn new_ext( tim: Peri<'d, T>, _pin: TriggerPin<'d, T, Ext>, _irq: impl Binding<T::CaptureCompareInterrupt, CaptureCompareInterruptHandler<T>> + 'd, freq: Hertz, pulse_end: u32, counting_mode: CountingMode, polarity: ExternalTriggerPolarity, ) -> Self
Create a new one pulse driver.
The pulse is triggered by a external trigger input pin.
Sourcepub fn set_pulse_end(&mut self, ticks: u32)
pub fn set_pulse_end(&mut self, ticks: u32)
Set the end of the pulse in ticks from the trigger.
Sourcepub fn set_reset_on_trigger(&mut self, reset: bool)
pub fn set_reset_on_trigger(&mut self, reset: bool)
Reset the timer on each trigger
Sourcepub fn channel(&mut self, channel: Channel) -> OnePulseChannel<'_, T>
pub fn channel(&mut self, channel: Channel) -> OnePulseChannel<'_, T>
Get a single channel
If you need to use multiple channels, use Self::split
.
Sourcepub fn ch1(&mut self) -> OnePulseChannel<'_, T>
pub fn ch1(&mut self) -> OnePulseChannel<'_, T>
Channel 1
This is just a convenience wrapper around Self::channel
.
If you need to use multiple channels, use Self::split
.
Sourcepub fn ch2(&mut self) -> OnePulseChannel<'_, T>
pub fn ch2(&mut self) -> OnePulseChannel<'_, T>
Channel 2
This is just a convenience wrapper around Self::channel
.
If you need to use multiple channels, use Self::split
.
Sourcepub fn ch3(&mut self) -> OnePulseChannel<'_, T>
pub fn ch3(&mut self) -> OnePulseChannel<'_, T>
Channel 3
This is just a convenience wrapper around Self::channel
.
If you need to use multiple channels, use Self::split
.
Sourcepub fn ch4(&mut self) -> OnePulseChannel<'_, T>
pub fn ch4(&mut self) -> OnePulseChannel<'_, T>
Channel 4
This is just a convenience wrapper around Self::channel
.
If you need to use multiple channels, use Self::split
.
Sourcepub fn split(self) -> OnePulseChannels<'static, T>where
'd: 'static,
pub fn split(self) -> OnePulseChannels<'static, T>where
'd: 'static,
Splits a OnePulse
into four output channels.